Source Code Cross Referenced for CellPanel.java in  » Ajax » GWT » com » google » gwt » user » client » ui » 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.user.client.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 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.user.client.ui;
017:
018:        import com.google.gwt.user.client.DOM;
019:        import com.google.gwt.user.client.Element;
020:        import com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant;
021:        import com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant;
022:
023:        /**
024:         * A panel whose child widgets are contained within the cells of a table. Each
025:         * cell's size may be set independently. Each child widget can take up a subset
026:         * of its cell and can be aligned within it.
027:         */
028:        public abstract class CellPanel extends ComplexPanel {
029:
030:            private int spacing;
031:            private Element table, body;
032:
033:            public CellPanel() {
034:                table = DOM.createTable();
035:                body = DOM.createTBody();
036:                DOM.appendChild(table, body);
037:                setElement(table);
038:            }
039:
040:            /**
041:             * Gets the amount of spacing between this panel's cells.
042:             * 
043:             * @return the inter-cell spacing, in pixels
044:             */
045:            public int getSpacing() {
046:                return spacing;
047:            }
048:
049:            /**
050:             * Sets the width of the border to be applied to all cells in this panel. This
051:             * is particularly useful when debugging layouts, in that it allows you to see
052:             * explicitly the cells that contain this panel's children.
053:             * 
054:             * @param width the width of the panel's cell borders, in pixels
055:             */
056:            public void setBorderWidth(int width) {
057:                DOM.setElementProperty(table, "border", "" + width);
058:            }
059:
060:            /**
061:             * Sets the height of the cell associated with the given widget, related to
062:             * the panel as a whole.
063:             * 
064:             * @param w the widget whose cell height is to be set
065:             * @param height the cell's height, in CSS units
066:             */
067:            public void setCellHeight(Widget w, String height) {
068:                Element td = DOM.getParent(w.getElement());
069:                DOM.setElementProperty(td, "height", height);
070:            }
071:
072:            /**
073:             * Sets the horizontal alignment of the given widget within its cell.
074:             * 
075:             * @param w the widget whose horizontal alignment is to be set
076:             * @param align the widget's horizontal alignment, as defined in
077:             *          {@link HasHorizontalAlignment}.
078:             */
079:            public void setCellHorizontalAlignment(Widget w,
080:                    HorizontalAlignmentConstant align) {
081:                Element td = getWidgetTd(w);
082:                if (td != null) {
083:                    setCellHorizontalAlignment(td, align);
084:                }
085:            }
086:
087:            /**
088:             * Sets the vertical alignment of the given widget within its cell.
089:             * 
090:             * @param w the widget whose vertical alignment is to be set
091:             * @param align the widget's vertical alignment, as defined in
092:             *          {@link HasVerticalAlignment}.
093:             */
094:            public void setCellVerticalAlignment(Widget w,
095:                    VerticalAlignmentConstant align) {
096:                Element td = getWidgetTd(w);
097:                if (td != null) {
098:                    setCellVerticalAlignment(td, align);
099:                }
100:            }
101:
102:            /**
103:             * Sets the width of the cell associated with the given widget, related to the
104:             * panel as a whole.
105:             * 
106:             * @param w the widget whose cell width is to be set
107:             * @param width the cell's width, in CSS units
108:             */
109:            public void setCellWidth(Widget w, String width) {
110:                Element td = DOM.getParent(w.getElement());
111:                DOM.setElementProperty(td, "width", width);
112:            }
113:
114:            /**
115:             * Sets the amount of spacing between this panel's cells.
116:             * 
117:             * @param spacing the inter-cell spacing, in pixels
118:             */
119:            public void setSpacing(int spacing) {
120:                this .spacing = spacing;
121:                DOM.setElementPropertyInt(table, "cellSpacing", spacing);
122:            }
123:
124:            protected Element getBody() {
125:                return body;
126:            }
127:
128:            protected Element getTable() {
129:                return table;
130:            }
131:
132:            protected void setCellHorizontalAlignment(Element td,
133:                    HorizontalAlignmentConstant align) {
134:                DOM.setElementProperty(td, "align", align.getTextAlignString());
135:            }
136:
137:            protected void setCellVerticalAlignment(Element td,
138:                    VerticalAlignmentConstant align) {
139:                DOM.setStyleAttribute(td, "verticalAlign", align
140:                        .getVerticalAlignString());
141:            }
142:
143:            private Element getWidgetTd(Widget w) {
144:                if (w.getParent() != this) {
145:                    return null;
146:                }
147:                return DOM.getParent(w.getElement());
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.