summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rwxr-xr-xjava/src/IceGridGUI/Application/Adapter.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/AdapterEditor.java85
-rwxr-xr-xjava/src/IceGridGUI/Application/ApplicationEditor.java144
-rwxr-xr-xjava/src/IceGridGUI/Application/CommunicatorSubEditor.java78
-rwxr-xr-xjava/src/IceGridGUI/Application/DbEnv.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/DbEnvEditor.java3
-rwxr-xr-xjava/src/IceGridGUI/Application/ListTextField.java104
-rwxr-xr-xjava/src/IceGridGUI/Application/MapField.java194
-rwxr-xr-xjava/src/IceGridGUI/Application/Node.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/NodeEditor.java78
-rwxr-xr-xjava/src/IceGridGUI/Application/ParametersField.java251
-rwxr-xr-xjava/src/IceGridGUI/Application/PlainServer.java6
-rwxr-xr-xjava/src/IceGridGUI/Application/PlainServerEditor.java6
-rwxr-xr-xjava/src/IceGridGUI/Application/PlainService.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/PlainServiceEditor.java6
-rwxr-xr-xjava/src/IceGridGUI/Application/PropertiesField.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/PropertySet.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/PropertySetEditor.java71
-rwxr-xr-xjava/src/IceGridGUI/Application/ReplicaGroup.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ReplicaGroupEditor.java79
-rwxr-xr-xjava/src/IceGridGUI/Application/Root.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerInstance.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerInstanceEditor.java178
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerSubEditor.java220
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerTemplate.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerTemplateEditor.java7
-rwxr-xr-xjava/src/IceGridGUI/Application/Service.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceInstance.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceInstanceEditor.java182
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceSubEditor.java5
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceTemplate.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceTemplateEditor.java7
-rwxr-xr-xjava/src/IceGridGUI/Application/TemplateEditor.java102
-rwxr-xr-xjava/src/IceGridGUI/Coordinator.java5
-rwxr-xr-xjava/src/IceGridGUI/ListDialog.java191
-rwxr-xr-xjava/src/IceGridGUI/ParametersDialog.java284
-rwxr-xr-xjava/src/IceGridGUI/SessionKeeper.java6
-rwxr-xr-xjava/src/IceGridGUI/TableDialog.java234
38 files changed, 841 insertions, 1711 deletions
diff --git a/java/src/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/Application/Adapter.java
index 090ef32292c..83bcdccc8c3 100755
--- a/java/src/IceGridGUI/Application/Adapter.java
+++ b/java/src/IceGridGUI/Application/Adapter.java
@@ -99,7 +99,7 @@ class Adapter extends TreeNode implements DescriptorHolder
protected Editor createEditor()
{
- return new AdapterEditor(getCoordinator().getMainFrame());
+ return new AdapterEditor();
}
diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java
index bdc50e82e51..49cc88fa149 100755
--- a/java/src/IceGridGUI/Application/AdapterEditor.java
+++ b/java/src/IceGridGUI/Application/AdapterEditor.java
@@ -19,7 +19,6 @@ import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
@@ -34,9 +33,9 @@ import IceGridGUI.*;
class AdapterEditor extends CommunicatorChildEditor
{
- AdapterEditor(JFrame parentFrame)
+ AdapterEditor()
{
- _objects.setEditable(false);
+ _objects = new MapField(this, "Identity", "Type", true);
//
// Create buttons
@@ -79,33 +78,6 @@ class AdapterEditor extends CommunicatorChildEditor
"Goto the definition of this replica group");
_replicaGroupButton = new JButton(gotoReplicaGroup);
- //
- // _objectsButton
- //
- _objectsDialog = new TableDialog(parentFrame,
- "Registered Objects",
- "Object Identity",
- "Type", true);
-
- Action openObjectsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.Map result = _objectsDialog.show(_objectsMap,
- getProperties());
- if(result != null)
- {
- updated();
- _objectsMap = result;
- setObjectsField();
- }
- }
- };
- openObjectsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit registered objects");
- _objectsButton = new JButton(openObjectsDialog);
-
-
Action checkRegisterProcess = new AbstractAction("Register Process")
{
public void actionPerformed(ActionEvent e)
@@ -215,7 +187,7 @@ class AdapterEditor extends CommunicatorChildEditor
descriptor.replicaGroupId = getReplicaGroupIdAsString();
descriptor.registerProcess = _registerProcess.isSelected();
descriptor.waitForActivation = _waitForActivation.isSelected();
- descriptor.objects = mapToObjectDescriptorSeq(_objectsMap);
+ descriptor.objects = mapToObjectDescriptorSeq(_objects.get());
}
boolean isSimpleUpdate()
@@ -257,7 +229,17 @@ class AdapterEditor extends CommunicatorChildEditor
builder.nextLine();
builder.append("Registered Objects");
- builder.append(_objects, _objectsButton);
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-6);
+ scrollPane = new JScrollPane(_objects);
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
builder.append("", _registerProcess);
@@ -309,35 +291,7 @@ class AdapterEditor extends CommunicatorChildEditor
}
}
-
- private void setObjectsField()
- {
- Adapter adapter = getAdapter();
-
- final Utils.Resolver resolver = adapter.getCoordinator().substitute() ?
- adapter.getResolver() : null;
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
-
- return Utils.substitute((String)entry.getKey(), resolver)
- + " as '"
- + Utils.substitute((String)entry.getValue(), resolver)
- + "'";
- }
- };
-
- _objects.setText(
- Utils.stringify(_objectsMap.entrySet(), stringifier,
- ", ", toolTipHolder));
-
- _objects.setToolTipText(toolTipHolder.value);
- }
-
+
private void setId(String id)
{
if(id.equals(""))
@@ -507,9 +461,7 @@ class AdapterEditor extends CommunicatorChildEditor
//
// Objects
//
- _objectsMap = objectDescriptorSeqToMap(descriptor.objects);
- setObjectsField();
- _objectsButton.setEnabled(isEditable);
+ _objects.set(objectDescriptorSeqToMap(descriptor.objects), resolver, isEditable);
_registerProcess.setSelected(descriptor.registerProcess);
_registerProcess.setEnabled(isEditable);
@@ -584,10 +536,7 @@ class AdapterEditor extends CommunicatorChildEditor
private JCheckBox _registerProcess;
private JCheckBox _waitForActivation;
- private JTextField _objects = new JTextField(20);
- private java.util.Map _objectsMap;
- private TableDialog _objectsDialog;
- private JButton _objectsButton;
+ private MapField _objects;
static private final Object PUBLISH_ACTUAL = new Object()
{
diff --git a/java/src/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/Application/ApplicationEditor.java
index 721728df622..e46ca3f0da0 100755
--- a/java/src/IceGridGUI/Application/ApplicationEditor.java
+++ b/java/src/IceGridGUI/Application/ApplicationEditor.java
@@ -15,7 +15,6 @@ import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
@@ -85,35 +84,15 @@ class ApplicationEditor extends Editor
}
}
- ApplicationEditor(JFrame parentFrame)
+ ApplicationEditor()
{
_name.getDocument().addDocumentListener(_updateListener);
_description.getDocument().addDocumentListener(_updateListener);
- _variables.setEditable(false);
//
// Variables
//
- _variablesDialog = new TableDialog(parentFrame,
- "Variables", "Name", "Value", true);
-
- Action openVariablesDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.TreeMap result = _variablesDialog.show(_variablesMap,
- getProperties());
- if(result != null)
- {
- updated();
- _variablesMap = result;
- setVariablesField();
- }
- }
- };
- openVariablesDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit variables");
- _variablesButton = new JButton(openVariablesDialog);
+ _variables = new MapField(this, "Name", "Value", false);
//
// Distrib
@@ -127,27 +106,10 @@ class ApplicationEditor extends Editor
distribTextField.getDocument().addDocumentListener(
_updateListener);
- _distribDirs.setEditable(false);
- _distribDirsDialog = new ListDialog(parentFrame,
- "Directories", true);
-
- Action openDistribDirsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _distribDirsDialog.show(
- _distribDirsList, getProperties());
- if(result != null)
- {
- updated();
- _distribDirsList = result;
- setDistribDirsField();
- }
- }
- };
- openDistribDirsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit directory list");
- _distribDirsButton = new JButton(openDistribDirsDialog);
+ _distribDirs.getDocument().addDocumentListener(_updateListener);
+ _distribDirs.setToolTipText(
+ "<html>Include only these directories when patching.<br>"
+ + "Use whitespace as separator; use double-quotes around directories containing whitespaces</html>");
}
@@ -167,8 +129,18 @@ class ApplicationEditor extends Editor
builder.nextRow(2);
builder.nextLine();
- builder.append("Variables", _variables);
- builder.append(_variablesButton);
+ builder.append("Variables");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-6);
+ scrollPane = new JScrollPane(_variables);
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
JComponent c = builder.appendSeparator("Distribution");
@@ -177,7 +149,7 @@ class ApplicationEditor extends Editor
builder.append(_distrib, 3);
builder.nextLine();
builder.append("Directories");
- builder.append(_distribDirs, _distribDirsButton);
+ builder.append(_distribDirs, 3);
builder.nextLine();
}
@@ -190,14 +162,14 @@ class ApplicationEditor extends Editor
boolean isSimpleUpdate()
{
ApplicationDescriptor descriptor = (ApplicationDescriptor)_target.getDescriptor();
- return descriptor.name.equals(_name.getText()) && _variablesMap.equals(descriptor.variables);
+ return descriptor.name.equals(_name.getText()) && _variables.get().equals(descriptor.variables);
}
void writeDescriptor()
{
ApplicationDescriptor descriptor = (ApplicationDescriptor)_target.getDescriptor();
descriptor.name = _name.getText();
- descriptor.variables = _variablesMap;
+ descriptor.variables = _variables.get();
descriptor.description = _description.getText();
if(_distrib.getSelectedItem() == NO_DISTRIB)
@@ -208,7 +180,7 @@ class ApplicationEditor extends Editor
{
descriptor.distrib.icepatch = _distrib.getSelectedItem().toString();
}
- descriptor.distrib.directories = _distribDirsList;
+ descriptor.distrib.directories = _distribDirs.getList();
}
@@ -232,10 +204,8 @@ class ApplicationEditor extends Editor
_description.setOpaque(isEditable);
_description.setToolTipText("An optional description for this application");
- _variablesMap = descriptor.variables;
- setVariablesField();
- _variablesButton.setEnabled(isEditable);
-
+ _variables.set(descriptor.variables, resolver, isEditable);
+
_distrib.setEnabled(true);
_distrib.setEditable(true);
String icepatch =
@@ -251,64 +221,14 @@ class ApplicationEditor extends Editor
_distrib.setEnabled(isEditable);
_distrib.setEditable(isEditable);
- _distribDirsList = new java.util.LinkedList(descriptor.distrib.directories);
- setDistribDirsField();
- _distribDirsButton.setEnabled(isEditable);
+ _distribDirs.setList(descriptor.distrib.directories, resolver);
+ _distribDirs.setEditable(isEditable);
_applyButton.setEnabled(false);
_discardButton.setEnabled(false);
detectUpdates(true);
}
- private void setDistribDirsField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _distribDirs.setText(
- Utils.stringify(_distribDirsList, stringifier, ", ",
- toolTipHolder));
-
- String toolTip = "<html>Include only these directories";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _distribDirs.setToolTipText(toolTip);
- }
-
- private void setVariablesField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
-
- return (String)entry.getKey() + "="
- + Utils.substitute((String)entry.getValue(), resolver);
- }
- };
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- _variables.setText(
- Utils.stringify(_variablesMap.entrySet(), stringifier,
- ", ", toolTipHolder));
- _variables.setToolTipText(toolTipHolder.value);
- }
-
static private final Object NO_DISTRIB = new Object()
{
public String toString()
@@ -320,15 +240,7 @@ class ApplicationEditor extends Editor
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
-
- private JTextField _variables = new JTextField(20);
- private JButton _variablesButton;
- private TableDialog _variablesDialog;
- private java.util.TreeMap _variablesMap;
-
+ private MapField _variables;
private JComboBox _distrib;
- private JTextField _distribDirs = new JTextField(20);
- private java.util.LinkedList _distribDirsList;
- private ListDialog _distribDirsDialog;
- private JButton _distribDirsButton;
+ private ListTextField _distribDirs = new ListTextField(20);
}
diff --git a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
index 6be39e45c44..a3e7f2e4d9d 100755
--- a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
+++ b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
@@ -13,8 +13,6 @@ import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
-
-import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
@@ -27,7 +25,7 @@ import IceGridGUI.*;
class CommunicatorSubEditor
{
- CommunicatorSubEditor(Editor mainEditor, JFrame parentFrame)
+ CommunicatorSubEditor(Editor mainEditor)
{
_mainEditor = mainEditor;
@@ -35,29 +33,10 @@ class CommunicatorSubEditor
_mainEditor.getUpdateListener());
_description.setToolTipText("An optional description");
- _propertySets.setEditable(false);
+ _propertySets.getDocument().addDocumentListener(
+ _mainEditor.getUpdateListener());
_properties = new PropertiesField(mainEditor);
-
- _propertySetsDialog = new ListDialog(parentFrame,
- "Property Set References", true);
-
- Action openPropertySetsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _propertySetsDialog.show(
- _propertySetsList, _mainEditor.getProperties());
- if(result != null)
- {
- _mainEditor.updated();
- _propertySetsList = result;
- setPropertySetsField();
- }
- }
- };
- openPropertySetsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit property set references");
- _propertySetsButton = new JButton(openPropertySetsDialog);
+ _description.setToolTipText("Property Set References");
}
@@ -75,7 +54,7 @@ class CommunicatorSubEditor
builder.nextLine();
builder.append("Property Sets");
- builder.append(_propertySets, _propertySetsButton);
+ builder.append(_propertySets, 3);
builder.nextLine();
builder.append("Properties");
@@ -98,7 +77,7 @@ class CommunicatorSubEditor
void writeDescriptor(CommunicatorDescriptor descriptor)
{
descriptor.propertySet.references =
- (String[])_propertySetsList.toArray(new String[0]);
+ (String[])_propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
descriptor.description = _description.getText();
}
@@ -108,56 +87,23 @@ class CommunicatorSubEditor
Utils.Resolver detailResolver = _mainEditor.getDetailResolver();
isEditable = isEditable && (detailResolver == null);
- _propertySetsList = java.util.Arrays.asList(descriptor.propertySet.references);
- setPropertySetsField();
- _propertySetsButton.setEnabled(isEditable);
-
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
+ detailResolver);
+ _propertySets.setEditable(isEditable);
+
_properties.setProperties(descriptor.propertySet.properties,
descriptor.adapters,
detailResolver, isEditable);
-
+
_description.setText(
Utils.substitute(descriptor.description, detailResolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
}
-
- private void setPropertySetsField()
- {
- final Utils.Resolver resolver = _mainEditor.getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _propertySets.setText(
- Utils.stringify(_propertySetsList,
- stringifier, ", ", toolTipHolder));
-
- String toolTip = "<html>Property Sets";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _propertySets.setToolTipText(toolTip);
- }
-
protected Editor _mainEditor;
private JTextArea _description = new JTextArea(3, 20);
-
- private JTextField _propertySets = new JTextField(20);
- private java.util.List _propertySetsList;
- private ListDialog _propertySetsDialog;
- private JButton _propertySetsButton;
-
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
}
diff --git a/java/src/IceGridGUI/Application/DbEnv.java b/java/src/IceGridGUI/Application/DbEnv.java
index 779636fd76d..01ff345e196 100755
--- a/java/src/IceGridGUI/Application/DbEnv.java
+++ b/java/src/IceGridGUI/Application/DbEnv.java
@@ -97,7 +97,7 @@ class DbEnv extends TreeNode implements DescriptorHolder
protected Editor createEditor()
{
- return new DbEnvEditor(getCoordinator().getMainFrame());
+ return new DbEnvEditor();
}
public Object getDescriptor()
diff --git a/java/src/IceGridGUI/Application/DbEnvEditor.java b/java/src/IceGridGUI/Application/DbEnvEditor.java
index 6f4745ace68..80c9f307677 100755
--- a/java/src/IceGridGUI/Application/DbEnvEditor.java
+++ b/java/src/IceGridGUI/Application/DbEnvEditor.java
@@ -14,7 +14,6 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
@@ -27,7 +26,7 @@ import IceGridGUI.*;
class DbEnvEditor extends CommunicatorChildEditor
{
- DbEnvEditor(JFrame parentFrame)
+ DbEnvEditor()
{
_name.getDocument().addDocumentListener(_updateListener);
_name.setToolTipText(
diff --git a/java/src/IceGridGUI/Application/ListTextField.java b/java/src/IceGridGUI/Application/ListTextField.java
new file mode 100755
index 00000000000..fd12a48698a
--- /dev/null
+++ b/java/src/IceGridGUI/Application/ListTextField.java
@@ -0,0 +1,104 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package IceGridGUI.Application;
+
+import IceGrid.*;
+import IceGridGUI.*;
+
+import javax.swing.JTextField;
+
+//
+// A special field used to show/edit a list of strings separated
+// by whitespace
+//
+
+public class ListTextField extends JTextField
+{
+ public ListTextField(int columns)
+ {
+ super(columns);
+ }
+
+ public void setList(java.util.List list, Utils.Resolver resolver)
+ {
+ java.util.Iterator p = list.iterator();
+ String text = null;
+
+ while(p.hasNext())
+ {
+ if(text == null)
+ {
+ text = "";
+ }
+ else
+ {
+ text += " ";
+ }
+
+ String str = (String)p.next();
+ str = Utils.substitute(str, resolver);
+
+ if(str.length() == 0)
+ {
+ text += "\"\"";
+ }
+ else if(str.matches("\\S*"))
+ {
+ //
+ // Only non-whitespace characters
+ //
+ text += str;
+ }
+ else
+ {
+ text += '"' + str + '"';
+ }
+ }
+ setText(text);
+ }
+
+ public java.util.LinkedList getList()
+ {
+ String text = getText().trim();
+ java.util.LinkedList result = new java.util.LinkedList();
+
+ while(text.length() > 0)
+ {
+ if(text.startsWith("\""))
+ {
+ int last = text.indexOf("\"", 1);
+ if(last == -1)
+ {
+ result.add(text.substring(1));
+ text = "";
+ }
+ else
+ {
+ result.add(text.substring(1, last));
+ text = text.substring(last + 1).trim();
+ }
+ }
+ else
+ {
+ String[] strings = text.split("\\s", 2);
+ if(strings.length == 1)
+ {
+ result.add(strings[0]);
+ text = "";
+ }
+ else
+ {
+ result.add(strings[0]);
+ text = strings[1].trim();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/java/src/IceGridGUI/Application/MapField.java b/java/src/IceGridGUI/Application/MapField.java
new file mode 100755
index 00000000000..e8d40bf8945
--- /dev/null
+++ b/java/src/IceGridGUI/Application/MapField.java
@@ -0,0 +1,194 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package IceGridGUI.Application;
+
+import IceGrid.*;
+import IceGridGUI.*;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+
+
+//
+// A special field used to show/edit a map
+//
+
+public class MapField extends JTable
+{
+ public MapField(Editor editor, String headKey, String headValue, boolean substituteKey)
+ {
+ _substituteKey = substituteKey;
+
+ _columnNames = new java.util.Vector(2);
+ _columnNames.add(headKey);
+ _columnNames.add(headValue);
+
+ _editor = editor;
+
+ Action deleteRow = new AbstractAction("Delete selected row(s)")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if(_editable)
+ {
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+
+ for(;;)
+ {
+ int selectedRow = getSelectedRow();
+ if(selectedRow == -1)
+ {
+ break;
+ }
+ else
+ {
+ _model.removeRow(selectedRow);
+ }
+ }
+ }
+ }
+ };
+ getActionMap().put("delete", deleteRow);
+ getInputMap().put(
+ KeyStroke.getKeyStroke("DELETE"), "delete");
+
+ }
+
+ public void set(java.util.Map map, Utils.Resolver resolver,
+ boolean editable)
+ {
+ _editable = editable;
+
+ //
+ // Transform map into vector of vectors
+ //
+ java.util.Vector vector = new java.util.Vector(map.size());
+ java.util.Iterator p = map.entrySet().iterator();
+ while(p.hasNext())
+ {
+ java.util.Vector row = new java.util.Vector(2);
+ java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
+
+ if(_substituteKey)
+ {
+ row.add(Utils.substitute((String)entry.getKey(), resolver));
+ }
+ else
+ {
+ row.add((String)entry.getKey());
+ }
+ row.add(Utils.substitute((String)entry.getValue(), resolver));
+ vector.add(row);
+ }
+
+ if(_editable)
+ {
+ java.util.Vector newRow = new java.util.Vector(2);
+ newRow.add("");
+ newRow.add("");
+ vector.add(newRow);
+ }
+
+ _model = new DefaultTableModel(vector, _columnNames)
+ {
+ public boolean isCellEditable(int row, int column)
+ {
+ return _editable;
+ }
+ };
+
+ _model.addTableModelListener(new TableModelListener()
+ {
+ public void tableChanged(TableModelEvent e)
+ {
+ if(_editable)
+ {
+ Object lastKey = _model.getValueAt(
+ _model.getRowCount() - 1 , 0);
+ if(lastKey != null && !lastKey.equals(""))
+ {
+ _model.addRow(new Object[]{"", ""});
+ }
+ _editor.updated();
+ }
+ }
+ });
+ setModel(_model);
+
+ setCellSelectionEnabled(_editable);
+ setOpaque(_editable);
+ setPreferredScrollableViewportSize(getPreferredSize());
+
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
+ getDefaultRenderer(String.class);
+ cr.setOpaque(_editable);
+ }
+
+
+ public java.util.TreeMap get()
+ {
+ assert _editable;
+
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+ java.util.Vector vector = _model.getDataVector();
+
+ java.util.TreeMap result = new java.util.TreeMap();
+
+ java.util.Iterator p = vector.iterator();
+ while(p.hasNext())
+ {
+ java.util.Vector row = (java.util.Vector)p.next();
+
+ //
+ // Eliminate rows with null or empty keys
+ //
+ String key = (String)row.elementAt(0);
+ if(key != null)
+ {
+ key = key.trim();
+ if(!key.equals(""))
+ {
+ String val = (String) row.elementAt(1);
+ if(val == null)
+ {
+ val = "";
+ }
+ result.put(key, val);
+ }
+ }
+ }
+ return result;
+ }
+
+ private DefaultTableModel _model;
+ private java.util.Vector _columnNames;
+ private boolean _editable = false;
+
+ private boolean _substituteKey;
+
+ private Editor _editor;
+}
+
+
diff --git a/java/src/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/Application/Node.java
index d1ad33e347b..d24e5c580be 100755
--- a/java/src/IceGridGUI/Application/Node.java
+++ b/java/src/IceGridGUI/Application/Node.java
@@ -389,7 +389,7 @@ class Node extends TreeNode implements PropertySetParent
protected Editor createEditor()
{
- return new NodeEditor(getCoordinator().getMainFrame());
+ return new NodeEditor();
}
public boolean isEphemeral()
diff --git a/java/src/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/Application/NodeEditor.java
index 51648a35f9b..dc0578ae48b 100755
--- a/java/src/IceGridGUI/Application/NodeEditor.java
+++ b/java/src/IceGridGUI/Application/NodeEditor.java
@@ -15,7 +15,6 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
@@ -152,38 +151,17 @@ class NodeEditor extends Editor
}
}
- NodeEditor(JFrame parentFrame)
+ NodeEditor()
{
_name.getDocument().addDocumentListener(_updateListener);
_name.setToolTipText("Must match the IceGrid.Node.Name property of the desired icegridnode process");
_description.getDocument().addDocumentListener(_updateListener);
_description.setToolTipText("An optional description for this node");
- _variables.setEditable(false);
-
-
+
//
// Variables
//
- _variablesDialog = new TableDialog(parentFrame,
- "Variables", "Name", "Value", true);
-
- Action openVariablesDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.TreeMap result = _variablesDialog.show(_variablesMap,
- getProperties());
- if(result != null)
- {
- updated();
- _variablesMap = result;
- setVariablesField();
- }
- }
- };
- openVariablesDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit variables");
- _variablesButton = new JButton(openVariablesDialog);
+ _variables = new MapField(this, "Name", "Value", false);
_loadFactor.getDocument().addDocumentListener(_updateListener);
_loadFactor.setToolTipText("<html>A floating point value.<br>"
@@ -208,9 +186,20 @@ class NodeEditor extends Editor
builder.nextRow(2);
builder.nextLine();
- builder.append("Variables", _variables);
- builder.append(_variablesButton);
+ builder.append("Variables");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
builder.nextLine();
+ builder.append("");
+ builder.nextRow(-6);
+ scrollPane = new JScrollPane(_variables);
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
+ builder.nextLine();
+
builder.append("Load Factor");
builder.append(_loadFactor, 3);
builder.nextLine();
@@ -219,14 +208,14 @@ class NodeEditor extends Editor
boolean isSimpleUpdate()
{
NodeDescriptor descriptor = (NodeDescriptor)_target.getDescriptor();
- return (_variablesMap.equals(descriptor.variables));
+ return (_variables.get().equals(descriptor.variables));
}
void writeDescriptor()
{
NodeDescriptor descriptor = (NodeDescriptor)_target.getDescriptor();
descriptor.description = _description.getText();
- descriptor.variables = _variablesMap;
+ descriptor.variables = _variables.get();
descriptor.loadFactor = _loadFactor.getText();
}
@@ -248,9 +237,7 @@ class NodeEditor extends Editor
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
- _variablesMap = descriptor.variables;
- setVariablesField();
- _variablesButton.setEnabled(isEditable);
+ _variables.set(descriptor.variables, resolver, isEditable);
_loadFactor.setText(
Utils.substitute(descriptor.loadFactor, resolver));
@@ -260,34 +247,9 @@ class NodeEditor extends Editor
_discardButton.setEnabled(node.isEphemeral());
detectUpdates(true);
}
-
- private void setVariablesField()
- {
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- public String toString(Object obj)
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
-
- return (String)entry.getKey() + "="
- + Utils.substitute((String)entry.getValue(), resolver);
- }
- };
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- _variables.setText(
- Utils.stringify(_variablesMap.entrySet(), stringifier,
- ", ", toolTipHolder));
- _variables.setToolTipText(toolTipHolder.value);
- }
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
- private JTextField _variables = new JTextField(20);
- private JButton _variablesButton;
- private TableDialog _variablesDialog;
- private java.util.TreeMap _variablesMap;
+ private MapField _variables;
private JTextField _loadFactor = new JTextField(20);
}
diff --git a/java/src/IceGridGUI/Application/ParametersField.java b/java/src/IceGridGUI/Application/ParametersField.java
new file mode 100755
index 00000000000..f5f107df0a0
--- /dev/null
+++ b/java/src/IceGridGUI/Application/ParametersField.java
@@ -0,0 +1,251 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package IceGridGUI.Application;
+
+import IceGrid.*;
+import IceGridGUI.*;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JComboBox;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableColumn;
+
+//
+// A special field used to show/edit parameters
+//
+
+public class ParametersField extends JTable
+{
+ public ParametersField(Editor editor, String valHeading,
+ boolean editNames, final String nullLabel)
+ {
+ _editNames = editNames;
+ _editor = editor;
+
+ _nullObject = new Object()
+ {
+ public String toString()
+ {
+ return nullLabel;
+ }
+ };
+
+ _columnNames = new java.util.Vector(2);
+ _columnNames.add("Name");
+ _columnNames.add(valHeading);
+
+ JComboBox comboBox = new JComboBox();
+ comboBox.setEditable(true);
+ comboBox.addItem(_nullObject);
+ _cellEditor = new DefaultCellEditor(comboBox);
+
+ Action deleteRow = new AbstractAction("Delete selected row(s)")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if(_editable && _editNames)
+ {
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+
+ for(;;)
+ {
+ int selectedRow = getSelectedRow();
+ if(selectedRow == -1)
+ {
+ break;
+ }
+ else
+ {
+ _model.removeRow(selectedRow);
+ }
+ }
+ }
+ }
+ };
+ getActionMap().put("delete", deleteRow);
+ getInputMap().put(
+ KeyStroke.getKeyStroke("DELETE"), "delete");
+
+ }
+
+ public void set(java.util.List names,
+ java.util.Map values,
+ Utils.Resolver resolver, boolean editable)
+ {
+ _editable = editable;
+
+ //
+ // Transform map into vector of vectors
+ //
+ java.util.Vector vector = new java.util.Vector(names.size());
+ java.util.Iterator p = names.iterator();
+ while(p.hasNext())
+ {
+ java.util.Vector row = new java.util.Vector(2);
+ String name = (String)p.next();
+
+ row.add(name);
+
+ Object val = values.get(name);
+ if(val == null)
+ {
+ row.add(_nullObject);
+ }
+ else
+ {
+ row.add(Utils.substitute((String)val, resolver));
+ }
+ vector.add(row);
+ }
+
+ if(_editable && _editNames)
+ {
+ java.util.Vector newRow = new java.util.Vector(2);
+ newRow.add("");
+ newRow.add(_nullObject);
+ vector.add(newRow);
+ }
+
+ _model = new DefaultTableModel(vector, _columnNames)
+ {
+ public boolean isCellEditable(int row, int column)
+ {
+ if(_editable)
+ {
+ if(column == 0)
+ {
+ return _editNames;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+
+ _model.addTableModelListener(new TableModelListener()
+ {
+ public void tableChanged(TableModelEvent e)
+ {
+ if(_editable)
+ {
+ if(_editNames)
+ {
+ Object lastKey = _model.getValueAt(
+ _model.getRowCount() - 1 , 0);
+ if(lastKey != null && !lastKey.equals(""))
+ {
+ _model.addRow(new Object[]{"", _nullObject});
+ }
+ }
+ _editor.updated();
+ }
+ }
+ });
+ setModel(_model);
+
+ TableColumn valColumn = getColumnModel().getColumn(1);
+ valColumn.setCellEditor(_cellEditor);
+
+ setCellSelectionEnabled(_editable);
+ setOpaque(_editable);
+ setPreferredScrollableViewportSize(getPreferredSize());
+
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
+ getDefaultRenderer(String.class);
+ cr.setOpaque(_editable);
+ }
+
+
+ public java.util.Map get(java.util.List names)
+ {
+ assert _editable;
+
+ if(_editNames)
+ {
+ assert names != null;
+ }
+
+
+ java.util.Map values = new java.util.HashMap();
+
+ if(isEditing())
+ {
+ getCellEditor().stopCellEditing();
+ }
+ java.util.Vector vector = _model.getDataVector();
+
+ java.util.Iterator p = vector.iterator();
+ while(p.hasNext())
+ {
+ java.util.Vector row = (java.util.Vector)p.next();
+
+ //
+ // Eliminate rows with null or empty names
+ //
+ String name = (String)row.elementAt(0);
+ if(name != null)
+ {
+ if(_editNames)
+ {
+ name = name.trim();
+ }
+
+ if(!name.equals(""))
+ {
+ if(_editNames)
+ {
+ names.add(name);
+ }
+
+ Object val = row.elementAt(1);
+
+ //
+ // Eliminate entries with "default" value
+ //
+ if(val != _nullObject)
+ {
+ assert val != null;
+ values.put(name, val);
+ }
+ }
+ }
+ }
+ return values;
+ }
+
+ private final boolean _editNames;
+ private final Object _nullObject;
+ private DefaultTableModel _model;
+ private java.util.Vector _columnNames;
+ private boolean _editable = false;
+ private Editor _editor;
+ private TableCellEditor _cellEditor;
+}
+
+
diff --git a/java/src/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/Application/PlainServer.java
index d0b99ef872b..45a65211730 100755
--- a/java/src/IceGridGUI/Application/PlainServer.java
+++ b/java/src/IceGridGUI/Application/PlainServer.java
@@ -149,9 +149,9 @@ class PlainServer extends Communicator implements Server
}
actions[NEW_ADAPTER] = !_services.initialized();
- actions[NEW_SERVICE] = _services.initialized();
actions[NEW_DBENV] = !_services.initialized();
-
+ actions[NEW_SERVICE] = _services.initialized();
+ actions[NEW_SERVICE_FROM_TEMPLATE] = _services.initialized();
return actions;
}
public JPopupMenu getPopupMenu()
@@ -186,7 +186,7 @@ class PlainServer extends Communicator implements Server
protected Editor createEditor()
{
- return new PlainServerEditor(getCoordinator().getMainFrame());
+ return new PlainServerEditor();
}
public Component getTreeCellRendererComponent(
diff --git a/java/src/IceGridGUI/Application/PlainServerEditor.java b/java/src/IceGridGUI/Application/PlainServerEditor.java
index a56f8cebbd6..ec855ae1cfc 100755
--- a/java/src/IceGridGUI/Application/PlainServerEditor.java
+++ b/java/src/IceGridGUI/Application/PlainServerEditor.java
@@ -8,8 +8,6 @@
// **********************************************************************
package IceGridGUI.Application;
-import javax.swing.JFrame;
-
import com.jgoodies.forms.builder.DefaultFormBuilder;
import IceGrid.*;
@@ -27,9 +25,9 @@ class PlainServerEditor extends AbstractServerEditor
return _subEditor.isSimpleUpdate();
}
- PlainServerEditor(JFrame parentFrame)
+ PlainServerEditor()
{
- _subEditor = new ServerSubEditor(this, parentFrame);
+ _subEditor = new ServerSubEditor(this);
}
//
diff --git a/java/src/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/Application/PlainService.java
index a94f556fe76..67734554064 100755
--- a/java/src/IceGridGUI/Application/PlainService.java
+++ b/java/src/IceGridGUI/Application/PlainService.java
@@ -145,7 +145,7 @@ class PlainService extends Communicator implements Service, Cloneable
protected Editor createEditor()
{
- return new PlainServiceEditor(getCoordinator().getMainFrame());
+ return new PlainServiceEditor();
}
Editable getEnclosingEditable()
diff --git a/java/src/IceGridGUI/Application/PlainServiceEditor.java b/java/src/IceGridGUI/Application/PlainServiceEditor.java
index e5d5769dafa..5d0884a4e16 100755
--- a/java/src/IceGridGUI/Application/PlainServiceEditor.java
+++ b/java/src/IceGridGUI/Application/PlainServiceEditor.java
@@ -8,8 +8,6 @@
// **********************************************************************
package IceGridGUI.Application;
-import javax.swing.JFrame;
-
import com.jgoodies.forms.builder.DefaultFormBuilder;
import IceGrid.*;
@@ -17,9 +15,9 @@ import IceGridGUI.*;
class PlainServiceEditor extends CommunicatorChildEditor
{
- PlainServiceEditor(JFrame parentFrame)
+ PlainServiceEditor()
{
- _subEditor = new ServiceSubEditor(this, parentFrame);
+ _subEditor = new ServiceSubEditor(this);
}
//
diff --git a/java/src/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/Application/PropertiesField.java
index 01d32fee8f8..0fe864ac054 100755
--- a/java/src/IceGridGUI/Application/PropertiesField.java
+++ b/java/src/IceGridGUI/Application/PropertiesField.java
@@ -26,7 +26,7 @@ import javax.swing.table.DefaultTableModel;
//
-// A special field used to edit show/edit properties
+// A special field used to show/edit properties
//
public class PropertiesField extends JTable
diff --git a/java/src/IceGridGUI/Application/PropertySet.java b/java/src/IceGridGUI/Application/PropertySet.java
index 2243fd3594f..d964ca1ae94 100755
--- a/java/src/IceGridGUI/Application/PropertySet.java
+++ b/java/src/IceGridGUI/Application/PropertySet.java
@@ -104,7 +104,7 @@ class PropertySet extends TreeNode
protected Editor createEditor()
{
- return new PropertySetEditor(getCoordinator().getMainFrame());
+ return new PropertySetEditor();
}
public boolean isEphemeral()
diff --git a/java/src/IceGridGUI/Application/PropertySetEditor.java b/java/src/IceGridGUI/Application/PropertySetEditor.java
index f3fc0865168..bb971992d2e 100755
--- a/java/src/IceGridGUI/Application/PropertySetEditor.java
+++ b/java/src/IceGridGUI/Application/PropertySetEditor.java
@@ -18,7 +18,6 @@ import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
@@ -115,7 +114,7 @@ class PropertySetEditor extends Editor
}
}
- PropertySetEditor(JFrame parentFrame)
+ PropertySetEditor()
{
//
// Associate updateListener with various fields
@@ -123,29 +122,9 @@ class PropertySetEditor extends Editor
_id.getDocument().addDocumentListener(_updateListener);
_id.setToolTipText("The id of this Property Set");
- _propertySets.setEditable(false);
+ _propertySets.getDocument().addDocumentListener(_updateListener);
+ _propertySets.setToolTipText("Property Set References");
_properties = new PropertiesField(this);
-
- _propertySetsDialog = new ListDialog(parentFrame,
- "Property Set References", true);
-
- Action openPropertySetsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _propertySetsDialog.show(
- _propertySetsList, getProperties());
- if(result != null)
- {
- updated();
- _propertySetsList = result;
- setPropertySetsField();
- }
- }
- };
- openPropertySetsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit property set references");
- _propertySetsButton = new JButton(openPropertySetsDialog);
}
void writeDescriptor()
@@ -154,7 +133,7 @@ class PropertySetEditor extends Editor
(PropertySetDescriptor)getPropertySet().getDescriptor();
descriptor.references =
- (String[])_propertySetsList.toArray(new String[0]);
+ (String[])_propertySets.getList().toArray(new String[0]);
descriptor.properties = _properties.getProperties();
}
@@ -170,7 +149,7 @@ class PropertySetEditor extends Editor
builder.nextLine();
builder.append("Property Sets");
- builder.append(_propertySets, _propertySetsButton);
+ builder.append(_propertySets, 3);
builder.nextLine();
builder.append("Properties");
@@ -178,7 +157,6 @@ class PropertySetEditor extends Editor
builder.append("");
builder.nextLine();
builder.append("");
-
builder.nextLine();
builder.append("");
@@ -211,9 +189,9 @@ class PropertySetEditor extends Editor
_id.setText(_target.getId());
_id.setEditable(_target.isEphemeral());
- _propertySetsList = java.util.Arrays.asList(descriptor.references);
- setPropertySetsField();
- _propertySetsButton.setEnabled(isEditable);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.references),
+ resolver);
+ _propertySets.setEditable(isEditable);
_properties.setProperties(descriptor.properties, null,
getDetailResolver(), isEditable);
@@ -228,39 +206,8 @@ class PropertySetEditor extends Editor
return (PropertySet)_target;
}
- private void setPropertySetsField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _propertySets.setText(
- Utils.stringify(_propertySetsList,
- stringifier, ", ", toolTipHolder));
-
- String toolTip = "<html>Property Sets";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _propertySets.setToolTipText(toolTip);
- }
-
private JTextField _id = new JTextField(20);
- private JTextField _propertySets = new JTextField(20);
- private java.util.List _propertySetsList;
- private ListDialog _propertySetsDialog;
- private JButton _propertySetsButton;
-
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
}
diff --git a/java/src/IceGridGUI/Application/ReplicaGroup.java b/java/src/IceGridGUI/Application/ReplicaGroup.java
index 28323371463..b7de274fd03 100755
--- a/java/src/IceGridGUI/Application/ReplicaGroup.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroup.java
@@ -102,7 +102,7 @@ class ReplicaGroup extends TreeNode
protected Editor createEditor()
{
- return new ReplicaGroupEditor(getCoordinator().getMainFrame());
+ return new ReplicaGroupEditor();
}
public boolean isEphemeral()
diff --git a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
index a04dbc14bf2..73077dc1858 100755
--- a/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
+++ b/java/src/IceGridGUI/Application/ReplicaGroupEditor.java
@@ -18,7 +18,6 @@ import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
@@ -166,35 +165,9 @@ class ReplicaGroupEditor extends Editor
}
}
- ReplicaGroupEditor(JFrame parentFrame)
+ ReplicaGroupEditor()
{
- _objects.setEditable(false);
-
- //
- // _objectsButton
- //
- _objectsDialog = new TableDialog(parentFrame,
- "Registered Objects",
- "Object Identity",
- "Type", true);
-
- Action openObjectsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.Map result = _objectsDialog.show(_objectsMap,
- getProperties());
- if(result != null)
- {
- updated();
- _objectsMap = result;
- setObjectsField();
- }
- }
- };
- openObjectsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit registered objects");
- _objectsButton = new JButton(openObjectsDialog);
+ _objects = new MapField(this, "Identity", "Type", true);
//
// load balancing
@@ -250,7 +223,7 @@ class ReplicaGroupEditor extends Editor
descriptor.id = _id.getText();
descriptor.description = _description.getText();
- descriptor.objects = AdapterEditor.mapToObjectDescriptorSeq(_objectsMap);
+ descriptor.objects = AdapterEditor.mapToObjectDescriptorSeq(_objects.get());
Object loadBalancing = _loadBalancing.getSelectedItem();
if(loadBalancing == RETURN_ALL)
@@ -304,7 +277,17 @@ class ReplicaGroupEditor extends Editor
builder.nextLine();
builder.append("Registered Objects");
- builder.append(_objects, _objectsButton);
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-6);
+ scrollPane = new JScrollPane(_objects);
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
builder.append("Load Balancing Policy");
@@ -324,31 +307,6 @@ class ReplicaGroupEditor extends Editor
_propertiesPanel.setName("Replica Group Properties");
}
- void setObjectsField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
-
- return Utils.substitute((String)entry.getKey(), resolver)
- + " as '"
- + Utils.substitute((String)entry.getValue(), resolver)
- + "'";
- }
- };
-
- _objects.setText(
- Utils.stringify(_objectsMap.entrySet(), stringifier,
- ", ", toolTipHolder));
- _objects.setToolTipText(toolTipHolder.value);
- }
-
-
void show(ReplicaGroup replicaGroup)
{
//
@@ -373,9 +331,7 @@ class ReplicaGroupEditor extends Editor
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
- _objectsMap = AdapterEditor.objectDescriptorSeqToMap(descriptor.objects);
- setObjectsField();
- _objectsButton.setEnabled(isEditable);
+ _objects.set(AdapterEditor.objectDescriptorSeqToMap(descriptor.objects), resolver, isEditable);
_loadBalancing.setEnabled(true);
@@ -446,8 +402,5 @@ class ReplicaGroupEditor extends Editor
private JComboBox _loadSample = new JComboBox(new Object[]
{"1", "5", "15"});
- private JTextField _objects = new JTextField(20);
- private java.util.Map _objectsMap;
- private TableDialog _objectsDialog;
- private JButton _objectsButton;
+ private MapField _objects;
}
diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java
index 1ec9bb9c7f1..ce6d6f7138a 100755
--- a/java/src/IceGridGUI/Application/Root.java
+++ b/java/src/IceGridGUI/Application/Root.java
@@ -141,7 +141,7 @@ public class Root extends ListTreeNode
protected Editor createEditor()
{
- return new ApplicationEditor(_coordinator.getMainFrame());
+ return new ApplicationEditor();
}
public TreeNode findNodeLike(TreePath path, boolean exactMatch)
diff --git a/java/src/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/Application/ServerInstance.java
index ec528144e58..f038aa1a7a6 100755
--- a/java/src/IceGridGUI/Application/ServerInstance.java
+++ b/java/src/IceGridGUI/Application/ServerInstance.java
@@ -74,7 +74,7 @@ class ServerInstance extends TreeNode implements Server
protected Editor createEditor()
{
- return new ServerInstanceEditor(getCoordinator().getMainFrame());
+ return new ServerInstanceEditor();
}
public Component getTreeCellRendererComponent(
diff --git a/java/src/IceGridGUI/Application/ServerInstanceEditor.java b/java/src/IceGridGUI/Application/ServerInstanceEditor.java
index 5c2952079a3..50d474b248f 100755
--- a/java/src/IceGridGUI/Application/ServerInstanceEditor.java
+++ b/java/src/IceGridGUI/Application/ServerInstanceEditor.java
@@ -14,7 +14,6 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
@@ -35,10 +34,10 @@ class ServerInstanceEditor extends AbstractServerEditor
ServerTemplate t = (ServerTemplate)_template.getSelectedItem();
descriptor.template = t.getId();
- descriptor.parameterValues = _parameterValuesMap;
+ descriptor.parameterValues = _parameters.get(null);;
descriptor.propertySet.references =
- (String[])_propertySetsList.toArray(new String[0]);
+ (String[])_propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
((ServerInstance)_target).isIceBox(
@@ -51,13 +50,12 @@ class ServerInstanceEditor extends AbstractServerEditor
ServerTemplate t = (ServerTemplate)_template.getSelectedItem();
return descriptor.template.equals(t.getId())
- && descriptor.parameterValues.equals(_parameterValuesMap);
+ && descriptor.parameterValues.equals(_parameters.get(null));
}
- ServerInstanceEditor(JFrame parentFrame)
+ ServerInstanceEditor()
{
_template.setToolTipText("Server template");
- _parameterValues.setEditable(false);
//
// Template
@@ -78,58 +76,12 @@ class ServerInstanceEditor extends AbstractServerEditor
"Goto this server template");
_templateButton = new JButton(gotoTemplate);
- //
- // Parameter values
- //
- _parametersDialog = new ParametersDialog(parentFrame,
- "Parameter values",
- "Value", false, "Use default");
-
- Action openParametersDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- getProperties()))
- {
- updated();
- setParameterValuesField();
- //
- // No need to redisplay details: since it's editable,
- // we're not substituting variables or parameters
- //
- }
- }
- };
- openParametersDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit parameters");
-
- _parametersButton = new JButton(openParametersDialog);
+ _parameters = new ParametersField(this, "Value", false, "Use default");
-
- _propertySets.setEditable(false);
+ _propertySets.getDocument().addDocumentListener(_updateListener);
+ _propertySets.setToolTipText("Property Set References");
+
_properties = new PropertiesField(this);
-
- _propertySetsDialog = new ListDialog(parentFrame,
- "Property Set References", true);
-
- Action openPropertySetsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _propertySetsDialog.show(
- _propertySetsList, getProperties());
- if(result != null)
- {
- updated();
- _propertySetsList = result;
- setPropertySetsField();
- }
- }
- };
- openPropertySetsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit property set references");
- _propertySetsButton = new JButton(openPropertySetsDialog);
}
ServerInstanceDescriptor getDescriptor()
@@ -159,12 +111,25 @@ class ServerInstanceEditor extends AbstractServerEditor
builder.append(_templateButton);
builder.nextLine();
- builder.append("Parameter values", _parameterValues);
- builder.append(_parametersButton);
+ builder.append("Parameters");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextRow(-6);
+ JScrollPane scrollPane = new JScrollPane(_parameters);
+ CellConstraints cc = new CellConstraints();
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
builder.append("Property Sets");
- builder.append(_propertySets, _propertySetsButton);
+ builder.append(_propertySets, 3);
builder.nextLine();
builder.append("Properties");
@@ -177,8 +142,7 @@ class ServerInstanceEditor extends AbstractServerEditor
builder.append("");
builder.nextRow(-6);
- JScrollPane scrollPane = new JScrollPane(_properties);
- CellConstraints cc = new CellConstraints();
+ scrollPane = new JScrollPane(_properties);
builder.add(scrollPane,
cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
@@ -194,6 +158,9 @@ class ServerInstanceEditor extends AbstractServerEditor
Root root = server.getRoot();
boolean isEditable = !root.getCoordinator().substitute();
+ Utils.Resolver resolver = isEditable ? null :
+ ((Node)_target.getParent()).getResolver();
+
//
// Need to make control enabled before changing it
//
@@ -221,10 +188,9 @@ class ServerInstanceEditor extends AbstractServerEditor
//
// Replace parameters but keep existing values
//
- _parameterList = td.parameters;
- _parameterValuesMap = makeParameterValues(_parameterValuesMap,
- _parameterList);
- setParameterValuesField();
+ _parameters.set(td.parameters,
+ makeParameterValues(_parameters.get(null), td.parameters),
+ null, true);
}
public void intervalAdded(ListDataEvent e)
@@ -237,15 +203,12 @@ class ServerInstanceEditor extends AbstractServerEditor
_template.getModel().addListDataListener(templateListener);
_template.setEnabled(isEditable);
- _parameterList = ((TemplateDescriptor)t.getDescriptor()).parameters;
- _parameterValuesMap = new java.util.HashMap(descriptor.parameterValues);
- setParameterValuesField();
- _parametersButton.setEnabled(isEditable);
-
+ _parameters.set(((TemplateDescriptor)t.getDescriptor()).parameters,
+ descriptor.parameterValues, resolver, isEditable);
- _propertySetsList = java.util.Arrays.asList(descriptor.propertySet.references);
- setPropertySetsField();
- _propertySetsButton.setEnabled(isEditable);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
+ getDetailResolver());
+ _propertySets.setEditable(isEditable);
_properties.setProperties(descriptor.propertySet.properties, null,
getDetailResolver(), isEditable);
@@ -255,75 +218,10 @@ class ServerInstanceEditor extends AbstractServerEditor
detectUpdates(true);
}
- private void setParameterValuesField()
- {
- final Utils.Resolver resolver = _target.getCoordinator().substitute() ?
- ((Node)_target.getParent()).getResolver() : null;
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- String name = (String)obj;
- String val = (String)_parameterValuesMap.get(name);
- if(val != null)
- {
- return name + "=" + Utils.substitute(val, resolver);
- }
- else
- {
- return null;
- }
- }
- };
-
- _parameterValues.setText(
- Utils.stringify(_parameterList, stringifier, ", ", toolTipHolder));
- _parameterValues.setToolTipText(toolTipHolder.value);
- }
-
- private void setPropertySetsField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _propertySets.setText(
- Utils.stringify(_propertySetsList,
- stringifier, ", ", toolTipHolder));
-
- String toolTip = "<html>Property Sets";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _propertySets.setToolTipText(toolTip);
- }
-
private JComboBox _template = new JComboBox();
private JButton _templateButton;
- private JTextField _parameterValues = new JTextField(20);
-
- private java.util.List _parameterList;
- private java.util.Map _parameterValuesMap;
-
- private ParametersDialog _parametersDialog;
- private JButton _parametersButton;
+ private ParametersField _parameters;
- private JTextField _propertySets = new JTextField(20);
- private java.util.List _propertySetsList;
- private ListDialog _propertySetsDialog;
- private JButton _propertySetsButton;
-
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
}
diff --git a/java/src/IceGridGUI/Application/ServerSubEditor.java b/java/src/IceGridGUI/Application/ServerSubEditor.java
index e8431b48856..489a2960578 100755
--- a/java/src/IceGridGUI/Application/ServerSubEditor.java
+++ b/java/src/IceGridGUI/Application/ServerSubEditor.java
@@ -16,7 +16,7 @@ import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JFrame;
+import javax.swing.JScrollPane;
import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -27,9 +27,9 @@ import IceGridGUI.*;
class ServerSubEditor extends CommunicatorSubEditor
{
- ServerSubEditor(Editor mainEditor, JFrame parentFrame)
+ ServerSubEditor(Editor mainEditor)
{
- super(mainEditor, parentFrame);
+ super(mainEditor);
_id.getDocument().addDocumentListener(
_mainEditor.getUpdateListener());
@@ -51,8 +51,13 @@ class ServerSubEditor extends CommunicatorSubEditor
+ "relative directories are relative to the current directory"
+ " of the icegridnode process.</html>");
- _options.setEditable(false);
- _envs.setEditable(false);
+ _options.getDocument().addDocumentListener(
+ _mainEditor.getUpdateListener());
+ _options.setToolTipText(
+ "<html>Command-line arguments for this server.<br>"
+ + "Use whitespace as separator; use double-quotes around arguments containing whitespaces</html>");
+
+ _envs = new MapField(mainEditor, "Name", "Value", true);
_activation = new JComboBox(new Object[]{ON_DEMAND, MANUAL});
_activation.setToolTipText("Select 'on-demand' to have IceGrid start your server on-demand");
@@ -72,49 +77,7 @@ class ServerSubEditor extends CommunicatorSubEditor
_deactivationTimeout.setToolTipText("<html>Number of seconds; if not set or set to 0, "
+ "the IceGrid Node<br> uses the value of its "
+ "IceGrid.Node.WaitTime property</html>");
-
-
- _envDialog = new TableDialog(parentFrame, "Environment Variables",
- "Name", "Value", true);
- Action openEnvDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.Map result = _envDialog.show(
- _envMap, _mainEditor.getProperties());
- if(result != null)
- {
- _mainEditor.updated();
- _envMap = result;
- setEnvsField();
- }
- }
- };
- openEnvDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit environment variables");
- _envButton = new JButton(openEnvDialog);
- _optionDialog = new ListDialog(parentFrame,
- "Command Arguments", false);
- Action openOptionDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _optionDialog.show(
- _optionList, _mainEditor.getProperties());
- if(result != null)
- {
- _mainEditor.updated();
- _optionList = result;
- setOptionsField();
- }
- }
- };
- openOptionDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit command-line arguments");
- _optionButton = new JButton(openOptionDialog);
-
-
Action appDistrib = new AbstractAction("Depends on the application distribution")
{
public void actionPerformed(ActionEvent e)
@@ -137,27 +100,12 @@ class ServerSubEditor extends CommunicatorSubEditor
distribTextField.getDocument().addDocumentListener(
_mainEditor.getUpdateListener());
- _distribDirs.setEditable(false);
- _distribDirsDialog = new ListDialog(parentFrame,
- "Directories", true);
-
- Action openDistribDirsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _distribDirsDialog.show(
- _distribDirsList, _mainEditor.getProperties());
- if(result != null)
- {
- _mainEditor.updated();
- _distribDirsList = result;
- setDistribDirsField();
- }
- }
- };
- openDistribDirsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit directory list");
- _distribDirsButton = new JButton(openDistribDirsDialog);
+ _distribDirs.getDocument().addDocumentListener(
+ _mainEditor.getUpdateListener());
+ _distribDirs.setToolTipText(
+ "<html>Include only these directories when patching.<br>"
+ + "Use whitespace as separator; use double-quotes around directories containing whitespaces</html>");
+
}
ServerDescriptor getServerDescriptor()
@@ -177,7 +125,6 @@ class ServerSubEditor extends CommunicatorSubEditor
//
super.appendProperties(builder);
-
builder.appendSeparator("Activation");
builder.append("Path to Executable");
builder.append(_exe, 3);
@@ -186,11 +133,25 @@ class ServerSubEditor extends CommunicatorSubEditor
builder.append(_pwd, 3);
builder.nextLine();
builder.append("Command Arguments");
- builder.append(_options, _optionButton);
+ builder.append(_options, 3);
builder.nextLine();
+
builder.append("Environment Variables");
- builder.append(_envs, _envButton);
builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-6);
+ CellConstraints cc = new CellConstraints();
+ JScrollPane scrollPane = new JScrollPane(_envs);
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
+ builder.nextLine();
+
+
builder.append("Activation Mode");
builder.append(_activation, 3);
builder.nextLine();
@@ -210,7 +171,7 @@ class ServerSubEditor extends CommunicatorSubEditor
builder.append(_distrib, 3);
builder.nextLine();
builder.append("Directories");
- builder.append(_distribDirs, _distribDirsButton);
+ builder.append(_distribDirs, 3);
builder.nextLine();
}
@@ -221,10 +182,10 @@ class ServerSubEditor extends CommunicatorSubEditor
descriptor.exe = _exe.getText();
descriptor.pwd = _pwd.getText();
- descriptor.options = _optionList;
+ descriptor.options = _options.getList();
descriptor.envs = new java.util.LinkedList();
- java.util.Iterator p = _envMap.entrySet().iterator();
+ java.util.Iterator p = _envs.get().entrySet().iterator();
while(p.hasNext())
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
@@ -246,7 +207,7 @@ class ServerSubEditor extends CommunicatorSubEditor
{
descriptor.distrib.icepatch = _distrib.getSelectedItem().toString();
}
- descriptor.distrib.directories = _distribDirsList;
+ descriptor.distrib.directories = _distribDirs.getList();
super.writeDescriptor(descriptor);
}
@@ -280,11 +241,10 @@ class ServerSubEditor extends CommunicatorSubEditor
Utils.substitute(descriptor.pwd, detailResolver));
_pwd.setEditable(isEditable);
- _optionList = descriptor.options;
- setOptionsField();
- _optionButton.setEnabled(isEditable);
+ _options.setList(descriptor.options, detailResolver);
+ _options.setEditable(isEditable);
- _envMap = new java.util.TreeMap();
+ java.util.Map envMap = new java.util.TreeMap();
java.util.Iterator p = descriptor.envs.iterator();
while(p.hasNext())
{
@@ -292,16 +252,15 @@ class ServerSubEditor extends CommunicatorSubEditor
int equal = env.indexOf('=');
if(equal == -1 || equal == env.length() - 1)
{
- _envMap.put(env, "");
+ envMap.put(env, "");
}
else
{
- _envMap.put(env.substring(0, equal),
- env.substring(equal + 1));
+ envMap.put(env.substring(0, equal),
+ env.substring(equal + 1));
}
}
- setEnvsField();
- _envButton.setEnabled(isEditable);
+ _envs.set(envMap, detailResolver, isEditable);
String activation = Utils.substitute(descriptor.activation,
detailResolver);
@@ -349,81 +308,12 @@ class ServerSubEditor extends CommunicatorSubEditor
_distrib.setEnabled(isEditable);
_distrib.setEditable(isEditable);
- _distribDirsList = new java.util.LinkedList(descriptor.distrib.directories);
- setDistribDirsField();
- _distribDirsButton.setEnabled(isEditable);
+ _distribDirs.setList(descriptor.distrib.directories, detailResolver);
+ _distribDirs.setEditable(isEditable);
show(descriptor, isEditable);
}
- private void setEnvsField()
- {
- final Utils.Resolver resolver = _mainEditor.getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)obj;
-
- return Utils.substitute((String)entry.getKey(), resolver)
- + "="
- + Utils.substitute((String)entry.getValue(), resolver);
- }
- };
-
- _envs.setText(
- Utils.stringify(_envMap.entrySet(), stringifier,
- ", ", toolTipHolder));
- _envs.setToolTipText(toolTipHolder.value);
- }
-
- private void setOptionsField()
- {
- final Utils.Resolver resolver = _mainEditor.getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _options.setText(
- Utils.stringify(_optionList, stringifier, " ", toolTipHolder));
- _options.setToolTipText(toolTipHolder.value);
- }
-
- private void setDistribDirsField()
- {
- final Utils.Resolver resolver = _mainEditor.getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _distribDirs.setText(
- Utils.stringify(_distribDirsList, stringifier, ", ",
- toolTipHolder));
-
- String toolTip = "<html>Include only these directories";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _distribDirs.setToolTipText(toolTip);
- }
-
static private final String ON_DEMAND = "on-demand";
static private final String MANUAL = "manual";
static private final Object NO_DISTRIB = new Object()
@@ -444,22 +334,12 @@ class ServerSubEditor extends CommunicatorSubEditor
private JTextField _activationTimeout = new JTextField(20);
private JTextField _deactivationTimeout = new JTextField(20);
- private JTextField _envs = new JTextField(20);
- private java.util.Map _envMap;
- private TableDialog _envDialog;
- private JButton _envButton;
-
- private JTextField _options = new JTextField(20);
- private java.util.LinkedList _optionList;
- private ListDialog _optionDialog;
- private JButton _optionButton;
-
+ private MapField _envs;
+
+ private ListTextField _options = new ListTextField(20);
+
private JCheckBox _applicationDistrib;
private JComboBox _distrib;
-
- private JTextField _distribDirs = new JTextField(20);
- private java.util.LinkedList _distribDirsList;
- private ListDialog _distribDirsDialog;
- private JButton _distribDirsButton;
+ private ListTextField _distribDirs = new ListTextField(20);
}
diff --git a/java/src/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/Application/ServerTemplate.java
index f15879c0b2e..eb60181035e 100755
--- a/java/src/IceGridGUI/Application/ServerTemplate.java
+++ b/java/src/IceGridGUI/Application/ServerTemplate.java
@@ -144,7 +144,7 @@ class ServerTemplate extends Communicator
protected Editor createEditor()
{
- return new ServerTemplateEditor(getCoordinator().getMainFrame());
+ return new ServerTemplateEditor();
}
public void destroy()
diff --git a/java/src/IceGridGUI/Application/ServerTemplateEditor.java b/java/src/IceGridGUI/Application/ServerTemplateEditor.java
index 013be9d166f..bfad59a82f4 100755
--- a/java/src/IceGridGUI/Application/ServerTemplateEditor.java
+++ b/java/src/IceGridGUI/Application/ServerTemplateEditor.java
@@ -8,16 +8,13 @@
// **********************************************************************
package IceGridGUI.Application;
-import javax.swing.JFrame;
-
import com.jgoodies.forms.builder.DefaultFormBuilder;
class ServerTemplateEditor extends TemplateEditor
{
- ServerTemplateEditor(JFrame parentFrame)
+ ServerTemplateEditor()
{
- super(parentFrame);
- _subEditor = new ServerSubEditor(this, parentFrame);
+ _subEditor = new ServerSubEditor(this);
}
void writeDescriptor()
diff --git a/java/src/IceGridGUI/Application/Service.java b/java/src/IceGridGUI/Application/Service.java
index 0904d8a2758..8ea476fda5c 100755
--- a/java/src/IceGridGUI/Application/Service.java
+++ b/java/src/IceGridGUI/Application/Service.java
@@ -8,5 +8,5 @@
// **********************************************************************
package IceGridGUI.Application;
-interface Service extends TemplateInstance
+interface Service extends TemplateInstance, DescriptorHolder
{}
diff --git a/java/src/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/Application/ServiceInstance.java
index f74a6a2b628..8ca8db73b63 100755
--- a/java/src/IceGridGUI/Application/ServiceInstance.java
+++ b/java/src/IceGridGUI/Application/ServiceInstance.java
@@ -162,7 +162,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
protected Editor createEditor()
{
- return new ServiceInstanceEditor(getCoordinator().getMainFrame());
+ return new ServiceInstanceEditor();
}
public String toString()
diff --git a/java/src/IceGridGUI/Application/ServiceInstanceEditor.java b/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
index 11135e3f895..bb0991a26a8 100755
--- a/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceInstanceEditor.java
@@ -14,7 +14,6 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComboBox;
-import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
@@ -29,10 +28,8 @@ import IceGridGUI.*;
class ServiceInstanceEditor extends CommunicatorChildEditor
{
- ServiceInstanceEditor(JFrame parentFrame)
+ ServiceInstanceEditor()
{
- _parameterValues.setEditable(false);
-
//
// Template
//
@@ -52,56 +49,11 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
"Goto this service template");
_templateButton = new JButton(gotoTemplate);
- //
- // Parameter values
- //
- _parametersDialog = new ParametersDialog(parentFrame,
- "Parameter values",
- "Value", false, "Use default");
-
- Action openParametersDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- getProperties()))
- {
- updated();
- setParameterValuesField();
- //
- // No need to redisplay details: since it's editable,
- // we're not substituting variables or parameters
- //
- }
- }
- };
- openParametersDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit parameter values");
- _parametersButton = new JButton(openParametersDialog);
+ _parameters = new ParametersField(this, "Value", false, "Use default");
- _propertySets.setEditable(false);
+ _propertySets.getDocument().addDocumentListener(_updateListener);
+ _propertySets.setToolTipText("Property Set References");
_properties = new PropertiesField(this);
-
- _propertySetsDialog = new ListDialog(parentFrame,
- "Property Set References", true);
-
- Action openPropertySetsDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- java.util.LinkedList result = _propertySetsDialog.show(
- _propertySetsList, getProperties());
- if(result != null)
- {
- updated();
- _propertySetsList = result;
- setPropertySetsField();
- }
- }
- };
- openPropertySetsDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit property set references");
- _propertySetsButton = new JButton(openPropertySetsDialog);
}
ServiceInstanceDescriptor getDescriptor()
@@ -129,10 +81,10 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
{
ServiceInstanceDescriptor descriptor = getDescriptor();
descriptor.template = ((ServiceTemplate)_template.getSelectedItem()).getId();
- descriptor.parameterValues = _parameterValuesMap;
+ descriptor.parameterValues = _parameters.get(null);
descriptor.propertySet.references =
- (String[])_propertySetsList.toArray(new String[0]);
+ (String[])_propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
}
@@ -142,7 +94,7 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
ServiceTemplate t = (ServiceTemplate)_template.getSelectedItem();
return descriptor.template.equals(t.getId())
- && descriptor.parameterValues.equals(_parameterValuesMap);
+ && descriptor.parameterValues.equals(_parameters.get(null));
}
Communicator.ChildList getChildList()
@@ -156,12 +108,25 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
builder.append(_templateButton);
builder.nextLine();
- builder.append("Parameter values", _parameterValues);
- builder.append(_parametersButton);
+ builder.append("Parameters");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextRow(-6);
+ JScrollPane scrollPane = new JScrollPane(_parameters);
+ CellConstraints cc = new CellConstraints();
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
builder.append("Property Sets");
- builder.append(_propertySets, _propertySetsButton);
+ builder.append(_propertySets, 3);
builder.nextLine();
builder.append("Properties");
@@ -174,8 +139,7 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
builder.append("");
builder.nextRow(-6);
- JScrollPane scrollPane = new JScrollPane(_properties);
- CellConstraints cc = new CellConstraints();
+ scrollPane = new JScrollPane(_properties);
builder.add(scrollPane,
cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
@@ -200,11 +164,13 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
//
assert getDescriptor().template.length() > 0;
-
ServiceInstanceDescriptor descriptor =
(ServiceInstanceDescriptor)service.getDescriptor();
Coordinator coordinator = service.getCoordinator();
boolean isEditable = !coordinator.substitute();
+
+ Utils.Resolver resolver = isEditable ? null :
+ ((TreeNode)service.getParent()).getResolver();
//
// Need to make control enabled before changing it
@@ -234,10 +200,9 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
//
// Replace parameters but keep existing values
//
- _parameterList = td.parameters;
- _parameterValuesMap = makeParameterValues(_parameterValuesMap,
- _parameterList);
- setParameterValuesField();
+ _parameters.set(td.parameters,
+ makeParameterValues(_parameters.get(null), td.parameters),
+ null, true);
}
public void intervalAdded(ListDataEvent e)
@@ -250,17 +215,12 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
_template.getModel().addListDataListener(templateListener);
_template.setEnabled(isEditable);
- //
- // The _parameterList is read-only
- //
- _parameterList = ((TemplateDescriptor)t.getDescriptor()).parameters;
- _parameterValuesMap = new java.util.HashMap(descriptor.parameterValues);
- setParameterValuesField();
- _parametersButton.setEnabled(isEditable);
+ _parameters.set(((TemplateDescriptor)t.getDescriptor()).parameters,
+ descriptor.parameterValues, resolver, isEditable);
- _propertySetsList = java.util.Arrays.asList(descriptor.propertySet.references);
- setPropertySetsField();
- _propertySetsButton.setEnabled(isEditable);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
+ getDetailResolver());
+ _propertySets.setEditable(isEditable);
_properties.setProperties(descriptor.propertySet.properties, null,
getDetailResolver(), isEditable);
@@ -270,77 +230,9 @@ class ServiceInstanceEditor extends CommunicatorChildEditor
detectUpdates(true);
}
- private void setParameterValuesField()
- {
- ServiceInstance service = (ServiceInstance)_target;
-
- final Utils.Resolver resolver = service.getCoordinator().substitute() ?
- ((TreeNode)service.getParent()).getResolver() : null;
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- String name = (String)obj;
- String val = (String)_parameterValuesMap.get(name);
- if(val != null)
- {
- return name + "=" + Utils.substitute(val, resolver);
- }
- else
- {
- return null;
- }
- }
- };
-
- _parameterValues.setText(
- Utils.stringify(_parameterList, stringifier, ", ", toolTipHolder));
- _parameterValues.setToolTipText(toolTipHolder.value);
- }
-
- private void setPropertySetsField()
- {
- final Utils.Resolver resolver = getDetailResolver();
-
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- return Utils.substitute((String)obj, resolver);
- }
- };
-
- _propertySets.setText(
- Utils.stringify(_propertySetsList,
- stringifier, ", ", toolTipHolder));
-
- String toolTip = "<html>Property Sets";
-
- if(toolTipHolder.value != null)
- {
- toolTip += ":<br>" + toolTipHolder.value;
- }
- toolTip += "</html>";
- _propertySets.setToolTipText(toolTip);
- }
-
private JComboBox _template = new JComboBox();
private JButton _templateButton;
- private JTextField _parameterValues = new JTextField(20);
-
- private java.util.List _parameterList;
- private java.util.Map _parameterValuesMap;
-
- private ParametersDialog _parametersDialog;
- private JButton _parametersButton;
-
- private JTextField _propertySets = new JTextField(20);
- private java.util.List _propertySetsList;
- private ListDialog _propertySetsDialog;
- private JButton _propertySetsButton;
-
+ private ParametersField _parameters;
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
}
diff --git a/java/src/IceGridGUI/Application/ServiceSubEditor.java b/java/src/IceGridGUI/Application/ServiceSubEditor.java
index 834d589679c..9f93298ac40 100755
--- a/java/src/IceGridGUI/Application/ServiceSubEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceSubEditor.java
@@ -12,7 +12,6 @@ import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
-import javax.swing.JFrame;
import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
@@ -22,9 +21,9 @@ import IceGridGUI.*;
class ServiceSubEditor extends CommunicatorSubEditor
{
- ServiceSubEditor(Editor mainEditor, JFrame parentFrame)
+ ServiceSubEditor(Editor mainEditor)
{
- super(mainEditor, parentFrame);
+ super(mainEditor);
_name.getDocument().addDocumentListener(
_mainEditor.getUpdateListener());
diff --git a/java/src/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/Application/ServiceTemplate.java
index 8051127e3df..7aa5b927f1e 100755
--- a/java/src/IceGridGUI/Application/ServiceTemplate.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplate.java
@@ -107,7 +107,7 @@ class ServiceTemplate extends Communicator
protected Editor createEditor()
{
- return new ServiceTemplateEditor(getCoordinator().getMainFrame());
+ return new ServiceTemplateEditor();
}
ServiceTemplate(boolean brandNew, ServiceTemplates parent,
diff --git a/java/src/IceGridGUI/Application/ServiceTemplateEditor.java b/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
index e9947c971c2..e5d72f4d41b 100755
--- a/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
+++ b/java/src/IceGridGUI/Application/ServiceTemplateEditor.java
@@ -8,16 +8,13 @@
// **********************************************************************
package IceGridGUI.Application;
-import javax.swing.JFrame;
-
import com.jgoodies.forms.builder.DefaultFormBuilder;
class ServiceTemplateEditor extends TemplateEditor
{
- ServiceTemplateEditor(JFrame parentFrame)
+ ServiceTemplateEditor()
{
- super(parentFrame);
- _subEditor = new ServiceSubEditor(this, parentFrame);
+ _subEditor = new ServiceSubEditor(this);
}
void writeDescriptor()
diff --git a/java/src/IceGridGUI/Application/TemplateEditor.java b/java/src/IceGridGUI/Application/TemplateEditor.java
index d80a7ff8e7b..75b8ebc8d3d 100755
--- a/java/src/IceGridGUI/Application/TemplateEditor.java
+++ b/java/src/IceGridGUI/Application/TemplateEditor.java
@@ -14,48 +14,23 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JOptionPane;
-import javax.swing.JFrame;
+import javax.swing.JScrollPane;
import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.layout.CellConstraints;
import IceGrid.*;
import IceGridGUI.*;
class TemplateEditor extends Editor
{
- TemplateEditor(JFrame parentFrame)
+ TemplateEditor()
{
_template.getDocument().addDocumentListener(_updateListener);
_template.setToolTipText("Must be unique within the enclosing application");
- _parameters.setEditable(false);
-
- //
- // Parameters
- //
- _parametersDialog = new ParametersDialog(parentFrame,
- "Parameters",
- "Default value", true, "No default");
-
- Action openParametersDialog = new AbstractAction("...")
- {
- public void actionPerformed(ActionEvent e)
- {
- if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- getProperties()))
- {
- updated();
- setParametersField();
- //
- // No need to redisplay details: since it's editable,
- // we're not substituting variables or parameters
- //
- }
- }
- };
- openParametersDialog.putValue(Action.SHORT_DESCRIPTION,
- "Edit parameters");
- _parametersButton = new JButton(openParametersDialog);
+
+ _parameters = new ParametersField(this, "Default value", true, "No default");
}
TemplateDescriptor getDescriptor()
@@ -71,15 +46,19 @@ class TemplateEditor extends Editor
void writeDescriptor()
{
TemplateDescriptor descriptor = getDescriptor();
- descriptor.parameters = _parameterList;
- descriptor.parameterDefaults = _parameterValuesMap;
+ java.util.LinkedList parameters = new java.util.LinkedList();
+ descriptor.parameterDefaults = _parameters.get(parameters);
+ descriptor.parameters = parameters;
}
boolean isSimpleUpdate()
{
TemplateDescriptor descriptor = getDescriptor();
- return descriptor.parameters.equals(_parameterList)
- && descriptor.parameterDefaults.equals(_parameterValuesMap);
+ java.util.List parameters = new java.util.LinkedList();
+ java.util.Map defaultValues = _parameters.get(parameters);
+
+ return descriptor.parameters.equals(parameters)
+ && descriptor.parameterDefaults.equals(defaultValues);
}
protected void appendProperties(DefaultFormBuilder builder)
@@ -88,8 +67,20 @@ class TemplateEditor extends Editor
builder.append(_template, 3);
builder.nextLine();
- builder.append("Parameters", _parameters);
- builder.append(_parametersButton);
+ builder.append("Parameters");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextRow(-6);
+ JScrollPane scrollPane = new JScrollPane(_parameters);
+ CellConstraints cc = new CellConstraints();
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
builder.nextLine();
}
@@ -99,9 +90,7 @@ class TemplateEditor extends Editor
_template.setText(_target.getId());
_template.setEditable(_target.isEphemeral());
- _parameterList = new java.util.LinkedList(descriptor.parameters);
- _parameterValuesMap = new java.util.HashMap(descriptor.parameterDefaults);
- setParametersField();
+ _parameters.set(descriptor.parameters, descriptor.parameterDefaults, null, true);
}
protected void applyUpdate()
@@ -207,38 +196,7 @@ class TemplateEditor extends Editor
root.enableSelectionListener();
}
}
-
- private void setParametersField()
- {
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
- Utils.Stringifier stringifier = new Utils.Stringifier()
- {
- public String toString(Object obj)
- {
- String name = (String)obj;
- String val = (String)_parameterValuesMap.get(name);
- if(val != null)
- {
- return name + "=" + val;
- }
- else
- {
- return name;
- }
- }
- };
-
- _parameters.setText(
- Utils.stringify(_parameterList, stringifier, ", ", toolTipHolder));
- _parameters.setToolTipText(toolTipHolder.value);
- }
-
- private JTextField _template = new JTextField(20);
- private JTextField _parameters = new JTextField(20);
- private java.util.LinkedList _parameterList;
- private java.util.Map _parameterValuesMap;
-
- private ParametersDialog _parametersDialog;
- private JButton _parametersButton;
+ private JTextField _template = new JTextField(20);
+ private ParametersField _parameters;
}
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index 241ebeded9f..1ed6f4876bb 100755
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -790,11 +790,11 @@ public class Coordinator
RegistryPrx registry = RegistryPrxHelper.
uncheckedCast(_communicator.stringToProxy(str));
- // TODO: XXX: If we decide to keep this method, we should pass a password!
try
{
session = AdminSessionPrxHelper.uncheckedCast(
- registry.createAdminSession(info.registryUsername, ""));
+ registry.createAdminSession(info.registryUsername,
+ new String(info.registryPassword)));
}
catch(IceGrid.PermissionDeniedException e)
{
@@ -1762,6 +1762,7 @@ public class Coordinator
{
System.err.println("_communicator.destroy() raised "
+ e.toString());
+ e.printStackTrace();
}
}
diff --git a/java/src/IceGridGUI/ListDialog.java b/java/src/IceGridGUI/ListDialog.java
deleted file mode 100755
index e5d4f227bf2..00000000000
--- a/java/src/IceGridGUI/ListDialog.java
+++ /dev/null
@@ -1,191 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-package IceGridGUI;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.KeyStroke;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-
-import com.jgoodies.forms.factories.Borders;
-import com.jgoodies.forms.factories.ButtonBarFactory;
-
-//
-// A simple list of strings
-//
-
-public class ListDialog extends JDialog
-{
- public ListDialog(Frame parentFrame, String title, boolean trim)
- {
- super(parentFrame, title + " - IceGrid Admin", true);
- setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
-
- _trim = trim;
-
- _columnNames = new java.util.Vector(1);
- _columnNames.add("item");
-
- _list = new JTable();
- _list.setTableHeader(null);
-
- Action ok = new AbstractAction("OK")
- {
- public void actionPerformed(ActionEvent e)
- {
- _cancelled = false;
- setVisible(false);
- }
- };
- JButton okButton = new JButton(ok);
-
- Action cancel = new AbstractAction("Cancel")
- {
- public void actionPerformed(ActionEvent e)
- {
- setVisible(false);
- }
- };
- JButton cancelButton = new JButton(cancel);
-
- Action deleteRow = new AbstractAction("Delete selected element(s)")
- {
- public void actionPerformed(ActionEvent e)
- {
- if(_list.isEditing())
- {
- _list.getCellEditor().stopCellEditing();
- }
-
- for(;;)
- {
- int selectedRow = _list.getSelectedRow();
- if(selectedRow == -1)
- {
- break;
- }
- else
- {
- _model.removeRow(selectedRow);
- }
- }
- }
- };
- _list.getActionMap().put("delete", deleteRow);
- _list.getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
-
-
- JScrollPane scrollPane = new JScrollPane(_list);
- scrollPane.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(scrollPane, BorderLayout.CENTER);
- JPanel buttonBar = ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
- buttonBar.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(buttonBar, BorderLayout.SOUTH);
- pack();
- }
-
- //
- // Returns null when cancel is pressed
- //
- public java.util.LinkedList show(java.util.List elts, JComponent onComponent)
- {
- _cancelled = true;
-
- java.util.Vector vector = new java.util.Vector();
- java.util.Iterator p = elts.iterator();
- while(p.hasNext())
- {
- java.util.Vector elt = new java.util.Vector(1);
- elt.add(p.next());
- vector.add(elt);
- }
-
- java.util.Vector newRow = new java.util.Vector(1);
- newRow.add("");
- vector.addElement(newRow);
-
- _model = new DefaultTableModel(vector, _columnNames);
-
- _model.addTableModelListener(new TableModelListener()
- {
- public void tableChanged(TableModelEvent e)
- {
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
- if(lastKey != null && !lastKey.equals(""))
- {
- _model.addRow(new Object[]{""});
- }
- }
- });
-
- _list.setModel(_model);
-
- setLocationRelativeTo(onComponent);
- setVisible(true);
-
- if(_cancelled)
- {
- return null;
- }
- else
- {
- if(_list.isEditing())
- {
- _list.getCellEditor().stopCellEditing();
- }
-
- //
- // Create results without empty strings
- //
- java.util.LinkedList result = new java.util.LinkedList();
- for(int i = 0; i < _model.getRowCount(); ++i)
- {
- String value = (String)_model.getValueAt(i, 0);
- if(value != null)
- {
- if(_trim)
- {
- value = value.trim();
- }
- if(!value.equals(""))
- {
- result.add(value);
- }
- }
- }
- return result;
- }
- }
-
- private boolean _cancelled;
- private DefaultTableModel _model;
- private JTable _list;
- private java.util.Vector _columnNames;
- private boolean _trim;
-}
-
-
-
diff --git a/java/src/IceGridGUI/ParametersDialog.java b/java/src/IceGridGUI/ParametersDialog.java
deleted file mode 100755
index 0899d9dc996..00000000000
--- a/java/src/IceGridGUI/ParametersDialog.java
+++ /dev/null
@@ -1,284 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-package IceGridGUI;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.DefaultCellEditor;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.KeyStroke;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableColumn;
-
-import com.jgoodies.forms.factories.Borders;
-import com.jgoodies.forms.factories.ButtonBarFactory;
-
-//
-// A simple two-column table dialog to edit parameter-with-defaults
-// and parameter-values
-//
-
-public class ParametersDialog extends JDialog
-{
-
- public ParametersDialog(Frame parentFrame, String title,
- String valHeading, boolean editNames,
- final String nullLabel)
- {
- super(parentFrame, title + " - IceGrid Admin", true);
- _editNames = editNames;
- _nullObject = new Object()
- {
- public String toString()
- {
- return nullLabel;
- }
- };
-
- setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
-
- _columnNames = new java.util.Vector(2);
- _columnNames.add("Name");
- _columnNames.add(valHeading);
-
- _table = new JTable();
-
- JComboBox comboBox = new JComboBox();
- comboBox.setEditable(true);
- comboBox.addItem(_nullObject);
- _cellEditor = new DefaultCellEditor(comboBox);
-
- Action ok = new AbstractAction("OK")
- {
- public void actionPerformed(ActionEvent e)
- {
- _cancelled = false;
- setVisible(false);
- }
- };
- JButton okButton = new JButton(ok);
-
- Action cancel = new AbstractAction("Cancel")
- {
- public void actionPerformed(ActionEvent e)
- {
- setVisible(false);
- }
- };
- JButton cancelButton = new JButton(cancel);
-
- if(_editNames)
- {
- Action deleteRow = new AbstractAction("Delete selected parameter(s)")
- {
- public void actionPerformed(ActionEvent e)
- {
- for(;;)
- {
- if(_table.isEditing())
- {
- _table.getCellEditor().stopCellEditing();
- }
-
- int selectedRow = _table.getSelectedRow();
- if(selectedRow == -1)
- {
- break;
- }
- else
- {
- _model.removeRow(selectedRow);
- }
- }
- }
- };
- _table.getActionMap().put("delete", deleteRow);
- _table.getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
- }
-
- JScrollPane scrollPane = new JScrollPane(_table);
- scrollPane.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(scrollPane, BorderLayout.CENTER);
- JPanel buttonBar = ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
- buttonBar.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(buttonBar, BorderLayout.SOUTH);
- pack();
- }
-
- //
- // true=ok, false=cancel
- //
- public boolean show(java.util.List names,
- java.util.Map values,
- JComponent onComponent)
- {
- _cancelled = true;
-
- //
- // Transform into vector of vectors
- //
- java.util.Vector vector = new java.util.Vector(names.size());
- java.util.Iterator p = names.iterator();
-
- while(p.hasNext())
- {
- java.util.Vector row = new java.util.Vector(2);
- Object name = p.next();
- row.add(name);
- Object val = values.get(name);
- if(val == null)
- {
- row.add(_nullObject);
- }
- else
- {
- row.add(val);
- }
- vector.add(row);
- }
-
- if(_editNames)
- {
- java.util.Vector newRow = new java.util.Vector(2);
- newRow.add("");
- newRow.add(_nullObject);
- vector.add(newRow);
- }
-
- _model = new DefaultTableModel(vector, _columnNames)
- {
- public boolean isCellEditable(int row, int column)
- {
- if(_editNames)
- {
- return true;
- }
- else
- {
- return column > 0;
- }
- }
- };
-
-
- _model.addTableModelListener(new TableModelListener()
- {
- public void tableChanged(TableModelEvent e)
- {
- if(_editNames)
- {
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
- if(lastKey != null && !lastKey.equals(""))
- {
- _model.addRow(new Object[]{"", _nullObject});
- }
- }
- }
- });
-
- _table.setModel(_model);
-
- TableColumn valColumn = _table.getColumnModel().getColumn(1);
- valColumn.setCellEditor(_cellEditor);
-
- setLocationRelativeTo(onComponent);
- setVisible(true);
-
- if(_cancelled)
- {
- return false;
- }
- else
- {
- if(_table.isEditing())
- {
- _table.getCellEditor().stopCellEditing();
- }
- vector = _model.getDataVector();
-
- //
- // Transform vector into list & map
- //
- if(_editNames)
- {
- names.clear();
- }
- values.clear();
-
- p = vector.iterator();
- while(p.hasNext())
- {
- java.util.Vector row = (java.util.Vector)p.next();
-
- //
- // Eliminate rows with null or empty names
- //
- String name = (String)row.elementAt(0);
- if(name != null)
- {
- if(_editNames)
- {
- name = name.trim();
- }
-
- if(!name.equals(""))
- {
- if(_editNames)
- {
- names.add(name);
- }
-
- Object val = row.elementAt(1);
-
- //
- // Eliminate entries with "default" value
- //
- if(val != _nullObject)
- {
- assert val != null;
- values.put(name, val);
- }
- }
- }
- }
- return true;
- }
- }
-
- private final boolean _editNames;
- private final Object _nullObject;
- private boolean _cancelled;
- private JTable _table;
- private DefaultTableModel _model;
- private java.util.Vector _columnNames;
- private TableCellEditor _cellEditor;
-}
-
-
-
diff --git a/java/src/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/SessionKeeper.java
index fa97a3a6078..9c150c32651 100755
--- a/java/src/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/SessionKeeper.java
@@ -155,6 +155,7 @@ class SessionKeeper
boolean routed = false;
String registryUsername = System.getProperty("user.name");
+ char[] registryPassword;
String registryInstanceName = "IceGrid";
String registryEndpoints = "";
@@ -217,6 +218,8 @@ class SessionKeeper
builder.append("Username", _registryUsername);
builder.nextLine();
+ builder.append("Password", _registryPassword);
+ builder.nextLine();
builder.append("IceGrid Instance Name", _registryInstanceName);
builder.nextLine();
builder.append("IceGrid Registry Endpoint(s)", _registryEndpoints);
@@ -293,6 +296,7 @@ class SessionKeeper
_loginInfo.routed = (_tabbedPane.getSelectedIndex() == 1);
_loginInfo.registryUsername = _registryUsername.getText();
+ _loginInfo.registryPassword = _registryPassword.getPassword();
_loginInfo.registryInstanceName = _registryInstanceName.getText();
_loginInfo.registryEndpoints = _registryEndpoints.getText();
@@ -304,7 +308,7 @@ class SessionKeeper
private JTabbedPane _tabbedPane = new JTabbedPane();
private JTextField _registryUsername = new JTextField(30);
-
+ private JPasswordField _registryPassword = new JPasswordField(30);
private JTextField _registryInstanceName = new JTextField(30);
private JTextField _registryEndpoints = new JTextField(30);
diff --git a/java/src/IceGridGUI/TableDialog.java b/java/src/IceGridGUI/TableDialog.java
deleted file mode 100755
index f737ad6b0d1..00000000000
--- a/java/src/IceGridGUI/TableDialog.java
+++ /dev/null
@@ -1,234 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-package IceGridGUI;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.KeyStroke;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-
-import com.jgoodies.forms.factories.Borders;
-import com.jgoodies.forms.factories.ButtonBarFactory;
-
-//
-// A simple two-column table dialog, to edit properties and properties-like
-// maps.
-//
-
-public class TableDialog extends JDialog
-{
- public TableDialog(Frame parentFrame, String title,
- String heading0, String heading1, boolean editKeys)
- {
- super(parentFrame, title + " - IceGrid Admin", true);
- _editKeys = editKeys;
- setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
-
- _columnNames = new java.util.Vector(2);
- _columnNames.add(heading0);
- _columnNames.add(heading1);
-
- _table = new JTable();
-
- Action ok = new AbstractAction("OK")
- {
- public void actionPerformed(ActionEvent e)
- {
- _cancelled = false;
- setVisible(false);
- }
- };
- JButton okButton = new JButton(ok);
-
- Action cancel = new AbstractAction("Cancel")
- {
- public void actionPerformed(ActionEvent e)
- {
- setVisible(false);
- }
- };
- JButton cancelButton = new JButton(cancel);
-
- if(_editKeys)
- {
- Action deleteRow = new AbstractAction("Delete selected row(s)")
- {
- public void actionPerformed(ActionEvent e)
- {
- if(_table.isEditing())
- {
- _table.getCellEditor().stopCellEditing();
- }
-
- for(;;)
- {
- int selectedRow = _table.getSelectedRow();
- if(selectedRow == -1)
- {
- break;
- }
- else
- {
- _model.removeRow(selectedRow);
- }
- }
- }
- };
- _table.getActionMap().put("delete", deleteRow);
- _table.getInputMap().put(
- KeyStroke.getKeyStroke("DELETE"), "delete");
- }
-
- JScrollPane scrollPane = new JScrollPane(_table);
- scrollPane.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(scrollPane, BorderLayout.CENTER);
- JPanel buttonBar =
- ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
- buttonBar.setBorder(Borders.DIALOG_BORDER);
-
- getContentPane().add(buttonBar, BorderLayout.SOUTH);
- pack();
- }
-
- //
- // Returns null when cancel is pressed
- //
- public java.util.TreeMap show(java.util.Map map, JComponent onComponent)
- {
- _cancelled = true;
-
- //
- // Transform map into vector of vectors
- //
- java.util.Vector vector = new java.util.Vector(map.size());
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- java.util.Vector row = new java.util.Vector(2);
- row.add(entry.getKey());
- row.add(entry.getValue());
- vector.add(row);
- }
- if(_editKeys)
- {
- java.util.Vector newRow = new java.util.Vector(2);
- newRow.add("");
- newRow.add("");
- vector.add(newRow);
- }
-
- _model = new DefaultTableModel(vector, _columnNames)
- {
- public boolean isCellEditable(int row, int column)
- {
- if(_editKeys)
- {
- return true;
- }
- else
- {
- return column > 0;
- }
- }
- };
-
- _model.addTableModelListener(new TableModelListener()
- {
- public void tableChanged(TableModelEvent e)
- {
- if(_editKeys)
- {
- Object lastKey = _model.getValueAt(
- _model.getRowCount() - 1 , 0);
- if(lastKey != null && !lastKey.equals(""))
- {
- _model.addRow(new Object[]{"", ""});
- }
- }
- }
- });
-
-
- _table.setModel(_model);
-
- setLocationRelativeTo(onComponent);
- setVisible(true);
-
- if(_cancelled)
- {
- return null;
- }
- else
- {
- if(_table.isEditing())
- {
- _table.getCellEditor().stopCellEditing();
- }
- vector = _model.getDataVector();
-
- //
- // Transform vector into new Map
- //
- java.util.TreeMap result = new java.util.TreeMap();
- p = vector.iterator();
- while(p.hasNext())
- {
- java.util.Vector row = (java.util.Vector)p.next();
-
- //
- // Eliminate rows with null or empty keys
- //
- String key = (String)row.elementAt(0);
- if(key != null)
- {
- if(_editKeys)
- {
- key = key.trim();
- }
-
- if(!key.equals(""))
- {
- String val = (String) row.elementAt(1);
- if(val == null)
- {
- val = "";
- }
- result.put(key, val);
- }
- }
- }
- return result;
- }
- }
-
- private final boolean _editKeys;
- private boolean _cancelled;
- private JTable _table;
- private DefaultTableModel _model;
- private java.util.Vector _columnNames;
-}
-
-
-