1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.utgenome.gwt.utgb.client.track.lib.old;
26
27 import org.utgenome.gwt.utgb.client.track.Track;
28 import org.utgenome.gwt.utgb.client.track.TrackBase;
29 import org.utgenome.gwt.utgb.client.track.TrackFrame;
30 import org.utgenome.gwt.utgb.client.track.TrackGroup;
31
32 import com.google.gwt.event.dom.client.ClickEvent;
33 import com.google.gwt.event.dom.client.ClickHandler;
34 import com.google.gwt.user.client.ui.Button;
35 import com.google.gwt.user.client.ui.HorizontalPanel;
36 import com.google.gwt.user.client.ui.TextBox;
37 import com.google.gwt.user.client.ui.Widget;
38
39
40
41
42
43 public class OldUTGBAddTrackTrack extends TrackBase implements ClickHandler {
44
45 public static TrackFactory factory() {
46 return new TrackFactory() {
47 public Track newInstance() {
48 return new OldUTGBAddTrackTrack();
49 }
50 };
51 }
52
53 private final HorizontalPanel _panel = new HorizontalPanel();
54 private final Button addButton = new Button("Add");
55 private final TextBox descriptionXMLURLBox = new TextBox();
56
57 public OldUTGBAddTrackTrack() {
58 super("Add Track with Desc XML");
59
60 _panel.setSize("100%", "50px");
61 _panel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
62 _panel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
63 _panel.setStyleName("utgb-addtrack");
64 descriptionXMLURLBox.setVisibleLength(100);
65
66 _panel.add(addButton);
67 _panel.add(descriptionXMLURLBox);
68
69 addButton.addClickHandler(this);
70 }
71
72 public Widget getWidget() {
73 return _panel;
74 }
75
76 public int getMinimumWindowHeight() {
77 return 50;
78 }
79
80 public void setUp(TrackFrame trackFrame, TrackGroup group) {
81 trackFrame.pack();
82 }
83
84 public void onClick(ClickEvent e) {
85 final String descriptionXMLURL = descriptionXMLURLBox.getText();
86
87 if (descriptionXMLURL != null && descriptionXMLURL.length() > 0) {
88 final OldUTGBTrack newTrack = new OldUTGBTrack();
89 newTrack.setDescriptionXML(descriptionXMLURL);
90
91 _trackGroup.addTrack(newTrack);
92 }
93 }
94
95 }