Source Code Cross Referenced for AnnotRel.java in  » Database-ORM » MMBase » org » mmbase » module » builders » 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 » Database ORM » MMBase » org.mmbase.module.builders 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:        package org.mmbase.module.builders;
011:
012:        import java.text.SimpleDateFormat;
013:        import java.util.*;
014:
015:        import org.mmbase.module.core.MMObjectNode;
016:        import org.mmbase.module.corebuilders.InsRel;
017:        import org.mmbase.util.*;
018:        import org.mmbase.util.logging.*;
019:
020:        /**
021:         * @javadoc
022:         * @application Tools
023:         * @author David van Zeventer
024:         * @version $Id: AnnotRel.java,v 1.22 2005/10/06 17:46:39 michiel Exp $
025:         */
026:        public class AnnotRel extends InsRel {
027:
028:            // Defining possible annotation types
029:            public final static int HOURS = 0;
030:            public final static int MINUTES = 1;
031:            public final static int SECONDS = 2;
032:            public final static int MILLIS = 3;
033:            /*
034:                public final static int LINES   = 4;
035:                public final static int WORDS   = 5;
036:                public final static int CHARS   = 6;
037:                public final static int PIXELS  = 7;
038:                public final static int ROWS    = 8;
039:                public final static int COLS    = 9;
040:             */
041:
042:            private static final Logger log = Logging
043:                    .getLoggerInstance(AnnotRel.class);
044:
045:            /**
046:             * Sets defaults for a node.
047:             * Initializes all numeric fields to 0, and sets the annotation type to {@link #MILLIS}.
048:             * @param node The node to set the defaults of.
049:             */
050:            public void setDefaults(MMObjectNode node) {
051:                super .setDefaults(node);
052:                // Set the default value for pos and length to 0 (0:0:0.0)
053:                node.setValue("pos", 0);
054:                node.setValue("end", 0);
055:                node.setValue("length", 0);
056:                // All time values are default stored in milliseconds.
057:                node.setValue("type", MILLIS);
058:            }
059:
060:            /**
061:             * What should a GUI display for this node/field combo.
062:             * Displays the pos, end, and length fields as time-values,
063:             * and the annotation type field as a descriptive string.
064:             * @param node The node to display
065:             * @param field the name field of the field to display
066:             * @return the display of the node's field as a <code>String</code>, null if not specified
067:             */
068:            public String getGUIIndicator(String field, MMObjectNode node) {
069:                if (field.equals("pos")) {
070:                    int time = node.getIntValue("pos");
071:                    return RelativeTime.convertIntToTime(time);
072:                } else if (field.equals("end")) {
073:                    int time = node.getIntValue("end");
074:                    return RelativeTime.convertIntToTime(time);
075:                } else if (field.equals("length")) {
076:                    int time = node.getIntValue("length");
077:                    return RelativeTime.convertIntToTime(time);
078:                } else if (field.equals("type")) {
079:                    int val = node.getIntValue("type");
080:                    if (val == HOURS) {
081:                        return "Hours";
082:                    } else if (val == MINUTES) {
083:                        return "Minuten"; // return "Minutes";
084:                    } else if (val == SECONDS) {
085:                        return "Seconden"; // return "Seconds";
086:                    } else if (val == MILLIS) {
087:                        return "Milliseconden"; // return "Milliseconds";
088:                    }
089:
090:                    /*
091:                      else if (val==LINES) {
092:                        return "Regels";
093:                    } else if (val==WORDS) {
094:                        return "Woorden";
095:                    } else if (val==CHARS) {
096:                        return "Karakters";
097:                    } else if (val==PIXELS) {
098:                        return "Pixels";
099:                    } else if (val==ROWS) {
100:                        return "Rijen";
101:                    } else if (val==COLS) {
102:                        return "Kolommen";
103:                    }
104:                     */
105:                }
106:                return null;
107:            }
108:
109:            /**
110:             * The hook that passes all form related pages to the correct handler.
111:             * This method is not supported.
112:             * @param sp The PageInfo
113:             * @param cmds the commands (PRC-CMD) to process
114:             * @param vars variables (PRC-VAR) to use
115:             * @return the result value as a <code>String</code>
116:             */
117:            public boolean process(PageInfo sp, Hashtable cmds, Hashtable vars) {
118:                log.debug("process: This method isn't implemented yet.");
119:                return false;
120:            }
121:
122:            /**
123:             * Obtains a string value by performing the provided command.
124:             * This method is not supported.
125:             * @param sp The PageInfo
126:             * @param command the command to execute
127:             * @return the result value as a <code>String</code>
128:             */
129:            public String replace(PageInfo sp, StringTokenizer command) {
130:                log.debug("replace: This method isn't implemented yet.");
131:                return "";
132:            }
133:
134:            /**
135:             * Provides additional functionality when setting field values.
136:             * This method makes sure that the pos, end, and length values have the
137:             * correct value.
138:             * @param node the node whose fields are changed
139:             * @param field the fieldname that is changed
140:             * @return <code>true</code> if the call was handled.
141:             */
142:            public boolean setValue(MMObjectNode node, String field) {
143:                if (field.equals("end")) {
144:                    int pos = node.getIntValue("pos");
145:                    int end = node.getIntValue("end");
146:                    if (end != -1)
147:                        node.setValue("length", (end - pos));
148:                } else if (field.equals("pos")) {
149:                    int pos = node.getIntValue("pos");
150:                    int end = node.getIntValue("end");
151:                    if (end != -1)
152:                        node.setValue("length", (end - pos));
153:                } else if (field.equals("length")) {
154:                    // extra check needed to make sure we don't create a loop !
155:                    // XXX: ???
156:                    int pos = node.getIntValue("pos");
157:                    int end = node.getIntValue("end");
158:                    int len = node.getIntValue("length");
159:                }
160:                return true;
161:            }
162:
163:            public Object getValue(MMObjectNode node, String field) {
164:                if (field.equals("ms_pos")) {
165:                    int pos = node.getIntValue("pos");
166:                    //format to pos is in ms
167:                    return new SimpleDateFormat("hh:mm.0")
168:                            .format(new Date(pos));
169:                } else if (field.equals("ms_length")) {
170:                    int len = node.getIntValue("length");
171:                    return new SimpleDateFormat("hh:mm").format(new Date(len));
172:                } else if (field.equals("end")) {
173:                    int pos = node.getIntValue("pos");
174:                    int len = node.getIntValue("length");
175:                    int end = pos + len;
176:                    return ("" + end);
177:                }
178:                return (null);
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.