01: /*
02: * MyGWT Widget Library
03: * Copyright(c) 2007, MyGWT.
04: * licensing@mygwt.net
05: *
06: * http://mygwt.net/license
07: */
08: package net.mygwt.samples.explorer.client;
09:
10: import net.mygwt.samples.resources.client.TestData;
11: import net.mygwt.ui.client.MyDOM;
12: import net.mygwt.ui.client.Style;
13: import net.mygwt.ui.client.event.BaseEvent;
14: import net.mygwt.ui.client.event.SelectionListener;
15: import net.mygwt.ui.client.fx.FXStyle;
16: import net.mygwt.ui.client.util.Rectangle;
17: import net.mygwt.ui.client.widget.Button;
18: import net.mygwt.ui.client.widget.ButtonBar;
19: import net.mygwt.ui.client.widget.ContentPanel;
20: import net.mygwt.ui.client.widget.WidgetContainer;
21: import net.mygwt.ui.client.widget.layout.FlowLayout;
22:
23: import com.google.gwt.user.client.ui.VerticalPanel;
24:
25: public class FXPage extends Page {
26:
27: private ContentPanel cp;
28: private FXStyle fx;
29:
30: protected void createWidget(WidgetContainer container) {
31: VerticalPanel vp = new VerticalPanel();
32: vp.setSpacing(10);
33:
34: cp = new ContentPanel(Style.HEADER | Style.COLLAPSE,
35: "my-cpanel-small");
36: cp.setText("FX Demo");
37: cp.setIconStyle("icon-text");
38: cp.addText(TestData.DUMMY_TEXT_SHORT);
39:
40: cp.setWidth(200);
41:
42: fx = new FXStyle(cp.getElement());
43:
44: ButtonBar buttonBar = new ButtonBar(Style.LEFT);
45: buttonBar.add(new Button("Slide In / Out",
46: new SelectionListener() {
47: public void widgetSelected(BaseEvent be) {
48: if (MyDOM.isVisible(cp.getElement())) {
49: fx.slideOut(Style.NORTH);
50: } else {
51: fx.slideIn(Style.SOUTH);
52: }
53: }
54: }));
55: buttonBar.add(new Button("Fade In / Out",
56: new SelectionListener() {
57: public void widgetSelected(BaseEvent be) {
58: fx.fadeToggle();
59: }
60: }));
61: buttonBar.add(new Button("Move", new SelectionListener() {
62: public void widgetSelected(BaseEvent be) {
63: Rectangle rect = MyDOM.getBounds(cp.getElement());
64: fx.move(rect.x + 50, rect.y + 50);
65: }
66: }));
67:
68: buttonBar.add(new Button("Blink", new SelectionListener() {
69: public void widgetSelected(BaseEvent be) {
70: fx.blink();
71: }
72: }));
73:
74: vp.add(buttonBar);
75: vp.add(cp);
76:
77: container.setLayout(new FlowLayout());
78: container.add(vp);
79: }
80:
81: }
|