Java Doc for DatabaseTableModel.java in  » XML-UI » XUI » net » xoetrope » optional » data » sql » 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 » XML UI » XUI » net.xoetrope.optional.data.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.xoetrope.xui.data.XModel
      net.xoetrope.xui.data.XBaseModel
         net.xoetrope.optional.data.sql.DatabaseTableModel

DatabaseTableModel
public class DatabaseTableModel extends XBaseModel implements DumpWriter,XRowSelector(Code)

A wrapper for a database table allowing it to integrate with the XModel

Copyright: Copyright (c) 2003
License: see license.txt

$Revision: 1.5 $


Field Summary
 booleandirty
    
protected  StringmodelId
    
 booleanreadOnly
    
 CachedDatabaseTablextable
    

Constructor Summary
public  DatabaseTableModel()
    

Method Summary
public  Objectappend(String id)
    
public  voiddump(Writer w)
    
public  intexecuteUpdate(String sqlStr)
    
public  DatabaseRowModelfindRow(int fieldIdx, String value)
     Find a row with a specified field value
Parameters:
  fieldIdx - the index of the search field
Parameters:
  value - the search value the table row model containing the selected row.
public  DatabaseRowModelfindRow(String where)
     Find a row with a specified field value
Parameters:
  where - the search criteria the table row model containing the selected row.
public  DatabaseTableModelfindRows(int fieldIdx, String value)
     Find a set of rows with a specified field value
Parameters:
  fieldIdx - the index of the search field
Parameters:
  value - the search value the table model containing the selected rows.
public  DatabaseTableModelfindRows(String where)
     Find a set of rows with a specified field value
Parameters:
  where - the search criteria the table model containing the selected rows.
public  DatabaseTableModelfindRows(String requestFields, String where)
     Find a set of rows with a specified field value
Parameters:
  requestFields - the fields to return
Parameters:
  where - the search criteria the table model containing the selected rows.
public  voidfirst()
    
public  Objectget(String element)
    
public  XModelget(int i)
    
public  Objectget()
    
public  StringgetAttribName(int i)
     Gets the attribute name for field i.
public  ObjectgetAttribValue(int i)
    
public  doublegetAttribValueAsDouble(int i)
    
public  intgetAttribValueAsInt(int i)
    
public  StringgetAttribValueAsString(int i)
    
public  intgetAttribute(String attribName)
    
public  StringgetFieldValue(int colIdx)
     Provides iterative access to the table values.
public  StringgetFieldValue(int rowIdx, int colIdx)
     Provides random access to the table values.
public  StringgetId()
    
public  intgetNumAttributes()
    
public  intgetNumChildren()
    
public  intgetSelectedRow()
    
public static  DatabaseTableModelgetTable(String tableName)
     Look up a table by name in the overall model.
public  StringgetTagName()
     Gets the model element tag name, e.g.
public  StringgetValue()
     Provides iterative access to the table values.
public  XModelgetValue(int i)
    
public  doublegetValueAsDouble(String elementName)
    
public  intgetValueAsInt(String elementName)
     Gets the value attribute of the specified node as an int.
public  inthashCode()
    
public  booleanisDistinct()
    
public  voidlast()
    
public  booleannext()
    
public  booleanprevious()
    
public  voidretrieve()
     Get the table data.
public  voidset(String elementName, String attribName, Object newObject)
    
public  voidset(String attribName, Object newObject)
    
public  voidset(Object s)
    
public  voidsetAttribValue(int i, Object value)
    
public  voidsetDistinct(boolean isDistinct)
    
public  voidsetFieldValue(int colIdx, String newValue)
    
public  voidsetName(String newName)
    
public  voidsetOrderField(String fld)
    
public  voidsetReadOnly(boolean b)
    
public  voidsetSelectedRow(int rowIdx)
    
public  voidsetSqlStatement(String sqlStr, String connName, boolean writable)
    
public  voidsetupTable(String tableName)
    
public  voidsetupTable(String tableName, String fields, String whereClause)
    
public  voidsetupTable(String tableName, String fields, String whereClause, String connName, boolean writable)
    
public  voidsetupTable(String tableName, String fields, String whereClause, boolean writable)
    
protected  voidsync()
     Syncs the model with the service response is the xtable has been changed or if the node has timed out.

Field Detail
dirty
boolean dirty(Code)



modelId
protected String modelId(Code)



readOnly
boolean readOnly(Code)



xtable
CachedDatabaseTable xtable(Code)




Constructor Detail
DatabaseTableModel
public DatabaseTableModel()(Code)
Create a new model node for a database table




Method Detail
append
public Object append(String id)(Code)



