com.jaxfront.core.ui
Class FlipOrientationTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jaxfront.core.ui.FlipOrientationTableModel
All Implemented Interfaces:
DOMChangeListener, java.io.Serializable, java.util.EventListener, javax.swing.table.TableModel

public class FlipOrientationTableModel
extends javax.swing.table.AbstractTableModel
implements DOMChangeListener

The FlipOrientationTableModel is the model counter part to the RowHeadedTable. This model can be fliped so all columns will becom rows and vis versa.

See Also:
Serialized Form

Constructor Summary
FlipOrientationTableModel(AbstractType listType)
           
FlipOrientationTableModel(ListType listType)
          Constructor from a complex group list Extracts table info from the complex group list' XU definition OR if that is not defined, creates the table info by looking for SimpleTypes and SimpleTypeLists in the ComplexGroupList
 
Method Summary
 void domChanged(DOMChangeEvent event)
          Respond method for a DOM state changed (DOMChangeEvent).
 java.lang.Object getCachedValueAt(int row, int col)
           
 java.lang.Class getColumnClass(int columnIndex)
           
 int getColumnCount()
          Get the number of columns in the table Value depends on whether the table is flipped (This is used by the JTable displaying this model)
 java.lang.String getColumnName(int col)
          Get the column name at index col.
 java.lang.String[] getColumnNames()
           
 java.lang.String[][] getData()
           
 java.lang.String getExcelTableData()
          Returns the table's contents in a format that Excel can handle (tab, newline separated)
 FormulaExpression getFormulaExpression(int row, int col)
           
 int getIndexFor(Type type)
          Returns the index within the holding listType of the passing type.
 ListType getListType()
          Returns the holding list type.
 int getRowCount()
          Count the number of rows in the table.Value depends on whether the table is flipped
 java.util.List getRowFormulas(int col)
           
 java.util.Vector getRowHeaders()
           
 java.lang.String getRowName(int index)
           
 java.lang.String[] getRowValues(int row)
           
 SimpleType getSimpleTypeAt(int row, int col)
          Returns a simple type for a row and a column.
 RowHeaderLabellingStrategy getStrategy()
          Accessor to the labelling strategy needed by the view.
 TableInfo getTableInfo()
          Accessor to the table info.
 Type getTypeAt(int row, int col)
          Returns a simple type for a row and a column.
 java.lang.Object getValueAt(int row, int col)
          Get the Object at position row, column Returns the approriate object from the internal object table, location depends on row, column but also on whether the table is flipped or not. col = 0 will always return the rowHeaders for the table.
 boolean isCellEditable(int row, int column)
           
 boolean isCellEditableEnabled()
          Returns true if cells are editable.
 boolean isFlipped()
          Accessor to the flipped flag.
 void release()
          Releases alocated resources.
 java.lang.StringBuffer rowToCSV(int row, java.lang.String delim)
           
 void setFlipped(boolean flipped)
          Sets if the table is flipped.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 boolean showRowHeaders()
          Accessor to the showRowHeaders field.
 void swapFormula(int from, int to)
          Swaps the formula from one type to another.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlipOrientationTableModel

public FlipOrientationTableModel(AbstractType listType)

FlipOrientationTableModel

public FlipOrientationTableModel(ListType listType)
Constructor from a complex group list Extracts table info from the complex group list' XU definition OR if that is not defined, creates the table info by looking for SimpleTypes and SimpleTypeLists in the ComplexGroupList

Parameters:
listType -
Method Detail

domChanged

public void domChanged(DOMChangeEvent event)
Description copied from interface: DOMChangeListener
Respond method for a DOM state changed (DOMChangeEvent).

Specified by:
domChanged in interface DOMChangeListener
Parameters:
event - occured DOMChangeEvent
See Also:
DOMChangeListener.domChanged(DOMChangeEvent)

getCachedValueAt

public java.lang.Object getCachedValueAt(int row,
                                         int col)

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
See Also:
TableModel.getColumnClass(int)

getColumnCount

public int getColumnCount()
Get the number of columns in the table Value depends on whether the table is flipped (This is used by the JTable displaying this model)

Specified by:
getColumnCount in interface javax.swing.table.TableModel
See Also:
TableModel.getColumnCount()

getColumnName

public java.lang.String getColumnName(int col)
Get the column name at index col. Value depends on whether the table is flipped.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - the column to select
See Also:
TableModel.getColumnName(int)

getColumnNames

public java.lang.String[] getColumnNames()

getData

public java.lang.String[][] getData()

getExcelTableData

public java.lang.String getExcelTableData()
Returns the table's contents in a format that Excel can handle (tab, newline separated)

Returns:
String

getFormulaExpression

public FormulaExpression getFormulaExpression(int row,
                                              int col)

getIndexFor

public int getIndexFor(Type type)
Returns the index within the holding listType of the passing type.

Parameters:
type - to lookup index for

getListType

public ListType getListType()
Returns the holding list type.


getRowCount

public int getRowCount()
Count the number of rows in the table.Value depends on whether the table is flipped

Specified by:
getRowCount in interface javax.swing.table.TableModel
See Also:
TableModel.getRowCount()

getRowFormulas

public java.util.List getRowFormulas(int col)

getRowHeaders

public java.util.Vector getRowHeaders()

getRowName

public java.lang.String getRowName(int index)

getRowValues

public java.lang.String[] getRowValues(int row)

getSimpleTypeAt

public SimpleType getSimpleTypeAt(int row,
                                  int col)
Returns a simple type for a row and a column.

Parameters:
row - row to lookup
col - column to lookup

getStrategy

public RowHeaderLabellingStrategy getStrategy()
Accessor to the labelling strategy needed by the view.


getTableInfo

public TableInfo getTableInfo()
Accessor to the table info.


getTypeAt

public Type getTypeAt(int row,
                      int col)
Returns a simple type for a row and a column.

Parameters:
row - row to lookup
col - column to lookup

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Get the Object at position row, column Returns the approriate object from the internal object table, location depends on row, column but also on whether the table is flipped or not. col = 0 will always return the rowHeaders for the table. Values for the cells will be computed on the fly for not yet evaluated XPath Expressions.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
row - The row to select
col - The column to select
Returns:
The object at that location

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
See Also:
TableModel.isCellEditable(int, int)

isCellEditableEnabled

public boolean isCellEditableEnabled()
Returns true if cells are editable.


isFlipped

public boolean isFlipped()
Accessor to the flipped flag.


release

public void release()
Releases alocated resources.


rowToCSV

public java.lang.StringBuffer rowToCSV(int row,
                                       java.lang.String delim)

setFlipped

public void setFlipped(boolean flipped)
Sets if the table is flipped.

Parameters:
flipped - indicates if table is flipped

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
See Also:
TableModel.setValueAt(Object, int, int)

showRowHeaders

public boolean showRowHeaders()
Accessor to the showRowHeaders field.


swapFormula

public void swapFormula(int from,
                        int to)
Swaps the formula from one type to another.

Parameters:
fromType - base type
toType - target type