View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2009 utgenome.org
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *--------------------------------------------------------------------------*/
16  //--------------------------------------
17  // utgb-core Project
18  //
19  // GenomeTrack.java
20  // Since: Feb 17, 2009
21  //
22  // $URL: http://svn.utgenome.org/utgb/trunk/utgb/utgb-core/src/main/java/org/utgenome/gwt/utgb/client/track/lib/GenomeTrack.java $ 
23  // $Author: yoshimura $
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.track.lib;
26  
27  import org.utgenome.gwt.utgb.client.bio.DASLocation;
28  import org.utgenome.gwt.utgb.client.bio.GenomeDB;
29  import org.utgenome.gwt.utgb.client.db.datatype.StringType;
30  import org.utgenome.gwt.utgb.client.track.Track;
31  import org.utgenome.gwt.utgb.client.track.TrackConfigChange;
32  import org.utgenome.gwt.utgb.client.track.TrackFrame;
33  import org.utgenome.gwt.utgb.client.track.TrackGroup;
34  
35  /**
36   * DASTrack is for visualizing data that can be located on das data.
37   * 
38   * @author yoshimura
39   * 
40   */
41  public class DASTrack extends ReadTrack {
42  
43  	public static TrackFactory factory() {
44  		return new TrackFactory() {
45  			@Override
46  			public Track newInstance() {
47  				return new DASTrack();
48  			}
49  		};
50  	}
51  
52  	public DASTrack() {
53  		super("DAS Track", "DAS");
54  	}
55  
56  	private final String CONFIG_DAS_TYPE = "dasType";
57  
58  	@Override
59  	public void setUp(TrackFrame trackFrame, TrackGroup group) {
60  		super.setUp(trackFrame, group);
61  
62  		getConfig().addConfig("DAS Data Type", new StringType(CONFIG_DAS_TYPE), "");
63  	}
64  
65  	@Override
66  	public void onChangeTrackConfig(TrackConfigChange change) {
67  		super.onChangeTrackConfig(change);
68  
69  		if (change.contains(CONFIG_DAS_TYPE)) {
70  			refresh();
71  		}
72  	}
73  
74  	@Override
75  	public GenomeDB getGenomeDB() {
76  		return new DASLocation(super.getGenomeDB(), getConfig().getParameter(CONFIG_DAS_TYPE));
77  	}
78  
79  }