diff options
Diffstat (limited to 'java/src/IceGridGUI/Application/Editor.java')
-rwxr-xr-x | java/src/IceGridGUI/Application/Editor.java | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/java/src/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/Application/Editor.java index dd8cf663e00..cb3308c0111 100755 --- a/java/src/IceGridGUI/Application/Editor.java +++ b/java/src/IceGridGUI/Application/Editor.java @@ -39,62 +39,62 @@ import IceGridGUI.*; public class Editor extends EditorBase { static public java.util.Map makeParameterValues( - java.util.Map oldParameterValues, - java.util.List newParameters) + java.util.Map oldParameterValues, + java.util.List newParameters) { - java.util.Map result = new java.util.HashMap(); - - java.util.Iterator p = newParameters.iterator(); - while(p.hasNext()) - { - Object name = p.next(); - Object value = oldParameterValues.get(name); - if(value != null) - { - result.put(name, value); - } - } - return result; + java.util.Map result = new java.util.HashMap(); + + java.util.Iterator p = newParameters.iterator(); + while(p.hasNext()) + { + Object name = p.next(); + Object value = oldParameterValues.get(name); + if(value != null) + { + result.put(name, value); + } + } + return result; } public boolean save(boolean refresh) { - if(_applyButton.isEnabled()) - { - return validate() && applyUpdate(refresh); - } - else - { - return true; - } + if(_applyButton.isEnabled()) + { + return validate() && applyUpdate(refresh); + } + else + { + return true; + } } protected boolean validate() { - return true; + return true; } protected boolean applyUpdate(boolean refresh) { - assert false; - return false; + assert false; + return false; } protected void detectUpdates(boolean val) { - _detectUpdates = val; + _detectUpdates = val; } protected void discardUpdate() { - if(_target.isEphemeral()) - { - _target.delete(); - } - else - { - _target.getCoordinator().getCurrentTab().showNode(_target); - } + if(_target.isEphemeral()) + { + _target.delete(); + } + else + { + _target.getCoordinator().getCurrentTab().showNode(_target); + } } protected void appendProperties(DefaultFormBuilder builder) @@ -102,67 +102,67 @@ public class Editor extends EditorBase protected void buildPropertiesPanel() { - super.buildPropertiesPanel(); - JComponent buttonBar = - ButtonBarFactory.buildRightAlignedBar(_applyButton, - _discardButton); - buttonBar.setBorder(Borders.DIALOG_BORDER); - _propertiesPanel.add(buttonBar, BorderLayout.SOUTH); + super.buildPropertiesPanel(); + JComponent buttonBar = + ButtonBarFactory.buildRightAlignedBar(_applyButton, + _discardButton); + buttonBar.setBorder(Borders.DIALOG_BORDER); + _propertiesPanel.add(buttonBar, BorderLayout.SOUTH); } Editor() { - // - // _applyButton - // - AbstractAction apply = new AbstractAction("Apply") - { - public void actionPerformed(ActionEvent e) - { - if(validate()) - { - if(applyUpdate(true)) - { - _target.getRoot().getTree().grabFocus(); - } - } - } - }; - _applyButton = new JButton(apply); - _applyButton.setEnabled(false); - - // - // _discardButton - // - AbstractAction discard = new AbstractAction("Discard") - { - public void actionPerformed(ActionEvent e) - { - discardUpdate(); - _target.getRoot().getTree().grabFocus(); - } - }; - _discardButton = new JButton(discard); - _discardButton.setEnabled(false); - - _updateListener = new DocumentListener() - { - public void changedUpdate(DocumentEvent e) - { - updated(); - } - - public void insertUpdate(DocumentEvent e) - { - updated(); - } - - public void removeUpdate(DocumentEvent e) - { - updated(); - } - }; + // + // _applyButton + // + AbstractAction apply = new AbstractAction("Apply") + { + public void actionPerformed(ActionEvent e) + { + if(validate()) + { + if(applyUpdate(true)) + { + _target.getRoot().getTree().grabFocus(); + } + } + } + }; + _applyButton = new JButton(apply); + _applyButton.setEnabled(false); + + // + // _discardButton + // + AbstractAction discard = new AbstractAction("Discard") + { + public void actionPerformed(ActionEvent e) + { + discardUpdate(); + _target.getRoot().getTree().grabFocus(); + } + }; + _discardButton = new JButton(discard); + _discardButton.setEnabled(false); + + _updateListener = new DocumentListener() + { + public void changedUpdate(DocumentEvent e) + { + updated(); + } + + public void insertUpdate(DocumentEvent e) + { + updated(); + } + + public void removeUpdate(DocumentEvent e) + { + updated(); + } + }; } // @@ -170,32 +170,32 @@ public class Editor extends EditorBase // Object getSubDescriptor() { - return null; + return null; } Utils.Resolver getDetailResolver() { - return null; + return null; } public TreeNode getTarget() { - return _target; + return _target; } void updated() { - if(_detectUpdates) - { - _target.getRoot().disableRegistryUpdates(); - _applyButton.setEnabled(true); - _discardButton.setEnabled(true); - } + if(_detectUpdates) + { + _target.getRoot().disableRegistryUpdates(); + _applyButton.setEnabled(true); + _discardButton.setEnabled(true); + } } DocumentListener getUpdateListener() { - return _updateListener; + return _updateListener; } // @@ -203,36 +203,36 @@ public class Editor extends EditorBase // boolean check(String[] nameValArray) { - String emptyFields = ""; - int errorCount = 0; - - for(int i = 1; i < nameValArray.length; i += 2) - { - if(nameValArray[i] == null || nameValArray[i].length() == 0) - { - errorCount++; - if(emptyFields.length() > 0) - { - emptyFields += "\n"; - } - emptyFields += "'" + nameValArray[i - 1] + "'"; - } - } - - if(errorCount > 0) - { - String message = errorCount == 1 ? - emptyFields + " cannot be empty" : - "The following fields cannot be empty:\n" + emptyFields; - - JOptionPane.showMessageDialog( - _target.getCoordinator().getMainFrame(), - message, - "Validation failed", - JOptionPane.ERROR_MESSAGE); - } - - return errorCount == 0; + String emptyFields = ""; + int errorCount = 0; + + for(int i = 1; i < nameValArray.length; i += 2) + { + if(nameValArray[i] == null || nameValArray[i].length() == 0) + { + errorCount++; + if(emptyFields.length() > 0) + { + emptyFields += "\n"; + } + emptyFields += "'" + nameValArray[i - 1] + "'"; + } + } + + if(errorCount > 0) + { + String message = errorCount == 1 ? + emptyFields + " cannot be empty" : + "The following fields cannot be empty:\n" + emptyFields; + + JOptionPane.showMessageDialog( + _target.getCoordinator().getMainFrame(), + message, + "Validation failed", + JOptionPane.ERROR_MESSAGE); + } + + return errorCount == 0; } protected JButton _applyButton; |