Source Code Cross Referenced for SpinnerPointModel.java in  » Swing-Library » jide-common » com » jidesoft » spinner » 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 » jide common » com.jidesoft.spinner 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)SpinnerPointModel.java 4/8/2007
003:         *
004:         * Copyright 2002 - 2007 JIDE Software Inc. All rights reserved.
005:         */
006:
007:        package com.jidesoft.spinner;
008:
009:        import javax.swing.*;
010:        import java.awt.*;
011:
012:        /**
013:         * @author Nako Ruru
014:         */
015:        public class SpinnerPointModel extends AbstractSpinnerModel {
016:
017:            public final static int FIELD_X = 0;
018:            public final static int FIELD_Y = 1;
019:
020:            private Point point;
021:            private int field = FIELD_X;
022:
023:            /**
024:             * Create a default <code>SpinnerPointModel</code>
025:             */
026:            public SpinnerPointModel() {
027:                this (null);
028:            }
029:
030:            /**
031:             * Create a <code>SpinnerPointModel</code> with a specified <code>Point</code>
032:             *
033:             * @param point this specified<code>Point</code>
034:             */
035:            public SpinnerPointModel(Point point) {
036:                this .point = point == null ? new Point() : point;
037:            }
038:
039:            /**
040:             * The <i>current element</i> of the sequence.  This element is usually
041:             * displayed by the <code>editor</code> part of a <code>JSpinner</code>.
042:             *
043:             * @return the current spinner value.
044:             * @see #setValue
045:             */
046:            public Object getValue() {
047:                return point;
048:            }
049:
050:            /**
051:             * Changes current value of the model, typically this value is displayed
052:             * by the <code>editor</code> part of a  <code>JSpinner</code>.
053:             * If the <code>SpinnerModel</code> implementation doesn't support
054:             * the specified value then an <code>IllegalArgumentException</code>
055:             * is thrown.  For example a <code>SpinnerModel</code> for numbers might
056:             * only support values that are integer multiples of ten. In
057:             * that case, <code>model.setValue(new Number(11))</code>
058:             * would throw an exception.
059:             *
060:             * @param value new value
061:             * @throws IllegalArgumentException if <code>value</code> isn't allowed
062:             * @see #getValue
063:             */
064:            public void setValue(Object value) {
065:                setPoint((Point) value);
066:            }
067:
068:            /**
069:             * The <i>current element</i> of the sequence.  This element is usually
070:             * displayed by the <code>editor</code> part of a <code>JSpinner</code>.
071:             *
072:             * @return the current spinner value.
073:             * @see #setPoint(Point)
074:             * @see #getValue()
075:             */
076:            public Point getPoint() {
077:                return point;
078:            }
079:
080:            /**
081:             * @param point
082:             */
083:            public void setPoint(Point point) {
084:                if (!this .point.equals(point)) {
085:                    this .point = point;
086:                    fireStateChanged();
087:                }
088:            }
089:
090:            /**
091:             * @return
092:             */
093:            public int getField() {
094:                return field;
095:            }
096:
097:            /**
098:             * @param field
099:             */
100:            public void setField(int field) {
101:                this .field = field;
102:            }
103:
104:            /**
105:             * Return the object in the sequence that comes after the object returned
106:             * by <code>getValue()</code>. If the end of the sequence has been reached
107:             * then return null.  Calling this method does not effect <code>value</code>.
108:             *
109:             * @return the next legal value or null if one doesn't exist
110:             * @see #getValue
111:             * @see #getPreviousValue
112:             */
113:            public Object getNextValue() {
114:                Point p = (Point) point.clone();
115:                if (field == FIELD_X) {
116:                    p.x++;
117:                } else {
118:                    p.y++;
119:                }
120:                return p;
121:            }
122:
123:            /**
124:             * Return the object in the sequence that comes before the object returned
125:             * by <code>getValue()</code>.  If the end of the sequence has been reached then
126:             * return null. Calling this method does not effect <code>value</code>.
127:             *
128:             * @return the previous legal value or null if one doesn't exist
129:             * @see #getValue
130:             * @see #getNextValue
131:             */
132:            public Object getPreviousValue() {
133:                Point p = (Point) point.clone();
134:                if (field == FIELD_X) {
135:                    p.x--;
136:                } else {
137:                    p.y--;
138:                }
139:                return p;
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.