From d09be4494b8e9402ae3d2980a1b516829dfaf9e1 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 15 Sep 2010 11:12:06 +0000 Subject: [PATCH] reinstated the splitpanes with better size placement, and made tooltips button labels more helpful --- src/jalview/gui/WsJobParameters.java | 46 +++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 2da6106..918724c 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -124,6 +124,7 @@ public class WsJobParameters extends JPanel implements ItemListener, JSplitPane settingsPanel = new JSplitPane(); JSplitPane jobPanel = new JSplitPane(); + boolean split=true; JTabbedPane tabpanels=new JTabbedPane(); JPanel jobOptions = new JPanel(); @@ -226,8 +227,17 @@ public class WsJobParameters extends JPanel implements ItemListener, // should recover defaults from user prefs. //settingsPanel.setDividerLocation(0.4); //jobPanel.setDividerLocation(0.5); - tabpanels.setSelectedComponent(jobOptionsPane); 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) @@ -240,7 +250,7 @@ public class WsJobParameters extends JPanel implements ItemListener, private void jbInit() { - updatepref = JvSwingUtils.makeButton("Update", "Update the stored user preference", + updatepref = JvSwingUtils.makeButton("Update", "Update this existing user parameter set.", new ActionListener() { @@ -249,7 +259,7 @@ public class WsJobParameters extends JPanel implements ItemListener, update_actionPerformed(e); } }); - deletepref = JvSwingUtils.makeButton("Delete", "Delete the user preference", + deletepref = JvSwingUtils.makeButton("Delete", "Delete the currently selected user parameter set.", new ActionListener() { @@ -258,7 +268,7 @@ public class WsJobParameters extends JPanel implements ItemListener, delete_actionPerformed(e); } }); - createpref = JvSwingUtils.makeButton("Create", "Create a new preference", + createpref = JvSwingUtils.makeButton("Create", "Create a new parameter set with the current settings.", new ActionListener() { @@ -268,7 +278,7 @@ public class WsJobParameters extends JPanel implements ItemListener, } }); revertpref = JvSwingUtils.makeButton("Revert", - "Undo all changes to the current set", new ActionListener() + "Undo all changes to the current parameter set", new ActionListener() { public void actionPerformed(ActionEvent e) @@ -276,14 +286,14 @@ public class WsJobParameters extends JPanel implements ItemListener, revert_actionPerformed(e); } }); - startjob = JvSwingUtils.makeButton("Start", "Start Job",new ActionListener() + startjob = JvSwingUtils.makeButton("Start Job", "Start Job with current settings.",new ActionListener() { public void actionPerformed(ActionEvent e) { startjob_actionPerformed(e); } }); - canceljob = JvSwingUtils.makeButton("Cancel", "Cancel Job", new ActionListener() + canceljob = JvSwingUtils.makeButton("Cancel Job", "Close this dialog and cancel job.", new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -299,6 +309,7 @@ public class WsJobParameters extends JPanel implements ItemListener, 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); @@ -308,7 +319,7 @@ public class WsJobParameters extends JPanel implements ItemListener, 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); @@ -346,22 +357,23 @@ public class WsJobParameters extends JPanel implements ItemListener, 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); + if (split) { + settingsPanel.setLeftComponent(jobOptionsPanel); + settingsPanel.setRightComponent(jobParameters); + settingsPanel.setOrientation(JSplitPane.VERTICAL_SPLIT); + jobPanel.setRightComponent(settingsPanel); + } else { jobPanel.setRightComponent(tabpanels); - 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); + } + jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT); + add(SetNamePanel, BorderLayout.NORTH); add(jobPanel, BorderLayout.CENTER); JPanel dialogpanel = new JPanel(); dialogpanel.add(startjob); -- 1.7.10.2