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.ribbon.client.ui;
26
27 import org.utgenome.gwt.utgb.client.ui.FixedWidthLabel;
28 import org.utgenome.gwt.utgb.client.ui.RoundCornerFrame;
29 import org.utgenome.gwt.widget.client.Style;
30
31 import com.google.gwt.event.dom.client.ClickEvent;
32 import com.google.gwt.event.dom.client.ClickHandler;
33 import com.google.gwt.user.client.ui.AbsolutePanel;
34 import com.google.gwt.user.client.ui.Button;
35 import com.google.gwt.user.client.ui.Composite;
36 import com.google.gwt.user.client.ui.Label;
37 import com.google.gwt.user.client.ui.SimplePanel;
38 import com.google.gwt.user.client.ui.TabPanel;
39 import com.google.gwt.widgetideas.graphics.client.Color;
40 import com.google.gwt.widgetideas.graphics.client.GWTCanvas;
41
42
43
44
45
46
47
48 public class WeaverCanvas extends Composite {
49
50 private final AbsolutePanel mainPanel;
51 private final GWTCanvas canvas1;
52 private final GWTCanvas canvas2;
53
54 public WeaverCanvas() {
55
56 int width = 800;
57 int height = 500;
58 mainPanel = new AbsolutePanel();
59 mainPanel.setPixelSize(width, height);
60 canvas1 = new GWTCanvas(width, height);
61 canvas2 = new GWTCanvas(width, height);
62
63
64
65
66
67
68 canvas1.setFillStyle(new Color(200, 0, 0, 0.7f));
69 canvas1.fillRect(0, 0, 150, 150);
70
71 canvas2.setFillStyle(new Color(100, 200, 250));
72 canvas2.fillRect(30, 20, 200, 150);
73 canvas2.setFillStyle(new Color(200, 50, 240, 0.4f));
74 canvas2.fillRect(130, 40, 150, 40);
75
76 mainPanel.add(canvas2, 0, 0);
77 mainPanel.add(canvas1, 0, 0);
78
79 TabPanel tabPanel = new TabPanel();
80
81 RoundCornerFrame tab1 = new RoundCornerFrame("336699", 0.8f, 4);
82 RoundCornerFrame tab2 = new RoundCornerFrame("336699", 0.8f, 4);
83 tab2.setFrameColor("336699", 0.3f);
84
85 Label tl = new Label("Track Groups");
86 Style.fontColor(tl, "white");
87 Style.bold(tl);
88 Style.nowrap(tl);
89 Label tl2 = new Label("Tracks");
90 Style.fontColor(tl2, "white");
91 Style.bold(tl2);
92 Style.nowrap(tl2);
93
94 tab1.setWidget(tl);
95 tab2.setWidget(tl2);
96 tabPanel.add(new SimplePanel(), tab1);
97 tabPanel.add(new SimplePanel(), tab2);
98
99 mainPanel.add(tabPanel, 100, 100);
100
101 final RoundCornerFrame f = new RoundCornerFrame("3E5A77", 0.8f, 4);
102 final FixedWidthLabel l = new FixedWidthLabel("Hello World. Nice to meet you. Welcome to UTGB Toolkit", 200);
103 Style.fontSize(l, 12);
104 Style.fontColor(l, "white");
105
106 f.setWidget(l);
107
108
109
110
111
112
113
114
115
116
117 mainPanel.add(f, 10, 10);
118
119 final GWTCanvas canvas = new GWTCanvas(100, 100);
120 canvas.setFillStyle(new Color("rgba(100, 100, 255, 0.5)"));
121 canvas.fillRect(10, 20, 50, 30);
122
123 mainPanel.add(canvas, 40, 40);
124
125 Button scale = new Button("scale");
126 scale.addClickHandler(new ClickHandler() {
127
128 boolean on = false;
129
130 public void onClick(ClickEvent event) {
131 Style.scaleXwithAnimation(canvas, on ? 5 : 1.5, 0.5);
132 on = !on;
133 }
134 });
135
136 mainPanel.add(scale, 100, 300);
137
138 initWidget(mainPanel);
139 }
140
141 private int pos = 0;
142
143 public void move() {
144
145 pos += 2;
146
147
148 mainPanel.add(canvas1, pos, pos);
149
150 }
151
152 public void fade() {
153
154 }
155
156 }