Added setters for the name and the description of a Key intended to be

used in custom components.
This commit is contained in:
hneemann 2017-11-01 10:43:50 +01:00
parent 7f987f2d8f
commit 25ed0665c9
3 changed files with 109 additions and 79 deletions

1
.gitignore vendored
View File

@ -72,3 +72,4 @@ buildNumber.properties
/copybin.sh /copybin.sh
/Digital.sh /Digital.sh
/upload.sh /upload.sh
/copyToPluginExample.sh

View File

@ -36,7 +36,7 @@
<visualElement> <visualElement>
<elementName>LED</elementName> <elementName>LED</elementName>
<elementAttributes/> <elementAttributes/>
<pos x="580" y="180"/> <pos x="540" y="180"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>LED</elementName> <elementName>LED</elementName>
@ -51,7 +51,7 @@
</awt-color> </awt-color>
</entry> </entry>
</elementAttributes> </elementAttributes>
<pos x="580" y="220"/> <pos x="540" y="220"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>LED</elementName> <elementName>LED</elementName>
@ -66,22 +66,32 @@
</awt-color> </awt-color>
</entry> </entry>
</elementAttributes> </elementAttributes>
<pos x="580" y="260"/> <pos x="540" y="260"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>DiodeBackward</elementName> <elementName>DiodeBackward</elementName>
<elementAttributes/> <elementAttributes>
<pos x="500" y="340"/> <entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
</elementAttributes>
<pos x="420" y="260"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>DiodeBackward</elementName> <elementName>DiodeBackward</elementName>
<elementAttributes/> <elementAttributes>
<pos x="540" y="340"/> <entry>
<string>rotation</string>
<rotation rotation="3"/>
</entry>
</elementAttributes>
<pos x="420" y="380"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>PullUp</elementName> <elementName>PullUp</elementName>
<elementAttributes/> <elementAttributes/>
<pos x="500" y="280"/> <pos x="480" y="200"/>
</visualElement> </visualElement>
<visualElement> <visualElement>
<elementName>Ground</elementName> <elementName>Ground</elementName>
@ -91,8 +101,8 @@
</visualElements> </visualElements>
<wires> <wires>
<wire> <wire>
<p1 x="480" y="180"/> <p1 x="500" y="180"/>
<p2 x="580" y="180"/> <p2 x="540" y="180"/>
</wire> </wire>
<wire> <wire>
<p1 x="400" y="180"/> <p1 x="400" y="180"/>
@ -106,21 +116,25 @@
<p1 x="240" y="180"/> <p1 x="240" y="180"/>
<p2 x="280" y="180"/> <p2 x="280" y="180"/>
</wire> </wire>
<wire>
<p1 x="540" y="260"/>
<p2 x="580" y="260"/>
</wire>
<wire> <wire>
<p1 x="260" y="260"/> <p1 x="260" y="260"/>
<p2 x="280" y="260"/> <p2 x="280" y="260"/>
</wire> </wire>
<wire>
<p1 x="440" y="260"/>
<p2 x="480" y="260"/>
</wire>
<wire> <wire>
<p1 x="400" y="260"/> <p1 x="400" y="260"/>
<p2 x="460" y="260"/> <p2 x="420" y="260"/>
</wire>
<wire>
<p1 x="480" y="260"/>
<p2 x="540" y="260"/>
</wire> </wire>
<wire> <wire>
<p1 x="400" y="340"/> <p1 x="400" y="340"/>
<p2 x="440" y="340"/> <p2 x="460" y="340"/>
</wire> </wire>
<wire> <wire>
<p1 x="260" y="340"/> <p1 x="260" y="340"/>
@ -132,27 +146,7 @@
</wire> </wire>
<wire> <wire>
<p1 x="400" y="420"/> <p1 x="400" y="420"/>
<p2 x="480" y="420"/> <p2 x="500" y="420"/>
</wire>
<wire>
<p1 x="460" y="360"/>
<p2 x="500" y="360"/>
</wire>
<wire>
<p1 x="400" y="220"/>
<p2 x="440" y="220"/>
</wire>
<wire>
<p1 x="260" y="220"/>
<p2 x="280" y="220"/>
</wire>
<wire>
<p1 x="440" y="220"/>
<p2 x="580" y="220"/>
</wire>
<wire>
<p1 x="500" y="300"/>
<p2 x="540" y="300"/>
</wire> </wire>
<wire> <wire>
<p1 x="260" y="300"/> <p1 x="260" y="300"/>
@ -162,41 +156,53 @@
<p1 x="400" y="300"/> <p1 x="400" y="300"/>
<p2 x="420" y="300"/> <p2 x="420" y="300"/>
</wire> </wire>
<wire>
<p1 x="400" y="220"/>
<p2 x="460" y="220"/>
</wire>
<wire>
<p1 x="260" y="220"/>
<p2 x="280" y="220"/>
</wire>
<wire>
<p1 x="460" y="220"/>
<p2 x="540" y="220"/>
</wire>
<wire> <wire>
<p1 x="400" y="380"/> <p1 x="400" y="380"/>
<p2 x="540" y="380"/> <p2 x="420" y="380"/>
</wire> </wire>
<wire> <wire>
<p1 x="240" y="380"/> <p1 x="240" y="380"/>
<p2 x="280" y="380"/> <p2 x="280" y="380"/>
</wire> </wire>
<wire>
<p1 x="440" y="380"/>
<p2 x="480" y="380"/>
</wire>
<wire> <wire>
<p1 x="260" y="460"/> <p1 x="260" y="460"/>
<p2 x="280" y="460"/> <p2 x="280" y="460"/>
</wire> </wire>
<wire> <wire>
<p1 x="400" y="460"/> <p1 x="400" y="460"/>
<p2 x="440" y="460"/> <p2 x="460" y="460"/>
</wire> </wire>
<wire> <wire>
<p1 x="480" y="180"/> <p1 x="480" y="200"/>
<p2 x="480" y="420"/> <p2 x="480" y="260"/>
</wire>
<wire>
<p1 x="480" y="260"/>
<p2 x="480" y="380"/>
</wire> </wire>
<wire> <wire>
<p1 x="240" y="180"/> <p1 x="240" y="180"/>
<p2 x="240" y="380"/> <p2 x="240" y="380"/>
</wire> </wire>
<wire> <wire>
<p1 x="500" y="340"/> <p1 x="500" y="180"/>
<p2 x="500" y="360"/> <p2 x="500" y="420"/>
</wire>
<wire>
<p1 x="500" y="280"/>
<p2 x="500" y="300"/>
</wire>
<wire>
<p1 x="500" y="300"/>
<p2 x="500" y="320"/>
</wire> </wire>
<wire> <wire>
<p1 x="260" y="160"/> <p1 x="260" y="160"/>
@ -231,28 +237,12 @@
<p2 x="420" y="320"/> <p2 x="420" y="320"/>
</wire> </wire>
<wire> <wire>
<p1 x="440" y="220"/> <p1 x="460" y="220"/>
<p2 x="440" y="340"/> <p2 x="460" y="340"/>
</wire> </wire>
<wire> <wire>
<p1 x="440" y="340"/> <p1 x="460" y="340"/>
<p2 x="440" y="460"/> <p2 x="460" y="460"/>
</wire>
<wire>
<p1 x="540" y="260"/>
<p2 x="540" y="300"/>
</wire>
<wire>
<p1 x="540" y="340"/>
<p2 x="540" y="380"/>
</wire>
<wire>
<p1 x="540" y="300"/>
<p2 x="540" y="320"/>
</wire>
<wire>
<p1 x="460" y="260"/>
<p2 x="460" y="360"/>
</wire> </wire>
</wires> </wires>
</circuit> </circuit>

