Java Doc for DataTypeDate.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » fw » datasetviewer » cellcomponent » 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 Client » squirrel sql 2.6.5a » net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent
      net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDate

DataTypeDate
public class DataTypeDate extends BaseDataTypeComponent implements IDataTypeComponent(Code)

author:
   gwg
author:
   This class provides the display components for handling Date data types,
author:
   specifically SQL type DATE.
author:
   The display components are for:
author:
  

    author:
      
  • read-only display within a table cell
    author:
      
  • editing within a table cell
    author:
      
  • read-only or editing display within a separate window
    author:
      

author:
   The class also contains
author:
  

    author:
      
  • a function to compare two display values
    author:
       to see if they are equal. This is needed because the display format
    author:
       may not be the same as the internal format, and all internal object
    author:
       types may not provide an appropriate equals() function.
    author:
      
  • a function to return a printable text form of the cell contents,
    author:
       which is used in the text version of the table.
    author:
      

author:
  


author:
   The components returned from this class extend RestorableJTextField
author:
   and RestorableJTextArea for use in editing table cells that
author:
   contain values of this data type. It provides the special behavior for null
author:
   handling and resetting the cell to the original value.


Inner Class :public static class DateFormatTypeCombo extends JComboBox


Constructor Summary
public  DataTypeDate(JTable table, ColumnDisplayDefinition colDef)
     Constructor - save the data needed by this data type.

Method Summary
public  booleanareEqual(Object obj1, Object obj2)
     Determine if two objects of this data type contain the same value.
public  booleancanDoFileIO()
     Say whether or not object can be exported to and imported from a file.
public  voidexportObject(FileOutputStream outStream, String text)
     Construct an appropriate external representation of the object and write it to a file. Errors are returned by throwing an IOException containing the cause of the problem as its message.

DataType is responsible for validating that the given text text from a Popup JTextArea can be converted to an object. This text-to-object conversion is the same as validateAndConvertInPopup, which may be used internally by the object to do the validation.

