Source Code Cross Referenced for Splitter.java in  » Ajax » zk » org » zkoss » zul » 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 » zk » org.zkoss.zul 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Splitter.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Thu Jun  8 14:54:05     2006, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2006 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        }}IS_RIGHT
016:         */
017:        package org.zkoss.zul;
018:
019:        import org.zkoss.lang.Objects;
020:        import org.zkoss.xml.HTMLs;
021:        import org.zkoss.zk.ui.Component;
022:        import org.zkoss.zk.ui.UiException;
023:        import org.zkoss.zk.ui.WrongValueException;
024:        import org.zkoss.zk.ui.event.Events;
025:        import org.zkoss.zk.ui.ext.client.Openable;
026:        import org.zkoss.zul.impl.XulElement;
027:
028:        /**
029:         * An element which should appear before or after an element inside a box
030:         * ({@link Box}, {@link Vbox} and {@link Hbox}).
031:         *
032:         * <p>When the splitter is dragged, the sibling elements of the splitter are
033:         * resized. If {@link #getCollapse} is true, a grippy in placed
034:         * inside the splitter, and one sibling element of the splitter is collapsed
035:         * when the grippy is clicked.
036:         *
037:         * <p>Events: onOpen
038:         *
039:         * <p>Default {@link #getSclass}: splitter.
040:         * 
041:         * @author tomyeh
042:         */
043:        public class Splitter extends XulElement {
044:            private String _collapse = "none";
045:            private boolean _open = true;
046:
047:            public Splitter() {
048:                setSclass("splitter");
049:            }
050:
051:            /** Returns the orientation of the splitter.
052:             * It is the same as the parent's orientation ({@link Box#getOrient}.
053:             */
054:            public String getOrient() {
055:                final Box box = (Box) getParent();
056:                return box != null ? box.getOrient() : "vertical";
057:            }
058:
059:            /** Returns which side of the splitter is collapsed when its grippy
060:             * is clicked. If this attribute is not specified, the splitter will
061:             * not cause a collapse.
062:             * If it is collapsed, {@link #isOpen} returns false.
063:             *
064:             * <p>Default: none.
065:             *
066:             * <p>The returned value can be one ofthe following.
067:             *
068:             * <dl>
069:             * <dt>none</dt>
070:             * <dd>No collpasing occurs.</dd>
071:             * <dt>before</dt>
072:             * <dd>When the grippy is clicked, the element immediately
073:             * before the splitter in the same parent is collapsed so that
074:             * its width or height is 0.</dd>
075:             * <dt>after</dt>
076:             * <dd>When the grippy is clicked, the element immediately
077:             * after the splitter in the same parent is collapsed so that
078:             * its width or height is 0.</dd>
079:             * </dl>
080:             *
081:             * <p>Unlike XUL, you don't have to put a so-called grippy component
082:             * as a child of the spiltter.
083:             */
084:            public String getCollapse() {
085:                return _collapse;
086:            }
087:
088:            /** Sets which side of the splitter is collapsed when its grippy
089:             * is clicked. If this attribute is not specified, the splitter will
090:             * not cause a collapse.
091:             *
092:             * @param collapse one of none, before and after.
093:             * If null or empty is specified, none is assumed.
094:             * @see #getCollapse
095:             */
096:            public void setCollapse(String collapse) throws WrongValueException {
097:                if (collapse == null || collapse.length() == 0)
098:                    collapse = "none";
099:                else if (!"none".equals(collapse) && !"before".equals(collapse)
100:                        && !"after".equals(collapse))
101:                    throw new WrongValueException("Unknown collpase: "
102:                            + collapse);
103:
104:                if (!Objects.equals(_collapse, collapse)) {
105:                    _collapse = collapse;
106:                    smartUpdate("z.colps", collapse);
107:                }
108:            }
109:
110:            /** Returns whether it is opne (i.e., not collapsed.
111:             * Meaningful only if {@link #getCollapse} is not "none".
112:             */
113:            public boolean isOpen() {
114:                return _open;
115:            }
116:
117:            /** Opens or collapses the splitter.
118:             * Meaningful only if {@link #getCollapse} is not "none".
119:             */
120:            public void setOpen(boolean open) {
121:                if (_open != open) {
122:                    _open = open;
123:                    smartUpdate("z.open", open);
124:                }
125:            }
126:
127:            protected String getRealSclass() {
128:                if ("vertical".equals(getOrient()))
129:                    return super .getRealSclass() + "-v";
130:                else
131:                    return super .getRealSclass() + "-h";
132:            }
133:
134:            //super//
135:            public String getOuterAttrs() {
136:                final StringBuffer sb = new StringBuffer(80).append(super 
137:                        .getOuterAttrs());
138:                appendAsapAttr(sb, Events.ON_OPEN);
139:
140:                if ("vertical".equals(getOrient()))
141:                    HTMLs.appendAttribute(sb, "z.vert", "true");
142:
143:                if (!"none".equals(_collapse))
144:                    HTMLs.appendAttribute(sb, "z.colps", _collapse);
145:                if (!_open)
146:                    sb.append(" z.open=\"false\"");
147:                return sb.toString();
148:            }
149:
150:            public void setParent(Component parent) {
151:                if (parent != null && !(parent instanceof  Box))
152:                    throw new UiException("Wrong parent: " + parent);
153:                super .setParent(parent);
154:            }
155:
156:            /** Not allow any children.
157:             */
158:            public boolean isChildable() {
159:                return false;
160:            }
161:
162:            //-- ComponentCtrl --//
163:            protected Object newExtraCtrl() {
164:                return new ExtraCtrl();
165:            }
166:
167:            /** A utility class to implement {@link #getExtraCtrl}.
168:             * It is used only by component developers.
169:             */
170:            protected class ExtraCtrl extends XulElement.ExtraCtrl implements 
171:                    Openable {
172:                //-- Openable --//
173:                public void setOpenByClient(boolean open) {
174:                    _open = open;
175:                }
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.