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.widget.client;
26
27 import org.utgenome.gwt.widget.client.impl.TrackPanelBase;
28
29 import com.google.gwt.user.client.ui.FocusPanel;
30 import com.google.gwt.user.client.ui.HorizontalPanel;
31 import com.google.gwt.user.client.ui.Label;
32 import com.google.gwt.user.client.ui.ScrollPanel;
33 import com.google.gwt.user.client.ui.VerticalPanel;
34 import com.google.gwt.user.client.ui.Widget;
35
36
37
38
39
40
41
42
43 public class TrackWindowPanel extends TrackPanelBase {
44
45 private FrameBorder border;
46 private ScrollPanel scrollPanel = new ScrollPanel();
47 private FocusPanel labelFrame = new FocusPanel();
48 private HorizontalPanel titleFrame = new HorizontalPanel();
49 private VerticalPanel layoutPanel = new VerticalPanel();
50 private String title;
51 private Label titleLabel = new Label();
52
53 public TrackWindowPanel() {
54 drawWidget();
55
56 initWidget(layoutPanel);
57 }
58
59 protected void drawWidget() {
60
61
62 setTrackTitle("Track");
63 Style.fontSize(titleLabel, 11);
64 Style.fontFamily(titleLabel, "Tahoma, Arial, Verdana");
65 Style.set(titleLabel, "color", "white");
66 Style.overflowHidden(titleLabel);
67 Style.fullBlock(titleLabel);
68 labelFrame.add(titleLabel);
69
70
71 Style.fullWidth(labelFrame);
72 Style.cursor(labelFrame, Style.CURSOR_MOVE);
73
74
75 titleFrame.setHeight("23px");
76
77 Style.fullWidth(titleFrame);
78 Label windowLeftCorner = new Label();
79 windowLeftCorner.setSize("9px", "23px");
80 Style.fontSize(windowLeftCorner, 0);
81 Style.backgroundImage(windowLeftCorner, "theme/default/tdl.gif");
82 Style.backgroundNoRepeat(windowLeftCorner);
83 Label windowRightCorner = new Label();
84 windowRightCorner.setSize("9px", "23px");
85 Style.fontSize(windowRightCorner, 0);
86 Style.backgroundImage(windowRightCorner, "theme/default/tdr.gif");
87 Style.backgroundNoRepeat(windowRightCorner);
88
89
90 HorizontalPanel titleBarFrame = new HorizontalPanel();
91 titleBarFrame.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
92 titleBarFrame.setHeight("23px");
93 titleBarFrame.add(labelFrame);
94 titleBarFrame.setCellWidth(labelFrame, "100%");
95 titleBarFrame.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
96 titleBarFrame.add(getIconSetPanel());
97 Style.fullWidth(titleBarFrame);
98 Style.backgroundImage(titleBarFrame, "theme/default/td.gif");
99 Style.backgroundRepeatX(titleBarFrame);
100 Style.backgroundColor(titleBarFrame, "EEEEEE");
101
102
103 titleFrame.add(windowLeftCorner);
104 titleFrame.add(titleBarFrame);
105 titleFrame.setCellWidth(titleBarFrame, "100%");
106 titleFrame.add(windowRightCorner);
107
108
109 VerticalPanel borderContent = new VerticalPanel();
110
111
112
113 Style.fullSize(layoutPanel);
114 layoutPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
115 layoutPanel.add(titleFrame);
116
117
118 borderContent.add(scrollPanel);
119
120
121
122
123 HorizontalPanel hp = new HorizontalPanel();
124 Style.fullWidth(hp);
125
126 Style.backgroundColor(hp, "E0E0E0");
127 hp.setHeight("16px");
128 hp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
129 hp.add(getResizeButton());
130 borderContent.add(hp);
131
132
133 border = new FrameBorder(2, FrameBorder.EAST | FrameBorder.SOUTH | FrameBorder.WEST);
134 Style.fullWidth(border);
135 border.setWidget(borderContent);
136 layoutPanel.add(border);
137
138
139 setWidth(200);
140 setHeight(100);
141 }
142
143 public void setWidth(int pixelWidth) {
144 if (pixelWidth >= 0) {
145 layoutPanel.setWidth(pixelWidth + "px");
146 scrollPanel.setWidth(pixelWidth - 4 + "px");
147 }
148 }
149
150 public void setHeight(int pixelHeight) {
151 if (pixelHeight >= 41) {
152 layoutPanel.setWidth(pixelHeight + "px");
153 border.setHeight(pixelHeight - 23 + "px");
154 scrollPanel.setHeight(pixelHeight - 41 + "px");
155 }
156 }
157
158 public void addTrackButtonListener(TrackButtonListener listener) {
159 iconSet.addTrackButtonListener(listener);
160 }
161
162 public Widget getDraggableWidget() {
163 return labelFrame;
164 }
165
166 public String getTrackTitle() {
167 return title;
168 }
169
170 public void setTrackTitle(String title) {
171 this.title = title;
172 titleLabel.setText(title);
173 titleLabel.setTitle(title);
174 }
175
176 public void setTrackContent(Widget w) {
177 scrollPanel.setWidget(w);
178 }
179
180 }