dump
public void dump(Writer w)(Code)
Write teh contents of this model node to a stream
Parameters:
  w - the write/stream



executeUpdate
public int executeUpdate(String sqlStr) throws Exception(Code)
Update the underlying database table using the specified SQL statement
Parameters:
  sqlStr - the full UPDATE SQL statement the number of rows affected by the update



findRow
public DatabaseRowModel findRow(int fieldIdx, String value)(Code)
Find a row with a specified field value
Parameters:
  fieldIdx - the index of the search field
Parameters:
  value - the search value the table row model containing the selected row. null is returned ifthis table has uncommitted updates



findRow
public DatabaseRowModel findRow(String where)(Code)
Find a row with a specified field value
Parameters:
  where - the search criteria the table row model containing the selected row. null is returned ifthis table has uncommitted updates



findRows
public DatabaseTableModel findRows(int fieldIdx, String value)(Code)
Find a set of rows with a specified field value
Parameters:
  fieldIdx - the index of the search field
Parameters:
  value - the search value the table model containing the selected rows. null is returned ifthis table has uncommitted updates



findRows
public DatabaseTableModel findRows(String where)(Code)
Find a set of rows with a specified field value
Parameters:
  where - the search criteria the table model containing the selected rows. null is returned ifthis table has uncommitted updates



findRows
public DatabaseTableModel findRows(String requestFields, String where)(Code)
Find a set of rows with a specified field value
Parameters:
  requestFields - the fields to return
Parameters:
  where - the search criteria the table model containing the selected rows. null is returned ifthis table has uncommitted updates



first
public void first()(Code)
Moves the table's cursor to the first row



get
public Object get(String element)(Code)
Get the value of the element located at the path in the element parameter If the attribName parameter is not null we get the value of the attributeValues
Parameters:
  element - The path to the XModel we require
Parameters:
  attribName - The name of the attribute we require or null if we justwant the XModel value The value of the XModel or the attribute



get
public XModel get(int i)(Code)
Get the XModel at element i
Parameters:
  i - The index of the values array The XModel at location i



get
public Object get()(Code)
gets the value attribute the value of the model



getAttribName
public String getAttribName(int i)(Code)
Gets the attribute name for field i. For this node the table field name is returned.
Parameters:
  i - The index of the attributeNames array whose value we want The string value of the attributeNames array at position i



getAttribValue
public Object getAttribValue(int i)(Code)
Get the value of an attribute (row)
Parameters:
  i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i



getAttribValueAsDouble
public double getAttribValueAsDouble(int i)(Code)

Parameters:
  i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i



getAttribValueAsInt
public int getAttribValueAsInt(int i)(Code)

Parameters:
  i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i



getAttribValueAsString
public String getAttribValueAsString(int i)(Code)

Parameters:
  i - The index of the attributeValues array whose value we want The string value of the attributeValues array at position i



getAttribute
public int getAttribute(String attribName)(Code)
returns the index of the attribiteNames array whose value is the same as the attribName
Parameters:
  attribName - The name of the attribute we are trying to locate The index of the attributeNames array containg the name



getFieldValue
public String getFieldValue(int colIdx)(Code)
Provides iterative access to the table values. The current row in the table is used to index the data. This method does not implicitly retrieve the data so you must call the retrieve method explicitly.
Parameters:
  colIdx - the column of field index the data



getFieldValue
public String getFieldValue(int rowIdx, int colIdx)(Code)
Provides random access to the table values. This method does not implicitly retrieve the data so you must call the retrieve method explicitly.
Parameters:
  rowIdx - the row index
Parameters:
  colIdx - the column of field index the data



getId
public String getId()(Code)
Gets the name attribute



getNumAttributes
public int getNumAttributes()(Code)
Get the number of fields in this TableModel the number of fields



getNumChildren
public int getNumChildren()(Code)
Gets the number of rows for this table the number of rows



getSelectedRow
public int getSelectedRow()(Code)
Get the row selection index the current row selection index (zero based)



getTable
public static DatabaseTableModel getTable(String tableName)(Code)
Look up a table by name in the overall model.
Parameters:
  tableName - the table name the table node



getTagName
public String getTagName()(Code)
Gets the model element tag name, e.g. 'Component' from the XML fragment



getValue
public String getValue()(Code)
Provides iterative access to the table values. The current row in the table is used to index the data. This method does not implicitly retrieve the data so you must call the retrieve method explicitly. the data



getValue
public XModel getValue(int i)(Code)

Parameters:
  i - The index into the values array The XModel at position i of the values array.



