From: jprocter Date: Sun, 11 Jul 2010 13:48:48 +0000 (+0000) Subject: no tooltip and cleaner parameter layout X-Git-Tag: Release_2_6~148 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0a55443b38dc5fe8718ce1e101ae603ee4d3c5c7;p=jalview.git no tooltip and cleaner parameter layout --- diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 89028ef..36f416c 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -300,14 +300,15 @@ public class WsJobParameters extends JPanel implements ItemListener, paramPane.getViewport().setView(paramList); jobParameters.add(paramPane, BorderLayout.NORTH); // jobParameters.add(paramButtons, BorderLayout.SOUTH); - settingsPanel.setLayout(new BorderLayout()); + settingsPanel.setLayout(new GridLayout(2,1)); // settingsPanel.add(modified, BorderLayout.NORTH); JPanel jobOptionsPanel = new JPanel(); + jobOptionsPanel.setLayout(new BorderLayout()); jobOptionsPanel.setBorder(new TitledBorder("Options")); jobOptionsPane.getViewport().setView(jobOptions); - jobOptionsPanel.add(jobOptionsPane); - settingsPanel.add(jobOptionsPanel, BorderLayout.NORTH); - settingsPanel.add(jobParameters, BorderLayout.SOUTH); + jobOptionsPanel.add(jobOptionsPane, BorderLayout.CENTER); + settingsPanel.add(jobOptionsPanel); + settingsPanel.add(jobParameters); setLayout(new BorderLayout()); // setPreferredSize(new Dimension(400, 600)); @@ -588,7 +589,7 @@ public class WsJobParameters extends JPanel implements ItemListener, public class ParamBox extends JPanel implements ChangeListener, ActionListener { - JCheckBox showDesc = new JCheckBox(); + JButton showDesc = new JButton(); JTextArea string = new JTextArea(); JScrollPane descPanel = new JScrollPane(); @@ -599,24 +600,23 @@ public class WsJobParameters extends JPanel implements ItemListener, ValueConstrain validator = null; JPanel settingPanel = new JPanel(); + JPanel controlPanel=new JPanel(); + boolean integ = false; boolean choice = false; - + boolean descisvisible=false; public ParamBox(final WsJobParameters pmlayout, Parameter parm) { - setLayout(new FlowLayout(FlowLayout.LEFT)); - setBorder(new TitledBorder(parm.getName())); setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT)); + setBorder(new TitledBorder(parm.getName())); + setLayout(null); + showDesc.setFont(new Font("Verdana", Font.PLAIN, 11)); + showDesc.setText("?"); string.setFont(new Font("Verdana", Font.PLAIN, 11)); string.setBackground(getBackground()); // string.setSize(new Dimension(PARAM_WIDTH, 80)); string.setEditable(false); - showDesc.setText("Show Description"); - showDesc.setSelected(false); - showDesc.setToolTipText(parm.getDescription()); - //showDesc.setLocation(2,2); - descPanel.setPreferredSize(new Dimension(PARAM_WIDTH-20, 90)); descPanel.getViewport().setView(string); //descPanel.setLocation(2,17); descPanel.setVisible(false); @@ -628,9 +628,9 @@ public class WsJobParameters extends JPanel implements ItemListener, @Override public void actionPerformed(ActionEvent e) { - boolean show = showDesc.isSelected(); - descPanel.setVisible(show); - me.setPreferredSize(new Dimension(PARAM_WIDTH, (show) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT)); + descisvisible=!descisvisible; + descPanel.setVisible(descisvisible); + me.setPreferredSize(new Dimension(PARAM_WIDTH, (descisvisible) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT)); me.validate(); pmlayout.refreshParamLayout(); } @@ -640,7 +640,15 @@ public class WsJobParameters extends JPanel implements ItemListener, string.setColumns(32); string.setText(parm.getDescription()); // name.setToolTipText(parm.getDescription()); - add(showDesc); + JPanel firstrow = new JPanel(); + firstrow.setLayout(null); + controlPanel.setLayout(new BorderLayout()); + controlPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH-70,PARAM_CLOSEDHEIGHT-50)); + showDesc.setBounds(new Rectangle(10,10,16,16)); + firstrow.add(showDesc); + firstrow.add(controlPanel); + firstrow.setBounds(new Rectangle(10,20,PARAM_WIDTH-30, PARAM_CLOSEDHEIGHT-30)); + add(firstrow); validator = parm.getValidValue(); parameter = parm; if (validator != null) @@ -655,7 +663,8 @@ public class WsJobParameters extends JPanel implements ItemListener, } } updateControls(parm); - add(descPanel); // , BorderLayout.NORTH); + descPanel.setBounds(new Rectangle(10,PARAM_CLOSEDHEIGHT+10, PARAM_WIDTH-20, PARAM_HEIGHT-PARAM_CLOSEDHEIGHT-30)); + add(descPanel); validate(); } @@ -667,7 +676,7 @@ public class WsJobParameters extends JPanel implements ItemListener, JComboBox choicebox; public int getBoxHeight() { - return (showDesc.isSelected() ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT); + return (descisvisible ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT); } public void updateControls(Parameter parm) { @@ -681,7 +690,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { choicebox = new JComboBox(); choicebox.addActionListener(this); - add(choicebox); + controlPanel.add(choicebox,BorderLayout.CENTER); } else { @@ -689,13 +698,9 @@ public class WsJobParameters extends JPanel implements ItemListener, slider.addChangeListener(this); valueField = new JTextField(); valueField.addActionListener(this); - valueField.setPreferredSize(new Dimension(80, 25)); - JPanel container = new JPanel(); - // container.setLayout(new FlowLayout()); - add(slider);// , BorderLayout.SOUTH); - add(valueField);// ,BorderLayout.CENTER); - // add(container, BorderLayout.EAST); - // container.validate(); + valueField.setPreferredSize(new Dimension(60, 25)); + controlPanel.add(slider,BorderLayout.WEST); + controlPanel.add(valueField, BorderLayout.EAST); } } @@ -1126,7 +1131,11 @@ public class WsJobParameters extends JPanel implements ItemListener, Preset p = null; try { - p = service.getPresets().getPresetByName(setname); + PresetManager prman = service.getPresets(); + if (prman!=null) + { + p = prman.getPresetByName(setname); + } } catch (Exception ex) { ex.printStackTrace();