com.tirsen.angkor.table
Class Table

java.lang.Object
  |
  +--com.tirsen.angkor.Component
        |
        +--com.tirsen.angkor.widget.Container
              |
              +--com.tirsen.angkor.table.Table
All Implemented Interfaces:
java.io.Serializable, View

public class Table
extends Container

The table should support the following features: Implemented ones:

  • Fetch values from the model.
  • A default cell-view-factory.
  • Cell-view-factories for each column overriding the default one.
  • Cell-view-factories for rows not getting values from the model. (for example a column for executing actions on the object on the row or for marking rows to remove) TODOs:
  • Row-view-factories for rows not getting values from the model. (for example a last line for adding new objects)
  • Inserting view-only view-factories before and after columns and rows. The implicit model and view-only row-view-factories and column-view-factories will probably be refactored into a TableColumn-class instead. The TableColumn-class has an index into the model if it is from the model and a view-factory for the cells. This way columns can be arranged in any order and still maintain a simple link to the model. This does not support the view-only rows so oftenly used on the web for creating a new row in the model, ie. a view-only row is not supported (in contrast to the view-only columns which are supported).

    Version:
    $Revision: 1.5 $
    $Id: Table.java,v 1.5 2002/10/09 21:37:37 tirsen Exp $
    Author:
    $Author: tirsen $
    See Also:
    Serialized Form

    Field Summary
     
    Fields inherited from class com.tirsen.angkor.widget.Container
    children
     
    Constructor Summary
    Table()
               
    Table(boolean readOnly)
               
     
    Method Summary
     void addTableColumn(int index, TableColumn column)
              Insert a new column at the specified index.
     void addTableColumn(TableColumn column)
              Add a new column at the end.
    protected  TableModel createDefaultTableModel()
               
     ValueModel getCellModel(int row, int column)
               
     View getCellView(int row, int column)
               
     java.util.List getChildren()
               
     int getColumnCount()
              Returns the number of columns table.
     java.lang.String getColumnName(int column)
               
     int getEndRow()
               
     int getRowCount()
               
     java.util.List getRowViews(int row)
               
     int getStartRow()
               
     TableModel getTableModel()
               
     TableCellViewFactory getViewFactory()
               
     void render(RenderContext context)
              Render this view on the given context if the view is visible.
     void resetCreatedViews()
              Call this method when we have a suspicion that cell-views will need to be recreated.
     void scrollBackward()
               
     void scrollForward()
               
     void scrollToStart()
               
     void setColumnCellViewFactory(int column, TableCellViewFactory columnFactory)
               
     void setModel(TableModel model)
               
     void setNumberOfScrollRows(int numberOfRows)
              Sets the maximum number of rows for scrolling.
     void setRange(int start, int end)
              If any number is set to a negative number it is subtracted from the number of rows.
     void setReadOnly(boolean readOnly)
               
     void setTableCellViewFactory(TableCellViewFactory viewFactory)
               
     
    Methods inherited from class com.tirsen.angkor.widget.Container
    add, add, createChildren, getNumberOfChildren, isChildrenCreated, iterateAllElements, iterateCollection, maybeCreateChildren, parse, remove, renderChildren
     
    Methods inherited from class com.tirsen.angkor.Component
    allocateUniqueId, getAttribute, getContainer, getId, getRenderContext, getVisibleIndex, isDebugTables, isParsing, isVisible, setAttribute, setContainer, setId, setVisible, uniqueId
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Table

    public Table()

    Table

    public Table(boolean readOnly)
    Method Detail

    setModel

    public void setModel(TableModel model)

    getRowViews

    public java.util.List getRowViews(int row)

    setReadOnly

    public void setReadOnly(boolean readOnly)

    getCellView

    public View getCellView(int row,
                            int column)

    getCellModel

    public ValueModel getCellModel(int row,
                                   int column)

    resetCreatedViews

    public void resetCreatedViews()
    Call this method when we have a suspicion that cell-views will need to be recreated.


    getChildren

    public java.util.List getChildren()
    Overrides:
    getChildren in class Container

    getViewFactory

    public TableCellViewFactory getViewFactory()

    setTableCellViewFactory

    public void setTableCellViewFactory(TableCellViewFactory viewFactory)

    getRowCount

    public int getRowCount()

    getColumnCount

    public int getColumnCount()
    Returns the number of columns table. Note that this is necessarily not the same number of columns as in the model.


    getTableModel

    public TableModel getTableModel()

    createDefaultTableModel

    protected TableModel createDefaultTableModel()

    getColumnName

    public java.lang.String getColumnName(int column)

    setRange

    public void setRange(int start,
                         int end)
    If any number is set to a negative number it is subtracted from the number of rows. As a special case of this setting end to -1 sets the range to end at the last row. If end is lower or equal to start sets the range to show all.


    addTableColumn

    public void addTableColumn(int index,
                               TableColumn column)
    Insert a new column at the specified index.


    addTableColumn

    public void addTableColumn(TableColumn column)
    Add a new column at the end.


    setColumnCellViewFactory

    public void setColumnCellViewFactory(int column,
                                         TableCellViewFactory columnFactory)

    getStartRow

    public int getStartRow()

    getEndRow

    public int getEndRow()

    scrollToStart

    public void scrollToStart()

    scrollForward

    public void scrollForward()

    scrollBackward

    public void scrollBackward()

    setNumberOfScrollRows

    public void setNumberOfScrollRows(int numberOfRows)
    Sets the maximum number of rows for scrolling. If set to 0 disables scrolling (ie. shows all). A call to this method automatically scrolls to the start of the table.


    render

    public void render(RenderContext context)
                throws java.io.IOException
    Description copied from interface: View
    Render this view on the given context if the view is visible. Performed during render-phase.

    Specified by:
    render in interface View
    Overrides:
    render in class Container
    java.io.IOException
    See Also:
    View.setVisible(boolean), View.isVisible()


    Copyright © 2002-2002 . All Rights Reserved.