|
Cytoscape 3.0.1 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 public fields or a methods
in a Task object that allows the Task to be configured
with user supplied information. Tunable annotations allow Tasks to
be configured with specific, user supplied data, without needing to produce
a user interface. The TaskManager is responsible for inferring a
user interface from the types of the fields or methods being annotated.
Tunable annotations are suitable only for information that must be
supplied by the user. For instance, the name of a file to load can only
be known by the user, so is appropriate to be specified by the user. Other
information necessary for the Task to execute should be provided
as constructor arguments to the Task.
Tunable annotations provide several parameters that can be used to control
the display of Tunables in the eventual user interface. These parameters
are documented below.
Here is an example of how to use a Tunable annotation for a field annotation:
@Tunable(description="your last name", group={"Human","pupil"}, params="displayState=collapsed")
public String lastName = "Smith";
This tunable will be grouped in the user interface first within the "Human" group, then
within the "pupil" group. How this grouping is displayed to users is a function of which TaskManager
is used. Likewise, if supported by the TaskManager, the display state of the Tunable
will initially be collapsed.
Tunable annotation for method annotation.
Method annotations require both a getter and a setter method to get and set a
value. Only the getter method needs to be annotated. The getter method must take no arguments
and return a value and be named with the prefix "get". The setter method does not need a
Tunable annotation, however the method must take a single argument of the same type as
the getter method, it must return void, it must be named with the prefix "set", and the
rest of the name must match that of the getter method.
@Tunable(description="your last name", group={"Human","pupil"}, params="displayState=collapsed")
public String getLastName() {
return lastName;
}
// NO Tunable annotation for the setter method.
public void setLastName(String newLastName) {
lastName = newLastName;
}
| Optional Element Summary | |
|---|---|
String |
dependsOn
To add a dependency between two or more Tunables, where
the display of one Tunable depends on the
the state of another. |
String |
description
Mandatory, human-readable label identifying the Tunable as displayed to a user. |
String[] |
groups
Used to define the presentation grouping of the Tunable. |
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
Returns true if this field or method is used to control the display of other Tunables. |
String |
xorKey
Returns a value that matches one of the values found in a different Tunable annotated field or method that returns true for the xorChildren()
method. |
public abstract String description
public abstract String[] groups
@Tunable(description="write your last name", group={"Company","Department","Office"})
public String lastName = "Smith";
The lastName Tunable will be nested within the "Company", "Department",
"Office", and "Identity" groups. The order of groups defines their nesting.
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 = "Cytoscape Development";
Tunable to "Office" group. The "Identity" group will
appear with officeName within the "Office" group.
public abstract boolean xorChildren
Tunables. The other Tunables in question are matched according
the groups() value and the xorKey() of the other
Tunables. See xorKey() for a full example.
Tunables.public abstract String xorKey
true for the xorChildren()
method.
Example :
@Tunable(description="Distance measure", group={"Measure"}, xorChildren=true)
public ListSingleSelection chooser = new ListSingleSelection("Metric","English");
@Tunable(description="Metric distances", group={"Measure","Metric"}, xorKey="Metric")
public ListSingleSelection metric = new ListSingleSelection("millimeter","meter","kilometer");
@Tunable(description="English distances", group={"Measure","English"}, xorKey="English")
public ListSingleSelection english = new ListSingleSelection("inch","yard","mile");
Based on the selection made in the "chooser" Tunable, either the "metric" or
the "english" Tunable will be displayed, not both.
The xorKey value must match one of the
values specified in the xorChildren Tunable.
public abstract String dependsOn
Tunables, where
the display of one Tunable depends on the
the state of another.
Here is an example of how to add dependencies between Tunables:
@Tunable(description="Type") public boolean type = false; @Tunable(description="Host name",dependsOn="type=true") public String hostname="";So
hostname will only be displayed if type is set to "true"
public abstract String params
BoundedDouble,
BoundedFloat, and similar classes.
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.1 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||