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 com.google.gwt.user.client.ui.HorizontalPanel;
11:
12: import net.mygwt.samples.resources.client.TestData;
13: import net.mygwt.ui.client.Style;
14: import net.mygwt.ui.client.fx.Draggable;
15: import net.mygwt.ui.client.widget.ContentPanel;
16: import net.mygwt.ui.client.widget.WidgetContainer;
17:
18: public class DraggablePage extends Page {
19:
20: protected void createWidget(WidgetContainer container) {
21: final HorizontalPanel vp = new HorizontalPanel();
22: vp.setSpacing(10);
23:
24: ContentPanel cp = new ContentPanel(Style.HEADER
25: | Style.COLLAPSE, "my-cpanel-small");
26: cp.setStyleAttribute("margin", "10");
27: cp.setText("Proxy Drag");
28: cp.setPadding(5);
29: cp.addText(TestData.DUMMY_TEXT_SHORT);
30: cp.setWidth(200);
31:
32: vp.add(cp);
33:
34: Draggable d = new Draggable(cp);
35: d.container = container;
36:
37: cp = new ContentPanel(Style.HEADER | Style.COLLAPSE,
38: "my-cpanel-small");
39: cp.setStyleAttribute("margin", "10");
40: cp.setText("Direct Drag");
41: cp.setIconStyle("icon-text");
42: cp.setPadding(5);
43: cp.addText("Drags can only be started from the header.");
44: cp.setWidth(200);
45: vp.add(cp);
46:
47: d = new Draggable(cp, cp.getHeader());
48: d.container = container;
49: d.useProxy = false;
50:
51: cp = new ContentPanel(Style.HEADER | Style.NONE,
52: "my-cpanel-small");
53: cp.setStyleAttribute("margin", "10");
54: cp.setText("Constrain");
55: cp.setIconStyle("icon-text");
56: cp.setPadding(5);
57: cp.addText("Can only be dragged vertically.");
58: cp.setWidth(200);
59: vp.add(cp);
60:
61: d = new Draggable(cp, cp.getHeader());
62: d.container = container;
63: d.constrainHorizontal = true;
64:
65: container.add(vp);
66: container.setScrollEnabled(true);
67: }
68:
69: }
|