X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fjbgui%2FGStructureViewer.java;h=ac2202ca7e3214548e9a2aa5d733f87d446b8c85;hb=9876fdccf311378e690c1f9e18db52675d427b89;hp=6769404bcbae99ac843b622e68d41b3f3f522c6f;hpb=4cea7a0328724b90a6a7c16ae8c926e0cc12cedd;p=jalview.git
diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java
index 6769404..ac2202c 100644
--- a/src/jalview/jbgui/GStructureViewer.java
+++ b/src/jalview/jbgui/GStructureViewer.java
@@ -1,30 +1,93 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
+import jalview.api.structures.JalviewStructureDisplayI;
import jalview.util.MessageManager;
-import javax.swing.*;
-import java.awt.event.ActionListener;
+import java.awt.GridLayout;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-public class GStructureViewer extends JInternalFrame
+import javax.swing.ButtonGroup;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+
+public abstract class GStructureViewer extends JInternalFrame implements
+ JalviewStructureDisplayI
{
+ // private AAStructureBindingModel bindingModel;
+
+ protected JMenu savemenu = new JMenu();
+
+ protected JMenu viewMenu = new JMenu();
+
+ protected JMenu chainMenu = new JMenu();
+
+ protected JMenu viewerActionMenu = new JMenu();
+
+ protected JMenuItem alignStructs = new JMenuItem();
+
+ protected JMenuItem fitToWindow = new JMenuItem();
+
+ protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
+
+ protected JMenuItem helpItem = new JMenuItem();
+
+ protected JLabel statusBar = new JLabel();
+
+ protected JPanel statusPanel = new JPanel();
+
+ /**
+ * Constructor
+ */
public GStructureViewer()
{
try
@@ -38,10 +101,16 @@ public class GStructureViewer extends JInternalFrame
private void jbInit() throws Exception
{
+ JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
+
+ JMenu fileMenu = new JMenu();
fileMenu.setText(MessageManager.getString("action.file"));
+
savemenu.setActionCommand(MessageManager.getString("action.save_image"));
savemenu.setText(MessageManager.getString("action.save_as"));
+
+ JMenuItem pdbFile = new JMenuItem();
pdbFile.setText(MessageManager.getString("label.pdb_file"));
pdbFile.addActionListener(new ActionListener()
{
@@ -50,6 +119,8 @@ public class GStructureViewer extends JInternalFrame
pdbFile_actionPerformed(actionEvent);
}
});
+
+ JMenuItem png = new JMenuItem();
png.setText("PNG");
png.addActionListener(new ActionListener()
{
@@ -58,6 +129,8 @@ public class GStructureViewer extends JInternalFrame
png_actionPerformed(actionEvent);
}
});
+
+ JMenuItem eps = new JMenuItem();
eps.setText("EPS");
eps.addActionListener(new ActionListener()
{
@@ -66,6 +139,8 @@ public class GStructureViewer extends JInternalFrame
eps_actionPerformed(actionEvent);
}
});
+
+ JMenuItem viewMapping = new JMenuItem();
viewMapping.setText(MessageManager.getString("label.view_mapping"));
viewMapping.addActionListener(new ActionListener()
{
@@ -75,9 +150,24 @@ public class GStructureViewer extends JInternalFrame
}
});
viewMenu.setText(MessageManager.getString("action.view"));
+
chainMenu.setText(MessageManager.getString("action.show_chain"));
+
+ fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
+ fitToWindow.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ fitToWindow_actionPerformed();
+ }
+ });
+
+ JMenu colourMenu = new JMenu();
colourMenu.setText(MessageManager.getString("label.colours"));
- backGround.setText(MessageManager.getString("label.background_colour") + "...");
+
+ JMenuItem backGround = new JMenuItem();
+ backGround
+ .setText(MessageManager.getString("action.background_colour"));
backGround.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -134,7 +224,8 @@ public class GStructureViewer extends JInternalFrame
hydroColour_actionPerformed(actionEvent);
}
});
- strandColour.setText(MessageManager.getString("label.strand_propensity"));
+ strandColour.setText(MessageManager
+ .getString("label.strand_propensity"));
strandColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -166,7 +257,8 @@ public class GStructureViewer extends JInternalFrame
buriedColour_actionPerformed(actionEvent);
}
});
- purinePyrimidineColour.setText(MessageManager.getString("label.purine_pyrimidine"));
+ purinePyrimidineColour.setText(MessageManager
+ .getString("label.purine_pyrimidine"));
purinePyrimidineColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -183,26 +275,31 @@ public class GStructureViewer extends JInternalFrame
userColour_actionPerformed(actionEvent);
}
});
- jmolColour.setSelected(false);
- jmolColour.setText(MessageManager.getString("label.colour_with_jmol"));
- jmolColour.setToolTipText(MessageManager.getString("label.let_jmol_manage_structure_colours"));
- jmolColour.addActionListener(new ActionListener()
+ viewerColour.setSelected(false);
+ viewerColour
+ .setText(MessageManager.getString("label.colour_with_jmol"));
+ viewerColour.setToolTipText(MessageManager
+ .getString("label.let_jmol_manage_structure_colours"));
+ viewerColour.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
- jmolColour_actionPerformed(actionEvent);
+ viewerColour_actionPerformed(actionEvent);
}
});
+
+ JMenu helpMenu = new JMenu();
helpMenu.setText(MessageManager.getString("action.help"));
- jmolHelp.setText(MessageManager.getString("label.jmol_help"));
- jmolHelp.addActionListener(new ActionListener()
+ helpItem.setText(MessageManager.getString("label.jmol_help"));
+ helpItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
- jmolHelp_actionPerformed(actionEvent);
+ showHelp_actionPerformed(actionEvent);
}
});
- alignStructs.setText(MessageManager.getString("label.align_structures"));
+ alignStructs
+ .setText(MessageManager.getString("label.align_structures"));
alignStructs.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
@@ -210,12 +307,12 @@ public class GStructureViewer extends JInternalFrame
alignStructs_actionPerformed(actionEvent);
}
});
- jmolActionMenu.setText(MessageManager.getString("label.jmol"));
+ viewerActionMenu.setText(MessageManager.getString("label.jmol"));
menuBar.add(fileMenu);
menuBar.add(viewMenu);
menuBar.add(colourMenu);
- menuBar.add(jmolActionMenu);
- jmolActionMenu.setVisible(false);
+ menuBar.add(viewerActionMenu);
+ viewerActionMenu.setVisible(false);
menuBar.add(helpMenu);
fileMenu.add(savemenu);
fileMenu.add(viewMapping);
@@ -236,9 +333,11 @@ public class GStructureViewer extends JInternalFrame
colourMenu.add(buriedColour);
colourMenu.add(purinePyrimidineColour);
colourMenu.add(userColour);
- colourMenu.add(jmolColour);
+ colourMenu.add(viewerColour);
colourMenu.add(backGround);
+ ButtonGroup colourButtons = new ButtonGroup();
+
colourButtons.add(seqColour);
colourButtons.add(chainColour);
colourButtons.add(chargeColour);
@@ -249,80 +348,29 @@ public class GStructureViewer extends JInternalFrame
colourButtons.add(strandColour);
colourButtons.add(turnColour);
colourButtons.add(buriedColour);
+ colourButtons.add(purinePyrimidineColour);
colourButtons.add(userColour);
- colourButtons.add(jmolColour);
+ colourButtons.add(viewerColour);
- helpMenu.add(jmolHelp);
- jmolActionMenu.add(alignStructs);
+ helpMenu.add(helpItem);
+ viewerActionMenu.add(alignStructs);
+
+ statusPanel.setLayout(new GridLayout());
+ this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
+ statusPanel.add(statusBar, null);
}
- protected void jmolColour_actionPerformed(ActionEvent actionEvent)
+ protected void fitToWindow_actionPerformed()
{
}
- protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ protected void viewerColour_actionPerformed(ActionEvent actionEvent)
{
}
- JMenuBar menuBar = new JMenuBar();
-
- JMenu fileMenu = new JMenu();
-
- JMenu savemenu = new JMenu();
-
- JMenuItem pdbFile = new JMenuItem();
-
- JMenuItem png = new JMenuItem();
-
- JMenuItem eps = new JMenuItem();
-
- JMenuItem viewMapping = new JMenuItem();
-
- protected JMenu viewMenu = new JMenu();
-
- protected JMenu chainMenu = new JMenu();
-
- JMenu jMenu1 = new JMenu();
-
- protected JMenu colourMenu = new JMenu();
-
- protected JMenu jmolActionMenu = new JMenu();
-
- protected JMenuItem alignStructs = new JMenuItem();
-
- JMenuItem backGround = new JMenuItem();
-
- protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
-
- protected JRadioButtonMenuItem jmolColour = new JRadioButtonMenuItem();
-
- protected ButtonGroup colourButtons = new ButtonGroup();
-
- JMenu helpMenu = new JMenu();
-
- JMenuItem jmolHelp = new JMenuItem();
+ protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ {
+ }
public void pdbFile_actionPerformed(ActionEvent actionEvent)
{
@@ -409,8 +457,18 @@ public class GStructureViewer extends JInternalFrame
}
- public void jmolHelp_actionPerformed(ActionEvent actionEvent)
+ public void showHelp_actionPerformed(ActionEvent actionEvent)
{
}
+
+ // {
+ // return bindingModel;
+ // }
+
+ // public void setBindingModel(AAStructureBindingModel bindingModel)
+ // {
+ // this.bindingModel = bindingModel;
+ // }
+
}