Source Code Cross Referenced for IUnBox.java in  » J2EE » WiSerFramework » de » ug2t » unifiedGui » interfaces » 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 » J2EE » WiSerFramework » de.ug2t.unifiedGui.interfaces 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.unifiedGui.interfaces;
032:
033:        import java.util.*;
034:
035:        import de.ug2t.kernel.*;
036:        import de.ug2t.unifiedGui.*;
037:
038:        /**
039:         * @author dirk
040:         * 
041:         * IUnBox is the interface to the boxes. A box is a container which aligns it's
042:         * children either from left to right or from top to bottom. A box might have
043:         * different borders on each side. Alignment, margin and padding settings are
044:         * available as well. The box model is similar to css border-box model. A box
045:         * has two render modes, a layouted one which renders all properties correctly.
046:         * And a simple one which is much more performant but might not render
047:         * alignments, gaps and flexible components correctly. Use this one e.g. for
048:         * cells of large tables.
049:         */
050:        public interface IUnBox extends IUnContainer, IUnComponent {
051:            public static final int LEFT = 0;
052:            public static final int RIGHT = 1;
053:            public static final int TOP = 2;
054:            public static final int BOTTOM = 3;
055:
056:            public static final int BORDER_DOTTED = 0;
057:            public static final int BORDER_DASHED = 1;
058:            public static final int BORDER_DOUBLE = 2;
059:            public static final int BORDER_LINE = 3;
060:
061:            public static final int BOX_CONSTRAINT_NONE = 0;
062:            public static final int BOX_CONSTRAINT_FLEX = 1;
063:            public static final int BOX_CONSTRAINT_FLEXFILLX = 2;
064:            public static final int BOX_CONSTRAINT_FLEXFILLY = 3;
065:            public static final int BOX_CONSTRAINT_FLEXFILLXY = 4;
066:
067:            public static final String[] BORDER_STYLES = { "DOTTED", "DASHED",
068:                    "DOUBLE", "SOLID" };
069:
070:            public static final int VBOX = 0;
071:            public static final int HBOX = 1;
072:
073:            public static final int LAYOUTED = 0;
074:            public static final int SIMPLE = 1;
075:            public static final int SINGLE = 2;
076:
077:            /**
078:             * @author Dirk
079:             * 
080:             * date: 29.05.2007 project: WiSer-Framework
081:             * 
082:             * <p>
083:             * Factory is a convenience class to create components of the surrounding
084:             * interface's type without taking care for the WidgetServer MultiChannel API.
085:             * It's use is similar to a constructor.
086:             * </p>
087:             */
088:            public static class Factory {
089:                /**
090:                 * Creates a standard version of this component as described in the factory.
091:                 * If you create masses of components for e.g. within a renderer use
092:                 * <i> create(IUnApplication xAppl)</i> for performance
093:                 * reasons.
094:                 * 
095:                 * @param xHvType
096:                 *          Either IUnBox.VBOX for vertical alignment of components or IUnBox.HBOX for horizontal 
097:                 *          alignment of components
098:                 * @return new component
099:                 */
100:                public static IUnBox create(int xHvType) {
101:                    IUnApplication l_appl = (IUnApplication) KeRegisteredObject
102:                            .pcmf_getObjByName(IUnApplication.MY_APPL);
103:                    return (l_appl.pcmf_getComponentFactory().pcmf_createBox(
104:                            l_appl.pcmf_getApplType(), "", xHvType, l_appl));
105:                }
106:
107:                /**
108:                 * Creates a special version of this component as described in the factory
109:                 * configuration under the descriptor xFactoryDesc. If you create masses of
110:                 * components for e.g. within a renderer use <i>
111:                 * create(IUnApplication xAppl, String xFactoryDesc)</i> for performance
112:                 * reasons.
113:                 * 
114:                 * @param xHvType
115:                 *          Either IUnBox.VBOX for vertical alignment of components or IUnBox.HBOX for horizontal 
116:                 *          alignment of components
117:                 * @param xFactoryDesc
118:                 *          descriptor
119:                 * @return new component
120:                 */
121:                public static IUnBox create(int xHvType, String xFactoryDesc) {
122:                    IUnApplication l_appl = (IUnApplication) KeRegisteredObject
123:                            .pcmf_getObjByName(IUnApplication.MY_APPL);
124:                    return (l_appl.pcmf_getComponentFactory()
125:                            .pcmf_createBoxPlugin(l_appl.pcmf_getApplType(),
126:                                    "", xHvType, l_appl, xFactoryDesc));
127:                }
128:
129:                /**
130:                 * Creates a standard version of this component as described in the factory
131:                 * within the given application-context. If you create masses of components
132:                 * for e.g. within a renderer use this method for performance reasons.
133:                 * 
134:                 * @param xHvType
135:                 *          Either IUnBox.VBOX for vertical alignment of components or IUnBox.HBOX for horizontal 
136:                 *          alignment of components
137:                 * @param xAppl
138:                 *          application in which context the component is created
139:                 * @return new component
140:                 */
141:                public static IUnBox create(int xHvType, IUnApplication xAppl) {
142:                    return (xAppl.pcmf_getComponentFactory().pcmf_createBox(
143:                            xAppl.pcmf_getApplType(), "", xHvType, xAppl));
144:                }
145:
146:                /**
147:                 * Creates a special version of this component as described in the factory
148:                 * configuration under the descriptor xFactoryDesc. If you create masses of
149:                 * components for e.g. within a renderer use this function for performance
150:                 * reasons.
151:                 * 
152:                 * @param xHvType
153:                 *          Either IUnBox.VBOX for vertical alignment of components or IUnBox.HBOX for horizontal 
154:                 *          alignment of components
155:                 * @param xFactoryDesc
156:                 *          descriptor
157:                 * @param xAppl
158:                 *          application in which context the component is created
159:                 * @return new component
160:                 */
161:                public static IUnBox create(int xHvType, IUnApplication xAppl,
162:                        String xFactoryDesc) {
163:                    return (xAppl.pcmf_getComponentFactory()
164:                            .pcmf_createBoxPlugin(xAppl.pcmf_getApplType(), "",
165:                                    xHvType, xAppl, xFactoryDesc));
166:                }
167:            }
168:
169:            /**
170:             * @author Dirk
171:             * 
172:             * Sets a border to one side of the box
173:             * 
174:             * @param xDir
175:             *          LEFT | RIGTHT | TOP | BOTTOM the side of the box where the border
176:             *          appears
177:             * @param xCol
178:             *          color of the border
179:             * @param xWidth
180:             *          width of the border
181:             * @param xStyle
182:             *          BORDER_DASED | BORDER_DOTTED | BORDER_DOUBLE | BORDER_LINE style
183:             *          of the border
184:             */
185:            public void pcmf_setBorder(int xDir, String xCol, int xWidth,
186:                    int xStyle);
187:
188:            /**
189:             * @author Dirk
190:             * 
191:             * Sets the alignment of all Components rendered within the box
192:             * 
193:             * @param xAlign
194:             *          NORTH | EAST | WEST | SOUTH and combinations like NORTHWEST
195:             */
196:            public void pcmf_setBoxAlign(String xAlign);
197:
198:            /**
199:             * @author Dirk
200:             * 
201:             * Sets the padding to one side of the box. Padding is the space between the
202:             * content and the box
203:             * 
204:             * @param xDir
205:             *          LEFT | RIGTHT | TOP | BOTTOM the side of the box where the padding
206:             *          appears
207:             * @param xWidth
208:             *          space in pixel
209:             */
210:            public void pcmf_setPadding(int xDir, int xWidth);
211:
212:            /**
213:             * @author Dirk
214:             * 
215:             * Sets the margin to one side of the box. argin is the space between the
216:             * border and the outer frame of the box
217:             * 
218:             * @param xDir
219:             *          LEFT | RIGTHT | TOP | BOTTOM the side of the box where the padding
220:             *          appears
221:             * @param xWidth
222:             *          space in pixel
223:             */
224:            public void pcmf_setMargin(int xDir, int xWidth);
225:
226:            /**
227:             * @author Dirk
228:             * 
229:             * Sets the background imgage of the box
230:             * 
231:             * @param xImg
232:             *          background image
233:             */
234:            public void pcmf_setBgImage(IUnImage xImg);
235:
236:            /**
237:             * @author Dirk
238:             * 
239:             * Sts the gap between the Components of the box in pixel
240:             * 
241:             * @param xGap
242:             *          gap in pixel
243:             */
244:            public void pcmf_setGap(int xGap);
245:
246:            /**
247:             * @author Dirk
248:             * 
249:             * Sets whether the box is a horizontal or a verical box
250:             * 
251:             * @param xType
252:             *          HBOX | VBOX
253:             */
254:            public void pcmf_setBoxHVType(int xType);
255:
256:            /**
257:             * @author Dirk
258:             * 
259:             * Sets the type of the box. A Simple box renders only the borders, margins,
260:             * paddings and direction correctly. Alignment and constraints are working
261:             * partly correct. It is much faster in rendering than the layouted box. A
262:             * Single box only renders one child and the borders, margins, paddings and
263:             * orientation WEST | EAST | CENTER. Use this one to box many single items
264:             * like labels.
265:             * 
266:             * @param xType
267:             *          SIMPLE | LAYOUTED | SINGLE
268:             */
269:            public void pcmf_setBoxType(int xType);
270:
271:            /**
272:             * @author Dirk
273:             * 
274:             * Sets a layout contraint to a Component
275:             * 
276:             * @param xObj
277:             *          Component
278:             * @param xConstraint
279:             *          BOX_CONSTRAINT_NONE | BOX_CONSTRAINT_FLEX |
280:             *          BOX_CONSTRAINT_FLEXFILLX | BOX_CONSTRAINT_FLEXFILLY |
281:             *          BOX_CONSTRAINT_FLEXFILLXY
282:             */
283:            public void pcmf_setContraint(UnComponent xObj, int xConstraint);
284:
285:            public class BoxHelper {
286:                // T L B R
287:                public static void pcmf_setBoxPadding(IUnBox xBox, String xVal) {
288:                    StringTokenizer l_tk = new StringTokenizer(xVal, ",; ");
289:
290:                    int l_t = 0;
291:                    int l_l = 0;
292:                    int l_b = 0;
293:                    int l_r = 0;
294:
295:                    if (l_tk.hasMoreElements()) {
296:                        String l_tok = l_tk.nextToken();
297:                        if (!l_tok.trim().equals(""))
298:                            l_t = Integer.parseInt(l_tok);
299:                    }
300:                    if (l_tk.hasMoreElements()) {
301:                        String l_tok = l_tk.nextToken();
302:                        if (!l_tok.trim().equals(""))
303:                            l_l = Integer.parseInt(l_tok);
304:                    }
305:                    if (l_tk.hasMoreElements()) {
306:                        String l_tok = l_tk.nextToken();
307:                        if (!l_tok.trim().equals(""))
308:                            l_b = Integer.parseInt(l_tok);
309:                    }
310:                    if (l_tk.hasMoreElements()) {
311:                        String l_tok = l_tk.nextToken();
312:                        if (!l_tok.trim().equals(""))
313:                            l_r = Integer.parseInt(l_tok);
314:                    }
315:
316:                    xBox.pcmf_setPadding(IUnBox.TOP, l_t);
317:                    xBox.pcmf_setPadding(IUnBox.LEFT, l_l);
318:                    xBox.pcmf_setPadding(IUnBox.RIGHT, l_r);
319:                    xBox.pcmf_setPadding(IUnBox.BOTTOM, l_b);
320:                }
321:
322:                public static void pcmf_setBoxMargin(IUnBox xBox, String xVal) {
323:                    StringTokenizer l_tk = new StringTokenizer(xVal, ",; ");
324:
325:                    int l_t = 0;
326:                    int l_l = 0;
327:                    int l_b = 0;
328:                    int l_r = 0;
329:
330:                    if (l_tk.hasMoreElements()) {
331:                        String l_tok = l_tk.nextToken();
332:                        if (!l_tok.trim().equals(""))
333:                            l_t = Integer.parseInt(l_tok);
334:                    }
335:                    if (l_tk.hasMoreElements()) {
336:                        String l_tok = l_tk.nextToken();
337:                        if (!l_tok.trim().equals(""))
338:                            l_l = Integer.parseInt(l_tok);
339:                    }
340:                    if (l_tk.hasMoreElements()) {
341:                        String l_tok = l_tk.nextToken();
342:                        if (!l_tok.trim().equals(""))
343:                            l_b = Integer.parseInt(l_tok);
344:                    }
345:                    if (l_tk.hasMoreElements()) {
346:                        String l_tok = l_tk.nextToken();
347:                        if (!l_tok.trim().equals(""))
348:                            l_r = Integer.parseInt(l_tok);
349:                    }
350:
351:                    xBox.pcmf_setMargin(IUnBox.TOP, l_t);
352:                    xBox.pcmf_setMargin(IUnBox.LEFT, l_l);
353:                    xBox.pcmf_setMargin(IUnBox.RIGHT, l_r);
354:                    xBox.pcmf_setMargin(IUnBox.BOTTOM, l_b);
355:                }
356:
357:                // "solid, 10, red"
358:                public static void pcmf_setBorderStyle(IUnBox xBox, int xDir,
359:                        String xVal) {
360:                    StringTokenizer l_tk = new StringTokenizer(xVal, ",; ");
361:
362:                    int l_style = IUnBox.BORDER_LINE;
363:                    int l_width = 1;
364:                    String l_color = "black";
365:
366:                    if (l_tk.hasMoreElements()) {
367:                        String l_tok = l_tk.nextToken();
368:                        if (!l_tok.trim().equals("")) {
369:                            l_width = Integer.parseInt(l_tok);
370:                        }
371:                    }
372:                    if (l_tk.hasMoreElements()) {
373:                        String l_tok = l_tk.nextToken();
374:                        if (!l_tok.trim().equals("")) {
375:                            l_tok = l_tok.toUpperCase();
376:                            l_style = Arrays.asList(IUnBox.BORDER_STYLES)
377:                                    .indexOf(l_tok);
378:                        }
379:                    }
380:                    if (l_tk.hasMoreElements()) {
381:                        String l_tok = l_tk.nextToken();
382:                        if (!l_tok.trim().equals("")) {
383:                            l_color = l_tok;
384:                        }
385:                    }
386:                    xBox.pcmf_setBorder(xDir, l_color, l_width, l_style);
387:                }
388:            }
389:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.