|
Cytoscape 3.0.0-beta1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface Tunable
An annotation type that can be applied to a field or a method
in order to allow TunableInterceptor
to catch it,
and so to use its members to create a corresponding interface for a user.
This interface describes the different members that can be used in the
@Tunable(...)
to control the instantiation of user interface to
present to a user.
Here is an example of how to use a Tunable
annotation:
@Tunable(description="your last name", group={"Human","pupil"}, params="displayState=collapsed")
public String lastName = "Smith";
This tunable will be part of a group("pupil
"), which is also a part of
a metagroup("Human
").collapsed
could
indicate that the initial state of the panel that may display the JTextField with the
lastName
will be collapsed and needs to
be expanded in order to see its components.
Optional Element Summary | |
---|---|
String |
dependsOn
To add a dependency between 2 or more Tunables |
String |
description
Human-readable label identifying the tunable as displayed to a user. |
String[] |
groups
Used to define all the groups in which the Tunable takes part (by default, its doesn't belong to any group). |
String[] |
listenForChange
Returns a list of Tunable field/method names that will trigger this Tunable to be updated. |
String |
params
Returns a key1=value1;key2=value2;...;keyN=valueN type string. |
boolean |
xorChildren
Boolean value to choose if the Tunable will control the display of other,
nested child tunables. |
String |
xorKey
Key that will refer to the "value" of the Tunable which has
xorChildren=true |
public abstract String description
public abstract String[] groups
Example:
@Tunable(description="write your last name", group={"Company","Department","office","identity"})
public String lastName = "Smith";
This String Tunable
will take part of these 4 groups.
warning: Note that they are set in an order of subgroups of a main one.
Example:@Tunable(description="write your first name", groups={"Company","Department","office","identity"})
public String firstName = "John";@Tunable(description="write the name of your office", groups={"Company","Department","office"})
public String officeName = "CytoscapeDevelopment's Office"; Here we have a second item for the identity of a person(the firstName).So, the 2Tunable
lastName and firstName are in the subgroup identity But, theTunable
String officeName will only take part of the upperGroup office, and so won't be set with these other 2 fields.
public abstract boolean xorChildren
Tunable
will control the display of other,
nested child tunables.
public abstract String xorKey
Tunable
which has
xorChildren=true
Example :
@Tunable(description="Single list", group={"TestGroup"}, xorChildren=true)
public ListSingleSelection chooser = new ListSingleSelection("Names","FirstNames");
@Tunable(description="Multi list", group={"TestGroup","Names"}, xorKey="Names")
public ListMultipleSelection names = new ListMultipleSelection("Johnson","Turner","Smith");
@Tunable(description="Multi list", group={"TestGroup","First Names"}, xorKey="FirstNames")
public ListMultipleSelection firstnames = new ListMultipleSelection("George","Jane","Sarah");
Here, the 2 ListMultipleSelection
won't be displayed in the GUI at the
same time : each of them depends on the xorKey(FirstNames or Names)
that will match the "value" (i.e item that has been selected) in the
ListSingleSelection
public abstract String dependsOn
Tunables
TheSoJPanel
of theTunable
that depends on the other one will be activated only if the value which is required is set. Here is an example of how to add dependencies betweenTunables
:
@Tunable(description="Type") public boolean type = false; @Tunable(description="Host name",dependsOn="type=true") public String hostname="";
hostname
will be activated if type
is set to "true"
public abstract String params
AbstractBounded
and
AbstractFlexiblyBounded
.
Tunable
within a group, if nothing has
been specified, "vertical" will be the default. These values will be in a 1-to-1
correspondence with the strings in the "group" array. Excess values will be ignored.
Tunable
's group has to be
displayed or not in the titleBorder
of the JPanel
representing this group.
Tunable
's JPanel will be
collapsible. The value must be either "collapsed" or "uncollapsed" indicating the
initial display state.
public abstract String[] listenForChange
@Tunable(description="A")
public String getA() {
return a;
}
public void setA(String a) {
this.a = a;
}
// listenForChange="A" means that the value of this
// Tunable will be updated every time A is changed.
@Tunable(description="B",listenForChange="A")
public String getB() {
if ( a.equals("somethingSpecial") )
return "hooray!";
else
return b;
}
public void setB(String b) {
this.b = b;
}
|
Cytoscape 3.0.0-beta1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |