|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.datatools.sqltools.common.ui.tableviewer.AccessibleTableViewer
public class AccessibleTableViewer
A concrete viewer to support tab function.
It is designed to be instantiated with a pre-existing SWT table control and configured with a domain-specific content
provider ( TableDataContentProvider
), table label provider ( TableDataLabelProvider
) ,
element filter (optional), and element sorter (optional).
Field Summary | |
---|---|
static java.lang.String |
GROUP_COPY
Context menu group for cut/copy/paste related actions. |
Constructor Summary | |
---|---|
AccessibleTableViewer(org.eclipse.swt.widgets.Composite parent)
Creates a accessible table viewer on a newly-created table control under the given parent. |
|
AccessibleTableViewer(org.eclipse.swt.widgets.Composite parent,
int style)
Creates a table viewer on a newly-created table control under the given parent. |
|
AccessibleTableViewer(org.eclipse.swt.widgets.Table table)
Creates a table viewer on the given table control. |
Method Summary | |
---|---|
void |
add(java.lang.Object element)
Adds the given element to this table viewer. |
void |
add(java.lang.Object[] elements)
Adds the given elements to this table viewer. |
void |
cancelEditing()
Cancels a currently active cell editor. |
void |
clear(int index)
Clear the table item at the specified index |
void |
doDelete()
Delete a row which is positioned by cursor. |
void |
doDeleteAll(boolean confirm)
Delete all rows in this table viewer. |
void |
doInsertRow()
Insert a empty row into table. |
void |
doRefresh(boolean confirm)
Refreshes the contents of the table if dirty. |
void |
doRevert()
This method will revert the added, deleted and changes rows in the table on the currently displayed table data to the original table data. |
boolean |
doSave()
This method is used to save table data. |
void |
doSetNull()
|
void |
doUpdateValue()
To make the selected cell editable. |
void |
editElement(java.lang.Object element,
int column)
Starts editing the given element. |
org.eclipse.jface.viewers.CellEditor[] |
getCellEditors()
Returns the cell editors of this table viewer. |
org.eclipse.jface.viewers.ICellModifier |
getCellModifier()
Returns the cell modifier of this table viewer. |
java.lang.Object[] |
getColumnProperties()
Returns the column properties of this table viewer. |
org.eclipse.swt.widgets.Control |
getControl()
|
TableDataTableCursor |
getCursor()
Returns the table viewer's cursor. |
java.lang.Object |
getElementAt(int index)
Returns the element with the given index from this table viewer. |
org.eclipse.jface.viewers.IBaseLabelProvider |
getLabelProvider()
The table viewer implementation of this Viewer framework method returns the label provider, which
in the case of table viewers will be an instance of either ITableLabelProvider or
ILabelProvider . |
org.eclipse.datatools.sqltools.common.core.tableviewer.IRowData |
getOrCreateRow()
|
org.eclipse.datatools.sqltools.common.core.tableviewer.IRowData |
getRow()
Returns the IRowData over which the TableCursor is positioned. |
org.eclipse.swt.widgets.Table |
getTable()
Returns this table viewer's table control. |
void |
insert(java.lang.Object element,
int position)
Inserts the given element into this table viewer at the given position. |
boolean |
isCellEditorActive()
Returns whether there is an active cell editor. |
boolean |
isDirty()
Returns whether the table data of this viewer have changed since the last save operation. |
boolean |
isReadonly()
Returns whether the viewer input is read-only. |
void |
movedownRow()
Move the select row down. |
void |
moveupRow()
Move the selected row up. |
void |
refresh()
|
void |
refreshViewer(java.lang.Object element)
Refreshes this viewer starting with the given element. |
void |
remove(java.lang.Object element)
Removes the given element from this table viewer. |
void |
remove(java.lang.Object[] elements)
Removes the given elements from this table viewer. |
void |
replace(java.lang.Object element,
int index)
Replace the entries starting at index with elements. |
void |
reveal(java.lang.Object element)
|
void |
setCellEditors(org.eclipse.jface.viewers.CellEditor[] editors)
Sets the cell editors of this table viewer. |
void |
setCellModifier(org.eclipse.jface.viewers.ICellModifier modifier)
Sets the cell modifier of this table viewer. |
void |
setColumnProperties(java.lang.String[] columnProperties)
Sets the column properties of this table viewer. |
void |
setCursor(TableDataTableCursor cursor)
Set cursor for the table viewer. |
void |
setDirty(boolean value)
|
boolean |
setFocus()
Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it. |
void |
setItemCount(int count)
Set the item count of the receiver. |
void |
setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)
The table viewer implementation of this Viewer framework method ensures that the given label
provider is an instance of either ITableLabelProvider or ILabelProvider . |
void |
setSortable(boolean sort)
Sets the table's column as sortable if the argument is true , and sets it non-sortable otherwise. |
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer |
---|
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, getComparator, getComparer, getFilters, getSelection, getSorter, refresh, refresh, refresh, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setContentProvider, setFilters, setInput, setSelection, setSorter, setUseHashlookup, testFindItem, testFindItems, update, update |
Methods inherited from class org.eclipse.jface.viewers.ContentViewer |
---|
getContentProvider, getInput |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
---|
addHelpListener, addSelectionChangedListener, getData, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider |
---|
addSelectionChangedListener, removeSelectionChangedListener, setSelection |
Field Detail |
---|
public static final java.lang.String GROUP_COPY
"group.copy"
Constructor Detail |
---|
public AccessibleTableViewer(org.eclipse.swt.widgets.Composite parent)
MULTI, H_SCROLL, V_SCROLL,
and BORDER
. The viewer
has no input, no content provider, a default label provider, no sorter, and no filters. The table has no columns.
parent
- the parent controlpublic AccessibleTableViewer(org.eclipse.swt.widgets.Composite parent, int style)
parent
- the parent controlstyle
- SWT style bitspublic AccessibleTableViewer(org.eclipse.swt.widgets.Table table)
table
- the table controlMethod Detail |
---|
public void setCellEditors(org.eclipse.jface.viewers.CellEditor[] editors)
editors
- the list of cell editorspublic TableDataTableCursor getCursor()
public void setCursor(TableDataTableCursor cursor)
cursor
- TableDataTableCursorpublic org.eclipse.datatools.sqltools.common.core.tableviewer.IRowData getRow()
IRowData
over which the TableCursor is positioned.
public org.eclipse.datatools.sqltools.common.core.tableviewer.IRowData getOrCreateRow()
public void setDirty(boolean value)
public boolean isDirty()
true
if the table data of this viewer have changedpublic boolean isReadonly()
true
if the viewer input is read-onlypublic void doInsertRow()
public void doDelete()
public void doDeleteAll(boolean confirm)
confirm
- true
to ask the user before deleting all rows, and false
to delete
all rows without askingpublic void doUpdateValue()
public boolean setFocus()
true
if the control got focus, and false
if it was unable to.
org.eclipse.swt.SWTException
- public boolean doSave()
save
method.
public void doRefresh(boolean confirm)
If confirm
is true
the user is prompted to confirm the command. Otherwise, the
refresh happens without prompt.
confirm
- true
to ask the user before saving unsaved changes (recommended), and
false
to save unsaved changes without askingpublic void doRevert()
public void doSetNull()
public void moveupRow()
public void movedownRow()
public void add(java.lang.Object[] elements)
This method should be called (by the content provider) when elements have been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
elements
- the elements to addpublic void add(java.lang.Object element)
This method should be called (by the content provider) when a single element has been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model. Note that there is another method for efficiently processing the simultaneous addition of multiple elements.
element
- the element to addpublic void cancelEditing()
public void editElement(java.lang.Object element, int column)
element
- the elementcolumn
- the column numberpublic org.eclipse.jface.viewers.CellEditor[] getCellEditors()
public org.eclipse.jface.viewers.ICellModifier getCellModifier()
public java.lang.Object[] getColumnProperties()
public org.eclipse.swt.widgets.Control getControl()
getControl
in class org.eclipse.jface.viewers.Viewer
public java.lang.Object getElementAt(int index)
null
if the index is out
of range.
This method is internal to the framework.
index
- the zero-based index
null
if the index is out of rangepublic org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
Viewer
framework method returns the label provider, which
in the case of table viewers will be an instance of either ITableLabelProvider
or
ILabelProvider
. If it is an ITableLabelProvider
, then it provides a separate
label text and image for each column. If it is an ILabelProvider
, then it provides only the label
text and image for the first column, and any remaining columns are blank.
getLabelProvider
in class org.eclipse.jface.viewers.ContentViewer
public org.eclipse.swt.widgets.Table getTable()
public void insert(java.lang.Object element, int position)
This method should be called (by the content provider) when elements have been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
element
- the elementposition
- a 0-based position relative to the model, or -1 to indicate the last positionpublic void refreshViewer(java.lang.Object element)
element
- the elementpublic boolean isCellEditorActive()
true
if there is an active cell editor, and false
otherwisepublic void remove(java.lang.Object[] elements)
This method should be called (by the content provider) when elements have been removed from the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
elements
- the elements to removepublic void remove(java.lang.Object element)
This method should be called (by the content provider) when a single element has been removed from the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model. Note that there is another method for efficiently processing the simultaneous removal of multiple elements.
element
- the elementpublic void reveal(java.lang.Object element)
reveal
in class org.eclipse.jface.viewers.StructuredViewer
public void setCellModifier(org.eclipse.jface.viewers.ICellModifier modifier)
modifier
- the cell modifierpublic void setColumnProperties(java.lang.String[] columnProperties)
columnProperties
- the list of column propertiespublic void setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)
Viewer
framework method ensures that the given label
provider is an instance of either ITableLabelProvider
or ILabelProvider
. If it is
an ITableLabelProvider
, then it provides a separate label text and image for each column. If it
is an ILabelProvider
, then it provides only the label text and image for the first column, and
any remaining columns are blank.
setLabelProvider
in class org.eclipse.jface.viewers.StructuredViewer
public void setItemCount(int count)
count
- the new table size.public void replace(java.lang.Object element, int index)
element
- index
- ILazyContentProvider
public void clear(int index)
index
- the index of the table item to be clearedpublic void refresh()
refresh
in class org.eclipse.jface.viewers.StructuredViewer
public void setSortable(boolean sort)
true
, and sets it non-sortable otherwise.
Note: this method should be invoked after tableColumns are created.
sort
- the sortable state
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |