Source Code Cross Referenced for Caption.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:        /* Caption.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Tue Oct 11 14:31:07     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2005 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.zul;
020:
021:        import org.zkoss.zk.ui.Component;
022:        import org.zkoss.zk.ui.UiException;
023:
024:        import org.zkoss.zul.impl.LabelImageElement;
025:
026:        /**
027:         *  A header for a {@link Groupbox}.
028:         * It may contain either a text label, using {@link #setLabel},
029:         * or child elements for a more complex caption.
030:         *
031:         * @author tomyeh
032:         */
033:        public class Caption extends LabelImageElement {
034:            public Caption() {
035:            }
036:
037:            public Caption(String label) {
038:                setLabel(label);
039:            }
040:
041:            public Caption(String label, String src) {
042:                setLabel(label);
043:                setImage(src);
044:            }
045:
046:            /** Returns a compound label, which is the catenation of
047:             * parent's title, if the parent is {@link Window}, and {@link #getLabel}.
048:             * <p>Note: this is designed to used for component templating.
049:             * Application developers rarely need to access this method.
050:             *
051:             * <p>It is mainly used for component implementation.
052:             */
053:            public String getCompoundLabel() {
054:                final String label = getLabel();
055:                final Component p = getParent();
056:                if (p instanceof  Window) {
057:                    final String title = ((Window) p).getTitle();
058:                    if (title.length() > 0)
059:                        return label.length() > 0 ? title + " - " + label
060:                                : title;
061:                }
062:                return label;
063:            }
064:
065:            /** Returns whether the legend mold shall be used.
066:             * It actually returns {@link Groupbox#isLegend} if the parent
067:             * is a {@link Groupbox}.
068:             *
069:             * <p>Note: this is designed to used for component templating.
070:             * Application developers rarely need to access this method.
071:             */
072:            public boolean isLegend() {
073:                final Component p = getParent();
074:                return (p instanceof  Groupbox) && ((Groupbox) p).isLegend();
075:            }
076:
077:            /** Returns whether to display the closable button.
078:             * <p>Default: it returns true if the parent is window and {@link Window#isClosable}
079:             * is true.
080:             *
081:             * <p>It is mainly used for component implementation.
082:             */
083:            public boolean isClosableVisible() {
084:                final Component p = getParent();
085:                return (p instanceof  Window) && ((Window) p).isClosable();
086:            }
087:
088:            //-- super --//
089:            /** Returns the style class.
090:             * <p>Default: return caption if the parent is groupbox,
091:             * or title otherwise (say, the parent is window)
092:             */
093:            public String getSclass() {
094:                final String scls = super .getSclass();
095:                if (scls != null)
096:                    return scls;
097:                return getParent() instanceof  Groupbox ? "caption" : "title";
098:            }
099:
100:            public String getOuterAttrs() {
101:                final String attrs = super .getOuterAttrs();
102:                final String clkattrs = getAllOnClickAttrs(false);
103:                return clkattrs == null ? attrs : attrs + clkattrs;
104:            }
105:
106:            //-- Component --//
107:            public void setParent(Component parent) {
108:                if (parent != null && !(parent instanceof  Window)
109:                        && !(parent instanceof  Groupbox))
110:                    throw new UiException("Wrong parent: " + parent);
111:                super .setParent(parent);
112:            }
113:
114:            public void invalidate() {
115:                final Component p = getParent();
116:                if ((p instanceof  Groupbox) && ((Groupbox) p).isLegend())
117:                    p.invalidate(); //Bug 1679629
118:                else
119:                    super.invalidate();
120:            }
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.