Java Doc for ItsNatTable.java in  » Ajax » ItsNat » org » itsnat » comp » 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 » Ajax » ItsNat » org.itsnat.comp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.itsnat.comp.ItsNatTable

All known Subclasses:   org.itsnat.impl.comp.ItsNatTableImpl,
ItsNatTable
public interface ItsNatTable extends ItsNatElementComponent(Code)
Is the base interface of table based components.

A table component manages a javax.swing.table.TableModel data model, table cell values are rendered as markup using a special object, the renderer, and may be optionally edited "in place" using a user defined editor.

Any change to the data model is notified to the component and the markup is rendered again. The data model ever mandates over the markup, any initial markup content (initial rows) is removed.

Almost a row with a cell must be present in the markup, this row and cell are used as patterns to create new table rows/cells, and is removed because by default the data model is empty.

This component family uses two javax.swing.ListSelectionModel selection models, one for columns, another for rows, to keep track of selection states. When a cell is selected (usually by clicking it) the selection state is updated accordingly using both selection models (notifying to registered listeners).

ItsNat tables support all selection modes that Swing JTable supports, as in JTable ItsNatTable.setRowSelectionAllowed(boolean) and ItsNatTable.setColumnSelectionAllowed(boolean) control whether the complete row and column are selected when a cell is selected.

There is no default decoration of table cell selection, selection model listeners may be used to decorate the table markup when its selection state changes.

By default this component uses the default renderer and editor and a javax.swing.table.DefaultTableModel data model.

Row and column indexes start in 0.

This component family is the "componentized" version of org.itsnat.core.domutil.ElementTable and follows a similar philosophy (note the component version provides table header support).


author:
   Jose Maria Arranz Santamaria




Method Summary
public  voidchangeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
     Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
public  voidclearSelection()
     Clears any row or column selection.

Calls ListSelectionModel.clearSelection() method of both, row and column, selection models.

public  TableModelcreateDefaultTableModel()
     Creates a data model instance appropriated to this component.
public  ListSelectionModelgetColumnSelectionModel()
     Returns the current column selection model. the current column selection model.
public  intgetEditingColumn()
     Returns the column of the cell being edited. the column of the cell being edited.
public  intgetEditingRow()
     Returns the row of the cell being edited. the row of the cell being edited.
public  StringgetEditorActivatorEvent()
     Returns the event type used to activate the table cell edition process by the user. the event type used to activate the edition.
public  ItsNatTableCellEditorgetItsNatTableCellEditor()
     Returns the current table cell editor.
public  ItsNatTableCellRenderergetItsNatTableCellRenderer()
     Returns the current component renderer.
public  ItsNatTableHeadergetItsNatTableHeader()
     Returns the table header sub-component. the table header.
public  ItsNatTableStructuregetItsNatTableStructure()
     Returns the component structure.
public  ItsNatTableUIgetItsNatTableUI()
     Returns the user interface manager of this component.
public  ListSelectionModelgetRowSelectionModel()
     Returns the current row selection model. the current row selection model.
public  intgetSelectedColumn()
     Returns the index of the first selected column.
public  int[]getSelectedColumns()
     Returns an array with indices of the current selected columns.
public  intgetSelectedRow()
     Returns the index of the first selected row.
public  int[]getSelectedRows()
     Returns an array with indices of the current selected rows.
public  TableModelgetTableModel()
     Returns the current data model of this component.
public  booleanisCellSelected(int row, int column)
     Informs whether the specified cell is selected.

A cell is selected if cell selection is enabled ( ItsNatTable.isCellSelectionEnabled() returns true) and row selection OR column selection is enabled (not both) and the cell is part of a selected row or column.

public  booleanisCellSelectionEnabled()
     Informs whether cell selection is enabled.
public  booleanisColumnSelected(int column)
     Informs whether the specified column contains almost a cell selected.

This method simply delegates to getColumnSelectionModel().isSelectedIndex(column).


Parameters:
  column - the column index.
public  booleanisColumnSelectionAllowed()
     Informs whether column selection is allowed.
public  booleanisEditing()
     Informs whether a table cell value is being edited.
public  booleanisRowSelected(int row)
     Informs whether the specified row contains almost a cell selected.

This method simply delegates to getRowSelectionModel().isSelectedIndex(row).


Parameters:
  row - the row index.
public  booleanisRowSelectionAllowed()
     Informs whether row selection is allowed.
public  voidselectAll()
     Selects all cells in the table.
public  voidsetCellSelectionEnabled(boolean cellSelectionEnabled)
     Enables/disables cell selection.
public  voidsetColumnSelectionAllowed(boolean columnSelectionAllowed)
     Sets whether column selection is allowed.
public  voidsetColumnSelectionInterval(int index0, int index1)
     Sets a new column selection interval specifying an index range.
