+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * 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.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
package jalview.gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
ActionListener, DocumentListener
{
URL linkImageURL = getClass().getResource("/images/link.gif");
+
private static final String SVC_DEF = "Defaults"; // this is the null
// parameter set as shown to
// user
JSplitPane settingsPanel = new JSplitPane();
JSplitPane jobPanel = new JSplitPane();
- boolean split=true;
- JTabbedPane tabpanels=new JTabbedPane();
+
+ boolean split = true;
+
+ JTabbedPane tabpanels = new JTabbedPane();
+
JPanel jobOptions = new JPanel();
JScrollPane jobOptionsPane = new JScrollPane();
(int) (deskr.getCenterY() - 250), 480, 500));
frame.setContentPane(this);
// should recover defaults from user prefs.
- //settingsPanel.setDividerLocation(0.4);
- //jobPanel.setDividerLocation(0.5);
+ // settingsPanel.setDividerLocation(0.4);
+ // jobPanel.setDividerLocation(0.5);
frame.validate();
- if (split) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
+ if (split)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
settingsPanel.setDividerLocation(0.5);
- jobPanel.setDividerLocation(setDescr.getLineCount()>3 ? 0.35 : 0.16 );
+ jobPanel.setDividerLocation(setDescr.getLineCount() > 3 ? 0.35
+ : 0.16);
}
});
- } else {
+ }
+ else
+ {
tabpanels.setSelectedComponent(jobOptionsPane);
}
frame.setVisible(true);
return false;
}
-
private void jbInit()
{
- updatepref = JvSwingUtils.makeButton("Update", "Update this existing user parameter set.",
+ updatepref = JvSwingUtils.makeButton("Update",
+ "Update this existing user parameter set.",
new ActionListener()
{
update_actionPerformed(e);
}
});
- deletepref = JvSwingUtils.makeButton("Delete", "Delete the currently selected user parameter set.",
+ deletepref = JvSwingUtils.makeButton("Delete",
+ "Delete the currently selected user parameter set.",
new ActionListener()
{
delete_actionPerformed(e);
}
});
- createpref = JvSwingUtils.makeButton("Create", "Create a new parameter set with the current settings.",
+ createpref = JvSwingUtils.makeButton("Create",
+ "Create a new parameter set with the current settings.",
new ActionListener()
{
}
});
revertpref = JvSwingUtils.makeButton("Revert",
- "Undo all changes to the current parameter set", new ActionListener()
+ "Undo all changes to the current parameter set",
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
revert_actionPerformed(e);
}
});
- startjob = JvSwingUtils.makeButton("Start Job", "Start Job with current settings.",new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- startjob_actionPerformed(e);
- }
- });
- canceljob = JvSwingUtils.makeButton("Cancel Job", "Close this dialog and cancel job.", new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- canceljob_actionPerformed(e);
- }
- });
+ startjob = JvSwingUtils.makeButton("Start Job",
+ "Start Job with current settings.", new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ startjob_actionPerformed(e);
+ }
+ });
+ canceljob = JvSwingUtils.makeButton("Cancel Job",
+ "Close this dialog and cancel job.", new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ canceljob_actionPerformed(e);
+ }
+ });
setDetails.setBorder(new TitledBorder("Details"));
setDetails.setLayout(new BorderLayout());
setName.addItemListener(this);
setName.getEditor().addActionListener(this);
JPanel setNameInfo = new JPanel(new FlowLayout(FlowLayout.LEFT));
- SetNamePanel.setLayout(new GridLayout(2, 1));
- SetNamePanel.setMinimumSize(new Dimension(300, 40));
+ GridBagLayout gbl = new GridBagLayout();
+ SetNamePanel.setLayout(gbl);
+ SetNamePanel.setMinimumSize(new Dimension(300, 60));
JLabel setNameLabel = new JLabel("Current parameter set name :");
setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
// setNameLabel.setHorizontalAlignment(FlowLayout.LEFT);
JPanel buttonArea = new JPanel(new GridLayout(1, 1));
buttonArea.add(setsavebuts);
SetNamePanel.add(setNameInfo);
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridheight = 2;
+ gbl.setConstraints(setNameInfo, gbc);
SetNamePanel.add(buttonArea);
+ gbc = new GridBagConstraints();
+ gbc.gridx=0;
+ gbc.gridy=2;
+ gbc.gridheight = 1;
+ gbl.setConstraints(buttonArea, gbc);
setDetails.add(setDescrView, BorderLayout.CENTER);
- //setDetails.setPreferredSize(new Dimension(360, 100));
+ // setDetails.setPreferredSize(new Dimension(360, 100));
jobParameters.setBorder(new TitledBorder("Parameters"));
jobParameters.setLayout(new BorderLayout());
paramPane.setPreferredSize(new Dimension(360, 300));
jobOptionsPanel.setBorder(new TitledBorder("Options"));
jobOptionsPane.getViewport().setView(jobOptions);
jobOptionsPanel.add(jobOptionsPane, BorderLayout.CENTER);
-
+
setLayout(new BorderLayout());
jobPanel.setLeftComponent(setDetails);
- if (split) {
+ if (split)
+ {
settingsPanel.setLeftComponent(jobOptionsPanel);
settingsPanel.setRightComponent(jobParameters);
settingsPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
jobPanel.setRightComponent(settingsPanel);
- } else {
- jobPanel.setRightComponent(tabpanels);
- jobOptionsPane.setName("Options");
- tabpanels.add(jobOptionsPane);
- paramPane.setName("Parameters");
- tabpanels.add(paramPane);
+ }
+ else
+ {
+ jobPanel.setRightComponent(tabpanels);
+ jobOptionsPane.setName("Options");
+ tabpanels.add(jobOptionsPane);
+ paramPane.setName("Parameters");
+ tabpanels.add(paramPane);
}
jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
- add(SetNamePanel, BorderLayout.NORTH);
+ add(SetNamePanel, BorderLayout.NORTH);
add(jobPanel, BorderLayout.CENTER);
JPanel dialogpanel = new JPanel();
dialogpanel.add(startjob);
jobOptions.setPreferredSize(new Dimension(PARAM_WIDTH, optSet.size()
* OPTSET_HEIGHT));
- jobOptions.setLayout(new GridLayout(optSet.size(), 1));
+ FlowLayout fl;
+ jobOptions.setLayout(fl=new FlowLayout(FlowLayout.LEFT));
+
refreshParamLayout();
paramPane.validate();
revalidate();
finfo = parm.getFurtherDetails();
if (finfo != null)
{
- showDesc.setToolTipText("<html>"+JvSwingUtils.wrapTooltip("Click to show brief description<br><img src=\"" + linkImageURL + "\"/> Right click for further information.")+"</html>");
+ showDesc.setToolTipText("<html>"
+ + JvSwingUtils
+ .wrapTooltip("Click to show brief description<br><img src=\""
+ + linkImageURL
+ + "\"/> Right click for further information.")
+ + "</html>");
showDesc.addMouseListener(this);
}
else
{
- showDesc.setToolTipText("<html>"+JvSwingUtils.wrapTooltip("Click to show brief description.")+"</html>");
+ showDesc.setToolTipText("<html>"
+ + JvSwingUtils
+ .wrapTooltip("Click to show brief description.")
+ + "</html>");
}
showDesc.addActionListener(new ActionListener()
{
{
hasLink = true;
// optlabel.setToolTipText("<html><p>"+opt.getDescription()+"</p><img src=\""+linkImageURL+"\"/></html>");
- enabled.setToolTipText("<html>" + JvSwingUtils.wrapTooltip(opt.getDescription()+"<br><img src=\"" + linkImageURL + "\"/>")
+ enabled.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip(opt.getDescription()
+ + "<br><img src=\"" + linkImageURL + "\"/>")
+ "</html>");
// optlabel.addMouseListener(this);
enabled.addMouseListener(this);
else
{
// optlabel.setToolTipText(opt.getDescription());
- enabled.setToolTipText("<html>"+JvSwingUtils.wrapTooltip(opt.getDescription())+"</html>");
+ enabled.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip(opt.getDescription())
+ + "</html>");
}
add(enabled, BorderLayout.NORTH);
if (opt.getPossibleValues().size() > 1)
String msg = null;
if (isServicePreset(newname))
{
- final String oldname = curSetName!=null ? curSetName : lastParmSet;
- final Component ourframe=this;
- settingDialog=true;
+ final String oldname = curSetName != null ? curSetName
+ : lastParmSet;
+ final Component ourframe = this;
+ settingDialog = true;
setName.getEditor().setItem(oldname);
- settingDialog=false;
- javax.swing.SwingUtilities.invokeLater(new Runnable() {public void run() {
- JOptionPane.showMessageDialog(ourframe,
- "Invalid name - preset already exists.", "Invalid name",
- JOptionPane.WARNING_MESSAGE);
- }});
-
+ settingDialog = false;
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ JOptionPane.showMessageDialog(ourframe,
+ "Invalid name - preset already exists.",
+ "Invalid name", JOptionPane.WARNING_MESSAGE);
+ }
+ });
+
return;
}
curSetName = newname;
return paramStore.getPreset(lastParmSet);
}
}
-}
\ No newline at end of file
+}