com.droplets.api
Class Table

java.lang.Object
  |
  +--com.droplets.api.Component
        |
        +--com.droplets.api.Table
All Implemented Interfaces:
java.util.EventListener, TableModelListener

public class Table
extends Component
implements TableModelListener

Provides API for the table.

A table is modeled as a sequence of rows, each having a constant number of columns. The number of columns, once specified, cannot change during the lifetime of the table. Table selection is modeled as a rectangle, but only rows can act as selection units.

To operate, Table requires an instance of the TableModel sub-class, a data model which manages the underlying table data.

Important: The start() method may not be called until both the component and the enclosing window have been successfully constructed. (Ideally, they should be called from the window's start() method).

Tables support drag and drop. You need to pass the Component you want to accept drops from to the addAcceptDrop function. You then need to add a DropListener via a call to addDropListener. When a drop occurs we will generate a TableDropEvent. This TableDropEvent will be handled by DropListener class you created and added above.

Tables support editting. You need to set the EditId property in each TableCellValue returned by your TableModel, and support TableCellValueChangeEvents via the TableCellValueChangeListener interface.


Field Summary
static int GRIDLINES_BOTH
           
static int GRIDLINES_HORIZONTAL
           
static int GRIDLINES_NONE
           
static int GRIDLINES_VERTICAL
           
static int MUTLIPLE_INTERVAL_SELECTION
          Deprecated. Not implemented.
static int SELECT_CONTIGUOUS_ROWS
          Selection mode for selecting multiple contiguous rows.
static int SELECT_SINGLE_CELL
          Selection mode for selecting a single cell.
static int SELECT_SINGLE_ROW
          Selection mode for selecting a single row.
static int SINGLE_INTERVAL_SELECTION
          Deprecated. Use SELECT_CONTIGUOUS_ROWS.
static int SINGLE_SELECTION
          Deprecated. Use SELECT_SINGLE_ROW.
 
Fields inherited from class com.droplets.api.Component
ANCHOR_CENTER, ANCHOR_EAST, ANCHOR_NORTH, ANCHOR_NORTHEAST, ANCHOR_NORTHWEST, ANCHOR_SOUTH, ANCHOR_SOUTHEAST, ANCHOR_SOUTHWEST, ANCHOR_WEST, FILL_BOTH, FILL_HORIZONTAL, FILL_NONE, FILL_VERTICAL
 
Constructor Summary
Table(LayoutPlacement p, TableModel m, Window w)
           
Table(LayoutPlacement p, Window window, TableModel model)
          Table constructor.
 
Method Summary
protected  void action(java.lang.String action, java.lang.String args)
          Called by the server when the user has performed an action on this component.
 void addAcceptDrop(Component c)
          Add a valid target for us to accept drop messages from.
 void addClickListener(ClickListener l)
          Adds a listener to be notified of clicks and double-clicks
 void addDropListener(DropListener l)
          Adds a listener to be notified of drop events.
 void addKeyPressListener(KeyPressListener l)
          Adds a listener to be notified of key-press events.
 void addSelectionListener(SelectionListener l)
          Adds a listener to be notified of selection events.
 void addTableCellValueChangeListener(TableCellValueChangeListener l)
           
protected  void attributeChanged(java.lang.String name, java.lang.String value)
          Calls fireAttributeChangeEvent to notify all registered listeners that an attribute has changed.
 void ensureCellIsShown(CellCoords coords)
          Ensures that the row is visible
 void ensureCellIsShown(CellCoords coords, java.lang.String skin)
          Deprecated. This method no longer supports being skinned. Use the ensureCellIsShown method that does not take a skin. Ensures that the row is visible
 Color getColumnHeaderBgColor()
          Gets the background color of the column header.
 Color getColumnHeaderFgColor()
          Gets the foreground color of the column header.
 boolean getColumnHeadersVisible()
          Gets the visibility of the column header.
 Color getDragOverBgColor()
          Gets the background color of the row that the mouse is being dragged over.
 Color getDragOverFgColor()
          Gets the foreground color of the row that the mouse is being dragged over.
 Color getFocusColor()
          Returns the color of the focus box for cells.
 Color getGridlineColor()
          Returns the color of the gridlines (borders between cells).
 int getGridlines()
          Returns the mode of gridlines: GRIDLINES_NONE, GRIDLINES_HORIZONTAL, etc.
 boolean getKeysEnabled()
          Returns the flag indicating whether or not this table accepts key-presses.
 boolean getLocalStore()
          Gets the client-side cache setting.
 boolean getLockSecondarySortAscending()
          If the secondary sort is locked at a particular column will return whether it is ascending or not.
 int getLockSecondarySortCol()
          If the secondary sort is locked at a particular column will return that column, otherwise it returns -1.
 CellCoords getPortOrigin()
          Returns the coordinate of the port area relative to the origin of the table's data sheet.
 Color getReadOnlyFocusColor()
          Returns the color of the focus box for read-only cells.
 CellRectangle getRectangularSelection()
          If the selection is a rectangle (currently the only supported mode), returns it.
 boolean getScrollbarVisible()
          Returns the flag indicating whether or not the table scroll bar is visible.
 Color getSelectionBgColor()
          Returns the background color of the selection.
 Color getSelectionFgColor()
          Returns the foreground color of the selection.
 int getSelectionMode()
          Returns the mode of selection.
 boolean getShowSecondarySort()
          returns true if the table is showing the secondary sort triangle in the header.
 boolean getSortOnClick()
          Returns the flag indicating whether or not the table supports sorting when column headers are clicked.
protected  java.lang.String getSpecification()
          This method is used internally by the Droplet API
 CellRectangle getVisibleCellRectangle()
          Returns the coordinate of the port area relative to the origin of the table's data sheet.
 void handleDataChanged(TableModelEvent evt)
          Specified by handleDataChanged in TableModelListener
 void handleRowsDeleted(TableModelEvent evt)
          Specified by handleRowsDeleted in TableModelListener
 void handleRowsInserted(TableModelEvent evt)
          Specified by handleRowsInserted in TableModelListener
 boolean isSelectionEmpty()
          Checks whether or not current selection is empty.
protected  void processSortData(int col1, boolean ascend1, int col2, boolean ascend2)
          Handle a request to sort the data in the table.
 void removeAcceptDrop(Component c)
          Stop accepting drop messages from the specified target.
 void removeClickListener(ClickListener l)
          Removes a click listener.
 void removeDropListener(DropListener l)
          Removes a drop listener.
 void removeKeyPressListener(KeyPressListener l)
          Removes a key press listener.
 void removeSelectionListener(SelectionListener l)
          Removes a listener to selection events.
 void removeTableCellValueChangeListener(TableCellValueChangeListener l)
           
protected  void sendCommandAttribute(java.lang.String p1, java.lang.String p2)
          This method is used internally by the Droplet API
protected  void setAttribute(java.lang.String p1, java.lang.String p2, java.lang.String p3)
          This method is used internally by the Droplet API.
 void setColumnHeaderBgColor(Color c)
          Sets the background color of column headers.
 void setColumnHeaderBgColor(Color c, java.lang.String skin)
          Sets the background color of column headers.
 void setColumnHeaderFgColor(Color c)
          Sets the foreground color of column headers.
 void setColumnHeaderFgColor(Color c, java.lang.String skin)
          Sets the foreground color of column headers.
 void setColumnHeadersVisible(boolean isVisible)
          Controls the visibility of column headers.
 void setColumnHeadersVisible(boolean isVisible, java.lang.String skin)
          Controls the visibility of column headers.
 void setDragOverBgColor(Color c)
          Sets the background color of the row that the mouse is being dragged over.
 void setDragOverBgColor(Color c, java.lang.String skin)
          Sets the background color of the row that the mouse is being dragged over.
 void setDragOverFgColor(Color c)
          Sets the foreground color of the row that the mouse is being dragged over.
 void setDragOverFgColor(Color c, java.lang.String skin)
          Sets the foreground color of the row that the mouse is being dragged over.
 void setFocusColor(Color c)
          Sets the color of the focus box for cells.
 void setFocusColor(Color c, java.lang.String skin)
          Sets the color of the focus box for cells, and allows skinning.
 void setGridlineColor(Color c)
          Sets the gridline color.
 void setGridlineColor(Color c, java.lang.String skin)
          Sets the gridline color.
 void setGridlines(int gridlines)
          Sets the gridline mode: GRIDLINES_NONE, GRIDLINES_VERTICAL, GRIDLINES_HORIZONTAL, GRIDLINES_BOTH
 void setGridlines(int gridlines, java.lang.String skin)
          Sets the gridline mode.
 void setKeysEnabled(boolean isEnabled)
          Enables/disables the sending of key-stroke events.
 void setLocalStore(boolean enable)
          Enables/disables client-local data cache.
 void setLockSecondarySort(int col, boolean isAscending)
          Locks the secondary sort at a particular column.
 void setModel(TableModel model)
          set a new TableModel This will cause all of the attributes of the Model to be reread (Model size, data, headers etc)
 void setPortOrigin(CellCoords coords)
          Sets the specified cell as the first visible cell in the table.
 void setPortOrigin(CellCoords coords, java.lang.String skin)
          Deprecated. This method no longer supports being skinned. Use the setPortOrigin method that does not take a skin. Sets the specified cell as the first visible cell in the table.
 void setReadOnlyFocusColor(Color c)
          Sets the color of the focus box for read-only cells.
 void setReadOnlyFocusColor(Color c, java.lang.String skin)
          Sets the color of the focus box for read-only cells, and allows skinning.
 void setRectangularSelection(CellRectangle selection)
          Sets the current selection.
 void setScrollbarVisible(boolean isVisible)
          Controls whether or not the vertical scrollbar is visible.
 void setScrollbarVisible(boolean isVisible, java.lang.String skin)
          Controls whether or not the vertical scrollbar is visible.
 void setSelectionBgColor(Color c)
          Controls the background color of selection.
 void setSelectionBgColor(Color c, java.lang.String skin)
          Controls the background color of selection.
 void setSelectionFgColor(Color c)
          Controls the foreground color of selection.
 void setSelectionFgColor(Color c, java.lang.String skin)
          Controls the foreground color of selection.
 void setSelectionMode(int selectionMode)
          Controls the type of supported selection.
 void setSelectionMode(int selectionMode, java.lang.String skin)
          Controls the type of supported selection.
 void setShowSecondarySort(boolean shouldShow)
          Pass true if you want the secondary sort to be indicated in the header of the column.
 void setSortOnClick(boolean enabled)
          Controls whether or not the table will support sorting when a user clicks on its column headers.
 void setSortOnClick(boolean enabled, java.lang.String skin)
          Controls whether or not the table will support sorting when a user clicks on its column headers.
 void showSort(int primaryColumn, boolean primaryAscending, int secondaryColumn, boolean secondaryAscending)
          Shows triangles on the headers indicating that the data is sorted a specific way Do this in the start() of the parent window if the data is initially sorted in some way.
 void start()
          Sends the initial data to the table.
 
Methods inherited from class com.droplets.api.Component
addActionListener, addAttributeChangeListener, addValueChangeListener, constructionFailed, equals, fireActionEvent, fireAttributeChangeEvent, fireValueChangeEvent, getAnchor, getAttribute, getBgColor, getBoolAttribute, getBordersAttribute, getColorAttribute, getCursor, getCursorType, getDoubleAttribute, getEnabled, getFgColor, getFill, getFont, getGridHeight, getGridWidth, getGridX, getGridY, getInsets, getIntAttribute, getIPadX, getIPadY, getOpaque, getParent, getScriptingName, getStringAttribute, getToolTip, getValue, getVisible, getWeightX, getWeightY, getWindow, invalidate, isAddedToWindow, isContainer, isFocusTraversable, isFocusTraversableDefault, isValid, removeActionListener, removeAttributeChangeListener, removeValueChangeListener, requestFocus, reset, setAnchor, setAnchor, setArg, setBgColor, setBgColor, setBoolAttribute, setBordersAttribute, setColorAttribute, setCursor, setCursor, setCursorType, setDoubleAttribute, setEnabled, setEnabled, setEnterButton, setEnterButton, setEnterButton, setFgColor, setFgColor, setFill, setFill, setFocusTraversable, setFont, setFont, setGridHeight, setGridHeight, setGridWidth, setGridWidth, setGridX, setGridX, setGridY, setGridY, setInsets, setInsets, setIntAttribute, setIPadX, setIPadX, setIPadY, setIPadY, setItemListAttribute, setOpaque, setOpaque, setScriptingName, setStringAttribute, setToolTip, setValue, setValue, setVisible, setVisible, setWeightX, setWeightX, setWeightY, setWeightY, storeAttribute, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRIDLINES_NONE

public static final int GRIDLINES_NONE

GRIDLINES_HORIZONTAL

public static final int GRIDLINES_HORIZONTAL

GRIDLINES_VERTICAL

public static final int GRIDLINES_VERTICAL

GRIDLINES_BOTH

public static final int GRIDLINES_BOTH

MUTLIPLE_INTERVAL_SELECTION

public static final int MUTLIPLE_INTERVAL_SELECTION
Deprecated. Not implemented.

Indicates that multiple row intervals can be selected (NOT SUPPORTED)

SINGLE_INTERVAL_SELECTION

public static final int SINGLE_INTERVAL_SELECTION
Deprecated. Use SELECT_CONTIGUOUS_ROWS.

Indicates that a single row interval can be selected (multiple contiguous rows)

SINGLE_SELECTION

public static final int SINGLE_SELECTION
Deprecated. Use SELECT_SINGLE_ROW.

Indicates that a single row can be selected.

SELECT_SINGLE_ROW

public static final int SELECT_SINGLE_ROW
Selection mode for selecting a single row. This the default selection mode.

SELECT_CONTIGUOUS_ROWS

public static final int SELECT_CONTIGUOUS_ROWS
Selection mode for selecting multiple contiguous rows.

SELECT_SINGLE_CELL

public static final int SELECT_SINGLE_CELL
Selection mode for selecting a single cell.

Since:
Droplets API 2.23
Constructor Detail

Table

public Table(LayoutPlacement p,
             TableModel m,
             Window w)

Table

public Table(LayoutPlacement p,
             Window window,
             TableModel model)
Table constructor.
Parameters:
p - Specifies the position of the table within the grid-bag GUI Layout system.
window - Specifies the enclosing window.
model - Instance of the TableModel subclass to manage the underlying table data.
Method Detail

start

public void start()
Sends the initial data to the table. Call from the window's start() method. This method also needs to be called if the user reconnects shortly after disconnecting. (for example from a browser reload).

setModel

public void setModel(TableModel model)
set a new TableModel This will cause all of the attributes of the Model to be reread (Model size, data, headers etc)
Parameters:
model - the new model

setAttribute

protected void setAttribute(java.lang.String p1,
                            java.lang.String p2,
                            java.lang.String p3)
This method is used internally by the Droplet API.
Overrides:
setAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
skin - the skin name to use for this attribute
value - the desired value
Returns:
true if the attribute's value changes as a result of this call, false if it already had the given value

getSpecification

protected java.lang.String getSpecification()
This method is used internally by the Droplet API
Overrides:
getSpecification in class Component
Following copied from class: com.droplets.api.Component
Returns:
the specification string

sendCommandAttribute

protected void sendCommandAttribute(java.lang.String p1,
                                    java.lang.String p2)
This method is used internally by the Droplet API
Overrides:
sendCommandAttribute in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute
value - the desired value

addDropListener

public void addDropListener(DropListener l)
Adds a listener to be notified of drop events.
Parameters:
l - An object implementing DropListener interface, that will recieve drop events.

removeDropListener

public void removeDropListener(DropListener l)
Removes a drop listener.
Parameters:
l - An object previously added with addDropListener(com.droplets.api.event.DropListener)

addKeyPressListener

public void addKeyPressListener(KeyPressListener l)
Adds a listener to be notified of key-press events.
Parameters:
l - An object implementing KeyPressListener interface, that will recieve key events.

removeKeyPressListener

public void removeKeyPressListener(KeyPressListener l)
Removes a key press listener.
Parameters:
l - An object previously added with addKeyPressListener(com.droplets.api.event.KeyPressListener)

addSelectionListener

public void addSelectionListener(SelectionListener l)
Adds a listener to be notified of selection events.
Parameters:
l - An object that will recieve selection events.

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
Removes a listener to selection events.
Parameters:
l - An object previously added with addSelectionListener(com.droplets.api.event.SelectionListener)

addClickListener

public void addClickListener(ClickListener l)
Adds a listener to be notified of clicks and double-clicks
Parameters:
l - An object that will recieve click events.

removeClickListener

public void removeClickListener(ClickListener l)
Removes a click listener.
Parameters:
l - An object previously added with addClickListener(com.droplets.api.event.ClickListener)

addTableCellValueChangeListener

public void addTableCellValueChangeListener(TableCellValueChangeListener l)

removeTableCellValueChangeListener

public void removeTableCellValueChangeListener(TableCellValueChangeListener l)

getDragOverBgColor

public Color getDragOverBgColor()
Gets the background color of the row that the mouse is being dragged over.
Returns:
Current value of the attribute.

getDragOverFgColor

public Color getDragOverFgColor()
Gets the foreground color of the row that the mouse is being dragged over.
Returns:
Current value of the attribute.

getColumnHeaderBgColor

public Color getColumnHeaderBgColor()
Gets the background color of the column header.
Returns:
Current value of the attribute.

getColumnHeaderFgColor

public Color getColumnHeaderFgColor()
Gets the foreground color of the column header.
Returns:
Current value of the attribute.

getColumnHeadersVisible

public boolean getColumnHeadersVisible()
Gets the visibility of the column header.
Returns:
Current value of the attribute.

getGridlineColor

public Color getGridlineColor()
Returns the color of the gridlines (borders between cells).
Returns:
Current value of the attribute.

getGridlines

public int getGridlines()
Returns the mode of gridlines: GRIDLINES_NONE, GRIDLINES_HORIZONTAL, etc.
Returns:
Current value of the attribute.

getLocalStore

public boolean getLocalStore()
Gets the client-side cache setting. If set to true, this flag causes the client to cache table data. Otherwise, only the port area is kept in the client's memory. Caching is used to enhance application performance when table data is unlikely to change.
Returns:
Current value of the attribute.

getPortOrigin

public CellCoords getPortOrigin()
Returns the coordinate of the port area relative to the origin of the table's data sheet.
Returns:
The current coordinate of the port origin..

getVisibleCellRectangle

public CellRectangle getVisibleCellRectangle()
Returns the coordinate of the port area relative to the origin of the table's data sheet.
Returns:
The current coordinate of the port origin..

getScrollbarVisible

public boolean getScrollbarVisible()
Returns the flag indicating whether or not the table scroll bar is visible.
Returns:
Current value of the attribute.

getSelectionBgColor

public Color getSelectionBgColor()
Returns the background color of the selection.
Returns:
Current value of the attribute.

getSelectionFgColor

public Color getSelectionFgColor()
Returns the foreground color of the selection.
Returns:
Current value of the attribute.

getSelectionMode

public int getSelectionMode()
Returns the mode of selection. Defaults to SELECT_SINGLE_ROW.
Returns:
Current value of the attribute.

getKeysEnabled

public boolean getKeysEnabled()
Returns the flag indicating whether or not this table accepts key-presses.
Returns:
Current value of the attribute.

getSortOnClick

public boolean getSortOnClick()
Returns the flag indicating whether or not the table supports sorting when column headers are clicked.
Returns:
Current value of the attribute.

getFocusColor

public Color getFocusColor()
Returns the color of the focus box for cells.

setFocusColor

public void setFocusColor(Color c)
Sets the color of the focus box for cells.

setFocusColor

public void setFocusColor(Color c,
                          java.lang.String skin)
Sets the color of the focus box for cells, and allows skinning.

getReadOnlyFocusColor

public Color getReadOnlyFocusColor()
Returns the color of the focus box for read-only cells.

setReadOnlyFocusColor

public void setReadOnlyFocusColor(Color c)
Sets the color of the focus box for read-only cells.

setReadOnlyFocusColor

public void setReadOnlyFocusColor(Color c,
                                  java.lang.String skin)
Sets the color of the focus box for read-only cells, and allows skinning.

setKeysEnabled

public void setKeysEnabled(boolean isEnabled)
Enables/disables the sending of key-stroke events.
Parameters:
isEnabled - Desired value of this attribute.

setDragOverBgColor

public void setDragOverBgColor(Color c,
                               java.lang.String skin)
Sets the background color of the row that the mouse is being dragged over.
Parameters:
c - Desired value of this attribute.
skin - The name to use for this attribute in the skin files.

setDragOverBgColor

public void setDragOverBgColor(Color c)
Sets the background color of the row that the mouse is being dragged over.
Parameters:
c - Desired value of this attribute.

setDragOverFgColor

public void setDragOverFgColor(Color c,
                               java.lang.String skin)
Sets the foreground color of the row that the mouse is being dragged over.
Parameters:
c - Desired value of this attribute.
skin - The name to use for this attribute in the skin files.

setDragOverFgColor

public void setDragOverFgColor(Color c)
Sets the foreground color of the row that the mouse is being dragged over.
Parameters:
c - Desired value of this attribute.

setColumnHeaderBgColor

public void setColumnHeaderBgColor(Color c,
                                   java.lang.String skin)
Sets the background color of column headers.
Parameters:
c - Desired value of this attribute.
skin - The name to use for this attribute in the skin files.

setColumnHeaderBgColor

public void setColumnHeaderBgColor(Color c)
Sets the background color of column headers.
Parameters:
c - Desired value of this attribute.

setColumnHeaderFgColor

public void setColumnHeaderFgColor(Color c,
                                   java.lang.String skin)
Sets the foreground color of column headers.
Parameters:
c - Desired value of this attribute
skin - The name to use for this attribute in the skin files.

setColumnHeaderFgColor

public void setColumnHeaderFgColor(Color c)
Sets the foreground color of column headers.
Parameters:
c - Desired value of this attribute

setColumnHeadersVisible

public void setColumnHeadersVisible(boolean isVisible,
                                    java.lang.String skin)
Controls the visibility of column headers.
Parameters:
isVisible - True/false
skin - the name to use for this attribute in the skin files.

setColumnHeadersVisible

public void setColumnHeadersVisible(boolean isVisible)
Controls the visibility of column headers.
Parameters:
isVisible - Desired value for this attribute.

setGridlines

public void setGridlines(int gridlines,
                         java.lang.String skin)
Sets the gridline mode.
Parameters:
gridlines - Desired value for this attribute.
skin - The name to use for this attribute in the skin files.

setGridlines

public void setGridlines(int gridlines)
Sets the gridline mode: GRIDLINES_NONE, GRIDLINES_VERTICAL, GRIDLINES_HORIZONTAL, GRIDLINES_BOTH
Parameters:
gridlines - Desired value for this attribute.

setGridlineColor

public void setGridlineColor(Color c,
                             java.lang.String skin)
Sets the gridline color.
Parameters:
c - Desired value for this attribute.
skin - name to use for this attribute in the skin files.

setGridlineColor

public void setGridlineColor(Color c)
Sets the gridline color.
Parameters:
c - Desired value for this attribute.

setLocalStore

public void setLocalStore(boolean enable)
Enables/disables client-local data cache. This setting will increase the efficiency of client-side scrolling, but will take up client-side memory.
Parameters:
enabled - If true, the client-local data cache will become enabled.

setPortOrigin

public void setPortOrigin(CellCoords coords,
                          java.lang.String skin)
Deprecated. This method no longer supports being skinned. Use the setPortOrigin method that does not take a skin. Sets the specified cell as the first visible cell in the table.

Parameters:
coords - Coordinates of the top-left corner of the port area relative to the table's origin.
skin - Name to use for this attribute in the skin files.

setPortOrigin

public void setPortOrigin(CellCoords coords)
Sets the specified cell as the first visible cell in the table.
Parameters:
coords - Coordinates of the top-left corner of the port area relative to the table's origin.

ensureCellIsShown

public void ensureCellIsShown(CellCoords coords,
                              java.lang.String skin)
Deprecated. This method no longer supports being skinned. Use the ensureCellIsShown method that does not take a skin. Ensures that the row is visible

Parameters:
coords - Coordinates of the top-left corner of the port area relative to the table's origin.
skin - Name to use for this attribute in the skin files.

ensureCellIsShown

public void ensureCellIsShown(CellCoords coords)
Ensures that the row is visible
Parameters:
coords - Coordinates of the top-left corner of the port area relative to the table's origin.

setSortOnClick

public void setSortOnClick(boolean enabled,
                           java.lang.String skin)
Controls whether or not the table will support sorting when a user clicks on its column headers.
Parameters:
enabled - Desired value of this flag.
skin - Name to use for this attribute in the skin files.

setSortOnClick

public void setSortOnClick(boolean enabled)
Controls whether or not the table will support sorting when a user clicks on its column headers.
Parameters:
enabled - Desired value of this flag.

showSort

public void showSort(int primaryColumn,
                     boolean primaryAscending,
                     int secondaryColumn,
                     boolean secondaryAscending)
Shows triangles on the headers indicating that the data is sorted a specific way Do this in the start() of the parent window if the data is initially sorted in some way. You do not need to do this in your TableModel.sortData() implementation
Parameters:
primaryColumn - The column that is sorted first (big triangle)
primaryAscending - True if the column is sorted in ascending order
secondaryColumn - The column that is used to resolve equal values in the primary sort (small triangle)
secondaryAscending - True if the secondary column is sorted in ascending order

setLockSecondarySort

public void setLockSecondarySort(int col,
                                 boolean isAscending)
Locks the secondary sort at a particular column. Set the col parameter to -1 to unlock the secondary sort.
Parameters:
col - The column to lock the secondary sort on
isAscending - true if the sort should be ascending, false if not
See Also:
getLockSecondarySortCol(), getLockSecondarySortAscending()

getLockSecondarySortCol

public int getLockSecondarySortCol()
If the secondary sort is locked at a particular column will return that column, otherwise it returns -1.
Returns:
the locked secondary sort column or -1 if no column is locked
See Also:
setLockSecondarySort(int, boolean), getLockSecondarySortAscending()

getLockSecondarySortAscending

public boolean getLockSecondarySortAscending()
If the secondary sort is locked at a particular column will return whether it is ascending or not. Only makes sense to call this function if getLockSecondarySortCol() did not return -1.
Returns:
true if the locked secondary sort column is an ascending sort
See Also:
setLockSecondarySort(int, boolean), getLockSecondarySortCol()

setShowSecondarySort

public void setShowSecondarySort(boolean shouldShow)
Pass true if you want the secondary sort to be indicated in the header of the column. Pass false to not indicate the secondary sort.
Parameters:
shouldShow - true if you want the secondary sort to be indicated in the header or the column, false if not.
See Also:
getShowSecondarySort()

getShowSecondarySort

public boolean getShowSecondarySort()
returns true if the table is showing the secondary sort triangle in the header. Set with setShowSecondarySort()
Returns:
true if the table is showing the secondary sort triangle in the header.
See Also:
setShowSecondarySort(boolean)

setScrollbarVisible

public void setScrollbarVisible(boolean isVisible,
                                java.lang.String skin)
Controls whether or not the vertical scrollbar is visible.
Parameters:
isVisible - Desired value of this flag.
skin - name to use for this attribute in the skin files.

setScrollbarVisible

public void setScrollbarVisible(boolean isVisible)
Controls whether or not the vertical scrollbar is visible.
Parameters:
isVisible - Desired value of this flag.

setSelectionBgColor

public void setSelectionBgColor(Color c,
                                java.lang.String skin)
Controls the background color of selection.
Parameters:
c - Desired color of the selection.
skin - Name to use for this attribute in the skin files.

setSelectionBgColor

public void setSelectionBgColor(Color c)
Controls the background color of selection.
Parameters:
c - Desired color of the selection background.

setSelectionFgColor

public void setSelectionFgColor(Color c,
                                java.lang.String skin)
Controls the foreground color of selection.
Parameters:
c - Desired color of the selection foreground.
skin - Name to use for this attribute in the skin files.

setSelectionFgColor

public void setSelectionFgColor(Color c)
Controls the foreground color of selection.
Parameters:
c - Desired color of the selection foreground.

setSelectionMode

public void setSelectionMode(int selectionMode,
                             java.lang.String skin)
Controls the type of supported selection. Currently only SELECT_SINGLE_ROW, SELECT_CONTIGUOUS_ROWS, and SELECT_SINGLE_CELL are supported.
Parameters:
selectionMode - Desired selection mode.
skin - Name to use for this attribute in the skin files.

setSelectionMode

public void setSelectionMode(int selectionMode)
Controls the type of supported selection. Currently only SELECT_SINGLE_ROW, SELECT_CONTIGUOUS_ROWS, and SELECT_SINGLE_CELL are supported.
Parameters:
selectionMode - Desired selection mode.

getRectangularSelection

public CellRectangle getRectangularSelection()
If the selection is a rectangle (currently the only supported mode), returns it. In the future we will add getSelection() for anything other then a rectangle.
Returns:
The rectangle object describing the selected area.

setRectangularSelection

public void setRectangularSelection(CellRectangle selection)
Sets the current selection. Depending upon the selection mode, this selection may be cropped.
Parameters:
selection - A rectangle object describing the desired selected area.

isSelectionEmpty

public boolean isSelectionEmpty()
Checks whether or not current selection is empty.
Returns:
true if nothing is currently seleted.

addAcceptDrop

public void addAcceptDrop(Component c)
Add a valid target for us to accept drop messages from.
Parameters:
c - The component to accept drop messages from.

removeAcceptDrop

public void removeAcceptDrop(Component c)
Stop accepting drop messages from the specified target.
Parameters:
c - The component that no longer will send drop messages to us.

handleDataChanged

public void handleDataChanged(TableModelEvent evt)
Specified by handleDataChanged in TableModelListener
Specified by:
handleDataChanged in interface TableModelListener

handleRowsDeleted

public void handleRowsDeleted(TableModelEvent evt)
Specified by handleRowsDeleted in TableModelListener
Specified by:
handleRowsDeleted in interface TableModelListener

handleRowsInserted

public void handleRowsInserted(TableModelEvent evt)
Specified by handleRowsInserted in TableModelListener
Specified by:
handleRowsInserted in interface TableModelListener

action

protected void action(java.lang.String action,
                      java.lang.String args)
Description copied from class: Component
Called by the server when the user has performed an action on this component. Subclasses should overridde to handle any actions that they need to handle in a special way - for example, if they maintain a separate listener list for some kinds of actions. If a subclass gets an action it doesn't recognize or is not interested in, it should pass the call on to this implementation in order to support notification of ActionListeners.
Overrides:
action in class Component
Following copied from class: com.droplets.api.Component
Parameters:
action - Identifies the type of action that occurred
args - Action-specific arguments (extra information)

attributeChanged

protected void attributeChanged(java.lang.String name,
                                java.lang.String value)
Description copied from class: Component
Calls fireAttributeChangeEvent to notify all registered listeners that an attribute has changed. Unless a subclass has a special need to call this method, it should only be called by the server.
Overrides:
attributeChanged in class Component
Following copied from class: com.droplets.api.Component
Parameters:
name - name of the attribute that changed
value - its new value

processSortData

protected void processSortData(int col1,
                               boolean ascend1,
                               int col2,
                               boolean ascend2)
Handle a request to sort the data in the table.


Copyright © Droplets, 2001. All Rights Reserved.