-
- boolean initEnabled = false;
-
- String initVal = null;
-
- public void setInitialValue()
- {
- initEnabled = enabled.isSelected();
- if (option.getPossibleValues() != null
- && option.getPossibleValues().size() > 1)
- {
- initVal = (String) val.getSelectedItem();
- }
- else
- {
- initVal = (initEnabled) ? option.getDefaultValue() : null;
- }
- }
-
- public OptionI getOptionIfEnabled()
- {
- if (!enabled.isSelected())
- {
- return null;
- }
- OptionI opt = option.copy();
-
- if (val.getSelectedItem() != null)
- {
- opt.setDefaultValue((String) val.getSelectedItem());
- }
- return opt;
- }
-
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() != enabled)
- {
- enabled.setSelected(true);
- }
- checkIfModified();
- }
-
- private void checkIfModified()
- {
- boolean notmod = (initEnabled == enabled.isSelected());
- if (enabled.isSelected())
- {
- if (initVal != null)
- {
- notmod &= initVal.equals(val.getSelectedItem());
- }
- else
- {
- // compare against default service setting
- notmod &= option.getDefaultValue() == null
- || option.getDefaultValue().equals(val.getSelectedItem());
- }
- }
- else
- {
- notmod &= initVal == null;
- }
- argSetModified(this, !notmod);
- }
-
- public void mouseClicked(MouseEvent e)
- {
- if (javax.swing.SwingUtilities.isRightMouseButton(e))
- {
- showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
- }
- }
-
- public void mousePressed(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- private OptionBox addOption(OptionI opt)
- {
- OptionBox cb = optSet.get(opt.getName());
- if (cb == null)
- {
- cb = new OptionBox(opt);
- optSet.put(opt.getName(), cb);
- jobOptions.add(cb);
- }
- return cb;
- }
-
- public static void showUrlPopUp(JComponent invoker, final String finfo,
- int x, int y)
- {
-
- JPopupMenu mnu = new JPopupMenu();
- JMenuItem mitem = new JMenuItem("View " + finfo);
- mitem.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- Desktop.showUrl(finfo);
-
- }
- });
- mnu.add(mitem);
- mnu.show(invoker, x, y);
- }
-
- protected void refreshParamLayout()
- {
- FlowLayout fl = new FlowLayout();
- paramList.setLayout(fl);
- int s = 2 * fl.getVgap();
- for (ParamBox pbox : paramSet.values())