diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-04-03 15:15:13 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-04-03 15:15:13 -0700 |
commit | b415955846ce0d5c2e0c283f897190ccd2c3616a (patch) | |
tree | 10daf6bb8a05edf5052a33f10ea16c73d8ae0d89 /java/src/IceGridGUI/Application/PlainService.java | |
parent | Bug 3465 - Remove _adapter members from test where unecessary (diff) | |
download | ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.bz2 ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.xz ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.zip |
removing Java2 mapping
Diffstat (limited to 'java/src/IceGridGUI/Application/PlainService.java')
-rw-r--r-- | java/src/IceGridGUI/Application/PlainService.java | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/java/src/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/Application/PlainService.java index 83196b28184..1218cf8ad5a 100644 --- a/java/src/IceGridGUI/Application/PlainService.java +++ b/java/src/IceGridGUI/Application/PlainService.java @@ -6,6 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** + package IceGridGUI.Application; import java.awt.Component; @@ -17,7 +18,7 @@ import IceGrid.*; import IceGridGUI.*; class PlainService extends Communicator implements Service, Cloneable -{ +{ static public ServiceDescriptor copyDescriptor(ServiceDescriptor sd) { @@ -27,28 +28,25 @@ class PlainService extends Communicator implements Service, Cloneable copy.propertySet = PropertySet.copyDescriptor(copy.propertySet); return copy; } - + public Component getTreeCellRendererComponent( - JTree tree, - Object value, - boolean sel, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { if(_cellRenderer == null) { _cellRenderer = new DefaultTreeCellRenderer(); - _cellRenderer.setOpenIcon( - Utils.getIcon("/icons/16x16/service.png")); + _cellRenderer.setOpenIcon(Utils.getIcon("/icons/16x16/service.png")); - _cellRenderer.setClosedIcon( - Utils.getIcon("/icons/16x16/service.png")); + _cellRenderer.setClosedIcon(Utils.getIcon("/icons/16x16/service.png")); } - return _cellRenderer.getTreeCellRendererComponent( - tree, value, sel, expanded, leaf, row, hasFocus); + return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); } // @@ -58,10 +56,10 @@ class PlainService extends Communicator implements Service, Cloneable { boolean[] actions = new boolean[ACTION_COUNT]; actions[COPY] = !_ephemeral; - + Object clipboard = getCoordinator().getClipboard(); - if(clipboard != null && - (clipboard instanceof ServiceInstanceDescriptor + if(clipboard != null && + (clipboard instanceof ServiceInstanceDescriptor || clipboard instanceof Adapter.AdapterCopy || clipboard instanceof DbEnvDescriptor)) { @@ -71,17 +69,18 @@ class PlainService extends Communicator implements Service, Cloneable actions[DELETE] = true; actions[NEW_ADAPTER] = !_ephemeral; actions[NEW_DBENV] = !_ephemeral; - + if(_parent instanceof Server && !_ephemeral) { actions[SHOW_VARS] = true; actions[SUBSTITUTE_VARS] = true; } - + actions[MOVE_UP] = canMove(true); actions[MOVE_DOWN] = canMove(false); return actions; } + public JPopupMenu getPopupMenu() { ApplicationActions actions = getCoordinator().getActionsForPopup(); @@ -97,21 +96,23 @@ class PlainService extends Communicator implements Service, Cloneable actions.setTarget(this); return _popup; } + public void copy() { getCoordinator().setClipboard(ServiceInstance.copyDescriptor(_descriptor)); getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } - + public void moveUp() { move(true); } + public void moveDown() { move(false); } - + public Object getDescriptor() { return _descriptor; @@ -151,7 +152,7 @@ class PlainService extends Communicator implements Service, Cloneable { return new PlainServiceEditor(); } - + Editable getEnclosingEditable() { return ((Communicator)_parent).getEnclosingEditable(); @@ -174,8 +175,8 @@ class PlainService extends Communicator implements Service, Cloneable assert canMove(up); ((Communicator)_parent).getServices().move(this, up); } - - public Object rebuild(java.util.List editables) + + public Object rebuild(java.util.List<Editable> editables) throws UpdateFailedException { Communicator communicator = (Communicator)_parent; @@ -183,7 +184,7 @@ class PlainService extends Communicator implements Service, Cloneable PlainService newService = null; newService = (PlainService)services.createChild(_descriptor); - + Object backup = null; try @@ -215,15 +216,12 @@ class PlainService extends Communicator implements Service, Cloneable _dbEnvs = from._dbEnvs; _services = from._services; _childListArray = from._childListArray; - + _descriptor = from._descriptor; _resolver = from._resolver; } - PlainService(Communicator parent, - String name, - ServiceInstanceDescriptor descriptor, - Utils.Resolver resolver) + PlainService(Communicator parent, String name, ServiceInstanceDescriptor descriptor, Utils.Resolver resolver) throws UpdateFailedException { super(parent, name); @@ -245,25 +243,26 @@ class PlainService extends Communicator implements Service, Cloneable _ephemeral = true; } - static java.util.List createAttributes(ServiceDescriptor descriptor) + static java.util.List<String[]> createAttributes(ServiceDescriptor descriptor) { - java.util.List attributes = new java.util.LinkedList(); + java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); attributes.add(createAttribute("name", descriptor.name)); attributes.add(createAttribute("entry", descriptor.entry)); return attributes; } - void write(XMLWriter writer) throws java.io.IOException + void write(XMLWriter writer) + throws java.io.IOException { if(!_ephemeral) { writer.writeStartTag("service", createAttributes(_descriptor.descriptor)); - + if(_descriptor.descriptor.description.length() > 0) { writer.writeElement("description", _descriptor.descriptor.description); } - + writePropertySet(writer, _descriptor.descriptor.propertySet, _descriptor.descriptor.adapters, _descriptor.descriptor.logs); writeLogs(writer, _descriptor.descriptor.logs, _descriptor.descriptor.propertySet.properties); @@ -273,7 +272,7 @@ class PlainService extends Communicator implements Service, Cloneable writer.writeEndTag("service"); } } - + CommunicatorDescriptor getCommunicatorDescriptor() { return _descriptor.descriptor; @@ -296,6 +295,6 @@ class PlainService extends Communicator implements Service, Cloneable private Utils.Resolver _resolver; private PlainServiceEditor _editor; - static private DefaultTreeCellRenderer _cellRenderer; + static private DefaultTreeCellRenderer _cellRenderer; static private JPopupMenu _popup; } |