org.utgenome.gwt.utgb.client.track
Class Track.TrackFactory

java.lang.Object
  extended by org.utgenome.gwt.utgb.client.track.Track.TrackFactory
Enclosing interface:
Track

public abstract static class Track.TrackFactory
extends Object

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.

Author:
leo

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

Track.TrackFactory

public Track.TrackFactory()
Method Detail

newInstance

public abstract Track newInstance()
obtain a new factory instance.

Returns:
new Factory instance.

setProperty

public void setProperty(String key,
                        String value)
set a property.

Parameters:
key - property name to be set.
value - property value to be set.

getProperty

public String getProperty(String key)
get a property value.

Parameters:
key - property name you want to know.
Returns:
property value.

clear

public void clear()


Copyright © 2007-2012 utgenome.org. All Rights Reserved.