|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.droplets.api.Component | +--com.droplets.api.Table
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int GRIDLINES_NONE
public static final int GRIDLINES_HORIZONTAL
public static final int GRIDLINES_VERTICAL
public static final int GRIDLINES_BOTH
public static final int MUTLIPLE_INTERVAL_SELECTION
public static final int SINGLE_INTERVAL_SELECTION
public static final int SINGLE_SELECTION
public static final int SELECT_SINGLE_ROW
public static final int SELECT_CONTIGUOUS_ROWS
public static final int SELECT_SINGLE_CELL
Constructor Detail |
public Table(LayoutPlacement p, TableModel m, Window w)
public Table(LayoutPlacement p, Window window, TableModel model)
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 |
public void start()
start()
method.
This method also needs to be called if the user reconnects shortly after disconnecting.
(for example from a browser reload).public void setModel(TableModel model)
model
- the new modelprotected void setAttribute(java.lang.String p1, java.lang.String p2, java.lang.String p3)
setAttribute
in class Component
com.droplets.api.Component
name
- name of the attributeskin
- the skin name to use for this attributevalue
- the desired valueprotected java.lang.String getSpecification()
getSpecification
in class Component
com.droplets.api.Component
protected void sendCommandAttribute(java.lang.String p1, java.lang.String p2)
sendCommandAttribute
in class Component
com.droplets.api.Component
name
- name of the attributevalue
- the desired valuepublic void addDropListener(DropListener l)
l
- An object implementing DropListener
interface, that will recieve drop events.public void removeDropListener(DropListener l)
l
- An object previously added with addDropListener(com.droplets.api.event.DropListener)
public void addKeyPressListener(KeyPressListener l)
l
- An object implementing KeyPressListener
interface, that will recieve key events.public void removeKeyPressListener(KeyPressListener l)
l
- An object previously added with addKeyPressListener(com.droplets.api.event.KeyPressListener)
public void addSelectionListener(SelectionListener l)
l
- An object that will recieve selection events.public void removeSelectionListener(SelectionListener l)
l
- An object previously added with addSelectionListener(com.droplets.api.event.SelectionListener)
public void addClickListener(ClickListener l)
l
- An object that will recieve click events.public void removeClickListener(ClickListener l)
l
- An object previously added with addClickListener(com.droplets.api.event.ClickListener)
public void addTableCellValueChangeListener(TableCellValueChangeListener l)
public void removeTableCellValueChangeListener(TableCellValueChangeListener l)
public Color getDragOverBgColor()
public Color getDragOverFgColor()
public Color getColumnHeaderBgColor()
public Color getColumnHeaderFgColor()
public boolean getColumnHeadersVisible()
public Color getGridlineColor()
public int getGridlines()
public boolean getLocalStore()
public CellCoords getPortOrigin()
public CellRectangle getVisibleCellRectangle()
public boolean getScrollbarVisible()
public Color getSelectionBgColor()
public Color getSelectionFgColor()
public int getSelectionMode()
public boolean getKeysEnabled()
public boolean getSortOnClick()
public Color getFocusColor()
public void setFocusColor(Color c)
public void setFocusColor(Color c, java.lang.String skin)
public Color getReadOnlyFocusColor()
public void setReadOnlyFocusColor(Color c)
public void setReadOnlyFocusColor(Color c, java.lang.String skin)
public void setKeysEnabled(boolean isEnabled)
isEnabled
- Desired value of this attribute.public void setDragOverBgColor(Color c, java.lang.String skin)
c
- Desired value of this attribute.skin
- The name to use for this attribute in the skin files.public void setDragOverBgColor(Color c)
c
- Desired value of this attribute.public void setDragOverFgColor(Color c, java.lang.String skin)
c
- Desired value of this attribute.skin
- The name to use for this attribute in the skin files.public void setDragOverFgColor(Color c)
c
- Desired value of this attribute.public void setColumnHeaderBgColor(Color c, java.lang.String skin)
c
- Desired value of this attribute.skin
- The name to use for this attribute in the skin files.public void setColumnHeaderBgColor(Color c)
c
- Desired value of this attribute.public void setColumnHeaderFgColor(Color c, java.lang.String skin)
c
- Desired value of this attributeskin
- The name to use for this attribute in the skin files.public void setColumnHeaderFgColor(Color c)
c
- Desired value of this attributepublic void setColumnHeadersVisible(boolean isVisible, java.lang.String skin)
isVisible
- True/falseskin
- the name to use for this attribute in the skin files.public void setColumnHeadersVisible(boolean isVisible)
isVisible
- Desired value for this attribute.public void setGridlines(int gridlines, java.lang.String skin)
gridlines
- Desired value for this attribute.skin
- The name to use for this attribute in the skin files.public void setGridlines(int gridlines)
gridlines
- Desired value for this attribute.public void setGridlineColor(Color c, java.lang.String skin)
c
- Desired value for this attribute.skin
- name to use for this attribute in the skin files.public void setGridlineColor(Color c)
c
- Desired value for this attribute.public void setLocalStore(boolean enable)
enabled
- If true, the client-local data cache will become enabled.public void setPortOrigin(CellCoords coords, java.lang.String skin)
setPortOrigin
method that does not take a skin.
Sets the specified cell as the first visible cell in the table.
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.public void setPortOrigin(CellCoords coords)
coords
- Coordinates of the top-left corner of the port area relative to the table's origin.public void ensureCellIsShown(CellCoords coords, java.lang.String skin)
ensureCellIsShown
method that does not take a skin.
Ensures that the row is visible
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.public void ensureCellIsShown(CellCoords coords)
coords
- Coordinates of the top-left corner of the port area relative to the table's origin.public void setSortOnClick(boolean enabled, java.lang.String skin)
enabled
- Desired value of this flag.skin
- Name to use for this attribute in the skin files.public void setSortOnClick(boolean enabled)
enabled
- Desired value of this flag.public void showSort(int primaryColumn, boolean primaryAscending, int secondaryColumn, boolean secondaryAscending)
primaryColumn
- The column that is sorted first (big triangle)primaryAscending
- True if the column is sorted in ascending ordersecondaryColumn
- 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 orderpublic void setLockSecondarySort(int col, boolean isAscending)
col
- The column to lock the secondary sort onisAscending
- true if the sort should be ascending, false if notgetLockSecondarySortCol()
,
getLockSecondarySortAscending()
public int getLockSecondarySortCol()
setLockSecondarySort(int, boolean)
,
getLockSecondarySortAscending()
public boolean getLockSecondarySortAscending()
setLockSecondarySort(int, boolean)
,
getLockSecondarySortCol()
public void setShowSecondarySort(boolean shouldShow)
shouldShow
- true if you want the secondary sort to be indicated
in the header or the column, false if not.getShowSecondarySort()
public boolean getShowSecondarySort()
setShowSecondarySort(boolean)
public void setScrollbarVisible(boolean isVisible, java.lang.String skin)
isVisible
- Desired value of this flag.skin
- name to use for this attribute in the skin files.public void setScrollbarVisible(boolean isVisible)
isVisible
- Desired value of this flag.public void setSelectionBgColor(Color c, java.lang.String skin)
c
- Desired color of the selection.skin
- Name to use for this attribute in the skin files.public void setSelectionBgColor(Color c)
c
- Desired color of the selection background.public void setSelectionFgColor(Color c, java.lang.String skin)
c
- Desired color of the selection foreground.skin
- Name to use for this attribute in the skin files.public void setSelectionFgColor(Color c)
c
- Desired color of the selection foreground.public void setSelectionMode(int selectionMode, java.lang.String skin)
selectionMode
- Desired selection mode.skin
- Name to use for this attribute in the skin files.public void setSelectionMode(int selectionMode)
selectionMode
- Desired selection mode.public CellRectangle getRectangularSelection()
getSelection()
for anything other then a rectangle.public void setRectangularSelection(CellRectangle selection)
selection
- A rectangle object describing the desired selected area.public boolean isSelectionEmpty()
public void addAcceptDrop(Component c)
c
- The component to accept drop messages from.public void removeAcceptDrop(Component c)
c
- The component that no longer will send drop messages to us.public void handleDataChanged(TableModelEvent evt)
handleDataChanged
in TableModelListener
handleDataChanged
in interface TableModelListener
public void handleRowsDeleted(TableModelEvent evt)
handleRowsDeleted
in TableModelListener
handleRowsDeleted
in interface TableModelListener
public void handleRowsInserted(TableModelEvent evt)
handleRowsInserted
in TableModelListener
handleRowsInserted
in interface TableModelListener
protected void action(java.lang.String action, java.lang.String args)
Component
action
in class Component
com.droplets.api.Component
action
- Identifies the type of action that occurredargs
- Action-specific arguments (extra information)protected void attributeChanged(java.lang.String name, java.lang.String value)
Component
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.attributeChanged
in class Component
com.droplets.api.Component
name
- name of the attribute that changedvalue
- its new valueprotected void processSortData(int col1, boolean ascend1, int col2, boolean ascend2)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |