summaryrefslogtreecommitdiff
path: root/sources/prefs/editors
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-27 17:23:45 +0000
committerPaul Buetow <paul@buetow.org>2008-05-27 17:23:45 +0000
commit97a3a4f07cdc8437f73f4270b237e85c7739a6be (patch)
tree32154e63775f1fa145d176301840e3150b8eb001 /sources/prefs/editors
parent39e9eb74c011ee5351ac1796e5df529a70aa8945 (diff)
client and server variables are now separate in the editor.
Diffstat (limited to 'sources/prefs/editors')
-rw-r--r--sources/prefs/editors/VSAbstractEditor.java44
-rw-r--r--sources/prefs/editors/VSProcessEditor.java17
2 files changed, 43 insertions, 18 deletions
diff --git a/sources/prefs/editors/VSAbstractEditor.java b/sources/prefs/editors/VSAbstractEditor.java
index 9ae98be..1b6351c 100644
--- a/sources/prefs/editors/VSAbstractEditor.java
+++ b/sources/prefs/editors/VSAbstractEditor.java
@@ -634,33 +634,47 @@ public abstract class VSAbstractEditor implements ActionListener {
editTable.fireTableDataChanged();
}
+ private ArrayList<String> filterOut(Set<String> set, ArrayList<String> filter, String prefix) {
+ ArrayList<String> ret = new ArrayList<String>();
+
+ for (String key : set) {
+ String fullKey = prefix + key;
+ if (filter.contains(fullKey))
+ ret.add(fullKey);
+ }
+
+ return ret;
+ }
+
/**
* Adds the to editor.
*
* @param label the label
* @param prefsKey the prefs key
* @param prefsToAdd the prefs to add
+ * @param addOnlyThisVariables only add variables which are in this list
*/
- protected void addToEditor(String label, String prefsKey, VSPrefs prefsToAdd) {
+ protected void addToEditor(String label, String prefsKey, VSPrefs prefsToAdd, ArrayList<String> addOnlyThisVariables) {
addSeparator(label);
prefsKey = "(" + prefsKey + ")";
ArrayList<String> fullKeys = new ArrayList<String>();
- Set<String> integerKeys = prefsToAdd.getIntegerKeySet();
- Set<String> vectorKeys = prefsToAdd.getVectorKeySet();
- Set<String> floatKeys = prefsToAdd.getFloatKeySet();
- Set<String> longKeys = prefsToAdd.getLongKeySet();
- Set<String> booleanKeys = prefsToAdd.getBooleanKeySet();
- Set<String> stringKeys = prefsToAdd.getStringKeySet();
-
- for (String key : integerKeys) fullKeys.add(VSPrefs.INTEGER_PREFIX + key);
- for (String key : vectorKeys) fullKeys.add(VSPrefs.VECTOR_PREFIX + key);
- for (String key : floatKeys) fullKeys.add(VSPrefs.FLOAT_PREFIX + key);
- for (String key : longKeys) fullKeys.add(VSPrefs.LONG_PREFIX + key);
- for (String key : booleanKeys) fullKeys.add(VSPrefs.BOOLEAN_PREFIX + key);
- for (String key : stringKeys) fullKeys.add(VSPrefs.STRING_PREFIX + key);
-
+ fullKeys.addAll(filterOut(prefsToAdd.getIntegerKeySet(), addOnlyThisVariables, VSPrefs.INTEGER_PREFIX));
+ fullKeys.addAll(filterOut(prefsToAdd.getVectorKeySet(), addOnlyThisVariables, VSPrefs.VECTOR_PREFIX));
+ fullKeys.addAll(filterOut(prefsToAdd.getFloatKeySet(), addOnlyThisVariables, VSPrefs.FLOAT_PREFIX));
+ fullKeys.addAll(filterOut(prefsToAdd.getLongKeySet(), addOnlyThisVariables, VSPrefs.LONG_PREFIX));
+ fullKeys.addAll(filterOut(prefsToAdd.getBooleanKeySet(), addOnlyThisVariables, VSPrefs.BOOLEAN_PREFIX));
+ fullKeys.addAll(filterOut(prefsToAdd.getStringKeySet(), addOnlyThisVariables, VSPrefs.STRING_PREFIX));
+
+ /*
+ for (String key : integerKeys) fullKeys.add(VSPrefs.INTEGER_PREFIX + key);
+ for (String key : vectorKeys) fullKeys.add(VSPrefs.VECTOR_PREFIX + key);
+ for (String key : floatKeys) fullKeys.add(VSPrefs.FLOAT_PREFIX + key);
+ for (String key : longKeys) fullKeys.add(VSPrefs.LONG_PREFIX + key);
+ for (String key : booleanKeys) fullKeys.add(VSPrefs.BOOLEAN_PREFIX + key);
+ for (String key : stringKeys) fullKeys.add(VSPrefs.STRING_PREFIX + key);
+ */
Collections.sort(fullKeys);
for (String fullKey : fullKeys) {
diff --git a/sources/prefs/editors/VSProcessEditor.java b/sources/prefs/editors/VSProcessEditor.java
index 8666fbe..1992d6c 100644
--- a/sources/prefs/editors/VSProcessEditor.java
+++ b/sources/prefs/editors/VSProcessEditor.java
@@ -13,7 +13,6 @@ import protocols.*;
import events.*;
import prefs.VSPrefs;
-// TODO: Auto-generated Javadoc
/**
* The Class VSProcessEditor.
*/
@@ -57,11 +56,23 @@ public class VSProcessEditor extends VSAbstractBetterEditor {
ArrayList<String> editableProtocolsClassnames =
VSRegisteredEvents.getEditableProtocolsClassnames();
- String protocolString = " " + prefs.getString("lang.protocol");
+ //String protocolString = " " + prefs.getString("lang.protocol");
+ String clientString = " " + prefs.getString("lang.client");
+ String serverString = " " + prefs.getString("lang.server");
+
for (String protocolClassname : editableProtocolsClassnames) {
String protocolShortname = VSRegisteredEvents.getShortname(protocolClassname);
VSAbstractProtocol protocol = process.getProtocolObject(protocolClassname);
- addToEditor(protocolShortname + protocolString, protocolShortname, protocol);
+ protocol.onClientInit();
+ protocol.onServerInit();
+
+ ArrayList<String> clientVariables = VSRegisteredEvents.getProtocolClientVariables(protocolClassname);
+ if (clientVariables != null)
+ addToEditor(protocolShortname + clientString, protocolShortname, protocol, clientVariables);
+
+ ArrayList<String> serverVariables = VSRegisteredEvents.getProtocolServerVariables(protocolClassname);
+ if (serverVariables != null)
+ addToEditor(protocolShortname + serverString, protocolShortname, protocol, serverVariables);
}
}