diff options
Diffstat (limited to 'java/src')
9 files changed, 58 insertions, 27 deletions
diff --git a/java/src/IceGridGUI/Application/AbstractServerEditor.java b/java/src/IceGridGUI/Application/AbstractServerEditor.java index 154f2d4c8f0..78aab335011 100755 --- a/java/src/IceGridGUI/Application/AbstractServerEditor.java +++ b/java/src/IceGridGUI/Application/AbstractServerEditor.java @@ -37,7 +37,7 @@ abstract class AbstractServerEditor extends Editor _propertiesPanel.setName("Server Properties");
}
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
Root root = _target.getRoot();
Server server = (Server)_target;
@@ -83,7 +83,7 @@ abstract class AbstractServerEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -143,7 +143,7 @@ abstract class AbstractServerEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -160,6 +160,7 @@ abstract class AbstractServerEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/Application/ApplicationEditor.java index e46ca3f0da0..851e5836443 100755 --- a/java/src/IceGridGUI/Application/ApplicationEditor.java +++ b/java/src/IceGridGUI/Application/ApplicationEditor.java @@ -28,7 +28,7 @@ import IceGridGUI.*; class ApplicationEditor extends Editor
{
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
Root root = (Root)_target;
MainPane mainPane = _target.getCoordinator().getMainPane();
@@ -61,7 +61,7 @@ class ApplicationEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
// Success
@@ -77,6 +77,7 @@ class ApplicationEditor extends Editor _applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/CommunicatorChildEditor.java b/java/src/IceGridGUI/Application/CommunicatorChildEditor.java index 651863bc0c2..b80d4e9f625 100755 --- a/java/src/IceGridGUI/Application/CommunicatorChildEditor.java +++ b/java/src/IceGridGUI/Application/CommunicatorChildEditor.java @@ -21,7 +21,7 @@ abstract class CommunicatorChildEditor extends Editor void postUpdate() {}
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
Root root = _target.getRoot();
root.disableSelectionListener();
@@ -60,7 +60,7 @@ abstract class CommunicatorChildEditor extends Editor JOptionPane.ERROR_MESSAGE);
root.setSelectedNode(_target);
- return;
+ return false;
}
//
@@ -96,7 +96,7 @@ abstract class CommunicatorChildEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -112,6 +112,7 @@ abstract class CommunicatorChildEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/Application/Editor.java index 9eea269f02c..c29894ee28b 100755 --- a/java/src/IceGridGUI/Application/Editor.java +++ b/java/src/IceGridGUI/Application/Editor.java @@ -56,10 +56,22 @@ public class Editor extends EditorBase return result;
}
+ public boolean save()
+ {
+ if(_applyButton.isEnabled())
+ {
+ return applyUpdate();
+ }
+ else
+ {
+ return true;
+ }
+ }
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
assert false;
+ return false;
}
protected void detectUpdates(boolean val)
diff --git a/java/src/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/Application/NodeEditor.java index dc0578ae48b..74236e9f2da 100755 --- a/java/src/IceGridGUI/Application/NodeEditor.java +++ b/java/src/IceGridGUI/Application/NodeEditor.java @@ -36,7 +36,7 @@ class NodeEditor extends Editor _propertiesPanel.setName("Node Properties");
}
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
Root root = _target.getRoot();
@@ -73,7 +73,7 @@ class NodeEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -115,7 +115,7 @@ class NodeEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
java.util.Iterator p = editables.iterator();
@@ -132,6 +132,7 @@ class NodeEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/PropertySetEditor.java b/java/src/IceGridGUI/Application/PropertySetEditor.java index bb971992d2e..702a19476d5 100755 --- a/java/src/IceGridGUI/Application/PropertySetEditor.java +++ b/java/src/IceGridGUI/Application/PropertySetEditor.java @@ -32,7 +32,7 @@ import IceGridGUI.*; class PropertySetEditor extends Editor
{
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
PropertySet nps = (PropertySet)_target;
Root root = nps.getRoot();
@@ -72,7 +72,7 @@ class PropertySetEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -93,6 +93,7 @@ class PropertySetEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java index 73077dc1858..aa684fa3b89 100755 --- a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java +++ b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java @@ -32,7 +32,7 @@ import IceGridGUI.*; class ReplicaGroupEditor extends Editor
{
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
ReplicaGroup replicaGroup = (ReplicaGroup)_target;
Root root = replicaGroup.getRoot();
@@ -72,7 +72,7 @@ class ReplicaGroupEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -124,7 +124,7 @@ class ReplicaGroupEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -144,6 +144,7 @@ class ReplicaGroupEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/Application/TemplateEditor.java b/java/src/IceGridGUI/Application/TemplateEditor.java index 75b8ebc8d3d..9c6504a5bc5 100755 --- a/java/src/IceGridGUI/Application/TemplateEditor.java +++ b/java/src/IceGridGUI/Application/TemplateEditor.java @@ -93,7 +93,7 @@ class TemplateEditor extends Editor _parameters.set(descriptor.parameters, descriptor.parameterDefaults, null, true);
}
- protected void applyUpdate()
+ protected boolean applyUpdate()
{
Root root = _target.getRoot();
root.disableSelectionListener();
@@ -131,7 +131,7 @@ class TemplateEditor extends Editor e.toString(),
"Apply failed",
JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
//
@@ -174,7 +174,7 @@ class TemplateEditor extends Editor //
// Everything was restored, user must deal with error
//
- return;
+ return false;
}
//
@@ -190,6 +190,7 @@ class TemplateEditor extends Editor root.getCoordinator().getCurrentTab().showNode(_target);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
+ return true;
}
finally
{
diff --git a/java/src/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/ApplicationPane.java index efd63957a9e..3ef7710ab51 100755 --- a/java/src/IceGridGUI/ApplicationPane.java +++ b/java/src/IceGridGUI/ApplicationPane.java @@ -118,7 +118,7 @@ public class ApplicationPane extends JSplitPane implements Tab if(_currentNode != null) { _root.getCoordinator().showActions(_currentNode); - _currentNode.getEditor(); + _currentEditor = _currentNode.getEditor(); } } @@ -242,15 +242,24 @@ public class ApplicationPane extends JSplitPane implements Tab public void save() { - _root.save(); + if(_currentEditor == null || _currentEditor.save()) + { + _root.save(); + } } public void saveToRegistry() { - _root.saveToRegistry(); + if(_currentEditor == null || _currentEditor.save()) + { + _root.saveToRegistry(); + } } public void saveToFile() { - _root.saveToFile(); + if(_currentEditor == null || _currentEditor.save()) + { + _root.saveToFile(); + } } public void discardUpdates() { @@ -295,14 +304,15 @@ public class ApplicationPane extends JSplitPane implements Tab } _propertiesFrame.setTitle("Properties"); _propertiesFrame.setToolBar(null); + _currentEditor = null; } else { - Editor editor = _currentNode.getEditor(); - Component currentProperties = editor.getProperties(); + _currentEditor = _currentNode.getEditor(); + Component currentProperties = _currentEditor.getProperties(); _propertiesFrame.setContent(currentProperties); _propertiesFrame.setTitle(currentProperties.getName()); - _propertiesFrame.setToolBar(editor.getToolBar()); + _propertiesFrame.setToolBar(_currentEditor.getToolBar()); } _propertiesFrame.validate(); _propertiesFrame.repaint(); @@ -387,7 +397,9 @@ public class ApplicationPane extends JSplitPane implements Tab // private java.util.LinkedList _previousNodes = new java.util.LinkedList(); private java.util.LinkedList _nextNodes = new java.util.LinkedList(); + private TreeNode _currentNode; + private Editor _currentEditor; static private final int HISTORY_MAX_SIZE = 20; } |