Source Code Cross Referenced for DateBlock.java in  » Content-Management-System » harmonise » org » openharmonise » swing » datefield » 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 » Content Management System » harmonise » org.openharmonise.swing.datefield 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.swing.datefield;
020:
021:        /**
022:         * A DateBlock allows values to be placed in a one-2-one mapping with
023:         * {@link org.openharmonise.swing.datefield.DateFormatBlock} objects.
024:         * Therefore each element of a date value can be manipulated.
025:         * 
026:         * @author Matthew Large
027:         * @version $Revision: 1.1 $
028:         *
029:         */
030:        public class DateBlock {
031:
032:            /**
033:             * Format block that this DateBlock is associated to.
034:             */
035:            private DateFormatBlock m_formatBlock = null;
036:
037:            /**
038:             * Position in date string that this value starts at.
039:             */
040:            private int m_nStartPos = -1;
041:
042:            /**
043:             * String length of this value.
044:             */
045:            private int m_nLength = -1;
046:
047:            /**
048:             * Current value.
049:             */
050:            private String m_sValue = "";
051:
052:            /**
053:             * Previous value for roll backs.
054:             */
055:            private String m_sPreviousValue = "";
056:
057:            /**
058:             * Constructs a new DateBlock.
059:             * 
060:             * @param formatBlock Format block that this DateBlock is associated to
061:             * @param nStartPos Position in date string that this value starts at
062:             * @param sValue Current value
063:             */
064:            public DateBlock(DateFormatBlock formatBlock, int nStartPos,
065:                    String sValue) {
066:                super ();
067:                this .m_formatBlock = formatBlock;
068:                this .m_nStartPos = nStartPos;
069:                this .m_sValue = sValue;
070:                this .m_sPreviousValue = sValue;
071:
072:                this .setup();
073:            }
074:
075:            /**
076:             * Sets the previous value.
077:             * 
078:             * @param sPreviousValue Value
079:             */
080:            public void setPreviousValue(String sPreviousValue) {
081:                this .m_sPreviousValue = sPreviousValue;
082:            }
083:
084:            /**
085:             * Returns the previous value.
086:             * 
087:             * @return Value
088:             */
089:            public String getPreviousValue() {
090:                return this .m_sPreviousValue;
091:            }
092:
093:            /**
094:             * Configures this DateBlock.
095:             *
096:             */
097:            private void setup() {
098:            }
099:
100:            /**
101:             * Returns the position in date string that this value starts at.
102:             * 
103:             * @return Start position in date string
104:             */
105:            public int getStartPos() {
106:                return this .m_nStartPos;
107:            }
108:
109:            /**
110:             * Sets the position in the date string that this value starts at.
111:             * 
112:             * @param nStartPos Start position in date string
113:             */
114:            public void setStartPos(int nStartPos) {
115:                this .m_nStartPos = nStartPos;
116:            }
117:
118:            /**
119:             * Returns the length of this value.
120:             * 
121:             * @return Length
122:             */
123:            public int getLength() {
124:                return this .m_sValue.length();
125:            }
126:
127:            /**
128:             * Returns the current value.
129:             * 
130:             * @return Value
131:             */
132:            public String getValue() {
133:                return this .m_sValue;
134:            }
135:
136:            /**
137:             * Sets the current value.
138:             * 
139:             * @param sValue Value
140:             */
141:            public void setValue(String sValue) {
142:                this .m_sValue = sValue;
143:            }
144:
145:            /**
146:             * Returns the format block.
147:             * 
148:             * @return Format block
149:             */
150:            public DateFormatBlock getFormatBlock() {
151:                return this .m_formatBlock;
152:            }
153:
154:            /**
155:             * Checks if this date block has a complete value.
156:             * 
157:             * @return true if this date block has a complete value
158:             */
159:            public boolean hasValue() {
160:                return (!this .getFormatBlock().isActiveBlock() || !this .m_sValue
161:                        .trim().equalsIgnoreCase(
162:                                this .m_formatBlock.getEntryFormat().trim()));
163:            }
164:
165:            /**
166:             * Clears the value, resetting it to the format string.
167:             *
168:             */
169:            public void clear() {
170:                this.m_sValue = this.m_formatBlock.getClearedValue();
171:                this.m_sPreviousValue = this.m_formatBlock.getClearedValue();
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.