public  voidsetColumnSelectionModel(ListSelectionModel selectionModel)
     Sets the new column selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again.

public  voidsetEditorActivatorEvent(String eventType)
     Sets the event type used to activate the table cell edition process by the user.
public  voidsetItsNatTableCellEditor(ItsNatTableCellEditor editor)
     Sets the table cell editor.

Table cell edition works very much the same as label edition (see ItsNatLabel.setItsNatLabelEditor(ItsNatLabelEditor) ).

Some differences:

The edition process starts programmatically by calling ItsNatTable.startEditingAt(int,int) .

The edition takes place inside the cell content element as returned by ItsNatTableStructure.getCellContentElement(ItsNatTableintintorg.w3c.dom.Element) .

The new cell value is set to the data model calling javax.swing.table.TableModel.setValueAt(Object,int,int).


Parameters:
  editor - the new editor.
public  voidsetItsNatTableCellRenderer(ItsNatTableCellRenderer renderer)
     Sets the component renderer.
public  voidsetRowSelectionAllowed(boolean rowSelectionAllowed)
     Sets whether row selection is allowed.
public  voidsetRowSelectionInterval(int index0, int index1)
     Sets a new row selection interval specifying an index range.
public  voidsetRowSelectionModel(ListSelectionModel selectionModel)
     Sets the new row selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again.

public  voidsetSelectedColumns(int[] indices)
     Sets the current selected columns.
public  voidsetSelectedRows(int[] indices)
     Sets the current selected rows.
public  voidsetSelectionMode(int selectionMode)
     Sets a new selection mode to the row and column selection models.

Calls ListSelectionModel.setSelectionMode() method of both, row and column, selection models.

public  voidsetTableModel(TableModel dataModel)
     Changes the data model of this component.

Current data model is disconnected from this component, and the new data model is bound to this component, every change is tracked and updates the user interfaces accordingly.

If the specified data model is the same instance as the current data model, then is reset, component listener is removed and added again.

public  voidstartEditingAt(int row, int column)
     Used to start programmatically a table cell edition process "in place".



Method Detail
changeSelection
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)(Code)
Updates the selection models of the table, depending on the state of the two flags: toggle and extend. Most changes to the selection are the result of mouse events received by the UI are channeled through this method.

This implementation uses the following conventions:

  • toggle: false, extend: false. Clear the previous selection and ensure the new cell is selected. This state is used to change the selection by clicking a cell (no shift and ctrl keys held)
  • toggle: false, extend: true. Extend the previous selection from the anchor to the specified cell, clearing all other selections. This state is used to change the selection by clicking a cell with shift key held.
  • toggle: true, extend: false. If the specified cell is selected, deselect it. If it is not selected, select it. This state is used to change the selection by clicking a cell with ctrl key held.
  • toggle: true, extend: true. Leave the selection state as it is, but move the anchor index to the specified location. This state is used to change the selection by clicking a cell with shift and ctrl keys held.

Note: original documentation (modified) obtained from JTable.changeSelection (Sun JDK 1.5).


Parameters:
  rowIndex - affects the selection at row
Parameters:
  columnIndex - affects the selection at column
Parameters:
  toggle - see description above
Parameters:
  extend - if true, extend the current selection



clearSelection
public void clearSelection()(Code)
Clears any row or column selection.

Calls ListSelectionModel.clearSelection() method of both, row and column, selection models.




createDefaultTableModel
public TableModel createDefaultTableModel()(Code)
Creates a data model instance appropriated to this component. This instance is not bound to the component. a new data model instance.



getColumnSelectionModel
public ListSelectionModel getColumnSelectionModel()(Code)
Returns the current column selection model. the current column selection model. By default a javax.swing.DefaultListSelectionModel instance.
See Also:   ItsNatTable.setColumnSelectionModel(javax.swing.ListSelectionModel)



getEditingColumn
public int getEditingColumn()(Code)
Returns the column of the cell being edited. the column of the cell being edited. -1 if none is being edited.



getEditingRow
public int getEditingRow()(Code)
Returns the row of the cell being edited. the row of the cell being edited. -1 if none is being edited.



getEditorActivatorEvent
public String getEditorActivatorEvent()(Code)
Returns the event type used to activate the table cell edition process by the user. the event type used to activate the edition. By default is "dblclick".
See Also:   ItsNatTable.setEditorActivatorEvent(String)



getItsNatTableCellEditor
public ItsNatTableCellEditor getItsNatTableCellEditor()(Code)
Returns the current table cell editor. This object is used to edit in place a table cell value. the current editor. By default uses the default editor calling (ItsNatComponentManager.createDefaultItsNatTableCellEditor(ItsNatComponent)) with a null parameter.
See Also:   ItsNatTable.setItsNatTableCellEditor(ItsNatTableCellEditor)



