Source Code Cross Referenced for FloatProperty.java in  » Swing-Library » InfoNode-Tabbed-Panel » net » infonode » properties » types » 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 » Swing Library » InfoNode Tabbed Panel » net.infonode.properties.types 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2004 NNL Technology AB
003:         * Visit www.infonode.net for information about InfoNode(R) 
004:         * products and how to contact NNL Technology AB.
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
019:         * MA 02111-1307, USA.
020:         */
021:
022:        // $Id: FloatProperty.java,v 1.5 2005/02/16 11:28:15 jesper Exp $
023:        package net.infonode.properties.types;
024:
025:        import net.infonode.properties.base.PropertyGroup;
026:        import net.infonode.properties.util.PropertyValueHandler;
027:        import net.infonode.properties.util.ValueHandlerProperty;
028:
029:        /**
030:         * A float property.
031:         *
032:         * @author $Author: jesper $
033:         * @version $Revision: 1.5 $
034:         */
035:        public class FloatProperty extends ValueHandlerProperty {
036:            private float minValue;
037:            private float maxValue;
038:            private int preferredDigitCount;
039:            private float preferredDelta;
040:
041:            /**
042:             * Constructor.
043:             * Creates an unbounded float property.
044:             *
045:             * @param group        the property group
046:             * @param name         the property name
047:             * @param description  the property description
048:             * @param valueHandler handles values for this property
049:             */
050:            public FloatProperty(PropertyGroup group, String name,
051:                    String description, PropertyValueHandler valueHandler) {
052:                this (group, name, description, valueHandler, Float.MIN_VALUE,
053:                        Float.MAX_VALUE);
054:            }
055:
056:            /**
057:             * Constructor.
058:             *
059:             * @param group        the property group
060:             * @param name         the property name
061:             * @param description  the property description
062:             * @param valueHandler handles values for this property
063:             * @param minValue     the smallest value that this property can have
064:             * @param maxValue     the largest value that this property can have
065:             */
066:            public FloatProperty(PropertyGroup group, String name,
067:                    String description, PropertyValueHandler valueHandler,
068:                    float minValue, float maxValue) {
069:                this (group, name, description, valueHandler, minValue,
070:                        maxValue, 6, 0.1f);
071:            }
072:
073:            /**
074:             * Constructor.
075:             *
076:             * @param group               the property group
077:             * @param name                the property name
078:             * @param description         the property description
079:             * @param valueHandler        handles values for this property
080:             * @param minValue            the smallest value that this property can have
081:             * @param maxValue            the largest value that this property can have
082:             * @param preferredDigitCount the preferred number of digits to allocate space for in an editor for a property value
083:             * @param preferredDelta      the preferred amount to increase and decrease a property value by
084:             */
085:            public FloatProperty(PropertyGroup group, String name,
086:                    String description, PropertyValueHandler valueHandler,
087:                    float minValue, float maxValue, int preferredDigitCount,
088:                    float preferredDelta) {
089:                super (group, name, Float.class, description, valueHandler);
090:                this .minValue = minValue;
091:                this .maxValue = maxValue;
092:                this .preferredDigitCount = preferredDigitCount;
093:                this .preferredDelta = preferredDelta;
094:            }
095:
096:            /**
097:             * Returns the preferred amount to increase and decrease a property value by.
098:             *
099:             * @return the preferred amount to increase and decrease a property value by
100:             */
101:            public float getPreferredDelta() {
102:                return preferredDelta;
103:            }
104:
105:            /**
106:             * Returns the smallest value that this property can have.
107:             *
108:             * @return the smallest value that this property can have
109:             */
110:            public float getMinValue() {
111:                return minValue;
112:            }
113:
114:            /**
115:             * Returns the largest value that this property can have.
116:             *
117:             * @return the largest value that this property can have
118:             */
119:            public float getMaxValue() {
120:                return maxValue;
121:            }
122:
123:            /**
124:             * Returns the preferred number of digits to allocate space for in an editor for a property value.
125:             *
126:             * @return the preferred number of digits to allocate space for in an editor for a property value
127:             */
128:            public int getPreferredDigitCount() {
129:                return preferredDigitCount;
130:            }
131:
132:            /**
133:             * Returns the float value of this property in a value container.
134:             *
135:             * @param valueContainer the value container
136:             * @return the float value of this property
137:             */
138:            public float get(Object valueContainer) {
139:                Object value = getValue(valueContainer);
140:                return value == null ? 0 : ((Number) getValue(valueContainer))
141:                        .floatValue();
142:            }
143:
144:            /**
145:             * Sets the float value of this property in a value container.
146:             *
147:             * @param valueContainer the value container
148:             * @param value          the float value
149:             */
150:            public void set(Object valueContainer, float value) {
151:                setValue(valueContainer, new Float(value));
152:            }
153:
154:            public boolean canBeAssiged(Object value) {
155:                if (!super .canBeAssiged(value))
156:                    return false;
157:
158:                float v = ((Number) value).floatValue();
159:                return v >= minValue && v <= maxValue;
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.