Source Code Cross Referenced for Popups.java in  » Ajax » GWT » com » google » gwt » sample » kitchensink » client » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » GWT » com.google.gwt.sample.kitchensink.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package com.google.gwt.sample.kitchensink.client;
017:
018:        import com.google.gwt.user.client.ui.Button;
019:        import com.google.gwt.user.client.ui.ClickListener;
020:        import com.google.gwt.user.client.ui.DialogBox;
021:        import com.google.gwt.user.client.ui.DockPanel;
022:        import com.google.gwt.user.client.ui.HTML;
023:        import com.google.gwt.user.client.ui.Image;
024:        import com.google.gwt.user.client.ui.ListBox;
025:        import com.google.gwt.user.client.ui.PopupPanel;
026:        import com.google.gwt.user.client.ui.VerticalPanel;
027:        import com.google.gwt.user.client.ui.Widget;
028:
029:        /**
030:         * Demonstrates {@link com.google.gwt.user.client.ui.PopupPanel} and
031:         * {@link com.google.gwt.user.client.ui.DialogBox}.
032:         */
033:        public class Popups extends Sink implements  ClickListener {
034:
035:            /**
036:             * A simple dialog box that displays a message, a Frame, and a close button.
037:             */
038:            private static class MyDialog extends DialogBox implements 
039:                    ClickListener {
040:                public MyDialog() {
041:                    setText("Sample DialogBox");
042:
043:                    Button closeButton = new Button("Close", this );
044:                    HTML msg = new HTML(
045:                            "<center>This is an example of a standard dialog box component.</center>",
046:                            true);
047:
048:                    DockPanel dock = new DockPanel();
049:                    dock.setSpacing(4);
050:
051:                    dock.add(closeButton, DockPanel.SOUTH);
052:                    dock.add(msg, DockPanel.NORTH);
053:                    dock.add(new Image("images/jimmy.jpg"), DockPanel.CENTER);
054:
055:                    dock.setCellHorizontalAlignment(closeButton,
056:                            DockPanel.ALIGN_RIGHT);
057:                    dock.setWidth("100%");
058:                    setWidget(dock);
059:                }
060:
061:                public void onClick(Widget sender) {
062:                    hide();
063:                }
064:            }
065:
066:            /**
067:             * A very simple popup that closes automatically when you click off of it.
068:             */
069:            private static class MyPopup extends PopupPanel {
070:                public MyPopup() {
071:                    super (true);
072:
073:                    HTML contents = new HTML(
074:                            "Click anywhere outside this popup to make it disappear.");
075:                    contents.setWidth("128px");
076:                    setWidget(contents);
077:
078:                    setStyleName("ks-popups-Popup");
079:                }
080:            }
081:
082:            public static SinkInfo init() {
083:                return new SinkInfo(
084:                        "Popups",
085:                        "<h2>Popups and Dialog Boxes</h2>"
086:                                + "<p>This page demonstrates GWT's built-in support for in-page "
087:                                + "popups.  The first is a very simple informational popup that closes "
088:                                + "itself automatically when you click off of it.  The second is a more "
089:                                + "complex draggable dialog box. If you're wondering why there's "
090:                                + "a list box at the bottom, it's to demonstrate that you can drag the "
091:                                + "dialog box over it (this obscure corner case often renders incorrectly "
092:                                + "on some browsers).</p>") {
093:
094:                    @Override
095:                    public Sink createInstance() {
096:                        return new Popups();
097:                    }
098:
099:                    @Override
100:                    public String getColor() {
101:                        return "#bf2a2a";
102:                    }
103:                };
104:            }
105:
106:            private Button dialogButton = new Button("Show Dialog", this );
107:            private Button popupButton = new Button("Show Popup", this );
108:
109:            public Popups() {
110:                VerticalPanel panel = new VerticalPanel();
111:                panel.add(popupButton);
112:                panel.add(dialogButton);
113:
114:                ListBox list = new ListBox();
115:                list.setVisibleItemCount(1);
116:                for (int i = 0; i < 10; ++i) {
117:                    list.addItem("list item " + i);
118:                }
119:                panel.add(list);
120:
121:                panel.setSpacing(8);
122:                initWidget(panel);
123:            }
124:
125:            public void onClick(Widget sender) {
126:                if (sender == popupButton) {
127:                    MyPopup p = new MyPopup();
128:                    int left = sender.getAbsoluteLeft() + 10;
129:                    int top = sender.getAbsoluteTop() + 10;
130:                    p.setPopupPosition(left, top);
131:                    p.show();
132:                } else if (sender == dialogButton) {
133:                    DialogBox dlg = new MyDialog();
134:                    dlg.center();
135:                }
136:            }
137:
138:            @Override
139:            public void onShow() {
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.