getItsNatTableCellRenderer
public ItsNatTableCellRenderer getItsNatTableCellRenderer()(Code)
Returns the current component renderer. This renderer converts a table cell value to markup. the current renderer. By default uses the default renderer (ItsNatComponentManager.createDefaultItsNatTableCellRenderer)
See Also:   ItsNatTable.setItsNatTableCellRenderer(ItsNatTableCellRenderer)



getItsNatTableHeader
public ItsNatTableHeader getItsNatTableHeader()(Code)
Returns the table header sub-component. the table header. Null if this table does not have a header.



getItsNatTableStructure
public ItsNatTableStructure getItsNatTableStructure()(Code)
Returns the component structure. the component structure.



getItsNatTableUI
public ItsNatTableUI getItsNatTableUI()(Code)
Returns the user interface manager of this component. the user interface manager.



getRowSelectionModel
public ListSelectionModel getRowSelectionModel()(Code)
Returns the current row selection model. the current row selection model. By default a javax.swing.DefaultListSelectionModel instance.
See Also:   ItsNatTable.setRowSelectionModel(javax.swing.ListSelectionModel)



getSelectedColumn
public int getSelectedColumn()(Code)
Returns the index of the first selected column. If several columns are selected returns the first one. index of the first selected column. -1 if none is selected.



getSelectedColumns
public int[] getSelectedColumns()(Code)
Returns an array with indices of the current selected columns. an array with the current selected columns.
See Also:   ItsNatTable.setSelectedColumns(int[])



getSelectedRow
public int getSelectedRow()(Code)
Returns the index of the first selected row. If several rows are selected returns the first one. index of the first selected row. -1 if none is selected.



getSelectedRows
public int[] getSelectedRows()(Code)
Returns an array with indices of the current selected rows. an array with the current selected rows.
See Also:   ItsNatTable.setSelectedRows(int[])



getTableModel
public TableModel getTableModel()(Code)
Returns the current data model of this component. the current data model
See Also:   ItsNatTable.setTableModel(javax.swing.table.TableModel)



isCellSelected
public boolean isCellSelected(int row, int column)(Code)
Informs whether the specified cell is selected.

A cell is selected if cell selection is enabled ( ItsNatTable.isCellSelectionEnabled() returns true) and row selection OR column selection is enabled (not both) and the cell is part of a selected row or column. If row selection AND column selection are enabled the cell is selected only if cell row AND column are selected, this mode (row and column selection enabled) allows selecting individual cells.

Summary:

  • To select complete rows: row selection enabled and column disabled. A single cell selection selects all remaining cells in the row
  • To select complete columns: column selection enabled and row disabled.
  • A single cell selection selects all remaining cells in the column
  • To select individual cells: column and row selection enabled.

Parameters:
  row - row position of the cell.
Parameters:
  column - column position of the cell. true if the specified cell is selected.
See Also:   ItsNatTable.isCellSelectionEnabled()



isCellSelectionEnabled
public boolean isCellSelectionEnabled()(Code)
Informs whether cell selection is enabled. A cell may be selected if row or column (or both) selection is enabled. if cell selection is enabled. By default is true.
See Also:   ItsNatTable.setCellSelectionEnabled(boolean)



isColumnSelected
public boolean isColumnSelected(int column)(Code)
Informs whether the specified column contains almost a cell selected.

This method simply delegates to getColumnSelectionModel().isSelectedIndex(column).


Parameters:
  column - the column index. true if the specified column is selected.



isColumnSelectionAllowed
public boolean isColumnSelectionAllowed()(Code)
Informs whether column selection is allowed. if column selection is allowed, true by default.
See Also:   ItsNatTable.setColumnSelectionAllowed(boolean)
See Also:   



isEditing
public boolean isEditing()(Code)
Informs whether a table cell value is being edited. true if a table cell value is being edited.
See Also:   ItsNatTable.startEditingAt(int,int)



isRowSelected
public boolean isRowSelected(int row)(Code)
Informs whether the specified row contains almost a cell selected.

This method simply delegates to getRowSelectionModel().isSelectedIndex(row).


Parameters:
  row - the row index. true if the specified row is selected.



isRowSelectionAllowed
public boolean isRowSelectionAllowed()(Code)
Informs whether row selection is allowed. if row selection is allowed, true by default.
See Also:   ItsNatTable.setRowSelectionAllowed(boolean)



selectAll
public void selectAll()(Code)
Selects all cells in the table.



setCellSelectionEnabled
public void setCellSelectionEnabled(boolean cellSelectionEnabled)(Code)
Enables/disables cell selection. If cell selection is enabled row and column selection are enabled too (if disabled are disabled too).
Parameters:
  cellSelectionEnabled - true if cell selection is enabled.
