diff --git a/src/org/openlcb/swing/NodeSelector.java b/src/org/openlcb/swing/NodeSelector.java
index 366f18ad..ac1ca7fc 100644
--- a/src/org/openlcb/swing/NodeSelector.java
+++ b/src/org/openlcb/swing/NodeSelector.java
@@ -28,18 +28,37 @@
* from a MimicNodeStore
*
* @author Bob Jacobsen Copyright (C) 2012
- * @version $Revision$
*/
public class NodeSelector extends JPanel {
- /** Comment for serialVersionUID
. */
- private static final long serialVersionUID = 1714640844679691939L;
-
+
private final PropertyChangeListener propertyChangeListener;
MimicNodeStore store;
JComboBox box;
private DefaultComboBoxModel model = new DefaultComboBoxModel();
private boolean seenLight = false;
+ private int termCount = 2; // how many terms to keep in ID string
+
+
+ /**
+ * Constructor that allows you to set the number of properties displayed
+ * after the NodeID.
+ *
+ * The properties will be shown in the order of User Name, User Description,
+ * Manufacturer+Model, Software version. Only non-empty values are shown.
+ *
+ * @param store Node store containing the existing network
+ * @param termCount Number of ID terms to include in the displayed ID
+ */
+ public NodeSelector(MimicNodeStore store, int termCount) {
+ this(store);
+ this.termCount = termCount;
+ }
+ /**
+ * Constructor with default displayed ID consisting of NodeID,
+ * User Name and User Description.
+ * @param store Node store containing the existing network
+ */
public NodeSelector(MimicNodeStore store) {
this.store = store;
@@ -98,7 +117,7 @@ protected class ModelEntry implements Comparable, PropertyChangeList
/**
* Constructor for prototype display value
- *
+ *
* @param description prototype display value
*/
private ModelEntry(String description) {
@@ -115,17 +134,19 @@ private void updateDescription() {
StringBuilder sb = new StringBuilder();
sb.append(nodeMemo.getNodeID().toString());
int count = 0;
- if (count < 2) {
+ if (count < termCount) {
count += addToDescription(ident.getUserName(), sb);
}
- if (count < 2) {
+ if (count < termCount) {
count += addToDescription(ident.getUserDesc(), sb);
}
- if (count < 2) {
- count += addToDescription(ident.getMfgName() + ident.getModelName(),
+ if (count < termCount) {
+ if (!ident.getMfgName().isEmpty() || !ident.getModelName().isEmpty()) {
+ count += addToDescription(ident.getMfgName() + " " +ident.getModelName(),
sb);
+ }
}
- if (count < 2) {
+ if (count < termCount) {
count += addToDescription(ident.getSoftwareVersion(), sb);
}
String newDescription = sb.toString();
@@ -174,7 +195,7 @@ public boolean equals(Object o) {
}
return false;
}
-
+
@Override
public int hashCode() {
return getNodeID().hashCode();