001: /*
002: * GWT-Ext Widget Library
003: * Copyright(c) 2007-2008, GWT-Ext.
004: * licensing@gwt-ext.com
005: *
006: * http://www.gwt-ext.com/license
007: */
008: package com.gwtext.sample.showcase2.client.panel;
009:
010: import com.google.gwt.user.client.ui.HorizontalPanel;
011: import com.gwtext.client.core.EventObject;
012: import com.gwtext.client.core.Function;
013: import com.gwtext.client.dd.DD;
014: import com.gwtext.client.widgets.*;
015: import com.gwtext.client.widgets.event.ButtonListenerAdapter;
016: import com.gwtext.client.widgets.layout.FitLayout;
017: import com.gwtext.client.widgets.layout.VerticalLayout;
018: import com.gwtext.sample.showcase2.client.SampleData;
019: import com.gwtext.sample.showcase2.client.ShowcasePanel;
020:
021: public class PanelsSample extends ShowcasePanel {
022:
023: public String getSourceUrl() {
024: return "source/panel/PanelsSample.java.html";
025: }
026:
027: public String getCssUrl() {
028: return "source/panel/PanelsSample.css.html";
029: }
030:
031: public Panel getViewPanel() {
032: if (panel == null) {
033: panel = new Panel();
034:
035: HorizontalPanel horizontalPanel = new HorizontalPanel();
036: horizontalPanel.setSpacing(15);
037:
038: Panel collapsiblePanel = new Panel();
039: collapsiblePanel.setTitle("Collapsible Panel");
040: collapsiblePanel.setWidth(200);
041: collapsiblePanel.setCollapsible(true);
042: collapsiblePanel.setHtml(SampleData.getShortBogusMarkup());
043:
044: Panel iconPanel = new Panel();
045: iconPanel.setTitle("Icon Panel");
046: iconPanel.setIconCls("paste-icon");
047: iconPanel.setWidth(200);
048: iconPanel.setHtml(SampleData.getShortBogusMarkup());
049: iconPanel.setShadow(true);
050:
051: HorizontalPanel horizontalPanel2 = new HorizontalPanel();
052: horizontalPanel2.setSpacing(15);
053:
054: Panel draggablePanel = new Panel();
055: draggablePanel.setTitle("Draggable Panel");
056: draggablePanel.setDraggable(true);
057: draggablePanel.setWidth(200);
058: draggablePanel.setHtml(SampleData.getShortBogusMarkup());
059: draggablePanel.setShadow(true);
060: DD dd = new DD(draggablePanel);
061:
062: Panel toolsPanel = new Panel();
063: toolsPanel.setTitle("Tools Panel");
064: toolsPanel.setIconCls("paste-icon");
065: toolsPanel.setWidth(200);
066: toolsPanel.setHtml(SampleData.getShortBogusMarkup());
067: toolsPanel.setShadow(true);
068: toolsPanel.addTool(new Tool(Tool.GEAR, new Function() {
069: public void execute() {
070: MessageBox.alert("Settings",
071: "The Settings tool was clicked");
072: }
073: }, "Settings"));
074: toolsPanel.addTool(new Tool(Tool.SEARCH, new Function() {
075: public void execute() {
076: MessageBox.alert("Search",
077: "The Search tool was clicked");
078: }
079: }, "Search"));
080:
081: Panel windowPanel = new Panel();
082: windowPanel.setHtml(SampleData.getShortBogusMarkup());
083: windowPanel.setShadow(true);
084:
085: final Window window = new Window();
086: window.setTitle("Window Panel");
087: window.setIconCls("paste-icon");
088: window.setMaximizable(true);
089: window.setResizable(true);
090: window.setLayout(new FitLayout());
091: window.setWidth(200);
092: window.setModal(false);
093:
094: window.addTool(new Tool(Tool.REFRESH, new Function() {
095: public void execute() {
096: MessageBox.alert("Refresh",
097: "The Refresh tool was clicked");
098: }
099: }, "Refresh"));
100: window.addTool(new Tool(Tool.PIN, new Function() {
101: public void execute() {
102: MessageBox.alert("Pin", "The Pin tool was clicked");
103: }
104: }, "Pin"));
105: window.add(windowPanel);
106:
107: Button button = new Button("Show Window Panel",
108: new ButtonListenerAdapter() {
109: public void onClick(Button button, EventObject e) {
110: window.show();
111: }
112: });
113:
114: window.setAnimateTarget(button.getId());
115:
116: horizontalPanel.add(collapsiblePanel);
117: horizontalPanel.add(toolsPanel);
118: horizontalPanel2.add(draggablePanel);
119: horizontalPanel2.add(button);
120:
121: Panel verticalPanel = new Panel();
122: verticalPanel.setLayout(new VerticalLayout(15));
123: verticalPanel.add(horizontalPanel);
124: verticalPanel.add(horizontalPanel2);
125:
126: panel.add(verticalPanel);
127: }
128: return panel;
129: }
130:
131: public String getIntro() {
132: return "A demonstration of basic Panel styles and configurations.";
133: }
134: }
|