Source Code Cross Referenced for Label.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 component which displays a text string, an icon, or both.
034:         */
035:        public class Label extends Component {
036:
037:            public static final String PROPERTY_ICON = "icon";
038:            public static final String PROPERTY_ICON_TEXT_MARGIN = "iconTextMargin";
039:            public static final String PROPERTY_LINE_WRAP = "lineWrap";
040:            public static final String PROPERTY_TEXT = "text";
041:            public static final String PROPERTY_TEXT_ALIGNMENT = "textAlignment";
042:            public static final String PROPERTY_TEXT_POSITION = "textPosition";
043:            public static final String PROPERTY_TOOL_TIP_TEXT = "toolTipText";
044:
045:            /**
046:             * Creates a label with no text or icon.
047:             */
048:            public Label() {
049:                this (null, null);
050:            }
051:
052:            /**
053:             * Creates a label with text.
054:             *
055:             * @param text the text to be displayed
056:             */
057:            public Label(String text) {
058:                this (text, null);
059:            }
060:
061:            /**
062:             * Creates a label with an icon.
063:             *
064:             * @param icon the icon to be displayed
065:             */
066:            public Label(ImageReference icon) {
067:                this (null, icon);
068:            }
069:
070:            /**
071:             * Creates a label with text and an icon.
072:             *
073:             * @param text the text to be displayed
074:             * @param icon the icon to be displayed
075:             */
076:            public Label(String text, ImageReference icon) {
077:                super ();
078:
079:                setIcon(icon);
080:                setText(text);
081:            }
082:
083:            /**
084:             * Returns the icon of the label.
085:             * 
086:             * @return the icon
087:             */
088:            public ImageReference getIcon() {
089:                return (ImageReference) getProperty(PROPERTY_ICON);
090:            }
091:
092:            /**
093:             * Returns the margin size between the icon and the text.
094:             * The margin will only be displayed if the label has both
095:             * icon and text properties set.
096:             * 
097:             * @return the margin size 
098:             */
099:            public Extent getIconTextMargin() {
100:                return (Extent) getProperty(PROPERTY_ICON_TEXT_MARGIN);
101:            }
102:
103:            /**
104:             * Returns the text of the label.
105:             * 
106:             * @return the text
107:             */
108:            public String getText() {
109:                return (String) getProperty(PROPERTY_TEXT);
110:            }
111:
112:            /**
113:             * Returns the alignment of the text relative to the icon.
114:             * 
115:             * @return the text alignment
116:             */
117:            public Alignment getTextAlignment() {
118:                return (Alignment) getProperty(PROPERTY_TEXT_ALIGNMENT);
119:            }
120:
121:            /**
122:             * Returns the position of the text relative to the icon.
123:             * 
124:             * @return the text position
125:             */
126:            public Alignment getTextPosition() {
127:                return (Alignment) getProperty(PROPERTY_TEXT_POSITION);
128:            }
129:
130:            /**
131:             * Returns the tool tip text (displayed when the mouse cursor is hovered 
132:             * over the component).
133:             * 
134:             * @return the tool tip text
135:             */
136:            public String getToolTipText() {
137:                return (String) getProperty(PROPERTY_TOOL_TIP_TEXT);
138:            }
139:
140:            /**
141:             * Determines if the text of the label should wrap in the event that 
142:             * horizontal space is limited.  Default value is true.
143:             * 
144:             * @return the line wrap state
145:             */
146:            public boolean isLineWrap() {
147:                Boolean value = (Boolean) getProperty(PROPERTY_LINE_WRAP);
148:                return value == null ? true : value.booleanValue();
149:            }
150:
151:            /**
152:             * This component does not support children.
153:             * 
154:             * @see nextapp.echo2.app.Component#isValidChild(nextapp.echo2.app.Component)
155:             */
156:            public boolean isValidChild(Component component) {
157:                return false;
158:            }
159:
160:            /**
161:             * Sets the icon to be displayed.
162:             *
163:             * @param newValue the icon to be displayed
164:             */
165:            public void setIcon(ImageReference newValue) {
166:                setProperty(PROPERTY_ICON, newValue);
167:            }
168:
169:            /**
170:             * Sets the margin size between the icon and the text.
171:             * The margin will only be displayed if the label has both
172:             * icon and text properties set.
173:             * 
174:             * @param newValue the margin size 
175:             */
176:            public void setIconTextMargin(Extent newValue) {
177:                setProperty(PROPERTY_ICON_TEXT_MARGIN, newValue);
178:            }
179:
180:            /**
181:             * Sets whether the text of the label should wrap in the event that 
182:             * horizontal space is limited.  Default value is true.
183:             * 
184:             * @param newValue the new line wrap state
185:             */
186:            public void setLineWrap(boolean newValue) {
187:                setProperty(PROPERTY_LINE_WRAP, new Boolean(newValue));
188:            }
189:
190:            /**
191:             * Sets the text to be displayed.
192:             *
193:             * @param newValue the text to be displayed
194:             */
195:            public void setText(String newValue) {
196:                setProperty(PROPERTY_TEXT, newValue);
197:            }
198:
199:            /**
200:             * Sets the alignment of the text relative to the icon.
201:             * Note that only one of the provided <code>Alignment</code>'s
202:             * settings should be non-default.
203:             * 
204:             * @param newValue the new text position
205:             */
206:            public void setTextAlignment(Alignment newValue) {
207:                setProperty(PROPERTY_TEXT_ALIGNMENT, newValue);
208:            }
209:
210:            /**
211:             * Sets the position of the text relative to the icon.
212:             * Note that only one of the provided <code>Alignment</code>'s
213:             * settings should be non-default.
214:             * 
215:             * @param newValue the new text position
216:             */
217:            public void setTextPosition(Alignment newValue) {
218:                setProperty(PROPERTY_TEXT_POSITION, newValue);
219:            }
220:
221:            /**
222:             * Sets the tool tip text (displayed when the mouse cursor is hovered 
223:             * over the component).
224:             * 
225:             * @param newValue the new tool tip text
226:             */
227:            public void setToolTipText(String newValue) {
228:                setProperty(PROPERTY_TOOL_TIP_TEXT, newValue);
229:            }
230:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.