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.Style;
12: import net.mygwt.ui.client.event.BaseEvent;
13: import net.mygwt.ui.client.event.SelectionListener;
14: import net.mygwt.ui.client.widget.Button;
15: import net.mygwt.ui.client.widget.ExpandBar;
16: import net.mygwt.ui.client.widget.ExpandItem;
17: import net.mygwt.ui.client.widget.Shell;
18: import net.mygwt.ui.client.widget.WidgetContainer;
19: import net.mygwt.ui.client.widget.layout.FillLayout;
20:
21: import com.google.gwt.user.client.ui.HorizontalPanel;
22:
23: public class ExpandBarPage extends Page {
24:
25: protected void createWidget(WidgetContainer container) {
26: HorizontalPanel hp = new HorizontalPanel();
27: hp.setSpacing(10);
28:
29: ExpandBar expandBar = new ExpandBar(Style.SINGLE | Style.HEADER);
30: expandBar.setSize(200, 300);
31: fillBar(expandBar);
32: hp.add(expandBar);
33:
34: expandBar = new ExpandBar(Style.MULTI);
35: expandBar.setWidth(200);
36: fillBar(expandBar);
37: hp.add(expandBar);
38:
39: expandBar = new ExpandBar(Style.SINGLE);
40: expandBar.setBorders(false);
41: fillBar(expandBar);
42:
43: final Shell shell = new Shell(Style.CLOSE | Style.RESIZE);
44: shell.setText("ExpandBar");
45: shell.setSize(300, 300);
46: WidgetContainer c = shell.getContent();
47: c.setLayout(new FillLayout());
48: c.add(expandBar);
49:
50: Button btn = new Button("Open", new SelectionListener() {
51: public void widgetSelected(BaseEvent be) {
52: shell.open();
53: }
54: });
55: hp.add(btn);
56:
57: container.add(hp);
58:
59: }
60:
61: private void fillBar(ExpandBar expandBar) {
62: ExpandItem item1 = new ExpandItem();
63: item1.setText("Item 1");
64: item1.getContainer().addText(TestData.DUMMY_TEXT_SHORT);
65: expandBar.add(item1);
66:
67: ExpandItem item2 = new ExpandItem();
68: item2.setText("Item 2");
69: item2.getContainer().addText(TestData.DUMMY_TEXT_SHORT);
70: expandBar.add(item2);
71:
72: ExpandItem item3 = new ExpandItem();
73: item3.setText("Item 3");
74: item3.getContainer().addText(TestData.DUMMY_TEXT_SHORT);
75: expandBar.add(item3);
76:
77: item1.setExpanded(true);
78: }
79:
80: }
|