getValueAsDouble
public double getValueAsDouble(String elementName)(Code)
Gets the value attribute as a Double value
Parameters:
  elementName -



getValueAsInt
public int getValueAsInt(String elementName)(Code)
Gets the value attribute of the specified node as an int.
Parameters:
  elementName -



hashCode
public int hashCode()(Code)
Get the hashcode for this model node the hashcode



isDistinct
public boolean isDistinct()(Code)
Check if the table is set to retrieve distinct rows the distinct flag



last
public void last()(Code)
Moves the table's cursor to the last row



next
public boolean next()(Code)
Moves the table's cursor to the next row



previous
public boolean previous()(Code)
Moves the table's cursor to the previous row



retrieve
public void retrieve()(Code)
Get the table data.



set
public void set(String elementName, String attribName, Object newObject)(Code)
Set the value of the attribute in the XModel located at the elementName
Parameters:
  elementName - The path to the XModel in the format 'base/foo
Parameters:
  attribName - The name of the attribute whose value we require
Parameters:
  newObject - The new value of the attribute



set
public void set(String attribName, Object newObject)(Code)
Set the value of the XModel located at the elementName
Parameters:
  elementName - The path to the XModel in the format 'base/foo
Parameters:
  newObject - The new value of the XModel



set
public void set(Object s)(Code)
Sets the model value
Parameters:
  s - the new value



setAttribValue
public void setAttribValue(int i, Object value)(Code)
Sets the attribute value
Parameters:
  i - The index of the attributeValues array whose value we want
Parameters:
  value - the value object



setDistinct
public void setDistinct(boolean isDistinct)(Code)
Set the table to retrieve distinct rows



setFieldValue
public void setFieldValue(int colIdx, String newValue)(Code)



setName
public void setName(String newName)(Code)
Sets the name attribute and constructs a new table of that name
Parameters:
  newName - the new name



setOrderField
public void setOrderField(String fld)(Code)
Set the field(s) used ORDER clause of the SQL query
Parameters:
  fld - the field name(s)



setReadOnly
public void setReadOnly(boolean b)(Code)
Sets the read only flag indicating whether or not the underlying table is read-only
Parameters:
  b - true for a read-only table.



setSelectedRow
public void setSelectedRow(int rowIdx)(Code)
Set the row selection index
Parameters:
  rowIdx - the new row selection index (zero based)



setSqlStatement
public void setSqlStatement(String sqlStr, String connName, boolean writable)(Code)
Specify the sql statement in its entirety
Parameters:
  sqlStr - the full SQL statement
Parameters:
  connName - the connection name



setupTable
public void setupTable(String tableName)(Code)
List the fields retrieved from the table
Parameters:
  tableName - the database table name



setupTable
public void setupTable(String tableName, String fields, String whereClause)(Code)
List the fields retrieved from the table
Parameters:
  tableName - the database table name
Parameters:
  fields - the database field names, or null if all fields are to be retrieved
Parameters:
  whereClause - the where clause, or null if all rows are to be selected



setupTable
public void setupTable(String tableName, String fields, String whereClause, String connName, boolean writable)(Code)
List the fields retrieved from the table
Parameters:
  tableName - the database table name
Parameters:
  fields - the database field names, or null if all fields are to be retrieved
Parameters:
  whereClause - the where clause, or null if all rows are to be selected
Parameters:
  connName - the connection name



setupTable
public void setupTable(String tableName, String fields, String whereClause, boolean writable)(Code)
List the fields retrieved from the table
Parameters:
  tableName - the database table name
Parameters:
  fields - the database field names, or null if all fields are to be retrieved
Parameters:
  whereClause - the where clause, or null if all rows are to be selected
Parameters:
  writable - sets the table as writable, normally this should be false



sync
protected void sync()(Code)
Syncs the model with the service response is the xtable has been changed or if the node has timed out.



Fields inherited from net.xoetrope.xui.data.XBaseModel
final public static int ID_ATTRIBUTE(Code)(Java Doc)
final public static int NUM_FIXED_ATTRIBUTE(Code)(Java Doc)
final public static int VALUE_ATTRIBUTE(Code)(Java Doc)
protected boolean addByDefault(Code)(Java Doc)
protected static boolean appendByDefault(Code)(Java Doc)
protected XModel parentModel(Code)(Java Doc)
protected XModel[] values(Code)(Java Doc)