See Also:   ItsNatTable.isCellSelectionEnabled()



setColumnSelectionAllowed
public void setColumnSelectionAllowed(boolean columnSelectionAllowed)(Code)
Sets whether column selection is allowed.
Parameters:
  columnSelectionAllowed - true if column selection is allowed.
See Also:   ItsNatTable.isColumnSelectionAllowed()
See Also:   
See Also:   ItsNatTable.isCellSelected(int,int)
See Also:   



setColumnSelectionInterval
public void setColumnSelectionInterval(int index0, int index1)(Code)
Sets a new column selection interval specifying an index range.

This method simply delegates to getColumnSelectionModel().setSelectionInterval(index0,index1).


Parameters:
  index0 - one end of the interval.
Parameters:
  index1 - other end of the interval



setColumnSelectionModel
public void setColumnSelectionModel(ListSelectionModel selectionModel)(Code)
Sets the new column selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again. Use this technique if you want to add a listener to be executed before the default component listener.
Parameters:
  selectionModel - the new column selection model.
See Also:   ItsNatTable.getColumnSelectionModel()




setEditorActivatorEvent
public void setEditorActivatorEvent(String eventType)(Code)
Sets the event type used to activate the table cell edition process by the user.
Parameters:
  eventType - the event type used to activate the edition.
See Also:   ItsNatTable.getEditorActivatorEvent()
See Also:   



setItsNatTableCellEditor
public void setItsNatTableCellEditor(ItsNatTableCellEditor editor)(Code)
Sets the table cell editor.

Table cell edition works very much the same as label edition (see ItsNatLabel.setItsNatLabelEditor(ItsNatLabelEditor) ).

Some differences:

The edition process starts programmatically by calling ItsNatTable.startEditingAt(int,int) .

The edition takes place inside the cell content element as returned by ItsNatTableStructure.getCellContentElement(ItsNatTableintintorg.w3c.dom.Element) .

The new cell value is set to the data model calling javax.swing.table.TableModel.setValueAt(Object,int,int).


Parameters:
  editor - the new editor. May be null (edition disabled).
See Also:   ItsNatTable.getItsNatTableCellEditor()
See Also:   



setItsNatTableCellRenderer
public void setItsNatTableCellRenderer(ItsNatTableCellRenderer renderer)(Code)
Sets the component renderer.
Parameters:
  renderer - the new renderer.
See Also:   ItsNatTable.getItsNatTableCellRenderer()
See Also:   



setRowSelectionAllowed
public void setRowSelectionAllowed(boolean rowSelectionAllowed)(Code)
Sets whether row selection is allowed.
Parameters:
  rowSelectionAllowed - true if row selection is allowed.
See Also:   ItsNatTable.isRowSelectionAllowed()
See Also:   
See Also:   ItsNatTable.isCellSelected(int,int)
See Also:   



setRowSelectionInterval
public void setRowSelectionInterval(int index0, int index1)(Code)
Sets a new row selection interval specifying an index range.

This method simply delegates to getRowSelectionModel().setSelectionInterval(index0,index1).


Parameters:
  index0 - one end of the interval.
Parameters:
  index1 - other end of the interval



setRowSelectionModel
public void setRowSelectionModel(ListSelectionModel selectionModel)(Code)
Sets the new row selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again. Use this technique if you want to add a listener to be executed before the default component listener.
Parameters:
  selectionModel - the new row selection model.
See Also:   ItsNatTable.getRowSelectionModel()




setSelectedColumns
public void setSelectedColumns(int[] indices)(Code)
Sets the current selected columns.
Parameters:
  indices - index array of the new selected columns.
See Also:   ItsNatTable.getSelectedColumns()



setSelectedRows
public void setSelectedRows(int[] indices)(Code)
Sets the current selected rows.
Parameters:
  indices - index array of the new selected rows.
See Also:   ItsNatTable.getSelectedRows()



setSelectionMode
public void setSelectionMode(int selectionMode)(Code)
Sets a new selection mode to the row and column selection models.

Calls ListSelectionModel.setSelectionMode() method of both, row and column, selection models.


Parameters:
  selectionMode - new selection mode value.



setTableModel
public void setTableModel(TableModel dataModel)(Code)
Changes the data model of this component.

Current data model is disconnected from this component, and the new data model is bound to this component, every change is tracked and updates the user interfaces accordingly.

If the specified data model is the same instance as the current data model, then is reset, component listener is removed and added again. Use this technique if you want to add a data model listener to be executed before the default component listener.
Parameters:
  dataModel - the new data model.




startEditingAt
public void startEditingAt(int row, int column)(Code)
Used to start programmatically a table cell edition process "in place".
See Also:   ItsNatTable.isEditing()



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