The DataType object must flush and close the output stream before returning. Typically it will create another object (e.g.

public  StringgetClassName()
     Return the name of the java class used to hold this data type.
public static  OkJPanelgetControlPanel()
     Generate a JPanel containing controls that allow the user to adjust the properties for this DataType. All properties are static accross all instances of this DataType.
public  ObjectgetDefaultValue(String dbDefaultValue)
     Get a default value for the table used to input data for a new row to be inserted into the DB.
public  JTextAreagetJTextArea(Object value)
    
public  JTextFieldgetJTextField()
     Return a JTextField usable in a CellEditor.
public static  booleangetReadDateAsTimestamp()
    
public  StringgetWhereClauseValue(Object value, ISQLDatabaseMetaData md)
     When updating the database, generate a string form of this object value that can be used in the WHERE clause to match the value in the database.
public  StringimportObject(FileInputStream inStream)
     Read a file and construct a valid object from its contents.
public  booleanisEditableInCell(Object originalValue)
     This Data Type can be edited in a table cell.
public  booleanisEditableInPopup(Object originalValue)
     Returns true if data type may be edited in the popup, false if not.
public  booleanneedToReRead(Object originalValue)
     See if a value in a column has been limited in some way and needs to be re-read before being used for editing.
public  ObjectreadResultSet(ResultSet rs, int index, boolean limitDataRead)
     On input from the DB, read the data from the ResultSet into the appropriate type of object to be stored in the table cell.
public  StringrenderObject(Object value)
     Render a value into text for this DataType.
public  voidsetPreparedStatementValue(PreparedStatement pstmt, Object value, int position)
     When updating the database, insert the appropriate datatype into the prepared statment at the given variable position.
public static  ObjectstaticReadResultSet(ResultSet rs, int index, boolean limitDataRead)
     On input from the DB, read the data from the ResultSet into the appropriate type of object to be stored in the table cell.
public  booleanuseBinaryEditingPanel()
     If true, this tells the PopupEditableIOPanel to use the binary editing panel rather than a pure text panel. The binary editing panel assumes the data is an array of bytes, converts it into text form, allows the user to change how that data is displayed (e.g.
public  ObjectvalidateAndConvert(String value, Object originalValue, StringBuffer messageBuffer)
     Implement the interface for validating and converting to internal object.
public  ObjectvalidateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer)
     Validating and converting in Popup is identical to cell-related operation.


Constructor Detail
DataTypeDate
public DataTypeDate(JTable table, ColumnDisplayDefinition colDef)(Code)
Constructor - save the data needed by this data type.




Method Detail
areEqual
public boolean areEqual(Object obj1, Object obj2)(Code)
Determine if two objects of this data type contain the same value. Neither of the objects is null



canDoFileIO
public boolean canDoFileIO()(Code)
Say whether or not object can be exported to and imported from a file. We put both export and import together in one test on the assumption that all conversions can be done both ways.



exportObject
public void exportObject(FileOutputStream outStream, String text) throws IOException(Code)
Construct an appropriate external representation of the object and write it to a file. Errors are returned by throwing an IOException containing the cause of the problem as its message.

DataType is responsible for validating that the given text text from a Popup JTextArea can be converted to an object. This text-to-object conversion is the same as validateAndConvertInPopup, which may be used internally by the object to do the validation.

The DataType object must flush and close the output stream before returning. Typically it will create another object (e.g. an OutputWriter), and that is the object that must be flushed and closed.

File is assumed to be and ASCII string of digits representing a value of this data type.




getClassName
public String getClassName()(Code)
Return the name of the java class used to hold this data type.



getControlPanel
public static OkJPanel getControlPanel()(Code)
Generate a JPanel containing controls that allow the user to adjust the properties for this DataType. All properties are static accross all instances of this DataType. However, the class may choose to apply the information differentially, such as keeping a list (also entered by the user) of table/column names for which certain properties should be used.

This is called ONLY if there is at least one property entered into the DTProperties for this class.

Since this method is called by reflection on the Method object derived from this class, it does not need to be included in the Interface. It would be nice to include this in the Interface for consistancy, documentation, etc, but the Interface does not seem to like static methods.




getDefaultValue
public Object getDefaultValue(String dbDefaultValue)(Code)
Get a default value for the table used to input data for a new row to be inserted into the DB.



getJTextArea
public JTextArea getJTextArea(Object value)(Code)



getJTextField
public JTextField getJTextField()(Code)
Return a JTextField usable in a CellEditor.



getReadDateAsTimestamp
public static boolean getReadDateAsTimestamp()(Code)



getWhereClauseValue
public String getWhereClauseValue(Object value, ISQLDatabaseMetaData md)(Code)
When updating the database, generate a string form of this object value that can be used in the WHERE clause to match the value in the database. A return value of null means that this column cannot be used in the WHERE clause, while a return of "null" (or "is null", etc) means that the column can be used in the WHERE clause and the value is actually a null value. This function must also include the column label so that its output is of the form: "columnName = value" or "columnName is null" or whatever is appropriate for this column in the database.



importObject
public String importObject(FileInputStream inStream) throws IOException(Code)
Read a file and construct a valid object from its contents. Errors are returned by throwing an IOException containing the cause of the problem as its message.

DataType is responsible for validating that the imported data can be converted to an object, and then must return a text string that can be used in the Popup window text area. This object-to-text conversion is the same as is done by the DataType object internally in the getJTextArea() method.

File is assumed to be and ASCII string of digits representing a value of this data type.




isEditableInCell
public boolean isEditableInCell(Object originalValue)(Code)
This Data Type can be edited in a table cell.



isEditableInPopup
public boolean isEditableInPopup(Object originalValue)(Code)
Returns true if data type may be edited in the popup, false if not.



needToReRead
public boolean needToReRead(Object originalValue)(Code)
See if a value in a column has been limited in some way and needs to be re-read before being used for editing. For read-only tables this may actually return true since we want to be able to view the entire contents of the cell even if it was not completely loaded during the initial table setup.



readResultSet
public Object readResultSet(ResultSet rs, int index, boolean limitDataRead) throws java.sql.SQLException(Code)
On input from the DB, read the data from the ResultSet into the appropriate type of object to be stored in the table cell.



renderObject
public String renderObject(Object value)(Code)
Render a value into text for this DataType.



setPreparedStatementValue
public void setPreparedStatementValue(PreparedStatement pstmt, Object value, int position) throws java.sql.SQLException(Code)
When updating the database, insert the appropriate datatype into the prepared statment at the given variable position.



staticReadResultSet
public static Object staticReadResultSet(ResultSet rs, int index, boolean limitDataRead) throws java.sql.SQLException(Code)
On input from the DB, read the data from the ResultSet into the appropriate type of object to be stored in the table cell.



useBinaryEditingPanel
public boolean useBinaryEditingPanel()(Code)
If true, this tells the PopupEditableIOPanel to use the binary editing panel rather than a pure text panel. The binary editing panel assumes the data is an array of bytes, converts it into text form, allows the user to change how that data is displayed (e.g. Hex, Decimal, etc.), and converts the data back from text to bytes when the user editing is completed. If this returns false, this DataType class must convert the internal data into a text string that can be displayed (and edited, if allowed) in a TextField or TextArea, and must handle all user key strokes related to editing of that data.



validateAndConvert
public Object validateAndConvert(String value, Object originalValue, StringBuffer messageBuffer)(Code)
Implement the interface for validating and converting to internal object. Null is a valid successful return, so errors are indicated only by existance or not of a message in the messageBuffer.



validateAndConvertInPopup
public Object validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer)(Code)
Validating and converting in Popup is identical to cell-related operation.



Fields inherited from net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent
final public static String NULL_VALUE_PATTERN(Code)(Java Doc)
protected ColumnDisplayDefinition _colDef(Code)(Java Doc)
protected DefaultColumnRenderer _renderer(Code)(Java Doc)
protected JTable _table(Code)(Java Doc)
protected RestorableJTextArea _textArea(Code)(Java Doc)
protected RestorableJTextField _textField(Code)(Java Doc)

Methods inherited from net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent
public void exportObject(FileOutputStream outStream, String text) throws IOException(Code)(Java Doc)
public String getClassName()(Code)(Java Doc)
public JTextArea getJTextArea(Object value)(Code)(Java Doc)
public JTextField getJTextField()(Code)(Java Doc)
protected KeyListener getKeyListener()(Code)(Java Doc)
public String importObject(FileInputStream inStream) throws IOException(Code)(Java Doc)
public String renderObject(Object value)(Code)(Java Doc)
public void setColumnDisplayDefinition(ColumnDisplayDefinition def)(Code)(Java Doc)
public void setTable(JTable table)(Code)(Java Doc)
public Object validateAndConvert(String value, Object originalValue, StringBuffer messageBuffer)(Code)(Java Doc)
public Object validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.