Methods inherited from net.xoetrope.xui.data.XBaseModel
public Object append(String elementName)(Code)(Java Doc)
public void append(XModel childNode)(Code)(Java Doc)
public Object get(String element)(Code)(Java Doc)
public XModel get(int i)(Code)(Java Doc)
public Object get()(Code)(Java Doc)
public boolean getAddByDefault()(Code)(Java Doc)
public static boolean getAppendByDefault()(Code)(Java Doc)
protected String getAttribFromPath(String path)(Code)(Java Doc)
public String getAttribName(int i)(Code)(Java Doc)
public Object getAttribValue(int i)(Code)(Java Doc)
public double getAttribValueAsDouble(int i)(Code)(Java Doc)
public int getAttribValueAsInt(int index)(Code)(Java Doc)
public String getAttribValueAsString(int i)(Code)(Java Doc)
public int getAttribute(String attribName)(Code)(Java Doc)
protected String getBaseFromPath(String path)(Code)(Java Doc)
public boolean getChildExists(String name)(Code)(Java Doc)
public String getId()(Code)(Java Doc)
public int getNumAttributes()(Code)(Java Doc)
public int getNumChildren()(Code)(Java Doc)
public XModel getParent()(Code)(Java Doc)
public double getValueAsDouble(String elementName)(Code)(Java Doc)
public int getValueAsInt(String elementName)(Code)(Java Doc)
public String getValueAsString(String elementName)(Code)(Java Doc)
public void hasAutoId(boolean b)(Code)(Java Doc)
public boolean hasAutoId()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public void insertChildAt(XModel newNode, int idx)(Code)(Java Doc)
public void remove(XModel child)(Code)(Java Doc)
public void removeAttributes()(Code)(Java Doc)
public void removeChild(String name)(Code)(Java Doc)
public void removeChild(String name, String value)(Code)(Java Doc)
public void removeChildren()(Code)(Java Doc)
public void set(String elementName, Object newObject)(Code)(Java Doc)
public void set(Object s)(Code)(Java Doc)
public void setAddByDefault(boolean state)(Code)(Java Doc)
public static void setAppendByDefault(boolean state)(Code)(Java Doc)
public void setAttribValue(int index, Object value)(Code)(Java Doc)
public void setAttribValue(int index, String attribName, Object value)(Code)(Java Doc)
public void setId(String newName)(Code)(Java Doc)
public void setNumAttributes(int num)(Code)(Java Doc)
public void setNumChildren(int num)(Code)(Java Doc)

Fields inherited from net.xoetrope.xui.data.XModel
protected String tagName(Code)(Java Doc)

Methods inherited from net.xoetrope.xui.data.XModel
public void addModelListener(XModelListener listener, String name)(Code)(Java Doc)
abstract public void append(XModel childNode)(Code)(Java Doc)
abstract public Object append(String elementName)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public void fireModelUpdated()(Code)(Java Doc)
public Object get(String element)(Code)(Java Doc)
abstract public XModel get(int i)(Code)(Java Doc)
abstract public Object get()(Code)(Java Doc)
abstract public String getAttribName(int i)(Code)(Java Doc)
abstract public Object getAttribValue(int i)(Code)(Java Doc)
abstract public double getAttribValueAsDouble(int i)(Code)(Java Doc)
abstract public int getAttribValueAsInt(int i)(Code)(Java Doc)
abstract public String getAttribValueAsString(int i)(Code)(Java Doc)
abstract public int getAttribute(String attribName)(Code)(Java Doc)
abstract public String getId()(Code)(Java Doc)
public static XModel getInstance()(Code)(Java Doc)
public int getNumAttributes()(Code)(Java Doc)
public int getNumChildren()(Code)(Java Doc)
public String getTagName()(Code)(Java Doc)
abstract public double getValueAsDouble(String elementName)(Code)(Java Doc)
abstract public int getValueAsInt(String elementName)(Code)(Java Doc)
abstract public String getValueAsString(String elementName)(Code)(Java Doc)
public boolean hasAutoId()(Code)(Java Doc)
public void hasAutoId(boolean b)(Code)(Java Doc)
abstract public int hashCode()(Code)(Java Doc)
public static String prefixOutputPath(String path)(Code)(Java Doc)
public void removeChildren()(Code)(Java Doc)
public XModel reset()(Code)(Java Doc)
public void resetAttributes()(Code)(Java Doc)
abstract public void set(String attribName, Object newObject)(Code)(Java Doc)
abstract public void set(Object s)(Code)(Java Doc)
abstract public void setAttribValue(int i, Object value)(Code)(Java Doc)
abstract public void setAttribValue(int i, String attribName, Object value)(Code)(Java Doc)
public void setId(String newId)(Code)(Java Doc)
public void setNumAttributes(int num)(Code)(Java Doc)
public void setNumChildren(int num)(Code)(Java Doc)
public void setTagName(String name)(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.