View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2007 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  // GenomeBrowser Project
18  //
19  // URLQueryArgumentTrack.java
20  // Since: Jun 15, 2007
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.track.lib.debug;
26  
27  import java.util.HashMap;
28  
29  import org.utgenome.gwt.utgb.client.track.Track;
30  import org.utgenome.gwt.utgb.client.track.TrackBase;
31  import org.utgenome.gwt.utgb.client.util.BrowserInfo;
32  
33  import com.google.gwt.user.client.ui.HorizontalPanel;
34  import com.google.gwt.user.client.ui.Label;
35  import com.google.gwt.user.client.ui.Widget;
36  
37  public class URLQueryArgumentTrack extends TrackBase {
38  	private final HorizontalPanel _panel = new HorizontalPanel();
39  
40  	public static TrackFactory factory() {
41  		return new TrackFactory() {
42  			public Track newInstance() {
43  				return new URLQueryArgumentTrack();
44  			}
45  		};
46  	}
47  
48  	public URLQueryArgumentTrack() {
49  		super("Query Argument");
50  
51  		_panel.setStyleName("selector");
52  	}
53  
54  	public Widget getWidget() {
55  		return _panel;
56  	}
57  
58  	public void draw() {
59  		_panel.clear();
60  
61  		HashMap<String, String> requestParam = BrowserInfo.getURLQueryRequestParameters();
62  		for (String key : requestParam.keySet()) {
63  			String value = (String) requestParam.get(key);
64  
65  			Label l = new Label(key + "=" + value);
66  			l.setStyleName("selector-item");
67  			_panel.add(l);
68  		}
69  	}
70  
71  }