View File

@ -16,6 +16,11 @@ public class Key<VALUE> {
private final String langKey; private final String langKey;
private boolean groupEditAllowed = false; private boolean groupEditAllowed = false;
// Both values are always null in digital.
// Both are only used within a custom implemented component.
private String name;
private String description;
/** /**
* Creates a new Key * Creates a new Key
* *
@ -42,10 +47,13 @@ public class Key<VALUE> {
/** /**
* Returns the attributes display name * Returns the attributes display name
* *
* @return thr name * @return the name of the key
*/ */
public String getName() { public String getName() {
return Lang.get(langKey); if (name != null)
return name;
else
return Lang.get(langKey);
} }
/** /**
@ -71,11 +79,15 @@ public class Key<VALUE> {
* @return the keys description * @return the keys description
*/ */
public String getDescription() { public String getDescription() {
String d = Lang.getNull(langKey + "_tt"); if (description != null)
if (d != null) return description;
return d; else {
else String d = Lang.getNull(langKey + "_tt");
return getName(); if (d != null)
return d;
else
return getName();
}
} }
/** /**
@ -97,11 +109,38 @@ public class Key<VALUE> {
* *
* @return this for chained calls * @return this for chained calls
*/ */
Key<VALUE> allowGroupEdit() { public Key<VALUE> allowGroupEdit() {
this.groupEditAllowed = true; this.groupEditAllowed = true;
return this; return this;
} }
/**
* Sets the name of this key.
* Is not used in Digital at all.
* This method can be used to define custom keys in custom java components.
*
* @param name the name of the key
* @return this for chained calls
*/
public Key<VALUE> setName(String name) {
this.name = name;
return this;
}
/**
* Sets the description of this key.
* Is not used in Digital at all.
* This method can be used to define custom keys in custom java components.
*
* @param description the name of the key
* @return this for chained calls
*/
public Key<VALUE> setDescription(String description) {
this.description = description;
return this;
}
/** /**
* A integer attribute. * A integer attribute.
* Stores additional combo box values * Stores additional combo box values