From 08044f16da407871ea84ccbfbc09e34cceb74080 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 15 Nov 2005 11:09:58 +0000 Subject: [PATCH] Graphical bits moved into files to save jar size --- src/jalview/appletgui/AlignFrame.java | 610 +++++++++++++++++++++++- src/jalview/appletgui/AlignmentPanel.java | 81 +++- src/jalview/appletgui/AnnotationLabels.java | 5 - src/jalview/appletgui/AnnotationPanel.java | 6 - src/jalview/appletgui/CutAndPasteTransfer.java | 56 ++- src/jalview/appletgui/Finder.java | 80 +++- src/jalview/appletgui/FontChooser.java | 99 +++- src/jalview/appletgui/IdCanvas.java | 6 - src/jalview/appletgui/PCAPanel.java | 102 +++- src/jalview/appletgui/PairwiseAlignPanel.java | 35 +- src/jalview/appletgui/RedundancyPanel.java | 6 +- src/jalview/appletgui/RotatableCanvas.java | 70 +-- src/jalview/appletgui/ScalePanel.java | 5 - src/jalview/appletgui/SeqCanvas.java | 14 +- src/jalview/appletgui/SliderPanel.java | 81 +++- src/jalview/appletgui/TreeCanvas.java | 5 - src/jalview/appletgui/TreePanel.java | 126 ++++- src/jalview/appletgui/UserDefinedColours.java | 141 +++++- 18 files changed, 1408 insertions(+), 120 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 692c2fd..f101ab5 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -19,7 +19,6 @@ package jalview.appletgui; -import jalview.jbappletgui.GAlignFrame; import jalview.schemes.*; import jalview.datamodel.*; import jalview.analysis.*; @@ -31,8 +30,8 @@ import java.io.InputStreamReader; import java.io.BufferedReader; import java.net.URL; -public class AlignFrame - extends GAlignFrame + +public class AlignFrame extends Frame { final AlignmentPanel alignPanel; public final AlignViewport viewport; @@ -43,6 +42,12 @@ public class AlignFrame public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title) { + try{ + jbInit(); + }catch(Exception ex) + { + ex.printStackTrace(); + } this.applet = applet; viewport = new AlignViewport(al, applet); alignPanel = new AlignmentPanel(this, viewport); @@ -1467,4 +1472,603 @@ public class AlignFrame } } + + ////////////////////////////////////////////////////////////////////////////////// + //JBuilder Graphics here + + protected MenuBar alignFrameMenuBar = new MenuBar(); + protected Menu fileMenu = new Menu(); + protected MenuItem closeMenuItem = new MenuItem(); + protected Menu editMenu = new Menu(); + protected Menu viewMenu = new Menu(); + protected Menu colourMenu = new Menu(); + protected Menu calculateMenu = new Menu(); + protected MenuItem selectAllSequenceMenuItem = new MenuItem(); + protected MenuItem deselectAllSequenceMenuItem = new MenuItem(); + protected MenuItem invertSequenceMenuItem = new MenuItem(); + protected MenuItem remove2LeftMenuItem = new MenuItem(); + protected MenuItem remove2RightMenuItem = new MenuItem(); + protected MenuItem removeGappedColumnMenuItem = new MenuItem(); + protected MenuItem removeAllGapsMenuItem = new MenuItem(); + protected CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem(); + protected CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem(); + protected MenuItem sortPairwiseMenuItem = new MenuItem(); + protected MenuItem sortIDMenuItem = new MenuItem(); + protected MenuItem sortGroupMenuItem = new MenuItem(); + protected MenuItem removeRedundancyMenuItem = new MenuItem(); + protected MenuItem pairwiseAlignmentMenuItem = new MenuItem(); + protected MenuItem PCAMenuItem = new MenuItem(); + protected MenuItem averageDistanceTreeMenuItem = new MenuItem(); + protected MenuItem neighbourTreeMenuItem = new MenuItem(); + BorderLayout borderLayout1 = new BorderLayout(); + public Label statusBar = new Label(); + protected Menu outputTextboxMenu = new Menu(); + protected MenuItem clustalColour = new MenuItem(); + protected MenuItem zappoColour = new MenuItem(); + protected MenuItem taylorColour = new MenuItem(); + protected MenuItem hydrophobicityColour = new MenuItem(); + protected MenuItem helixColour = new MenuItem(); + protected MenuItem strandColour = new MenuItem(); + protected MenuItem turnColour = new MenuItem(); + protected MenuItem buriedColour = new MenuItem(); + protected MenuItem userDefinedColour = new MenuItem(); + protected MenuItem PIDColour = new MenuItem(); + protected MenuItem BLOSUM62Colour = new MenuItem(); + MenuItem njTreeBlosumMenuItem = new MenuItem(); + MenuItem avDistanceTreeBlosumMenuItem = new MenuItem(); + protected CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem(); + protected CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem(); + MenuItem overviewMenuItem = new MenuItem(); + protected MenuItem undoMenuItem = new MenuItem(); + protected MenuItem redoMenuItem = new MenuItem(); + protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem(); + MenuItem noColourmenuItem = new MenuItem(); + protected CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem(); + protected CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem(); + MenuItem findMenuItem = new MenuItem(); + Menu searchMenu = new Menu(); + protected CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem(); + protected MenuItem nucleotideColour = new MenuItem(); + MenuItem deleteGroups = new MenuItem(); + MenuItem delete = new MenuItem(); + MenuItem copy = new MenuItem(); + MenuItem cut = new MenuItem(); + Menu Menu1 = new Menu(); + MenuItem pasteNew = new MenuItem(); + MenuItem pasteThis = new MenuItem(); + protected CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem(); + protected MenuItem font = new MenuItem(); + protected CheckboxMenuItem dbref = new CheckboxMenuItem(); + protected CheckboxMenuItem scaleAbove = new CheckboxMenuItem(); + protected CheckboxMenuItem scaleLeft = new CheckboxMenuItem(); + protected CheckboxMenuItem scaleRight = new CheckboxMenuItem(); + MenuItem modifyPID = new MenuItem(); + MenuItem modifyConservation = new MenuItem(); + protected Menu sortByTreeMenu = new Menu(); + Menu sort = new Menu(); + Menu calculate = new Menu(); + MenuItem inputText = new MenuItem(); + Menu helpMenu = new Menu(); + MenuItem documentation = new MenuItem(); + MenuItem about = new MenuItem(); + protected CheckboxMenuItem seqLimits = new CheckboxMenuItem(); + + private void jbInit() throws Exception { + + setMenuBar(alignFrameMenuBar); + + MenuItem item; + + // dynamically fill save as menu with available formats + for (int i = 0; i < jalview.io.AppletFormatAdapter.formats.size(); i++) + { + + item = new MenuItem( (String) jalview.io.AppletFormatAdapter.formats. + elementAt( + i)); + item.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + outputText_actionPerformed(e); + } + }); + + outputTextboxMenu.add(item); + } + + + fileMenu.setLabel("File"); + closeMenuItem.setLabel("Close"); + closeMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + closeMenuItem_actionPerformed(e); + } + }); + editMenu.setLabel("Edit"); + viewMenu.setLabel("View"); + colourMenu.setLabel("Colour"); + calculateMenu.setLabel("Calculate"); + selectAllSequenceMenuItem.setLabel("Select all"); + selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + selectAllSequenceMenuItem_actionPerformed(e); + } + }); + deselectAllSequenceMenuItem.setLabel("Deselect All"); + deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + deselectAllSequenceMenuItem_actionPerformed(e); + } + }); + invertSequenceMenuItem.setLabel("Invert Selection"); + invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + invertSequenceMenuItem_actionPerformed(e); + } + }); + remove2LeftMenuItem.setLabel("Remove Left"); + remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + remove2LeftMenuItem_actionPerformed(e); + } + }); + remove2RightMenuItem.setLabel("Remove Right"); + remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + remove2RightMenuItem_actionPerformed(e); + } + }); + removeGappedColumnMenuItem.setLabel("Remove Empty Columns"); + removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + removeGappedColumnMenuItem_actionPerformed(e); + } + }); + removeAllGapsMenuItem.setLabel("Remove All Gaps"); + removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + removeAllGapsMenuItem_actionPerformed(e); + } + }); + viewBoxesMenuItem.setLabel("Boxes"); + viewBoxesMenuItem.setState(true); + viewBoxesMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + viewBoxesMenuItem_actionPerformed(null); + } + }); + viewTextMenuItem.setLabel("Text"); + viewTextMenuItem.setState(true); + viewTextMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + viewTextMenuItem_actionPerformed(null); + } + }); + sortPairwiseMenuItem.setLabel("by Pairwise Identity"); + sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + sortPairwiseMenuItem_actionPerformed(e); + } + }); + sortIDMenuItem.setLabel("by ID"); + sortIDMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + sortIDMenuItem_actionPerformed(e); + } + }); + sortGroupMenuItem.setLabel("by Group"); + sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + sortGroupMenuItem_actionPerformed(e); + } + }); + removeRedundancyMenuItem.setLabel("Remove Redundancy..."); + removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + removeRedundancyMenuItem_actionPerformed(e); + } + }); + pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments..."); + pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + pairwiseAlignmentMenuItem_actionPerformed(e); + } + }); + PCAMenuItem.setLabel("Principal Component Analysis"); + PCAMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + PCAMenuItem_actionPerformed(e); + } + }); + averageDistanceTreeMenuItem.setLabel( + "Average Distance Using % Identity"); + averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + averageDistanceTreeMenuItem_actionPerformed(e); + } + }); + neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity"); + neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + neighbourTreeMenuItem_actionPerformed(e); + } + }); + alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11)); + statusBar.setBackground(Color.white); + statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); + statusBar.setText("Status bar"); + outputTextboxMenu.setLabel("Output to Textbox"); + clustalColour.setLabel("Clustalx"); + + clustalColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + clustalColour_actionPerformed(e); + } + }); + zappoColour.setLabel("Zappo"); + zappoColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + zappoColour_actionPerformed(e); + } + }); + taylorColour.setLabel("Taylor"); + taylorColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + taylorColour_actionPerformed(e); + } + }); + hydrophobicityColour.setLabel("Hydrophobicity"); + hydrophobicityColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + hydrophobicityColour_actionPerformed(e); + } + }); + helixColour.setLabel("Helix Propensity"); + helixColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + helixColour_actionPerformed(e); + } + }); + strandColour.setLabel("Strand Propensity"); + strandColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + strandColour_actionPerformed(e); + } + }); + turnColour.setLabel("Turn Propensity"); + turnColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + turnColour_actionPerformed(e); + } + }); + buriedColour.setLabel("Buried Index"); + buriedColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + buriedColour_actionPerformed(e); + } + }); + userDefinedColour.setLabel("User Defined..."); + userDefinedColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + userDefinedColour_actionPerformed(e); + } + }); + PIDColour.setLabel("Percentage Identity"); + PIDColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + PIDColour_actionPerformed(e); + } + }); + BLOSUM62Colour.setLabel("BLOSUM62 Score"); + BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + BLOSUM62Colour_actionPerformed(e); + } + }); + avDistanceTreeBlosumMenuItem.setLabel( + "Average Distance Using BLOSUM62"); + avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + avTreeBlosumMenuItem_actionPerformed(e); + } + }); + njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62"); + njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + njTreeBlosumMenuItem_actionPerformed(e); + } + }); + annotationPanelMenuItem.setActionCommand(""); + annotationPanelMenuItem.setState(true); + annotationPanelMenuItem.setLabel("Show Annotations"); + annotationPanelMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + annotationPanelMenuItem_actionPerformed(null); + } + }); + colourTextMenuItem.setLabel("Colour Text"); + colourTextMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + colourTextMenuItem_actionPerformed(null); + } + }); + overviewMenuItem.setLabel("Overview Window"); + overviewMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + overviewMenuItem_actionPerformed(e); + } + }); + undoMenuItem.setEnabled(false); + undoMenuItem.setLabel("Undo"); + undoMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + undoMenuItem_actionPerformed(e); + } + }); + redoMenuItem.setEnabled(false); + redoMenuItem.setLabel("Redo"); + redoMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + redoMenuItem_actionPerformed(e); + } + }); + conservationMenuItem.setLabel("by Conservation"); + conservationMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + conservationMenuItem_actionPerformed(null); + } + }); + noColourmenuItem.setLabel("None"); + noColourmenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + noColourmenuItem_actionPerformed(e); + } + }); + wrapMenuItem.setLabel("Wrap"); + wrapMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + wrapMenuItem_actionPerformed(null); + } + }); + renderGapsMenuItem.setLabel("Show Gaps"); + renderGapsMenuItem.setState(true); + renderGapsMenuItem.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + renderGapsMenuItem_actionPerformed(null); + } + }); + findMenuItem.setLabel("Find..."); + findMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + findMenuItem_actionPerformed(e); + } + }); + searchMenu.setLabel("Search"); + + abovePIDThreshold.setLabel("Above Identity Threshold"); + abovePIDThreshold.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + abovePIDThreshold_actionPerformed(null); + } + }); + nucleotideColour.setLabel("Nucleotide"); + nucleotideColour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + nucleotideColour_actionPerformed(e); + } + }); + deleteGroups.setLabel("Undefine Groups"); + deleteGroups.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + deleteGroups_actionPerformed(e); + } + }); + copy.setLabel("Copy"); + copy.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + copy_actionPerformed(e); + } + }); + cut.setLabel("Cut"); + cut.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + cut_actionPerformed(e); + } + }); + delete.setLabel("Delete"); + delete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + delete_actionPerformed(e); + } + }); + Menu1.setLabel("Paste"); + pasteNew.setLabel("To New Alignment"); + pasteNew.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + pasteNew_actionPerformed(e); + } + }); + pasteThis.setLabel("Add To This Alignment"); + pasteThis.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + pasteThis_actionPerformed(e); + } + }); + applyToAllGroups.setLabel("Apply Colour To All Groups"); + applyToAllGroups.setState(true); + applyToAllGroups.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + applyToAllGroups_actionPerformed(null); + } + }); + font.setLabel("Font..."); + font.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + font_actionPerformed(e); + } + }); + dbref.setLabel("ShowSequence DB Refs"); + dbref.setActionCommand(""); + dbref.setState(true); + dbref.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + dbref_actionPerformed(e); + } + }); + scaleAbove.setLabel("Scale Above"); + scaleAbove.setState(true); + scaleAbove.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + scaleAbove_actionPerformed(null); + } + }); + scaleLeft.setEnabled(false); + scaleLeft.setState(true); + scaleLeft.setLabel("Scale Left"); + scaleLeft.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + scaleLeft_actionPerformed(null); + } + }); + scaleRight.setEnabled(false); + scaleRight.setState(true); + scaleRight.setLabel("Scale Right"); + scaleRight.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + scaleRight_actionPerformed(null); + } + }); + modifyPID.setLabel("Modify Identity Threshold..."); + modifyPID.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + modifyPID_actionPerformed(e); + } + }); + modifyConservation.setLabel("Modify Conservation Threshold..."); + modifyConservation.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + modifyConservation_actionPerformed(e); + } + }); + sortByTreeMenu.setLabel("By Tree Order"); + sort.setLabel("Sort"); + calculate.setLabel("Calculate Tree"); + inputText.setLabel("Input from textbox"); + inputText.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + inputText_actionPerformed(e); + } + }); + + helpMenu.setLabel("Help"); + documentation.setLabel("Documentation"); + documentation.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + documentation_actionPerformed(e); + } + }); + + about.setLabel("About..."); + about.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + about_actionPerformed(e); + } + }); + seqLimits.setState(true); + seqLimits.setLabel("Show Sequence Limits"); + seqLimits.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + seqLimits_itemStateChanged(e); + } + }); + + alignFrameMenuBar.add(fileMenu); + alignFrameMenuBar.add(editMenu); + alignFrameMenuBar.add(searchMenu); + alignFrameMenuBar.add(viewMenu); + alignFrameMenuBar.add(colourMenu); + alignFrameMenuBar.add(calculateMenu); + alignFrameMenuBar.add(helpMenu); + fileMenu.add(inputText); + fileMenu.add(outputTextboxMenu); + fileMenu.addSeparator(); + fileMenu.add(closeMenuItem); + editMenu.add(undoMenuItem); + editMenu.add(redoMenuItem); + editMenu.add(cut); + editMenu.add(copy); + editMenu.add(Menu1); + editMenu.add(delete); + editMenu.addSeparator(); + editMenu.add(selectAllSequenceMenuItem); + editMenu.add(deselectAllSequenceMenuItem); + editMenu.add(invertSequenceMenuItem); + editMenu.add(deleteGroups); + editMenu.addSeparator(); + editMenu.add(remove2LeftMenuItem); + editMenu.add(remove2RightMenuItem); + editMenu.add(removeGappedColumnMenuItem); + editMenu.add(removeAllGapsMenuItem); + editMenu.add(removeRedundancyMenuItem); + searchMenu.add(findMenuItem); + viewMenu.add(font); + viewMenu.addSeparator(); + viewMenu.add(dbref); + viewMenu.add(seqLimits); + viewMenu.addSeparator(); + viewMenu.add(wrapMenuItem); + viewMenu.add(scaleAbove); + viewMenu.add(scaleLeft); + viewMenu.add(scaleRight); + viewMenu.addSeparator(); + viewMenu.add(viewBoxesMenuItem); + viewMenu.add(viewTextMenuItem); + viewMenu.add(colourTextMenuItem); + viewMenu.add(renderGapsMenuItem); + viewMenu.add(annotationPanelMenuItem); + viewMenu.addSeparator(); + viewMenu.add(overviewMenuItem); + colourMenu.add(applyToAllGroups); + colourMenu.addSeparator(); + colourMenu.add(noColourmenuItem); + colourMenu.add(clustalColour); + colourMenu.add(BLOSUM62Colour); + colourMenu.add(PIDColour); + colourMenu.add(zappoColour); + colourMenu.add(taylorColour); + colourMenu.add(hydrophobicityColour); + colourMenu.add(helixColour); + colourMenu.add(strandColour); + colourMenu.add(turnColour); + colourMenu.add(buriedColour); + colourMenu.add(nucleotideColour); + colourMenu.add(userDefinedColour); + colourMenu.addSeparator(); + colourMenu.add(conservationMenuItem); + colourMenu.add(modifyConservation); + colourMenu.add(abovePIDThreshold); + colourMenu.add(modifyPID); + calculateMenu.add(sort); + calculateMenu.add(calculate); + calculateMenu.addSeparator(); + calculateMenu.add(pairwiseAlignmentMenuItem); + calculateMenu.add(PCAMenuItem); + this.add(statusBar, BorderLayout.SOUTH); + Menu1.add(pasteNew); + Menu1.add(pasteThis); + sort.add(sortIDMenuItem); + sort.add(sortByTreeMenu); + sort.add(sortGroupMenuItem); + sort.add(sortPairwiseMenuItem); + calculate.add(averageDistanceTreeMenuItem); + calculate.add(neighbourTreeMenuItem); + calculate.add(avDistanceTreeBlosumMenuItem); + calculate.add(njTreeBlosumMenuItem); + helpMenu.add(documentation); + helpMenu.add(about); + } } + diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 44370d4..9fb6e62 100755 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -23,10 +23,8 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; -public class AlignmentPanel - extends GAlignmentPanel implements AdjustmentListener +public class AlignmentPanel extends Panel implements AdjustmentListener { AlignViewport av; @@ -46,6 +44,15 @@ public class AlignmentPanel public AlignmentPanel(AlignFrame af, final AlignViewport av) { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + if(System.getProperty("os.name").startsWith("Mac")) MAC = true; @@ -492,6 +499,74 @@ public class AlignmentPanel seqPanel.seqCanvas.repaint(); scalePanel.repaint(); annotationPanel.repaint(); + } + protected Panel sequenceHolderPanel = new Panel(); + protected Scrollbar vscroll = new Scrollbar(); + protected Scrollbar hscroll = new Scrollbar(); + protected Panel seqPanelHolder = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); + protected Panel scalePanelHolder = new Panel(); + protected Panel idPanelHolder = new Panel(); + BorderLayout borderLayout5 = new BorderLayout(); + protected Panel idSpaceFillerPanel1 = new Panel(); + public Panel annotationSpaceFillerHolder = new Panel(); + BorderLayout borderLayout6 = new BorderLayout(); + BorderLayout borderLayout7 = new BorderLayout(); + Panel hscrollHolder = new Panel(); + BorderLayout borderLayout10 = new BorderLayout(); + protected Panel hscrollFillerPanel = new Panel(); + BorderLayout borderLayout11 = new BorderLayout(); + public Panel annotationScroller = new Panel(); + BorderLayout borderLayout4 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + + private void jbInit() throws Exception { + // idPanelHolder.setPreferredSize(new Dimension(70, 10)); + this.setLayout(borderLayout7); + + // sequenceHolderPanel.setPreferredSize(new Dimension(150, 150)); + sequenceHolderPanel.setLayout(borderLayout3); + seqPanelHolder.setLayout(borderLayout1); + scalePanelHolder.setBackground(Color.white); + + // scalePanelHolder.setPreferredSize(new Dimension(10, 30)); + scalePanelHolder.setLayout(borderLayout6); + idPanelHolder.setLayout(borderLayout5); + idSpaceFillerPanel1.setBackground(Color.white); + + // idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30)); + idSpaceFillerPanel1.setLayout(borderLayout11); + annotationSpaceFillerHolder.setBackground(Color.white); + + // annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80)); + annotationSpaceFillerHolder.setLayout(borderLayout4); + hscroll.setOrientation(Scrollbar.HORIZONTAL); + hscrollHolder.setLayout(borderLayout10); + hscrollFillerPanel.setBackground(Color.white); + + // hscrollFillerPanel.setPreferredSize(new Dimension(70, 10)); + hscrollHolder.setBackground(Color.white); + + // annotationScroller.setPreferredSize(new Dimension(10, 80)); + // this.setPreferredSize(new Dimension(220, 166)); + seqPanelHolder.setBackground(Color.white); + idPanelHolder.setBackground(Color.white); + annotationScroller.setLayout(borderLayout2); + sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH); + sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER); + seqPanelHolder.add(vscroll, BorderLayout.EAST); + sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH); + + // Panel3.add(secondaryPanelHolder, BorderLayout.SOUTH); + this.add(idPanelHolder, BorderLayout.WEST); + idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH); + idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH); + this.add(hscrollHolder, BorderLayout.SOUTH); + hscrollHolder.add(hscroll, BorderLayout.CENTER); + hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST); + this.add(sequenceHolderPanel, BorderLayout.CENTER); } + } diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index dcdccc5..1df7455 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -159,11 +159,6 @@ public class AnnotationLabels public void drawComponent(Graphics g, int width) { - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(g); - } - FontMetrics fm = g.getFontMetrics(g.getFont()); g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height); diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 15e2671..a1597f8 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -219,12 +219,6 @@ public class AnnotationPanel fastPaint = false; } - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(gg); - } - - if (fastPaint) { g.drawImage(image, 0, 0, this); diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 43ec65e..c366409 100755 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -24,10 +24,8 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.io.*; -import jalview.jbappletgui.*; -public class CutAndPasteTransfer - extends GCutAndPasteTransfer +public class CutAndPasteTransfer extends Panel { jalview.bin.JalviewLite applet; @@ -37,7 +35,12 @@ public class CutAndPasteTransfer public CutAndPasteTransfer(boolean forImport, jalview.bin.JalviewLite mainApplet) { - super(); + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } + applet = mainApplet; if (!forImport) @@ -102,14 +105,51 @@ public class CutAndPasteTransfer af.statusBar.setText("Successfully pasted alignment file"); } } - Frame frame = (Frame)this.getParent(); - frame.setVisible(false); + + setVisible(false); } protected void cancel_actionPerformed(ActionEvent e) { - Frame frame = (Frame)this.getParent(); - frame.setVisible(false); + setVisible(false); + } + protected TextArea textarea = new TextArea(); + Button ok = new Button(); + Button cancel = new Button(); + protected Panel buttonPanel = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + + + private void jbInit() throws Exception { + textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); + textarea.setText("Paste your alignment file here"); + textarea.addMouseListener(new java.awt.event.MouseAdapter() { + public void mousePressed(MouseEvent e) { + textarea_mousePressed(e); + } + }); + this.setLayout(borderLayout1); + ok.setLabel("OK"); + ok.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + ok_actionPerformed(e); + } + }); + cancel.setLabel("Cancel"); + cancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + cancel_actionPerformed(e); + } + }); + this.add(buttonPanel, BorderLayout.SOUTH); + buttonPanel.add(ok, null); + buttonPanel.add(cancel, null); + this.add(textarea, java.awt.BorderLayout.CENTER); } + void textarea_mousePressed(MouseEvent e) { + if (textarea.getText().equals("Paste your alignment file here")) { + textarea.setText(""); + } + } } diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 7cb3763..fcca0c1 100755 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -25,10 +25,8 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; -public class Finder - extends GFinder +public class Finder extends Panel { AlignViewport av; AlignmentPanel ap; @@ -40,6 +38,15 @@ public class Finder int resIndex = 0; public Finder(final AlignmentPanel ap) { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + this.av = ap.av; this.ap = ap; frame = new Frame(); @@ -297,4 +304,71 @@ public class Finder } + Label jLabel1 = new Label(); + protected TextField textfield = new TextField(); + protected Button findAll = new Button(); + protected Button findNext = new Button(); + Panel jPanel1 = new Panel(); + GridLayout gridLayout1 = new GridLayout(); + protected Button createNewGroup = new Button(); + + + private void jbInit() throws Exception { + jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel1.setText("Find"); + jLabel1.setBounds(new Rectangle(3, 30, 34, 15)); + this.setLayout(null); + textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + textfield.setText(""); + textfield.setBounds(new Rectangle(40, 27, 133, 21)); + textfield.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyTyped(KeyEvent e) { + textfield_keyTyped(e); + } + }); + textfield.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + textfield_actionPerformed(e); + } + }); + findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + findAll.setLabel("Find all"); + findAll.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + findAll_actionPerformed(e); + } + }); + findNext.setEnabled(false); + findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + findNext.setLabel("Find Next"); + findNext.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + findNext_actionPerformed(e); + } + }); + jPanel1.setBounds(new Rectangle(180, 5, 141, 64)); + jPanel1.setLayout(gridLayout1); + gridLayout1.setHgap(0); + gridLayout1.setRows(3); + gridLayout1.setVgap(2); + createNewGroup.setEnabled(false); + createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + createNewGroup.setLabel("Create new group"); + createNewGroup.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + createNewGroup_actionPerformed(e); + } + }); + jPanel1.add(findNext, null); + jPanel1.add(findAll, null); + jPanel1.add(createNewGroup, null); + this.add(textfield, null); + this.add(jLabel1, null); + this.add(jPanel1, null); + } + + void textfield_keyTyped(KeyEvent e) { + findNext.setEnabled(true); + } + } diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 17fe98a..27e2a93 100755 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -21,10 +21,11 @@ package jalview.appletgui; import java.awt.*; -import jalview.jbappletgui.*; +import java.awt.event.ActionEvent; +import java.awt.event.ItemEvent; public class FontChooser - extends GFontChooser + extends Panel { AlignmentPanel ap; TreePanel tp; @@ -34,6 +35,15 @@ public class FontChooser public FontChooser(TreePanel tp) { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + this.tp = tp; oldFont = tp.getTreeFont(); init(); @@ -152,5 +162,90 @@ public class FontChooser } changeFont(); } + Label label1 = new Label(); + protected Choice fontSize = new Choice(); + protected Choice fontStyle = new Choice(); + Label label2 = new Label(); + Label label3 = new Label(); + protected Choice fontName = new Choice(); + Button ok = new Button(); + Button cancel = new Button(); + Panel panel1 = new Panel(); + Panel panel2 = new Panel(); + Panel panel3 = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); + Panel panel4 = new Panel(); + Panel panel5 = new Panel(); + BorderLayout borderLayout4 = new BorderLayout(); + + + private void jbInit() throws Exception { + label1.setFont(new java.awt.Font("Verdana", 0, 11)); + label1.setAlignment(Label.RIGHT); + label1.setText("Font: "); + this.setLayout(borderLayout4); + fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); + fontSize.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + fontSize_actionPerformed(); + } + }); + fontStyle.setFont(new java.awt.Font("Verdana", 0, 11)); + fontStyle.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + fontStyle_actionPerformed(); + } + }); + label2.setAlignment(Label.RIGHT); + label2.setFont(new java.awt.Font("Verdana", 0, 11)); + label2.setText("Size: "); + label3.setAlignment(Label.RIGHT); + label3.setFont(new java.awt.Font("Verdana", 0, 11)); + label3.setText("Style: "); + fontName.setFont(new java.awt.Font("Verdana", 0, 11)); + fontName.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + fontName_actionPerformed(); + } + }); + ok.setFont(new java.awt.Font("Verdana", 0, 11)); + ok.setLabel("OK"); + ok.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + ok_actionPerformed(); + } + }); + cancel.setFont(new java.awt.Font("Verdana", 0, 11)); + cancel.setLabel("Cancel"); + cancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + cancel_actionPerformed(); + } + }); + this.setBackground(Color.white); + panel1.setLayout(borderLayout1); + panel2.setLayout(borderLayout3); + panel3.setLayout(borderLayout2); + panel5.setBackground(Color.white); + panel4.setBackground(Color.white); + panel1.setBackground(Color.white); + panel2.setBackground(Color.white); + panel3.setBackground(Color.white); + panel1.add(label1, BorderLayout.WEST); + panel1.add(fontName, BorderLayout.CENTER); + panel5.add(panel1, null); + panel5.add(panel3, null); + panel5.add(panel2, null); + panel2.add(label3, BorderLayout.WEST); + panel2.add(fontStyle, BorderLayout.CENTER); + panel3.add(label2, BorderLayout.WEST); + panel3.add(fontSize, BorderLayout.CENTER); + this.add(panel4, BorderLayout.SOUTH); + panel4.add(ok, null); + panel4.add(cancel, null); + this.add(panel5, BorderLayout.CENTER); + } } diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 7686e8a..7bcc987 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -157,12 +157,6 @@ public class IdCanvas gg.setFont(av.getFont()); } - if(!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(gg); - } - - //Fill in the background gg.setColor(Color.white); Font italic = new Font(av.getFont().getName(), Font.ITALIC, diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 026ca09..0368d2a 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -26,10 +26,10 @@ import java.awt.event.*; import jalview.analysis.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; + public class PCAPanel - extends GPCAPanel implements Runnable + extends Frame implements Runnable { PCA pca; int top; @@ -40,6 +40,22 @@ public class PCAPanel public PCAPanel(AlignViewport av) { + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } + + for (int i = 1; i < 8; i++) + { + xCombobox.addItem("dim " + i); + yCombobox.addItem("dim " + i); + zCombobox.addItem("dim " + i); + } + this.av = av; if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize() > 3) { @@ -170,5 +186,87 @@ public class PCAPanel { rc.showLabels( labels.getState() ); } + Panel jPanel2 = new Panel(); + Label jLabel1 = new Label(); + Label jLabel2 = new Label(); + Label jLabel3 = new Label(); + protected Choice xCombobox = new Choice(); + protected Choice yCombobox = new Choice(); + protected Choice zCombobox = new Choice(); + FlowLayout flowLayout1 = new FlowLayout(); + BorderLayout borderLayout1 = new BorderLayout(); + MenuBar menuBar1 = new MenuBar(); + Menu menu1 = new Menu(); + Menu menu2 = new Menu(); + protected CheckboxMenuItem labels = new CheckboxMenuItem(); + MenuItem values = new MenuItem(); + + private void jbInit() + throws Exception + { + this.setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + jLabel1.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel1.setText("x="); + jLabel2.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel2.setText("y="); + jLabel3.setFont(new java.awt.Font("Verdana", 0, 12)); + jLabel3.setText("z="); + jPanel2.setBackground(Color.white); + zCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + zCombobox.addItemListener(new java.awt.event.ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + zCombobox_actionPerformed(null); + } + }); + yCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + yCombobox.addItemListener(new java.awt.event.ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + yCombobox_actionPerformed(null); + } + }); + xCombobox.setFont(new java.awt.Font("Verdana", 0, 12)); + xCombobox.addItemListener(new java.awt.event.ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + xCombobox_actionPerformed(null); + } + }); + this.setMenuBar(menuBar1); + menu1.setLabel("File"); + menu2.setLabel("View"); + labels.setLabel("Labels"); + labels.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent itemEvent) + { + labels_itemStateChanged(itemEvent); + } + }); + values.setLabel("Output Values..."); + values.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent actionEvent) + { + values_actionPerformed(actionEvent); + } + }); + this.add(jPanel2, BorderLayout.SOUTH); + jPanel2.add(jLabel1, null); + jPanel2.add(xCombobox, null); + jPanel2.add(jLabel2, null); + jPanel2.add(yCombobox, null); + jPanel2.add(jLabel3, null); + jPanel2.add(zCombobox, null); + menuBar1.add(menu1); + menuBar1.add(menu2); + menu2.add(labels); + menu1.add(values); + } } diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index e187663..910a206 100755 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -25,17 +25,24 @@ import java.awt.event.*; import jalview.analysis.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; +import java.awt.*; public class PairwiseAlignPanel - extends GPairwiseAlignPanel + extends Panel { Vector sequences = new Vector(); AlignmentPanel ap; public PairwiseAlignPanel(AlignmentPanel ap) { - super(); + try + { + jbInit(); + } + catch (Exception e) + { + e.printStackTrace(); + } this.ap = ap; float scores[][] = new float[ap.av.alignment.getHeight()][ap.av.alignment. getHeight()]; @@ -93,5 +100,27 @@ public class PairwiseAlignPanel "Pairwise Aligned Sequences"); } + protected ScrollPane scrollPane = new ScrollPane(); + protected TextArea textarea = new TextArea(); + protected Button viewInEditorButton = new Button(); + Panel jPanel1 = new Panel(); + BorderLayout borderLayout1 = new BorderLayout(); + + private void jbInit() throws Exception { + this.setLayout(borderLayout1); + textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); + textarea.setText(""); + viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); + viewInEditorButton.setLabel("View in alignment editor"); + viewInEditorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + viewInEditorButton_actionPerformed(e); + } + }); + this.add(scrollPane, BorderLayout.CENTER); + scrollPane.add(textarea); + this.add(jPanel1, BorderLayout.SOUTH); + jPanel1.add(viewInEditorButton, null); + } } diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 8aed730..3e3691b 100755 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -24,10 +24,8 @@ import java.util.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; -public class RedundancyPanel - extends GSliderPanel +public class RedundancyPanel extends SliderPanel { AlignmentPanel ap; @@ -35,6 +33,8 @@ public class RedundancyPanel public RedundancyPanel(AlignmentPanel ap) { + super(ap, 0, false, null); + this.ap = ap; label.setText("Enter the redundancy threshold"); diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index b27ab8a..c7696a0 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -36,6 +36,8 @@ public class RotatableCanvas RotatableMatrix idmat = new RotatableMatrix(3, 3); RotatableMatrix objmat = new RotatableMatrix(3, 3); RotatableMatrix rotmat = new RotatableMatrix(3, 3); + String tooltip; + int toolx, tooly; //RubberbandRectangle rubberband; @@ -291,13 +293,12 @@ public class RotatableCanvas return getPreferredSize(); } + public void update(Graphics g) + { + paint(g); + } public void paint(Graphics g) { - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(g); - } - if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); @@ -328,6 +329,12 @@ public class RotatableCanvas drawAxes(ig); } + if(tooltip!=null) + { + ig.setColor(Color.red); + ig.drawString(tooltip, toolx, tooly); + } + g.drawImage(img, 0, 0, this); } } @@ -394,14 +401,7 @@ public class RotatableCanvas getName(), x - 3, y - 4); } - } -// //Now the rectangle -// if (rectx2 != -1 && recty2 != -1) { -// g.setColor(Color.white); -// -// g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1); -// } } public Dimension minimumsize() @@ -512,27 +512,26 @@ public class RotatableCanvas repaint(); } - // private void fireSequenceSelectionEvent(Selection sel) { - // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel)); - //} public void mouseMoved(MouseEvent evt) { - // SequenceI found = findPoint(evt.getX(), evt.getY()); + SequenceI found = findPoint(evt.getX(), evt.getY()); + if(found==null) + tooltip = null; + else + { + tooltip = found.getName(); + toolx = evt.getX(); + tooly = evt.getY(); + } + repaint(); } public void mouseDragged(MouseEvent evt) { mx = evt.getX(); my = evt.getY(); - //Check if this is a rectangle drawing drag - if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) - { -// rectx2 = evt.getX(); -// recty2 = evt.getY(); - } - else - { + rotmat.setIdentity(); rotmat.rotate( (float) (my - omy), 'x'); @@ -562,8 +561,6 @@ public class RotatableCanvas omy = my; paint(this.getGraphics()); - } - } public void rectSelect(int x1, int y1, int x2, int y2) @@ -619,26 +616,5 @@ public class RotatableCanvas return null; } } - /* public boolean handleRubberbandEvent(RubberbandEvent evt) { - System.out.println("Rubberband handler called in RotatableCanvas with " + - evt.getBounds()); - - Rubberband rb = (Rubberband)evt.getSource(); - - // Clear the current selection (instance variable) - //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) { - // clearSelection(); - //} - - if (rb.getComponent() == this) { - Rectangle bounds = evt.getBounds(); - rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height); - } - - redrawneeded = true; - paint(this.getGraphics()); - - return true; - }*/ } diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index 336da66..af226f3 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -162,11 +162,6 @@ public class ScalePanel public void drawScale(Graphics gg, int startx, int endx, int width, int height) { - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(gg); - } - gg.setFont(av.getFont()); //Fill in the background diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 8984d62..33acb28 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -256,10 +256,6 @@ public class SeqCanvas { img = createImage(imgWidth, imgHeight); gg = img.getGraphics(); - if(!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(gg); - } gg.setFont(av.getFont()); } @@ -502,10 +498,12 @@ public class SeqCanvas group.sequences.contains(av.alignment.getSequenceAt( i))) { - if ((bottom == -1) && - !group.sequences.contains( - av.alignment.getSequenceAt(i + 1))) - { + + if (bottom == -1) + { + if(i == y2-1 || // Dont check for i+1 if on the bottom row + !group.sequences.contains(av.alignment.getSequenceAt(i+1 ))) + bottom = sy + av.charHeight; } diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 3e23728..a53e9dd 100755 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -25,11 +25,9 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; import jalview.schemes.*; -public class SliderPanel - extends GSliderPanel +public class SliderPanel extends Panel { AlignmentPanel ap; boolean forConservation = true; @@ -153,6 +151,11 @@ public class SliderPanel public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs) { + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } this.ap = ap; this.cs = cs; forConservation = forConserve; @@ -258,4 +261,76 @@ public class SliderPanel return Integer.parseInt(valueField.getText()); } + // this is used for conservation colours, PID colours and redundancy threshold + protected Scrollbar slider = new Scrollbar(); + protected TextField valueField = new TextField(); + protected Label label = new Label(); + Panel jPanel1 = new Panel(); + Panel jPanel2 = new Panel(); + protected Button applyButton = new Button(); + protected Button undoButton = new Button(); + FlowLayout flowLayout1 = new FlowLayout(); + protected Checkbox allGroupsCheck = new Checkbox(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + FlowLayout flowLayout2 = new FlowLayout(); + + private void jbInit() throws Exception { + this.setLayout(borderLayout2); + + // slider.setMajorTickSpacing(10); + // slider.setMinorTickSpacing(1); + // slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setFont(new java.awt.Font("Verdana", 0, 11)); + slider.setOrientation(0); + valueField.setFont(new java.awt.Font("Verdana", 0, 11)); + valueField.setText(" "); + valueField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + valueField_actionPerformed(e); + } + }); + label.setFont(new java.awt.Font("Verdana", 0, 11)); + label.setText("set this label text"); + jPanel1.setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setLabel("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + applyButton_actionPerformed(e); + } + }); + undoButton.setEnabled(false); + undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); + undoButton.setLabel("Undo"); + undoButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + undoButton_actionPerformed(e); + } + }); + allGroupsCheck.setEnabled(false); + allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); + allGroupsCheck.setLabel("Apply threshold to all groups"); + allGroupsCheck.setName("Apply to all Groups"); + this.setBackground(Color.white); + this.setForeground(Color.black); + jPanel2.add(label, null); + jPanel2.add(applyButton, null); + jPanel2.add(undoButton, null); + jPanel2.add(allGroupsCheck); + jPanel1.add(valueField, java.awt.BorderLayout.EAST); + jPanel1.add(slider, java.awt.BorderLayout.CENTER); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + this.add(jPanel2, java.awt.BorderLayout.CENTER); + } + + protected void applyButton_actionPerformed(ActionEvent e) + { + } + + protected void undoButton_actionPerformed(ActionEvent e) + { + } } diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index f74a1f6..e3f6c3c 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -354,11 +354,6 @@ public class TreeCanvas if(tree==null) return; - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(g); - } - g.setFont(font); diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 3e26a4b..03662ab 100755 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -22,14 +22,13 @@ package jalview.appletgui; import java.util.*; import java.awt.event.*; +import java.awt.*; import jalview.analysis.*; import jalview.datamodel.*; import jalview.io.*; -import jalview.jbappletgui.*; -public class TreePanel - extends GTreePanel +public class TreePanel extends Frame { SequenceI[] seq; String type; @@ -58,7 +57,16 @@ public class TreePanel public TreePanel(AlignViewport av, Vector seqVector, String type, String pwtype, int s, int e) { - super(); + try + { + jbInit(); + this.setMenuBar(jMenuBar1); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + initTreePanel(av, seqVector, type, pwtype, s, e, null); } @@ -74,7 +82,16 @@ public class TreePanel public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree, String type, String pwtype) { - super(); + try + { + jbInit(); + this.setMenuBar(jMenuBar1); + } + catch (Exception e) + { + e.printStackTrace(); + } + initTreePanel(av, seqVector, type, pwtype, 0, seqVector.size(), newtree); } @@ -192,4 +209,103 @@ public class TreePanel treeCanvas.setMarkPlaceholders(placeholdersMenu.getState()); } + BorderLayout borderLayout1 = new BorderLayout(); + protected ScrollPane scrollPane = new ScrollPane(); + MenuBar jMenuBar1 = new MenuBar(); + Menu jMenu2 = new Menu(); + protected MenuItem fontSize = new MenuItem(); + protected CheckboxMenuItem bootstrapMenu = new CheckboxMenuItem(); + protected CheckboxMenuItem distanceMenu = new CheckboxMenuItem(); + protected CheckboxMenuItem placeholdersMenu = new CheckboxMenuItem(); + protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem(); + Menu fileMenu = new Menu(); + MenuItem newickOutput = new MenuItem(); + CheckboxMenuItem fullId = new CheckboxMenuItem(); + + private void jbInit() throws Exception { + setLayout(borderLayout1); + this.setBackground(Color.white); + this.setFont(new java.awt.Font("Verdana", 0, 12)); + jMenu2.setLabel("View"); + fontSize.setLabel("Font..."); + fontSize.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + fontSize_actionPerformed(e); + } + }); + bootstrapMenu.setLabel("Show Bootstrap Values"); + bootstrapMenu.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + bootstrapMenu_actionPerformed(null); + } + }); + distanceMenu.setLabel("Show Distances"); + distanceMenu.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + distanceMenu_actionPerformed(null); + } + }); + placeholdersMenu.setLabel("Mark Unassociated Leaves"); + placeholdersMenu.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + placeholdersMenu_actionPerformed(null); + } + }); + fitToWindow.setState(true); + fitToWindow.setLabel("Fit To Window"); + fitToWindow.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(ItemEvent e) { + fitToWindow_actionPerformed(null); + } + }); + fileMenu.setLabel("File"); + newickOutput.setLabel("Newick Format"); + newickOutput.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent actionEvent) { + newickOutput_actionPerformed(actionEvent); + } + }); + fullId.setLabel("Show Full Id"); + fullId.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent itemEvent) + { + fullId_itemStateChanged(itemEvent); + } + }); + + add(scrollPane, BorderLayout.CENTER); + jMenuBar1.add(fileMenu); + jMenuBar1.add(jMenu2); + jMenu2.add(fitToWindow); + jMenu2.add(fontSize); + jMenu2.add(distanceMenu); + jMenu2.add(bootstrapMenu); + jMenu2.add(placeholdersMenu); + jMenu2.add(fullId); + fullId.setState(true); + fileMenu.add(newickOutput); + } + + + public void fullId_itemStateChanged(ItemEvent itemEvent) + { + tree.findHeight(tree.getTopNode()); + + // Now have to calculate longest name based on the leaves + Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector()); + + treeCanvas.longestName=""; + for (int i = 0; i < leaves.size(); i++) + { + SequenceNode lf = (SequenceNode) leaves.elementAt(i); + Sequence seq = (Sequence) lf.element(); + lf.setName(seq.getDisplayId(fullId.getState(), false)); + if(lf.getName().length() > treeCanvas.longestName.length()) + treeCanvas.longestName = lf.getName(); + } + + treeCanvas.repaint(); + } + } diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 36df306..7cd0391 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -25,11 +25,10 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; import jalview.schemes.*; public class UserDefinedColours - extends GUserDefinedColours + extends Panel { AlignmentPanel ap; @@ -49,7 +48,11 @@ public class UserDefinedColours public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg) { - super(); + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } frame = new Frame(); frame.add(this); jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345); @@ -262,4 +265,136 @@ public class UserDefinedColours frame.setVisible(false); } + + protected Panel buttonPanel = new Panel(); + protected GridLayout gridLayout = new GridLayout(); + Panel jPanel2 = new Panel(); + protected Button okButton = new Button(); + protected Button applyButton = new Button(); + protected Button cancelButton = new Button(); + protected Scrollbar rScroller = new Scrollbar(); + Label label1 = new Label(); + protected TextField rText = new TextField(); + Label label4 = new Label(); + protected Scrollbar gScroller = new Scrollbar(); + protected TextField gText = new TextField(); + Label label5 = new Label(); + protected Scrollbar bScroller = new Scrollbar(); + protected TextField bText = new TextField(); + protected Panel target = new Panel(); + + private void jbInit() throws Exception { + this.setLayout(null); + buttonPanel.setLayout(gridLayout); + gridLayout.setColumns(6); + gridLayout.setRows(4); + okButton.setFont(new java.awt.Font("Verdana", 0, 11)); + okButton.setLabel("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + okButton_actionPerformed(e); + } + }); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setLabel("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + applyButton_actionPerformed(e); + } + }); + cancelButton.setFont(new java.awt.Font("Verdana", 0, 11)); + cancelButton.setLabel("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + cancelButton_actionPerformed(e); + } + }); + this.setBackground(new Color(212, 208, 223)); + jPanel2.setBounds(new Rectangle(0, 265, 400, 35)); + buttonPanel.setBounds(new Rectangle(0, 123, 400, 142)); + rScroller.setMaximum(256); + rScroller.setMinimum(0); + rScroller.setOrientation(0); + rScroller.setUnitIncrement(1); + rScroller.setVisibleAmount(1); + rScroller.setBounds(new Rectangle(36, 27, 119, 19)); + rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + public void adjustmentValueChanged(AdjustmentEvent e) { + rScroller_adjustmentValueChanged(e); + } + }); + label1.setAlignment(Label.RIGHT); + label1.setText("R"); + label1.setBounds(new Rectangle(19, 30, 16, 15)); + rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + rText.setText("0 "); + rText.setBounds(new Rectangle(156, 27, 53, 19)); + rText.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + rText_actionPerformed(e); + } + }); + label4.setAlignment(Label.RIGHT); + label4.setText("G"); + label4.setBounds(new Rectangle(15, 56, 20, 15)); + gScroller.setMaximum(256); + gScroller.setMinimum(0); + gScroller.setOrientation(0); + gScroller.setUnitIncrement(1); + gScroller.setVisibleAmount(1); + gScroller.setBounds(new Rectangle(35, 52, 120, 20)); + gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + public void adjustmentValueChanged(AdjustmentEvent e) { + gScroller_adjustmentValueChanged(e); + } + }); + gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + gText.setText("0 "); + gText.setBounds(new Rectangle(156, 52, 53, 20)); + gText.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + gText_actionPerformed(e); + } + }); + label5.setAlignment(Label.RIGHT); + label5.setText("B"); + label5.setBounds(new Rectangle(14, 82, 20, 15)); + bScroller.setMaximum(256); + bScroller.setMinimum(0); + bScroller.setOrientation(0); + bScroller.setUnitIncrement(1); + bScroller.setVisibleAmount(1); + bScroller.setBounds(new Rectangle(35, 78, 120, 20)); + bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + public void adjustmentValueChanged(AdjustmentEvent e) { + bScroller_adjustmentValueChanged(e); + } + }); + bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + bText.setText("0 "); + bText.setBounds(new Rectangle(157, 78, 52, 20)); + bText.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + bText_actionPerformed(e); + } + }); + target.setBackground(Color.black); + target.setBounds(new Rectangle(229, 26, 134, 79)); + this.add(jPanel2, null); + jPanel2.add(okButton, null); + jPanel2.add(applyButton, null); + jPanel2.add(cancelButton, null); + this.add(buttonPanel, null); + this.add(target, null); + this.add(gScroller); + this.add(rScroller); + this.add(bScroller); + this.add(label5); + this.add(label4); + this.add(label1); + this.add(gText); + this.add(rText); + this.add(bText); +} + } -- 1.7.10.2