jalview.bin.JalviewLite applet;\r
\r
\r
- public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title)\r
+ public AlignFrame(AlignmentI al,\r
+ jalview.bin.JalviewLite applet,\r
+ String title,\r
+ boolean embedded)\r
{\r
try{\r
jbInit();\r
});\r
\r
\r
- add(alignPanel, BorderLayout.CENTER);\r
- jalview.bin.JalviewLite.addFrame(this, title, NEW_WINDOW_WIDTH, NEW_WINDOW_HEIGHT);\r
-\r
+ if(embedded)\r
+ {\r
+ setEmbedded();\r
+ }\r
+ else\r
+ {\r
+ add(alignPanel, BorderLayout.CENTER);\r
+ jalview.bin.JalviewLite.addFrame(this, title, NEW_WINDOW_WIDTH,\r
+ NEW_WINDOW_HEIGHT);\r
+ }\r
alignPanel.validate();\r
alignPanel.repaint();\r
}\r
}\r
\r
viewport.showSequenceFeatures = true;\r
- viewMenu.addSeparator();\r
- viewMenu.add(sequenceFeatures);\r
- viewMenu.add(featureSettings);\r
-\r
+ sequenceFeatures.setState(true);\r
\r
alignPanel.repaint();\r
\r
else if(evt.getSource()==annotationPanelMenuItem)\r
annotationPanelMenuItem_actionPerformed();\r
else if(evt.getSource()==sequenceFeatures)\r
- { viewport.showSequenceFeatures(sequenceFeatures.getState());\r
+ {\r
+ viewport.showSequenceFeatures(sequenceFeatures.getState());\r
alignPanel.seqPanel.seqCanvas.repaint();\r
- }\r
+ }\r
else if(evt.getSource()==conservationMenuItem)\r
conservationMenuItem_actionPerformed();\r
else if(evt.getSource()==abovePIDThreshold)\r
{\r
if(evt.getSource()==inputText)\r
inputText_actionPerformed();\r
+ else if(evt.getSource()==loadTree)\r
+ loadTree_actionPerformed();\r
else if(evt.getSource()==closeMenuItem)\r
closeMenuItem_actionPerformed();\r
else if(evt.getSource()==copy)\r
\r
public void inputText_actionPerformed()\r
{\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, applet);\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
Frame frame = new Frame();\r
frame.add(cap);\r
jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500);\r
\r
protected void outputText_actionPerformed(ActionEvent e)\r
{\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, applet);\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
Frame frame = new Frame();\r
frame.add(cap);\r
jalview.bin.JalviewLite.addFrame(frame,\r
// used by undo and redo\r
void restoreHistoryItem(HistoryItem hi)\r
{\r
- if (hi.getType() == HistoryItem.SORT)\r
- {\r
- for (int i = 0; i < hi.getSequences().size(); i++)\r
- {\r
- viewport.alignment.getSequences().setElementAt(hi.getSequences().\r
- elementAt(i), i);\r
- }\r
- }\r
- else\r
- {\r
- for (int i = 0; i < hi.getSequences().size(); i++)\r
- {\r
- SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
- if (restore.getLength() == 0)\r
- {\r
- // log.System.out.println(hi.getHidden().elementAt(i));\r
- restore.setSequence(hi.getHidden().elementAt(i).toString());\r
- viewport.alignment.getSequences().insertElementAt(\r
- restore,\r
- hi.getAlignIndex(i));\r
- }\r
- else\r
- {\r
- restore.setSequence(hi.getHidden().elementAt(i).toString());\r
- }\r
- }\r
- if (hi.getType() == HistoryItem.PASTE)\r
- {\r
- for (int i = viewport.alignment.getHeight() - 1;\r
- i > hi.getSequences().size() - 1; i--)\r
- {\r
- viewport.alignment.deleteSequence(i);\r
- }\r
- }\r
- }\r
+ hi.restore();\r
\r
updateEditMenuBar();\r
\r
{\r
newtitle = newtitle.concat("- from " + getTitle());\r
}\r
- AlignFrame af = new AlignFrame(new Alignment(newSeqs), applet, newtitle);\r
+ AlignFrame af = new AlignFrame(new Alignment(newSeqs),\r
+ applet,\r
+ newtitle,\r
+ false);\r
\r
jalview.bin.JalviewLite.addFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
NEW_WINDOW_HEIGHT);\r
jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
}\r
\r
- public void addTreeMenuItem(final TreePanel treePanel, String title)\r
+ void loadTree_actionPerformed()\r
+ {\r
+ TreePanel tp = null;\r
+\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
+ cap.setText("Paste your Newick tree file here.");\r
+ cap.treeImport = true;\r
+ Frame frame = new Frame();\r
+ frame.add(cap);\r
+ jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300);\r
+ }\r
+\r
+ public void loadTree(jalview.io.NewickFile tree, String treeFile)\r
+ {\r
+ TreePanel tp = new TreePanel(viewport,\r
+ viewport.getAlignment().getSequences(),\r
+ tree, "From File - ", treeFile);\r
+ jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
+ addTreeMenuItem(tp, treeFile);\r
+ }\r
+\r
+ void addTreeMenuItem(final TreePanel treePanel, String title)\r
{\r
final MenuItem item = new MenuItem(title);\r
sortByTreeMenu.add(item);\r
//JBuilder Graphics here\r
\r
protected MenuBar alignFrameMenuBar = new MenuBar();\r
- protected Menu fileMenu = new Menu();\r
- protected MenuItem closeMenuItem = new MenuItem();\r
- protected Menu editMenu = new Menu();\r
- protected Menu viewMenu = new Menu();\r
- protected Menu colourMenu = new Menu();\r
- protected Menu calculateMenu = new Menu();\r
- protected MenuItem selectAllSequenceMenuItem = new MenuItem();\r
+ protected Menu fileMenu = new Menu("File");\r
+ protected MenuItem loadTree = new MenuItem("Load Associated Tree");\r
+ protected MenuItem closeMenuItem = new MenuItem("Close");\r
+ protected Menu editMenu = new Menu("Edit");\r
+ protected Menu viewMenu = new Menu("View");\r
+ protected Menu colourMenu = new Menu("Colour");\r
+ protected Menu calculateMenu = new Menu("Calculate");\r
+ protected MenuItem selectAllSequenceMenuItem = new MenuItem("Select all");\r
protected MenuItem deselectAllSequenceMenuItem = new MenuItem();\r
protected MenuItem invertSequenceMenuItem = new MenuItem();\r
protected MenuItem remove2LeftMenuItem = new MenuItem();\r
\r
outputTextboxMenu.add(item);\r
}\r
-\r
- fileMenu.setLabel("File");\r
- closeMenuItem.setLabel("Close");\r
closeMenuItem.addActionListener(this);\r
- editMenu.setLabel("Edit");\r
- viewMenu.setLabel("View");\r
- colourMenu.setLabel("Colour");\r
- calculateMenu.setLabel("Calculate");\r
- selectAllSequenceMenuItem.setLabel("Select all");\r
+\r
+ loadTree.addActionListener(this);\r
selectAllSequenceMenuItem.addActionListener(this);\r
deselectAllSequenceMenuItem.setLabel("Deselect All");\r
deselectAllSequenceMenuItem.addActionListener(this);\r
featureSettings.addActionListener(this);\r
sequenceFeatures.setLabel("Sequence Features");\r
sequenceFeatures.addItemListener(this);\r
- sequenceFeatures.setState(true);\r
+ sequenceFeatures.setState(false);\r
\r
alignFrameMenuBar.add(fileMenu);\r
alignFrameMenuBar.add(editMenu);\r
fileMenu.add(inputText);\r
fileMenu.add(outputTextboxMenu);\r
fileMenu.addSeparator();\r
+ fileMenu.add(loadTree);\r
fileMenu.add(closeMenuItem);\r
editMenu.add(undoMenuItem);\r
editMenu.add(redoMenuItem);\r
viewMenu.add(renderGapsMenuItem);\r
viewMenu.add(annotationPanelMenuItem);\r
viewMenu.addSeparator();\r
+ viewMenu.add(sequenceFeatures);\r
+ viewMenu.add(featureSettings);\r
+ viewMenu.addSeparator();\r
viewMenu.add(overviewMenuItem);\r
colourMenu.add(applyToAllGroups);\r
colourMenu.addSeparator();\r
embeddedCalculate.addMouseListener(this);\r
embeddedHelp.addMouseListener(this);\r
\r
- setVisible(false);\r
+ // setVisible(false);\r
fileMenu.remove(closeMenuItem);\r
fileMenu.remove(2); // Seperator\r
\r
applet.setLayout(new BorderLayout());\r
applet.add(embeddedMenu, BorderLayout.NORTH);\r
applet.add(statusBar, BorderLayout.SOUTH);\r
- applet.validate();\r
-\r
+ // applet.validate();\r
\r
alignPanel.setSize(applet.size().width, applet.size().height\r
- embeddedMenu.HEIGHT - statusBar.HEIGHT);\r
\r
applet.add(alignPanel, BorderLayout.CENTER);\r
applet.validate();\r
+\r
}\r
\r
\r