Class InternalCompositeTable
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.nebula.widgets.compositetable.InternalCompositeTable
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable,org.eclipse.swt.widgets.Listener
class InternalCompositeTable extends org.eclipse.swt.widgets.Composite implements org.eclipse.swt.widgets.Listener(non-API) Class InternalCompositeTable. This is the run-time CompositeTableControl. It gets its prototype row and (optional) header objects from its SWT parent, then uses them to implement an SWT virtual table control.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intclientAreaHeightprivate org.eclipse.swt.widgets.CompositecontrolHolderprivate intcurrentColumnprivate intcurrentRowprivate intcurrentVisibleTopRowprivate org.eclipse.swt.widgets.ListenerdisplayKeyDownFilter(package private) EmptyTablePlaceholderemptyTablePlaceholderprivate java.lang.reflect.Constructor<?>headerConstructorprivate org.eclipse.swt.widgets.ControlheaderControlprivate org.eclipse.swt.events.PaintListenerheaderPaintListenerprivate org.eclipse.swt.widgets.CompositehScrollerprivate org.eclipse.swt.widgets.SliderhSliderprivate org.eclipse.swt.widgets.CompositehSliderHolderprivate org.eclipse.swt.events.SelectionListenerhSliderSelectionListenerprivate booleanhSliderVisibleprivate intmaxRowsVisibleprivate org.eclipse.swt.widgets.Menumenuprivate org.eclipse.swt.widgets.ControlmyHeaderprivate booleanneedToRequestRCprivate intnumRowsInCollectionprivate intnumRowsInDisplayprivate intnumRowsVisibleprivate CompositeTableparentprivate java.lang.reflect.Constructor<?>rowConstructorprivate org.eclipse.swt.widgets.ControlrowControlprivate org.eclipse.swt.events.PaintListenerrowPaintListenerprivate java.util.LinkedList<TableRow>rows(package private) org.eclipse.swt.events.ControlAdapterscrollerResizeHandlerprivate org.eclipse.swt.events.SelectionListenersliderSelectionListenerThe SelectionListener for the table's vertical slider control.private java.util.LinkedList<TableRow>spareRowsprivate inttopRowprivate org.eclipse.swt.widgets.SlidervSliderprivate org.eclipse.swt.widgets.CompositevSliderHolderprivate booleanvSliderVisible
-
Constructor Summary
Constructors Constructor Description InternalCompositeTable(org.eclipse.swt.widgets.Composite parentControl, int style)Constructor InternalCompositeTable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRefreshContentProvider(IRowContentProvider listener)Adds the specified listener to the set of listeners that will be notified when a row refresh event occurs.voidclearSelection()(non-API) SeeCompositeTable.clearSelection()instead.private intcomputeTopRowDelta(int row)private voidcreateControlHolder()Initialize the controlHolder, which is the holder Composite for the header object (if applicable) and the row objects.private voidcreateEmptyTablePlaceholer()private voidcreateHSliderHolder()Initialize the sliderHolder and slider.private org.eclipse.swt.widgets.ControlcreateInternalControl(org.eclipse.swt.widgets.Composite parent, java.lang.reflect.Constructor<?> constructor)Construct a header or row object on demand.private voidcreateVSliderHolder()Initialize the sliderHolder and slider.private TableRowcurrentRow()Gets the current TableRow.private voiddeferredSetFocus(org.eclipse.swt.widgets.Control toFocus, boolean rowChange)Set the focus to the specified control after allowing all pending events to complete first.private voiddeleteRowAt(int position)Delete the row at the specified 0-based position relative to the topmost row.private voiddeselect(org.eclipse.swt.widgets.Widget widget)Set the widget's selection to an empty selection.private voiddeselectCurrentRowIfVisible()voiddispose()private voiddisposeEmptyTablePlaceholder()private voiddisposeRows(java.util.LinkedList<TableRow> rowsCollection)Disposes all the row objects in the specified LinkedList.booleandoDeleteRow()voiddoFocusInitialRow()voiddoFocusLastRow()booleandoInsertRow()booleandoMakeFocusedRowVisible()Makes sure that the focused row is visiblevoiddoPageDown()voiddoPageUp()voiddoRowDown()voiddoRowUp()private voiddoSetTopRow(int topRow, int currentRow)private voiddrawGridLines(org.eclipse.swt.events.PaintEvent e, boolean isHeader)private booleanfireDeleteEvent()Request deletion of the current row from the underlying data structure.private voidfireHeaderConstructionEvent(org.eclipse.swt.widgets.Control newControl)Fire the row construction eventprivate intfireInsertEvent()Request that the model insert a new row into itself.private voidfireRefreshEvent(int positionInCollection, org.eclipse.swt.widgets.Control rowControl)private booleanfireRequestRowChangeEvent()Request permission from all listeners to leave the current row.private voidfireRowArriveEvent()Indicate to listeners that the focus is arriving on the specified rowprivate voidfireRowConstructionEvent(org.eclipse.swt.widgets.Control newControl)Fire the row construction eventprivate voidfireRowDeletedEvent()private voidfireRowDepartEvent()Indicate to listeners that the focus is about to leave the current row.private voidfireScrollEvent(ScrollEvent scrollEvent)Tell listeners that we just scrolled.private voidfixNumberOfRows()Utility method: Makes sure that the number of rows that are visible correspond with what should be visible given the table control's size, where it is scrolled, and the number of rows in the underlying collection.voidfocusGained(TableRow sender, org.eclipse.swt.events.FocusEvent e)Handle focusGained events on any child control.voidfocusLost(TableRow sender, org.eclipse.swt.events.FocusEvent e)Handle focusLost events on any child control.private org.eclipse.swt.widgets.ControlgetControl(int column, int row)Return the SWT control at (column, row), where row is a 0-based number starting from the top visible row.intgetControlRow(org.eclipse.swt.widgets.Control rowControl)Method getControlRow.TableRowgetControlRowObject(org.eclipse.swt.widgets.Control rowControl)Method getControlRowObject.org.eclipse.swt.widgets.ControlgetCurrentRowControl()Returns the SWT control corresponding to the current row.(package private) org.eclipse.swt.widgets.ControlgetHeader()Returns the actual header control (not the prototype).org.eclipse.swt.widgets.ControlgetHeaderControl()(non-API) Method getHeaderControl.private org.eclipse.swt.layout.GridDatagetHSliderGridData()Returns a GridData for the SliderHolder appropriate for if the slider is visible or not.private TableRowgetNewRow()Utility method: Creates a new row object or recycles one that had been previously created but was no longer needed.intgetNumRowsVisible()Method getNumRowsVisible.private TableRowgetRowByNumber(int rowNumber)Returns the TableRow by the specified 0-based offset from the top visible row.org.eclipse.swt.widgets.Control[]getRowControls()Method getRowControls.(package private) intgetRowHeight(int clientAreaHeight)private intgetRowNumber(TableRow row)Return the 0-based row number corresponding to a particular TableRow object.org.eclipse.swt.graphics.PointgetSelection()Method getSelection.intgetTopRow()Method getTopRow.private org.eclipse.swt.layout.GridDatagetVSliderGridData()Returns a GridData for the SliderHolder appropriate for if the slider is visible or not.voidhandleEvent(org.eclipse.swt.widgets.Event event)Scroll wheel event handling.private voidhandleNextRowNavigation()Try to go to the next row in the collection.private voidhandlePreviousRowNavigation(TableRow row)Try to go to the previous row in the collection.private voidinitialize()Initialize the overall table UI.private voidinsertRowAt(int position)Insert a new row object at the specified 0-based position relatve to the topmost row.private voidinternalSetSelection(int column, int row, boolean rowChange)Set the focus to the specified (column, row).booleanisHSliderVisible()Returns if the slider is visible.private booleanisRowVisible(int row)booleanisVSliderVisible()Returns if the slider is visible.voidkeyPressed(TableRow sender, org.eclipse.swt.events.KeyEvent e)Handle a keyPressed event on any row control.voidkeyTraversed(TableRow sender, org.eclipse.swt.events.TraverseEvent e)Handle the keyTraversed event on any child control in the table.protected voidlayoutControlHolder()Layout the child controls within the controlHolder Composite.private voidlayoutHeaderOrRow(org.eclipse.swt.widgets.Control control)(package private) voidrefreshAllRows()Fire the refresh event on all visible rows.(package private) voidrefreshRow(int row)voidremoveRefreshContentProvider(IRowContentProvider listener)Remove the specified listener from the set of listeners that will be notified when a row refresh event occurs.private voidresetFocus()Make sure that something sane inside the table has focus.private voidscrollTop()Utility method: Makes sure that the currently visible top row is the same as the top row specified in the TopRow property.voidsetBackground(org.eclipse.swt.graphics.Color color)voidsetHSliderVisible(boolean visible)Sets if the slider is visible or not.voidsetMaxRowsVisible(int maxRowsVisible)Method setMaxRowsVisible.voidsetMenu(org.eclipse.swt.widgets.Menu menu)private voidsetMenuOnCollection(java.util.LinkedList<TableRow> collection, org.eclipse.swt.widgets.Menu menu)voidsetNumRowsInCollection(int numRowsInCollection)Method setNumRowsInCollection.voidsetSelection(int column, int row)Method setSelection.voidsetTopRow(int topRow)Method setTopRow.voidsetVSliderVisible(boolean visible)Sets if the slider is visible or not.voidsetWeights()Method setWeights.private voidshowHeader()If the header control hasn't been created yet, create and show it.(package private) voidupdateVisibleRows()Main refresh algorithm entry point.-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
controlHolder
private org.eclipse.swt.widgets.Composite controlHolder
-
vSliderHolder
private org.eclipse.swt.widgets.Composite vSliderHolder
-
vSlider
private org.eclipse.swt.widgets.Slider vSlider
-
hScroller
private org.eclipse.swt.widgets.Composite hScroller
-
hSliderHolder
private org.eclipse.swt.widgets.Composite hSliderHolder
-
hSlider
private org.eclipse.swt.widgets.Slider hSlider
-
emptyTablePlaceholder
EmptyTablePlaceholder emptyTablePlaceholder
-
parent
private CompositeTable parent
-
maxRowsVisible
private int maxRowsVisible
-
numRowsInDisplay
private int numRowsInDisplay
-
numRowsInCollection
private int numRowsInCollection
-
topRow
private int topRow
-
currentRow
private int currentRow
-
currentColumn
private int currentColumn
-
currentVisibleTopRow
private int currentVisibleTopRow
-
numRowsVisible
private int numRowsVisible
-
rows
private java.util.LinkedList<TableRow> rows
-
spareRows
private java.util.LinkedList<TableRow> spareRows
-
clientAreaHeight
int clientAreaHeight
-
headerConstructor
private java.lang.reflect.Constructor<?> headerConstructor
-
rowConstructor
private java.lang.reflect.Constructor<?> rowConstructor
-
headerControl
private org.eclipse.swt.widgets.Control headerControl
-
myHeader
private org.eclipse.swt.widgets.Control myHeader
-
rowControl
private org.eclipse.swt.widgets.Control rowControl
-
scrollerResizeHandler
org.eclipse.swt.events.ControlAdapter scrollerResizeHandler
-
vSliderVisible
private boolean vSliderVisible
-
hSliderVisible
private boolean hSliderVisible
-
needToRequestRC
private boolean needToRequestRC
-
displayKeyDownFilter
private org.eclipse.swt.widgets.Listener displayKeyDownFilter
-
sliderSelectionListener
private org.eclipse.swt.events.SelectionListener sliderSelectionListener
The SelectionListener for the table's vertical slider control.
-
hSliderSelectionListener
private org.eclipse.swt.events.SelectionListener hSliderSelectionListener
-
headerPaintListener
private org.eclipse.swt.events.PaintListener headerPaintListener
-
rowPaintListener
private org.eclipse.swt.events.PaintListener rowPaintListener
-
menu
private org.eclipse.swt.widgets.Menu menu
-
-
Constructor Detail
-
InternalCompositeTable
public InternalCompositeTable(org.eclipse.swt.widgets.Composite parentControl, int style)Constructor InternalCompositeTable. The usual SWT constructor. The same style bits are allowed here as are allowed on Composite.- Parameters:
parentControl- The SWT parent.style- Style bits.
-
-
Method Detail
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)
- Overrides:
setBackgroundin classorg.eclipse.swt.widgets.Control
-
initialize
private void initialize()
Initialize the overall table UI.
-
createControlHolder
private void createControlHolder()
Initialize the controlHolder, which is the holder Composite for the header object (if applicable) and the row objects.
-
createVSliderHolder
private void createVSliderHolder()
Initialize the sliderHolder and slider. The SliderHolder is a Composite that is responsible for showing and hiding the vertical slider upon request.
-
createHSliderHolder
private void createHSliderHolder()
Initialize the sliderHolder and slider. The SliderHolder is a Composite that is responsible for showing and hiding the vertical slider upon request.
-
getVSliderGridData
private org.eclipse.swt.layout.GridData getVSliderGridData()
Returns a GridData for the SliderHolder appropriate for if the slider is visible or not.- Returns:
- A GridData with a widthHint of 0 if the slider is not visible or with a widthHint of SWT.DEFAULT otherwise.
-
getHSliderGridData
private org.eclipse.swt.layout.GridData getHSliderGridData()
Returns a GridData for the SliderHolder appropriate for if the slider is visible or not.- Returns:
- A GridData with a heightHint of 0 if the slider is not visible or with a heightHint of SWT.DEFAULT otherwise.
-
setVSliderVisible
public void setVSliderVisible(boolean visible)
Sets if the slider is visible or not.- Parameters:
visible- true if the slider should be visible; false otherwise.
-
isVSliderVisible
public boolean isVSliderVisible()
Returns if the slider is visible.- Returns:
- true if the slider is visible; false otherwise.
-
setHSliderVisible
public void setHSliderVisible(boolean visible)
Sets if the slider is visible or not.- Parameters:
visible- true if the slider should be visible; false otherwise.
-
isHSliderVisible
public boolean isHSliderVisible()
Returns if the slider is visible.- Returns:
- true if the slider is visible; false otherwise.
-
dispose
public void dispose()
- Overrides:
disposein classorg.eclipse.swt.widgets.Widget
-
disposeRows
private void disposeRows(java.util.LinkedList<TableRow> rowsCollection)
Disposes all the row objects in the specified LinkedList.- Parameters:
rowsCollection- The collection containing TableRow objects to dispose.
-
layoutControlHolder
protected void layoutControlHolder()
Layout the child controls within the controlHolder Composite.
-
layoutHeaderOrRow
private void layoutHeaderOrRow(org.eclipse.swt.widgets.Control control)
-
createInternalControl
private org.eclipse.swt.widgets.Control createInternalControl(org.eclipse.swt.widgets.Composite parent, java.lang.reflect.Constructor<?> constructor)Construct a header or row object on demand. Logs an error and returns null on failure.- Parameters:
parent- The SWT parent.constructor- The header or row object's constructor.- Returns:
- The constructed control or null if none could be constructed.
-
showHeader
private void showHeader()
If the header control hasn't been created yet, create and show it.
-
updateVisibleRows
void updateVisibleRows()
Main refresh algorithm entry point. This method refreshes everything in the table:- Makes sure the correct number of rows are visible
- Makes sure each row has been refreshed with data from the underlying model
-
getRowHeight
int getRowHeight(int clientAreaHeight)
-
scrollTop
private void scrollTop()
Utility method: Makes sure that the currently visible top row is the same as the top row specified in the TopRow property.
-
fixNumberOfRows
private void fixNumberOfRows()
Utility method: Makes sure that the number of rows that are visible correspond with what should be visible given the table control's size, where it is scrolled, and the number of rows in the underlying collection.
-
refreshAllRows
void refreshAllRows()
Fire the refresh event on all visible rows.
-
refreshRow
void refreshRow(int row)
-
isRowVisible
private boolean isRowVisible(int row)
-
resetFocus
private void resetFocus()
Make sure that something sane inside the table has focus.
-
insertRowAt
private void insertRowAt(int position)
Insert a new row object at the specified 0-based position relatve to the topmost row.- Parameters:
position- The 0-based position relative to the topmost row.
-
deleteRowAt
private void deleteRowAt(int position)
Delete the row at the specified 0-based position relative to the topmost row.- Parameters:
position- The 0-based position relative to the topmost row.
-
getNewRow
private TableRow getNewRow()
Utility method: Creates a new row object or recycles one that had been previously created but was no longer needed.- Returns:
- The new row object.
-
getHeaderControl
public org.eclipse.swt.widgets.Control getHeaderControl()
(non-API) Method getHeaderControl. Return the prototype control being used as a header.- Returns:
- The header control
-
getHeader
org.eclipse.swt.widgets.Control getHeader()
Returns the actual header control (not the prototype).- Returns:
- a control instance or null, if no header is available
-
setMaxRowsVisible
public void setMaxRowsVisible(int maxRowsVisible)
Method setMaxRowsVisible. Sets the maximum number of rows that will be permitted in the table at once. For example, setting this property to 1 will have the effect of creating a single editing area with a scroll bar on the right allowing the user to scroll through all rows using either the mouse or the PgUp/PgDn keys. The default value is Integer.MAX_VALUE.- Parameters:
maxRowsVisible- the maximum number of rows that are permitted to be visible at one time, regardless of the control's size.
-
getNumRowsVisible
public int getNumRowsVisible()
Method getNumRowsVisible. Returns the actual number of rows that are currently visible. Normally CompositeTable displays as many rows as will fit vertically given the control's size. This value can be clamped to a maximum using the MaxRowsVisible property.- Returns:
- the actual number of rows that are currently visible.
-
setNumRowsInCollection
public void setNumRowsInCollection(int numRowsInCollection)
Method setNumRowsInCollection. Sets the number of rows in the data structure that is being edited.- Parameters:
numRowsInCollection- the number of rows represented by the underlying data structure.
-
doSetTopRow
private void doSetTopRow(int topRow, int currentRow)
-
setTopRow
public void setTopRow(int topRow)
Method setTopRow. Set the number of the line that is being displayed in the top row of the CompositeTable editor (0-based). If the new top row is not equal to the current top row, the table will automatically be scrolled to the new position. This number must be greater than 0 and less than NumRowsInCollection.- Parameters:
topRow- the line number of the new top row.
-
getTopRow
public int getTopRow()
Method getTopRow. Return the number of the line that is being displayed in the top row of the CompositeTable editor (0-based).- Returns:
- the number of the top line.
-
getSelection
public org.eclipse.swt.graphics.Point getSelection()
Method getSelection. Returns the currently-selected (column, row) pair where the row specifies the offset from the top of the table window. In order to get the current row in the underlying data structure, use getSelection().y + getCurrentRow().- Returns:
- the currently-selected (column, row) pair where the row specifies the offset from the top of the table window, or null if no selection is available.
-
setSelection
public void setSelection(int column, int row)Method setSelection. Sets the currently-selected (column, row) pair where the row specifies the offset from the top of the table window. In order to get the current row in the underlying data structure, use getSelection().y + getCurrentRow().- Parameters:
column- the column to selectrow- the row to select
-
clearSelection
public void clearSelection()
(non-API) SeeCompositeTable.clearSelection()instead.
-
setWeights
public void setWeights()
Method setWeights. Indicates that the column weights were just set and we should re-layout the control holder object.
-
addRefreshContentProvider
public void addRefreshContentProvider(IRowContentProvider listener)
Adds the specified listener to the set of listeners that will be notified when a row refresh event occurs.- Parameters:
listener- the listener to add.
-
removeRefreshContentProvider
public void removeRefreshContentProvider(IRowContentProvider listener)
Remove the specified listener from the set of listeners that will be notified when a row refresh event occurs.- Parameters:
listener- the listener to remove.
-
fireRefreshEvent
private void fireRefreshEvent(int positionInCollection, org.eclipse.swt.widgets.Control rowControl)
-
createEmptyTablePlaceholer
private void createEmptyTablePlaceholer()
-
disposeEmptyTablePlaceholder
private void disposeEmptyTablePlaceholder()
-
keyPressed
public void keyPressed(TableRow sender, org.eclipse.swt.events.KeyEvent e)
Handle a keyPressed event on any row control.- Parameters:
sender- The row that is sending the evente- the actual KeyEvent
-
keyTraversed
public void keyTraversed(TableRow sender, org.eclipse.swt.events.TraverseEvent e)
Handle the keyTraversed event on any child control in the table.- Parameters:
sender- The row sending the event.e- The SWT TraverseEvent
-
doMakeFocusedRowVisible
public boolean doMakeFocusedRowVisible()
Makes sure that the focused row is visible- Returns:
- true if the display needed to be scrolled; false otherwise
-
computeTopRowDelta
private int computeTopRowDelta(int row)
-
handleEvent
public void handleEvent(org.eclipse.swt.widgets.Event event)
Scroll wheel event handling.- Specified by:
handleEventin interfaceorg.eclipse.swt.widgets.Listener
-
deselectCurrentRowIfVisible
private void deselectCurrentRowIfVisible()
-
focusLost
public void focusLost(TableRow sender, org.eclipse.swt.events.FocusEvent e)
Handle focusLost events on any child control. This is not currently used.- Parameters:
sender- The row containing the sending control.e- The SWT FocusEvent.
-
focusGained
public void focusGained(TableRow sender, org.eclipse.swt.events.FocusEvent e)
Handle focusGained events on any child control. FIXME: Needs to automatically scroll horizontally if the newly-focused control is fully or partially occluded.- Parameters:
sender- The row containing the sending control.e- The SWT FocusEvent.
-
drawGridLines
private void drawGridLines(org.eclipse.swt.events.PaintEvent e, boolean isHeader)
-
fireRowConstructionEvent
private void fireRowConstructionEvent(org.eclipse.swt.widgets.Control newControl)
Fire the row construction event- Parameters:
newControl- The new row's SWT control
-
fireHeaderConstructionEvent
private void fireHeaderConstructionEvent(org.eclipse.swt.widgets.Control newControl)
Fire the row construction event- Parameters:
newControl- The new row's SWT control
-
fireRowArriveEvent
private void fireRowArriveEvent()
Indicate to listeners that the focus is arriving on the specified row
-
fireRequestRowChangeEvent
private boolean fireRequestRowChangeEvent()
Request permission from all listeners to leave the current row.- Returns:
- true if all listeners permit the row change; false otherwise.
-
fireRowDepartEvent
private void fireRowDepartEvent()
Indicate to listeners that the focus is about to leave the current row.
-
fireDeleteEvent
private boolean fireDeleteEvent()
Request deletion of the current row from the underlying data structure.- Returns:
- true if the deletion was successful; false otherwise.
-
fireRowDeletedEvent
private void fireRowDeletedEvent()
-
fireInsertEvent
private int fireInsertEvent()
Request that the model insert a new row into itself.- Returns:
- The 0-based offset of the new row from the start of the collection or -1 if a new row could not be inserted.
-
fireScrollEvent
private void fireScrollEvent(ScrollEvent scrollEvent)
Tell listeners that we just scrolled.- Parameters:
scrollEvent- TODO
-
deselect
private void deselect(org.eclipse.swt.widgets.Widget widget)
Set the widget's selection to an empty selection.- Parameters:
widget- The widget to deselect
-
handleNextRowNavigation
private void handleNextRowNavigation()
Try to go to the next row in the collection.
-
handlePreviousRowNavigation
private void handlePreviousRowNavigation(TableRow row)
Try to go to the previous row in the collection.- Parameters:
row- The current table row.
-
currentRow
private TableRow currentRow()
Gets the current TableRow.- Returns:
- the current TableRow
-
getCurrentRowControl
public org.eclipse.swt.widgets.Control getCurrentRowControl()
Returns the SWT control corresponding to the current row.- Returns:
- the current row control.
-
getRowControls
public org.eclipse.swt.widgets.Control[] getRowControls()
Method getRowControls. Returns an array of SWT controls where each control represents a row control in the CompositeTable's current scrolled position. If CompositeTable is resized, scrolled, such that the rows that the CompositeTable control is displaying change in any way, the array that is returned by this method will become out of date and need to be retrieved again.- Returns:
- Control[] An array of SWT Control objects, each representing an SWT row object.
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)
- Overrides:
setMenuin classorg.eclipse.swt.widgets.Control
-
setMenuOnCollection
private void setMenuOnCollection(java.util.LinkedList<TableRow> collection, org.eclipse.swt.widgets.Menu menu)
-
getControlRow
public int getControlRow(org.eclipse.swt.widgets.Control rowControl)
Method getControlRow. Given a row control, returns its row number relative to the topRow.- Parameters:
rowControl- The row object to find- Returns:
- The row number of the rowControl relative to the topRow (0-based)
- Throws:
java.lang.IllegalArgumentException- if rowControl is not currently visible
-
getControlRowObject
public TableRow getControlRowObject(org.eclipse.swt.widgets.Control rowControl)
Method getControlRowObject. Given a row control, returns its row number relative to the topRow.- Parameters:
rowControl- The row object to find- Returns:
- The row object managing the rowControl
- Throws:
java.lang.IllegalArgumentException- if rowControl is not currently visible
-
getRowByNumber
private TableRow getRowByNumber(int rowNumber)
Returns the TableRow by the specified 0-based offset from the top visible row.- Parameters:
rowNumber- 0-based offset of the requested fow starting from the top visible row.- Returns:
- The corresponding TableRow or null if there is none.
-
getControl
private org.eclipse.swt.widgets.Control getControl(int column, int row)Return the SWT control at (column, row), where row is a 0-based number starting from the top visible row.- Parameters:
column- the 0-based column.row- the 0-based row starting from the top visible row.- Returns:
- the SWT control at (column, row)
-
getRowNumber
private int getRowNumber(TableRow row)
Return the 0-based row number corresponding to a particular TableRow object.- Parameters:
row- The TableRow to translate to row coordinates.- Returns:
- the 0-based row number or -1 if the specified TableRow is not visible.
-
internalSetSelection
private void internalSetSelection(int column, int row, boolean rowChange)Set the focus to the specified (column, row). If rowChange is true, fire a row change event, otherwise be silent.- Parameters:
column- The 0-based column to focusrow- The 0-based row to focusrowChange- true if a row change event should be fired; false otherwise.
-
deferredSetFocus
private void deferredSetFocus(org.eclipse.swt.widgets.Control toFocus, boolean rowChange)Set the focus to the specified control after allowing all pending events to complete first. If rowChange is true, fire a row arrive event after the focus has been set.- Parameters:
toFocus- The SWT Control to focusrowChange- true if the rowArrive event should be fired; false otherwise.
-
doFocusInitialRow
public void doFocusInitialRow()
-
doFocusLastRow
public void doFocusLastRow()
-
doPageUp
public void doPageUp()
-
doPageDown
public void doPageDown()
-
doRowUp
public void doRowUp()
-
doRowDown
public void doRowDown()
-
doInsertRow
public boolean doInsertRow()
-
doDeleteRow
public boolean doDeleteRow()
-
-