+/*
+ * 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;
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();
- 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);
- tabpanels.setSelectedComponent(jobOptionsPane);
+ // settingsPanel.setDividerLocation(0.4);
+ // jobPanel.setDividerLocation(0.5);
frame.validate();
+ if (split)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ settingsPanel.setDividerLocation(0.5);
+ jobPanel.setDividerLocation(setDescr.getLineCount() > 3 ? 0.35
+ : 0.16);
+ }
+ });
+ }
+ else
+ {
+ tabpanels.setSelectedComponent(jobOptionsPane);
+ }
frame.setVisible(true);
if (response > 0)
return false;
}
- protected JButton makeButton(String label, String tooltip,
- ActionListener action)
- {
- JButton button = new JButton();
- button.setText(label);
- button.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- button.setForeground(Color.black);
- button.setHorizontalAlignment(SwingConstants.CENTER);
- button.setToolTipText(tooltip);
- button.addActionListener(action);
- return button;
- }
-
private void jbInit()
{
- updatepref = makeButton("Update", "Update the stored user preference",
+ updatepref = JvSwingUtils.makeButton("Update",
+ "Update this existing user parameter set.",
new ActionListener()
{
update_actionPerformed(e);
}
});
- deletepref = makeButton("Delete", "Delete the user preference",
+ deletepref = JvSwingUtils.makeButton("Delete",
+ "Delete the currently selected user parameter set.",
new ActionListener()
{
delete_actionPerformed(e);
}
});
- createpref = makeButton("Create", "Create a new preference",
+ createpref = JvSwingUtils.makeButton("Create",
+ "Create a new parameter set with the current settings.",
new ActionListener()
{
create_actionPerformed(e);
}
});
- revertpref = makeButton("Revert",
- "Undo all changes to the current set", new ActionListener()
+ revertpref = JvSwingUtils.makeButton("Revert",
+ "Undo all changes to the current parameter set",
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
revert_actionPerformed(e);
}
});
- startjob.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- startjob.setText("Start");
- startjob.setToolTipText("Start Job");
- startjob.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- startjob_actionPerformed(e);
- }
- });
- canceljob.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
- canceljob.setText("Cancel");
- canceljob.setToolTipText("Cancel Job");
- canceljob.addActionListener(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());
setDescr.setBackground(getBackground());
setDescr.setEditable(true);
setDescr.getDocument().addDocumentListener(this);
+ setDescr.setToolTipText("Click to edit the notes for this parameter set.");
JScrollPane setDescrView = new JScrollPane();
// setDescrView.setPreferredSize(new Dimension(350, 200));
setDescrView.getViewport().setView(setDescr);
JPanel setNameInfo = new JPanel(new FlowLayout(FlowLayout.LEFT));
SetNamePanel.setLayout(new GridLayout(2, 1));
SetNamePanel.setMinimumSize(new Dimension(300, 40));
- JLabel setNameLabel = new JLabel("Parameter set: ");
+ JLabel setNameLabel = new JLabel("Current parameter set name :");
setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
// setNameLabel.setHorizontalAlignment(FlowLayout.LEFT);
setNameInfo.add(setNameLabel);
SetNamePanel.add(setNameInfo);
SetNamePanel.add(buttonArea);
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);
- //settingsPanel.setLeftComponent(jobOptionsPanel);
- //settingsPanel.setRightComponent(jobParameters);
- //settingsPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
setLayout(new BorderLayout());
jobPanel.setLeftComponent(setDetails);
- jobPanel.setRightComponent(tabpanels);
+ 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);
+ }
jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
add(SetNamePanel, BorderLayout.NORTH);
- //add(jobPanel, BorderLayout.CENTER);
- //setDescrView.setName("Description");
- //tabpanels.add(setDescrView);
- jobOptionsPane.setName("Options");
- tabpanels.add(jobOptionsPane);
- paramPane.setName("Parameters");
- tabpanels.add(paramPane);
add(jobPanel, BorderLayout.CENTER);
JPanel dialogpanel = new JPanel();
dialogpanel.add(startjob);
finfo = parm.getFurtherDetails();
if (finfo != null)
{
- showDesc.setToolTipText("<html><p>Click to show brief description<br><img src=\"" + linkImageURL + "\"/> Right click for further information.</p></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><p>Click to show brief description.</p></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><p>" + opt.getDescription()
- + "</p><img src=\"" + linkImageURL + "\"/></html>");
+ 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(opt.getDescription());
+ enabled.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip(opt.getDescription())
+ + "</html>");
}
add(enabled, BorderLayout.NORTH);
if (opt.getPossibleValues().size() > 1)
{
isUserPreset = false;
// Service defaults
+ setDescr.setText("");
updateTable(null, null);
lastParmSet = SVC_DEF;
}
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
+}