|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.utgenome.gwt.utgb.client.track.Track.TrackFactory
public abstract static class Track.TrackFactory
TrackFactory helps to create new Track instance, which can be used to defer its instantiation.
Since GWT has no Class.newInstance
method with configurable parameters, you have to implement your own
factory() method for each track to support deferred instantiation.
Note that, GWT.create(Class)
supports deferred instantiation, but you cannot configure any parameter
values, when instanticate classes.
How to use:
class YourOwnTrack extends TrackBase
{
public static abstract TrackFactory factory()
{
return new TrackFactory() {
Map properties = new HashMap();
public Track newInstance() {]
Track track = new YourOwnTrack();
// You should set properties to a Track instance.
// for example
//
// Set propertySet = properties.entrySet();
// Iterator it = propertySet.iterator();
// while ( it.hasNext() ) {
// Map.Entry entry = (Map.Entry)(it.next());
// String key = entry.getKey();
// String value = entry.getValue();
//
// track.setProperty(key, value); // YourOwnTrack#setProperty(String, String)
// }
return track;
}
public void setProperty(String key, String value) {
properties.put(key, value);
}
}
}
}
See also the usage examles in ToolBoxTrack
.
Constructor Summary | |
---|---|
Track.TrackFactory()
|
Method Summary | |
---|---|
void |
clear()
|
String |
getProperty(String key)
get a property value. |
abstract Track |
newInstance()
obtain a new factory instance. |
void |
setProperty(String key,
String value)
set a property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Track.TrackFactory()
Method Detail |
---|
public abstract Track newInstance()
public void setProperty(String key, String value)
key
- property name to be set.value
- property value to be set.public String getProperty(String key)
key
- property name you want to know.
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |