Source Code Cross Referenced for Grid.java in  » Ajax » NextApp-Echo2 » nextapp » echo2 » app » 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 » NextApp Echo2 » nextapp.echo2.app 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003:         * Copyright (C) 2002-2005 NextApp, Inc.
004:         *
005:         * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006:         *
007:         * The contents of this file are subject to the Mozilla Public License Version
008:         * 1.1 (the "License"); you may not use this file except in compliance with
009:         * the License. You may obtain a copy of the License at
010:         * http://www.mozilla.org/MPL/
011:         *
012:         * Software distributed under the License is distributed on an "AS IS" basis,
013:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014:         * for the specific language governing rights and limitations under the
015:         * License.
016:         *
017:         * Alternatively, the contents of this file may be used under the terms of
018:         * either the GNU General Public License Version 2 or later (the "GPL"), or
019:         * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020:         * in which case the provisions of the GPL or the LGPL are applicable instead
021:         * of those above. If you wish to allow use of your version of this file only
022:         * under the terms of either the GPL or the LGPL, and not to allow others to
023:         * use your version of this file under the terms of the MPL, indicate your
024:         * decision by deleting the provisions above and replace them with the notice
025:         * and other provisions required by the GPL or the LGPL. If you do not delete
026:         * the provisions above, a recipient may use your version of this file under
027:         * the terms of any one of the MPL, the GPL or the LGPL.
028:         */
029:
030:        package nextapp.echo2.app;
031:
032:        /**
033:         * A layout <code>Component</code> which renders its contents in a grid. Each
034:         * component is contained within a "cell" of the grid.
035:         * <code>GridLayoutData</code> layout data objects may used to cause cells to
036:         * expand to fill multiple columns or rows.
037:         * <p>
038:         * <b>Child LayoutData</b>: Children of this component may provide layout
039:         * information using the <code>nextapp.echo2.app.layout.GridLayoutData</code>
040:         * layout data object.
041:         * 
042:         * @see nextapp.echo2.app.layout.GridLayoutData
043:         */
044:        public class Grid extends Component {
045:
046:            public static final int DEFAULT_SIZE = 2;
047:
048:            /**
049:             * Constant value for <code>orientation</code> property indicating cells 
050:             * should be laid out horizontally and then vertically.
051:             * <code>ORIENTATION_HORIZONTAL</code> is the default orientation setting.
052:             */
053:            public static final int ORIENTATION_HORIZONTAL = 0;
054:
055:            /**
056:             * Constant value for <code>orientation</code> property indicating cells 
057:             * should be laid out vertically and then horizontally. 
058:             */
059:            public static final int ORIENTATION_VERTICAL = 1;
060:
061:            public static final String PROPERTY_BORDER = "border";
062:            public static final String PROPERTY_COLUMN_WIDTH = "columnWidth";
063:            public static final String PROPERTY_HEIGHT = "height";
064:            public static final String PROPERTY_INSETS = "insets";
065:            public static final String PROPERTY_ORIENTATION = "orientation";
066:            public static final String PROPERTY_ROW_HEIGHT = "rowHeight";
067:            public static final String PROPERTY_SIZE = "size";
068:            public static final String PROPERTY_WIDTH = "width";
069:
070:            /**
071:             * Creates a new horizontally-oriented <code>Grid</code> with the
072:             * default size (2).
073:             */
074:            public Grid() {
075:                super ();
076:            }
077:
078:            /**
079:             * Creates a new hoirzontally-oriented <code>Grid</code> with the 
080:             * specified size.
081:             * 
082:             * @param size the number of columns
083:             * @see #getSize()
084:             */
085:            public Grid(int size) {
086:                super ();
087:                setSize(size);
088:            }
089:
090:            /**
091:             * Returns the <code>Border</code>.
092:             * 
093:             * @return the border
094:             */
095:            public Border getBorder() {
096:                return (Border) getProperty(PROPERTY_BORDER);
097:            }
098:
099:            /**
100:             * Returns the width of the specified column.
101:             * This property supports <code>Extent</code>s with
102:             * fixed or percentile units.
103:             * 
104:             * @param columnIndex the column index
105:             * @return the width
106:             */
107:            public Extent getColumnWidth(int columnIndex) {
108:                return (Extent) getIndexedProperty(PROPERTY_COLUMN_WIDTH,
109:                        columnIndex);
110:            }
111:
112:            /**
113:             * Returns the overall height.
114:             * This property only supports <code>Extent</code>s with
115:             * fixed (i.e., not percent) units.
116:             * 
117:             * @return the height
118:             */
119:            public Extent getHeight() {
120:                return (Extent) getProperty(PROPERTY_HEIGHT);
121:            }
122:
123:            /**
124:             * Returns the default cell insets. The default cell insets will be used for
125:             * individual child cells that do not provide an <code>Insets</code> value
126:             * in their <code>GridLayoutData</code>.
127:             * 
128:             * @return the default cell insets
129:             */
130:            public Insets getInsets() {
131:                return (Insets) getProperty(PROPERTY_INSETS);
132:            }
133:
134:            /**
135:             * Returns the orientation of the grid (either horizontal or vertical).
136:             * The orientation describes the direction in which cells are laid out.
137:             * An orientation of <code>ORIENTATION_HORIZONTAL</code> (the default)
138:             * specifies that cells should be laid out in horizontal rows
139:             * with the <code>size</code> property specifying the number of columns
140:             * per row.
141:             * An orientation of <code>ORIENTATION_VERTICAL</code>
142:             * specifies that cells should be laid out in vertical columns
143:             * with the <code>size</code> property specifying the number of rows
144:             * per column.
145:             * 
146:             * @return the orientation, one of the following values:
147:             *         <ul>
148:             *         <li><code>ORIENTATION_HORIZONTAL</code> (the default)</li>
149:             *         <li><code>ORIENTATION_VERTICAL</code></li>
150:             *         </ul>
151:             * @see #setOrientation
152:             */
153:            public int getOrientation() {
154:                Integer orientationValue = (Integer) getProperty(PROPERTY_ORIENTATION);
155:                return orientationValue == null ? ORIENTATION_HORIZONTAL
156:                        : orientationValue.intValue();
157:            }
158:
159:            /**
160:             * Returns the height of the specified row.
161:             * This property only supports <code>Extent</code>s with
162:             * fixed (i.e., not percent) units.
163:             * 
164:             * @param rowIndex the row index
165:             * @return the height
166:             */
167:            public Extent getRowHeight(int rowIndex) {
168:                return (Extent) getIndexedProperty(PROPERTY_ROW_HEIGHT,
169:                        rowIndex);
170:            }
171:
172:            /**
173:             * Returns the number of columns or rows in the <code>Grid</code>.
174:             * If the <code>orientation</code> property is set to 
175:             * <code>ORIENTATION_HORIZONTAL</code>, this property represents the
176:             * number of columns in the <code>Grid</code>.
177:             * If the <code>orientation</code> property is set to 
178:             * <code>ORIENTATION_VERTICAL</code>, this property represents the
179:             * number of rows in the <code>Grid</code>.
180:             * 
181:             * @return the number of columns or rows  
182:             */
183:            public int getSize() {
184:                Integer sizeValue = (Integer) getProperty(PROPERTY_SIZE);
185:                if (sizeValue == null) {
186:                    return DEFAULT_SIZE;
187:                } else {
188:                    return sizeValue.intValue();
189:                }
190:            }
191:
192:            /**
193:             * Returns the overall width of the grid.
194:             * This property supports <code>Extent</code>s with
195:             * fixed or percentile units.
196:             * 
197:             * @return the width
198:             */
199:            public Extent getWidth() {
200:                return (Extent) getProperty(PROPERTY_WIDTH);
201:            }
202:
203:            /**
204:             * Sets the <code>Border</code>.
205:             * 
206:             * @param newValue the new border
207:             */
208:            public void setBorder(Border newValue) {
209:                setProperty(PROPERTY_BORDER, newValue);
210:            }
211:
212:            /**
213:             * Sets the width of the specified column.
214:             * This property supports <code>Extent</code>s with
215:             * fixed or percentile units.
216:             * 
217:             * @param columnIndex the column index
218:             * @param newValue the new width
219:             */
220:            public void setColumnWidth(int columnIndex, Extent newValue) {
221:                setIndexedProperty(PROPERTY_COLUMN_WIDTH, columnIndex, newValue);
222:            }
223:
224:            /**
225:             * Sets the overall height of the grid.
226:             * This property only supports <code>Extent</code>s with
227:             * fixed (i.e., not percent) units.
228:             * 
229:             * @param newValue the new height
230:             */
231:            public void setHeight(Extent newValue) {
232:                setProperty(PROPERTY_HEIGHT, newValue);
233:            }
234:
235:            /**
236:             * Sets the default cell insets. The default cell insets will be used for
237:             * individual child cells that do not provide an <code>Insets</code> value
238:             * in their <code>GridLayoutData</code>.
239:             * 
240:             * @param newValue the new default cell insets
241:             */
242:            public void setInsets(Insets newValue) {
243:                setProperty(PROPERTY_INSETS, newValue);
244:            }
245:
246:            /**
247:             * Sets the orientation of the grid (either horizontal or vertical).
248:             * The orientation describes the direction in which cells are laid out.
249:             * An orientation of <code>ORIENTATION_HORIZONTAL</code> (the default)
250:             * specifies that cells should be laid out in horizontal rows
251:             * with the <code>size</code> property specifying the number of columns
252:             * per row.
253:             * An orientation of <code>ORIENTATION_VERTICAL</code>
254:             * specifies that cells should be laid out in vertical columns
255:             * with the <code>size</code> property specifying the number of rows
256:             * per column.
257:             * 
258:             * @param newValue the new orientation, one of the following values:
259:             *        <ul>
260:             *        <li><code>ORIENTATION_HORIZONTAL</code> (the default)</li>
261:             *        <li><code>ORIENTATION_VERTICAL</code></li>
262:             *        </ul>
263:             */
264:            public void setOrientation(int newValue) {
265:                setProperty(PROPERTY_ORIENTATION, new Integer(newValue));
266:            }
267:
268:            /**
269:             * Sets the height of the specified row.
270:             * This property only supports <code>Extent</code>s with
271:             * fixed (i.e., not percent) units.
272:             * 
273:             * @param rowIndex the row index
274:             * @param newValue the new height
275:             */
276:            public void setRowHeight(int rowIndex, Extent newValue) {
277:                setIndexedProperty(PROPERTY_ROW_HEIGHT, rowIndex, newValue);
278:            }
279:
280:            /**
281:             * Sets the number of columns or rows in the grid.
282:             * If the <code>orientation</code> property is set to 
283:             * <code>ORIENTATION_HORIZONTAL</code>, this property represents the
284:             * number of columns in the <code>Grid</code>.
285:             * If the <code>orientation</code> property is set to 
286:             * <code>ORIENTATION_VERTICAL</code>, this property represents the
287:             * number of rows in the <code>Grid</code>.
288:             * 
289:             * @param newValue the number of columns or rows
290:             * @see #getSize()
291:             */
292:            public void setSize(int newValue) {
293:                setProperty(PROPERTY_SIZE, new Integer(newValue));
294:            }
295:
296:            /**
297:             * Sets the overall width of the grid.
298:             * This property supports <code>Extent</code>s with
299:             * fixed or percentile units.
300:             * 
301:             * @param newValue the new width
302:             */
303:            public void setWidth(Extent newValue) {
304:                setProperty(PROPERTY_WIDTH, newValue);
305:            }
306:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.