summaryrefslogtreecommitdiff
path: root/sources/prefs
diff options
context:
space:
mode:
Diffstat (limited to 'sources/prefs')
-rw-r--r--sources/prefs/VSPrefs.java40
-rw-r--r--sources/prefs/editors/VSAbstractEditor.java44
-rw-r--r--sources/prefs/editors/VSProcessEditor.java17
3 files changed, 82 insertions, 19 deletions
diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java
index f8beb66..cac3b18 100644
--- a/sources/prefs/VSPrefs.java
+++ b/sources/prefs/VSPrefs.java
@@ -12,7 +12,6 @@ import java.util.*;
* The Class VSPrefs.
*/
public class VSPrefs implements Serializable {
-
/** The Constant BOOLEAN_PREFIX. */
public static final String BOOLEAN_PREFIX = "Boolean: ";
@@ -1235,4 +1234,43 @@ public class VSPrefs implements Serializable {
return true;
}
+
+ /**
+ * Return all full keys
+ *
+ * @return Allf ull keys
+ */
+ public ArrayList<String> getAllFullKeys() {
+ ArrayList<String> allKeys = new ArrayList<String>();
+
+ Set<String> set = null;
+
+ set = getIntegerKeySet();
+ for (String key : set)
+ allKeys.add(INTEGER_PREFIX + key);
+
+ set = getVectorKeySet();
+ for (String key : set)
+ allKeys.add(VECTOR_PREFIX + key);
+
+ set = getLongKeySet();
+ for (String key : set)
+ allKeys.add(LONG_PREFIX + key);
+
+ set = getFloatKeySet();
+ for (String key : set)
+ allKeys.add(FLOAT_PREFIX + key);
+
+ set = getBooleanKeySet();
+ for (String key : set)
+ allKeys.add(BOOLEAN_PREFIX + key);
+
+ set = getStringKeySet();
+ for (String key : set)
+ allKeys.add(STRING_PREFIX + key);
+
+ Collections.sort(allKeys);
+
+ return allKeys;
+ }
}
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);
}
}