summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/IceGridGUI/Application/CommunicatorSubEditor.java')
-rw-r--r--java/src/IceGridGUI/Application/CommunicatorSubEditor.java80
1 files changed, 32 insertions, 48 deletions
diff --git a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
index 3ea2bc86172..7331a1a6ed5 100644
--- a/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
+++ b/java/src/IceGridGUI/Application/CommunicatorSubEditor.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -28,22 +29,18 @@ class CommunicatorSubEditor
CommunicatorSubEditor(Editor mainEditor)
{
_mainEditor = mainEditor;
-
- _description.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+
+ _description.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_description.setToolTipText("An optional description");
- _propertySets.getDocument().addDocumentListener(
- _mainEditor.getUpdateListener());
+ _propertySets.getDocument().addDocumentListener(_mainEditor.getUpdateListener());
_propertySets.setToolTipText("Property Set References");
_properties = new PropertiesField(mainEditor);
- _logFiles = new MapField(mainEditor, "Path", "Property",
- true);
+ _logFiles = new SimpleMapField(mainEditor, true, "Path", "Property");
_logFiles.setToolTipText("Log files used by this server or service");
}
-
void appendProperties(DefaultFormBuilder builder)
{
builder.append("Description");
@@ -52,11 +49,10 @@ class CommunicatorSubEditor
builder.nextRow(-2);
CellConstraints cc = new CellConstraints();
JScrollPane scrollPane = new JScrollPane(_description);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 3));
builder.nextRow(2);
builder.nextLine();
-
+
builder.append("Property Sets");
builder.append(_propertySets, 3);
builder.nextLine();
@@ -71,8 +67,7 @@ class CommunicatorSubEditor
builder.nextRow(-6);
scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -83,34 +78,30 @@ class CommunicatorSubEditor
builder.append("");
builder.nextRow(-4);
scrollPane = new JScrollPane(_logFiles);
- builder.add(scrollPane,
- cc.xywh(builder.getColumn(), builder.getRow(), 3, 5));
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 5));
builder.nextRow(4);
builder.nextLine();
}
void writeDescriptor(CommunicatorDescriptor descriptor)
{
- descriptor.propertySet.references =
- (String[])_propertySets.getList().toArray(new String[0]);
+ descriptor.propertySet.references = _propertySets.getList().toArray(new String[0]);
descriptor.propertySet.properties = _properties.getProperties();
descriptor.description = _description.getText();
- java.util.TreeMap tm = _logFiles.get();
- java.util.Iterator p = tm.entrySet().iterator();
+ java.util.TreeMap<String, String> tm = _logFiles.get();
descriptor.logs = new String[tm.size()];
int i = 0;
- while(p.hasNext())
+ for(java.util.Map.Entry<String, String> p : tm.entrySet())
{
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String path = (String)entry.getKey();
- String prop = ((String)entry.getValue()).trim();
+ String path = p.getKey();
+ String prop = p.getValue().trim();
descriptor.logs[i++] = path;
if(!prop.equals(""))
{
- setProperty((java.util.LinkedList)descriptor.propertySet.properties, prop, path);
+ setProperty((java.util.LinkedList<PropertyDescriptor>)descriptor.propertySet.properties, prop, path);
}
}
}
@@ -123,71 +114,64 @@ class CommunicatorSubEditor
//
// Note that we don't substitute in the lookup
//
- java.util.Map map = new java.util.TreeMap();
- for(int i = 0; i < descriptor.logs.length; ++i)
+ java.util.Map<String, String> map = new java.util.TreeMap<String, String>();
+ for(String log : descriptor.logs)
{
- String prop = lookupKey(descriptor.propertySet.properties,
- descriptor.logs[i]);
- map.put(descriptor.logs[i], prop);
+ String prop = lookupKey(descriptor.propertySet.properties, log);
+ map.put(log, prop);
}
_logFiles.set(map, detailResolver, isEditable);
- _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references),
- detailResolver);
+ _propertySets.setList(java.util.Arrays.asList(descriptor.propertySet.references), detailResolver);
_propertySets.setEditable(isEditable);
_properties.setProperties(descriptor.propertySet.properties,
descriptor.adapters,
descriptor.logs,
detailResolver, isEditable);
- _description.setText(
- Utils.substitute(descriptor.description, detailResolver));
+ _description.setText(Utils.substitute(descriptor.description, detailResolver));
_description.setEditable(isEditable);
_description.setOpaque(isEditable);
}
-
//
// Returns first key matching this value, if there is one
//
- private String lookupKey(java.util.List props, String value)
+ private String lookupKey(java.util.List<PropertyDescriptor> props, String value)
{
- java.util.Iterator p = props.iterator();
- while(p.hasNext())
+ for(PropertyDescriptor p : props)
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- if(pd.value.equals(value))
+ if(p.value.equals(value))
{
- return pd.name;
+ return p.name;
}
}
return "";
}
- private void setProperty(java.util.LinkedList props, String key, String newValue)
+ private void setProperty(java.util.LinkedList<PropertyDescriptor> props, String key, String newValue)
{
removeProperty(props, key);
props.addFirst(new PropertyDescriptor(key, newValue));
}
- private void removeProperty(java.util.List props, String key)
+ private void removeProperty(java.util.List<PropertyDescriptor> props, String key)
{
- java.util.Iterator p = props.iterator();
+ java.util.Iterator<PropertyDescriptor> p = props.iterator();
while(p.hasNext())
{
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
+ PropertyDescriptor pd = p.next();
if(pd.name.equals(key))
{
p.remove();
}
}
}
-
protected Editor _mainEditor;
-
+
private JTextArea _description = new JTextArea(3, 20);
- private ListTextField _propertySets = new ListTextField(20);
+ private ListTextField _propertySets = new ListTextField(20);
private PropertiesField _properties;
- private MapField _logFiles;
+ private SimpleMapField _logFiles;
}