diff options
Diffstat (limited to 'java/src')
-rwxr-xr-x | java/src/IceGridGUI/Application/ApplicationEditor.java | 1 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/Root.java | 15 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/TreeNode.java | 2 | ||||
-rwxr-xr-x | java/src/IceGridGUI/ApplicationActions.java | 89 | ||||
-rwxr-xr-x | java/src/IceGridGUI/ApplicationPane.java | 18 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Coordinator.java | 17 |
6 files changed, 115 insertions, 27 deletions
diff --git a/java/src/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/Application/ApplicationEditor.java index 4a28607e2c6..a976f376acd 100755 --- a/java/src/IceGridGUI/Application/ApplicationEditor.java +++ b/java/src/IceGridGUI/Application/ApplicationEditor.java @@ -72,6 +72,7 @@ class ApplicationEditor extends Editor if(!savedDescriptor.name.equals(root.getId())) { mainPane.resetTitle(root); + root.getTreeModel().nodeChanged(root); } } diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java index 9c7453fdc8d..ef8854dc815 100755 --- a/java/src/IceGridGUI/Application/Root.java +++ b/java/src/IceGridGUI/Application/Root.java @@ -1140,6 +1140,17 @@ public class Root extends ListTreeNode return _updated || !_registryUpdatesEnabled; } + public void setPane(ApplicationPane app) + { + _applicationPane = app; + } + + public ApplicationPane getPane() + { + return _applicationPane; + } + + Editor getEditor(Class c, TreeNode node) { Editor result = (Editor)_editorMap.get(c); @@ -1319,7 +1330,7 @@ public class Root extends ListTreeNode return _replicaGroups; } - Root getRoot() + public Root getRoot() { return this; } @@ -1422,6 +1433,8 @@ public class Root extends ListTreeNode // private java.util.Map _editorMap = new java.util.HashMap(); + private ApplicationPane _applicationPane; + static private DefaultTreeCellRenderer _cellRenderer; static private JPopupMenu _popup; } diff --git a/java/src/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/Application/TreeNode.java index ae738a718f1..c7af0ac6345 100755 --- a/java/src/IceGridGUI/Application/TreeNode.java +++ b/java/src/IceGridGUI/Application/TreeNode.java @@ -46,7 +46,7 @@ public abstract class TreeNode extends TreeNodeBase super(parent, id); } - Root getRoot() + public Root getRoot() { assert _parent != null; return ((TreeNode)_parent).getRoot(); diff --git a/java/src/IceGridGUI/ApplicationActions.java b/java/src/IceGridGUI/ApplicationActions.java index 7fb5e8256e6..ed7c54c6f97 100755 --- a/java/src/IceGridGUI/ApplicationActions.java +++ b/java/src/IceGridGUI/ApplicationActions.java @@ -60,7 +60,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newAdapter(); + if(apply(_target)) + { + _target.newAdapter(); + } } }; @@ -69,7 +72,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newDbEnv(); + if(apply(_target)) + { + _target.newDbEnv(); + } } }; @@ -78,7 +84,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newNode(); + if(apply(_target)) + { + _target.newNode(); + } } }; @@ -87,7 +96,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newPropertySet(); + if(apply(_target)) + { + _target.newPropertySet(); + } } }; @@ -96,7 +108,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newReplicaGroup(); + if(apply(_target)) + { + _target.newReplicaGroup(); + } } }; @@ -105,7 +120,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newServer(); + if(apply(_target)) + { + _target.newServer(); + } } }; @@ -114,7 +132,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newServerIceBox(); + if(apply(_target)) + { + _target.newServerIceBox(); + } } }; @@ -123,7 +144,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newServerFromTemplate(); + if(apply(_target)) + { + _target.newServerFromTemplate(); + } } }; @@ -133,7 +157,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newService(); + if(apply(_target)) + { + _target.newService(); + } } }; @@ -142,7 +169,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newServiceFromTemplate(); + if(apply(_target)) + { + _target.newServiceFromTemplate(); + } } }; @@ -151,7 +181,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newTemplateServer(); + if(apply(_target)) + { + _target.newTemplateServer(); + } } }; @@ -160,7 +193,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newTemplateServerIceBox(); + if(apply(_target)) + { + _target.newTemplateServerIceBox(); + } } }; @@ -170,7 +206,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.newTemplateService(); + if(apply(_target)) + { + _target.newTemplateService(); + } } }; @@ -178,7 +217,6 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - assert isEnabled(); _target.copy(); } }; @@ -187,8 +225,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - assert isEnabled(); - _target.paste(); + if(apply(_target)) + { + _target.paste(); + } } }; @@ -196,7 +236,6 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - assert isEnabled(); _target.delete(); } }; @@ -232,7 +271,10 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.moveUp(); + if(apply(_target)) + { + _target.moveUp(); + } } }; @@ -240,11 +282,20 @@ public class ApplicationActions { public void actionPerformed(ActionEvent e) { - _target.moveDown(); + if(apply(_target)) + { + _target.moveDown(); + } } }; } + static private boolean apply(TreeNode target) + { + return target.getRoot().getPane().applyUpdates(false); + } + + private TreeNode _target; private Action[] _array = new Action[TreeNode.ACTION_COUNT]; } diff --git a/java/src/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/ApplicationPane.java index bb57e18c2d1..21762f500f7 100755 --- a/java/src/IceGridGUI/ApplicationPane.java +++ b/java/src/IceGridGUI/ApplicationPane.java @@ -73,11 +73,6 @@ public class ApplicationPane extends JSplitPane implements Tab { if(_currentNode != null) { - if(_currentEditor != null) - { - _currentEditor.save(true); - } - _currentEditor = _currentNode.getEditor(); if(_root.getCoordinator().getCurrentTab() == this) { @@ -231,6 +226,7 @@ public class ApplicationPane extends JSplitPane implements Tab } _root = newRoot; + _root.setPane(this); // // Tree display @@ -299,6 +295,18 @@ public class ApplicationPane extends JSplitPane implements Tab return true; } + public boolean applyUpdates(boolean refresh) + { + if(_currentEditor == null) + { + return true; + } + else + { + return _currentEditor.save(refresh); + } + } + private void registerAction(Coordinator c, int index) { Action action = c.getActionsForMenu().get(index); diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java index 8eb970bda40..ec21bb49f9e 100755 --- a/java/src/IceGridGUI/Coordinator.java +++ b/java/src/IceGridGUI/Coordinator.java @@ -1399,6 +1399,17 @@ public class Coordinator { _substitute = newValue; + boolean refresh = true; + if(getCurrentTab() instanceof ApplicationPane) + { + ApplicationPane app = (ApplicationPane)getCurrentTab(); + if(!app.applyUpdates(false)) + { + _substitute = !_substitute; + refresh = false; + } + } + if(_substitute) { _substituteMenuItem.setSelected(true); @@ -1409,7 +1420,11 @@ public class Coordinator _showVarsMenuItem.setSelected(true); _showVarsTool.setSelected(true); } - getCurrentTab().refresh(); + + if(refresh) + { + getCurrentTab().refresh(); + } } } |