Package com.iizigo.vs
Class TablePanel
- 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.swt.custom.SashForm
- com.iizix.swt.CustomSashForm
- com.iizigo.vs.TablePanel
- All Implemented Interfaces:
IComplexOperationSelection
,IContextMenuContributor
,IContextMenuContributorFormControl<org.eclipse.jface.viewers.Viewer>
,IFilterListener
,ISavePanel
,IVirtualSpacePanel
,EventListener
,IVSColumnBestValueListener
,IVSColumnListener
,IVSComponentListener
,IVSComponentState
,IVSTableListener
,java.util.EventListener
,org.eclipse.swt.events.DisposeListener
,org.eclipse.swt.graphics.Drawable
,org.eclipse.swt.internal.SWTEventListener
public class TablePanel extends CustomSashForm implements IVirtualSpacePanel, org.eclipse.swt.events.DisposeListener, EventListener, IFilterListener, IComplexOperationSelection, IVSColumnListener, IVSTableListener, IContextMenuContributor, ISavePanel
Panel used to display a selected Table in the VirtualSpace.- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from class com.iizix.swt.CustomSashForm
CustomSashForm.ICustomSashFormListener
Nested classes/interfaces inherited from interface com.iizix.prop.vs.IVSComponentState
IVSComponentState.State
Field Summary
Fields inherited from class com.iizix.swt.CustomSashForm
ARROW_DRAWN_INDEX, ARROW_HEIGHT, ARROW_MARGIN, ARROW_TYPE_INDEX, ARROW_WIDTH, arrowColor, borderColor, currentSashInfo, customSashFormListeners, DOWN_HIDE_ARROW, DOWN_RESTORE_ARROW, HEIGHT_INDEX, HIDE_ARROWS, inMouseClick, NO_HIDE_DOWN, NO_HIDE_LEFT, NO_HIDE_RIGHT, NO_HIDE_UP, noHideDown, noHideUp, sashBorders, UP_HIDE_ARROW, UP_RESTORE_ARROW, WIDTH_INDEX, X_INDEX, Y_INDEX
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Called to append menu items.boolean
doAddExpandCollapseAll(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Checks if expand/collapse all menu items should be added.void
doComplexOperationSelection(GProp<?>[] props)
Performs the selection of the components.Value.Type
getBestVSColumnHeaderValueType(VSRelativeReference<?> reference)
Requests the value type that would best suit the listener.ContainerSelection[]
getSelectionBefore(ComplexOperation op)
Override this method to return the initial selection that is suitable for restoring a selection usingdoComplexOperationSelection(GProp [])
.DesignerProp
getTarget()
Gets the default target when none other is found for the pop-up menu in the viewer.boolean
isReturningSelectionBeforeOperation()
Checks if this interface returns the selection before the operation takes place or not.void
onBroken(VSRelativeReference<?> reference, VSColumnHeader column)
Called when the property reference has been broken, i.e.void
onBroken(VSRelativeReference<?> reference, VSTable table)
Called when the property reference has been broken, i.e.void
onCellStateChanged(VSField cell, IVSComponentState.State state, boolean on)
Called when the cell changes state.void
onCellValueChanged(VSColumnHeader column, VSField cell, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
Called when the cell value is set in the column.void
onCellValueChanged(VSField cell, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
Called when the cell value is set.void
onConnections(IVSColumnListener[] listeners)
Called to update the connections.void
onConnections(IVSTableListener[] listeners)
Called to update the connections.void
onEditedProperty(GProp<?> comp)
Selection changed for panel.void
onEvent(GEvent event)
Property event.void
onFilter(java.lang.String text)
Called when a filter text has been applied.void
onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean on)
Called when the parent changes state.void
onResolved(VSRelativeReference<?> reference, VSColumnHeader column)
Called when the property reference has been resolved.void
onResolved(VSRelativeReference<?> reference, VSTable table)
Called when the property reference has been resolved.void
onRowAdded(VSColumnHeader column, VSRow row, int rowIndex)
Called when a row has been added to the table.void
onRowAdded(VSRow row, int index)
Called when a row is added.void
onRowRemoved(VSColumnHeader column, VSRow row, int rowIndex)
Called when a row has been removed from the table.void
onRowRemoved(VSRow row, int index)
Called when a row is removed.void
onRowStateChanged(VSRow row, IVSComponentState.State state, boolean on)
Called when a row selection state changed.void
onSelectionChanged(VSColumnHeader column, VSRow row, int rowIndex, boolean isSelected)
Called when the row selection is changed to forward to column listeners.void
onSingleSelectionChanged(VSColumnHeader column, int rowIndex)
Called when the row selection in table single-selection mode is changed to forward to column listeners.void
onSingleSelectionChanged(VSTable table, int index)
Called when the single selection changes.void
onStateChanged(VSColumnHeader table, IVSComponentState.State state, boolean on)
Called when the column changes state.void
onStateChanged(VSColumnHeader column, VSField cell, IVSComponentState.State state, boolean on)
Called when a cell in the column changes state.void
onStateChanged(VSTable table, IVSComponentState.State state, boolean on)
Called when the table changes state.void
prependMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Called to prepend menu items.void
saveSettings()
Called to save settings.boolean
setCellFocus(EditorVSField field)
Selects the field in the table by placing the cursor on the cell and selecting the row.void
widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
Sent when the widget is disposed.Methods inherited from class com.iizix.swt.CustomSashForm
addCustomSashFormListener, downHideClicked, downRestoreClicked, drawArrow, drawDownHideArrow, drawDownRestoreArrow, drawLeftHideArrow, drawLeftRestoreArrow, drawRightHideArrow, drawRightRestoreArrow, drawSashBorder, drawUpHideArrow, drawUpRestoreArrow, fireDividerMoved, getNewSashArray, getRestoreWeight, getSash, getSavedSizes, getWeightsForSave, hideDown, hideLeft, hideRight, hideUp, isFirstSashVisible, isFocusAncestorA, isNoHideDown, isNoHideLeft, isNoHideRight, isNoHideUp, isSecondSashVisible, layout, recomputeSashInfo, removeCustomSashFormListener, setFirstSashVisible, setNoHideDown, setNoHideLeft, setNoHideRight, setNoHideUp, setRestoreWeight, setSashBorders, setSecondSashVisible, setWeights, upHideClicked, upRestoreClicked
Methods inherited from class org.eclipse.swt.custom.SashForm
getMaximizedControl, getOrientation, getSashWidth, getStyle, getWeights, setBackground, setForeground, setLayout, setMaximizedControl, setOrientation, setSashWidth, setToolTipText
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList, toString
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, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, 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, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizigo.editor.complex.IComplexOperationSelection
isDisposed
Method Detail
saveSettings
public void saveSettings()
Called to save settings.- Specified by:
saveSettings
in interfaceISavePanel
- Specified by:
saveSettings
in interfaceIVirtualSpacePanel
setCellFocus
public boolean setCellFocus(EditorVSField field)
Selects the field in the table by placing the cursor on the cell and selecting the row.- Returns:
- true if successful, false if field cell is not inside table.
onEditedProperty
public void onEditedProperty(GProp<?> comp)
Selection changed for panel.- Specified by:
onEditedProperty
in interfaceIVirtualSpacePanel
onEvent
public void onEvent(GEvent event)
Property event.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
event
- The event.
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
Sent when the widget is disposed.- Specified by:
widgetDisposed
in interfaceorg.eclipse.swt.events.DisposeListener
- Parameters:
e
- an event containing information about the dispose
onFilter
public void onFilter(java.lang.String text)
Called when a filter text has been applied.- Specified by:
onFilter
in interfaceIFilterListener
- Parameters:
text
- The filter text to apply, null for none (never empty string).
doComplexOperationSelection
public void doComplexOperationSelection(GProp<?>[] props)
Performs the selection of the components.- Specified by:
doComplexOperationSelection
in interfaceIComplexOperationSelection
isReturningSelectionBeforeOperation
public boolean isReturningSelectionBeforeOperation()
Checks if this interface returns the selection before the operation takes place or not.- Specified by:
isReturningSelectionBeforeOperation
in interfaceIComplexOperationSelection
- Returns:
- false, must be overridden to return the selection before.
getSelectionBefore
public ContainerSelection[] getSelectionBefore(ComplexOperation op)
Override this method to return the initial selection that is suitable for restoring a selection usingdoComplexOperationSelection(GProp [])
.Use the method
ComplexOperation.newContainerSelection(GProp)
to create the array elements.- Specified by:
getSelectionBefore
in interfaceIComplexOperationSelection
- Parameters:
op
- The complex operation.- Returns:
- The selection that can be restored, null for none.
prependMenuItems
public void prependMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Called to prepend menu items.- Specified by:
prependMenuItems
in interfaceIContextMenuContributor
- Specified by:
prependMenuItems
in interfaceIContextMenuContributorFormControl<org.eclipse.jface.viewers.Viewer>
- Parameters:
viewer
- The viewer.menu
- The pop-up menu.target
- The selected target in the viewer, null for none.
appendMenuItems
public void appendMenuItems(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Called to append menu items.- Specified by:
appendMenuItems
in interfaceIContextMenuContributor
- Specified by:
appendMenuItems
in interfaceIContextMenuContributorFormControl<org.eclipse.jface.viewers.Viewer>
- Parameters:
viewer
- The viewer.menu
- The pop-up menu.target
- The selected target in the viewer, null for none.
doAddExpandCollapseAll
public boolean doAddExpandCollapseAll(org.eclipse.jface.viewers.Viewer viewer, IzMenu menu, DesignerProp target)
Checks if expand/collapse all menu items should be added.- Specified by:
doAddExpandCollapseAll
in interfaceIContextMenuContributor
getTarget
public DesignerProp getTarget()
Gets the default target when none other is found for the pop-up menu in the viewer.- Specified by:
getTarget
in interfaceIContextMenuContributor
- Specified by:
getTarget
in interfaceIContextMenuContributorFormControl<org.eclipse.jface.viewers.Viewer>
- Returns:
- The target, or null to use the default edited property.
onConnections
public void onConnections(IVSColumnListener[] listeners)
Called to update the connections.
onConnections
public void onConnections(IVSTableListener[] listeners)
Called to update the connections.
getBestVSColumnHeaderValueType
public Value.Type getBestVSColumnHeaderValueType(VSRelativeReference<?> reference)
Description copied from interface:IVSColumnBestValueListener
Requests the value type that would best suit the listener.- Specified by:
getBestVSColumnHeaderValueType
in interfaceIVSColumnBestValueListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.- Returns:
- null if none is available.
onResolved
public void onResolved(VSRelativeReference<?> reference, VSColumnHeader column)
Description copied from interface:IVSColumnListener
Called when the property reference has been resolved. UI components use this method to set its state according to the field.- Specified by:
onResolved
in interfaceIVSColumnListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.column
- The target reference.
onBroken
public void onBroken(VSRelativeReference<?> reference, VSColumnHeader column)
Description copied from interface:IVSColumnListener
Called when the property reference has been broken, i.e. unresolved.- Specified by:
onBroken
in interfaceIVSColumnListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.column
- The target reference.
onStateChanged
public void onStateChanged(VSColumnHeader table, IVSComponentState.State state, boolean on)
Description copied from interface:IVSColumnListener
Called when the column changes state.- Specified by:
onStateChanged
in interfaceIVSColumnListener
- Parameters:
table
- The VS table column.state
- The state change, possible values ENABLED, READONLY, VISIBLE or SELECTED.on
- New state.
onParentStateChanged
public void onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean on)
Description copied from interface:IVSComponentListener
Called when the parent changes state.- Specified by:
onParentStateChanged
in interfaceIVSComponentListener
- Parameters:
parent
- The parent who's state was changed.state
- The state change, possible values PARENT_ENABLED, PARENT_READONLY, PARENT_VISIBLE.on
- New state.
onSingleSelectionChanged
public void onSingleSelectionChanged(VSColumnHeader column, int rowIndex)
Description copied from interface:IVSColumnListener
Called when the row selection in table single-selection mode is changed to forward to column listeners.- Specified by:
onSingleSelectionChanged
in interfaceIVSColumnListener
- Parameters:
column
- The column.rowIndex
- The row index selected, -1 for none.
onSelectionChanged
public void onSelectionChanged(VSColumnHeader column, VSRow row, int rowIndex, boolean isSelected)
Description copied from interface:IVSColumnListener
Called when the row selection is changed to forward to column listeners.- Specified by:
onSelectionChanged
in interfaceIVSColumnListener
- Parameters:
column
- The column.row
- The row that was changed.rowIndex
- The row index.isSelected
- The selected state.
onStateChanged
public void onStateChanged(VSColumnHeader column, VSField cell, IVSComponentState.State state, boolean on)
Description copied from interface:IVSColumnListener
Called when a cell in the column changes state.- Specified by:
onStateChanged
in interfaceIVSColumnListener
- Parameters:
column
- The VS column.cell
- The VS field.state
- The state change.on
- New state.
onCellValueChanged
public void onCellValueChanged(VSColumnHeader column, VSField cell, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
Description copied from interface:IVSColumnListener
Called when the cell value is set in the column.- Specified by:
onCellValueChanged
in interfaceIVSColumnListener
- Parameters:
column
- The VS column.cell
- The VS field.value
- The value, never null, butvalue.isNull()
could be true.trigger
- The trigger property that may be null.postProcessing
- Post-processing instance.
onRowAdded
public void onRowAdded(VSColumnHeader column, VSRow row, int rowIndex)
Description copied from interface:IVSColumnListener
Called when a row has been added to the table.- Specified by:
onRowAdded
in interfaceIVSColumnListener
- Parameters:
column
- The column.row
- The row that was added.rowIndex
- The row index where it was inserted.
onRowRemoved
public void onRowRemoved(VSColumnHeader column, VSRow row, int rowIndex)
Description copied from interface:IVSColumnListener
Called when a row has been removed from the table.- Specified by:
onRowRemoved
in interfaceIVSColumnListener
- Parameters:
column
- The column.row
- The row that was removed.rowIndex
- The row index before removal.
onResolved
public void onResolved(VSRelativeReference<?> reference, VSTable table)
Description copied from interface:IVSTableListener
Called when the property reference has been resolved. UI components use this method to set its state according to the field.- Specified by:
onResolved
in interfaceIVSTableListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.table
- The target reference.
onBroken
public void onBroken(VSRelativeReference<?> reference, VSTable table)
Description copied from interface:IVSTableListener
Called when the property reference has been broken, i.e. unresolved.- Specified by:
onBroken
in interfaceIVSTableListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.table
- The target reference.
onStateChanged
public void onStateChanged(VSTable table, IVSComponentState.State state, boolean on)
Description copied from interface:IVSTableListener
Called when the table changes state.- Specified by:
onStateChanged
in interfaceIVSTableListener
- Parameters:
table
- The VS table.state
- The state change.on
- New state.
onSingleSelectionChanged
public void onSingleSelectionChanged(VSTable table, int index)
Description copied from interface:IVSTableListener
Called when the single selection changes.- Specified by:
onSingleSelectionChanged
in interfaceIVSTableListener
- Parameters:
table
- The table.index
- The row index, -1 if table is unselected.
onRowAdded
public void onRowAdded(VSRow row, int index)
Description copied from interface:IVSTableListener
Called when a row is added.- Specified by:
onRowAdded
in interfaceIVSTableListener
- Parameters:
row
- The row.index
- The index.
onRowRemoved
public void onRowRemoved(VSRow row, int index)
Description copied from interface:IVSTableListener
Called when a row is removed.- Specified by:
onRowRemoved
in interfaceIVSTableListener
- Parameters:
row
- The row.index
- The index.
onRowStateChanged
public void onRowStateChanged(VSRow row, IVSComponentState.State state, boolean on)
Description copied from interface:IVSTableListener
Called when a row selection state changed.- Specified by:
onRowStateChanged
in interfaceIVSTableListener
- Parameters:
row
- The row.state
- The state change.on
- New state.
onCellStateChanged
public void onCellStateChanged(VSField cell, IVSComponentState.State state, boolean on)
Description copied from interface:IVSTableListener
Called when the cell changes state.- Specified by:
onCellStateChanged
in interfaceIVSTableListener
- Parameters:
cell
- The VS cell.state
- The state change.on
- New state.
onCellValueChanged
public void onCellValueChanged(VSField cell, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
Description copied from interface:IVSTableListener
Called when the cell value is set.- Specified by:
onCellValueChanged
in interfaceIVSTableListener
- Parameters:
cell
- The VS field.value
- The value, never null, butvalue.isNull()
could be true.trigger
- The trigger property that may be null.postProcessing
- Post-processing instance.