Class NatTable
- 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.widgets.Canvas
-
- org.eclipse.nebula.widgets.nattable.NatTable
-
- All Implemented Interfaces:
EventListener,ILayer,ILayerListener,IPersistable,IClientAreaProvider,org.eclipse.swt.events.PaintListener,org.eclipse.swt.graphics.Drawable,org.eclipse.swt.internal.SWTEventListener
- Direct Known Subclasses:
NatTableFixture,NatTableFixture
public class NatTable extends org.eclipse.swt.widgets.Canvas implements ILayer, org.eclipse.swt.events.PaintListener, IClientAreaProvider, ILayerListener, IPersistable
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<IConfiguration>configurationsstatic intDEFAULT_STYLE_OPTIONSprotected ReadWriteLockeventListenerLockReadWriteLockthat is used to ensure that no concurrent modifications happen on event handlingprotected Stringidstatic StringINITIAL_PAINT_COMPLETE_FLAGKey that is used for loading NatTable states.-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider
DEFAULT
-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description NatTable(org.eclipse.swt.widgets.Composite parent)NatTable(org.eclipse.swt.widgets.Composite parent, boolean autoconfigure)NatTable(org.eclipse.swt.widgets.Composite parent, int style)NatTable(org.eclipse.swt.widgets.Composite parent, int style, boolean autoconfigure)NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer)NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer, boolean autoconfigure)NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer, EventConflaterChain chain, boolean autoconfigure)Only use this constructor to specify a custom EventConflaterChain with different refresh interval settings in case you are facing issues on rendering, e.g.NatTable(org.eclipse.swt.widgets.Composite parent, ILayer layer)NatTable(org.eclipse.swt.widgets.Composite parent, ILayer layer, boolean autoconfigure)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConfiguration(IConfiguration configuration)Adds a configuration to the table.voidaddDragSupport(int operations, org.eclipse.swt.dnd.Transfer[] transferTypes, org.eclipse.swt.dnd.DragSourceListener listener)Adds support for dragging items out of this control via a user drag-and-drop operation.voidaddDropSupport(int operations, org.eclipse.swt.dnd.Transfer[] transferTypes, org.eclipse.swt.dnd.DropTargetListener listener)Adds support for dropping items into this control via a user drag-and-drop operation.voidaddLayerListener(ILayerListener listener)Add a generalILayerListenerto handleILayerEvents on this layer.voidaddOverlayPainter(IOverlayPainter overlayPainter)protected voidcheckSubclass()booleancommitAndCloseActiveCellEditor()Checks if there is an active cell editor registered.voidconfigure()Processes all the registeredIConfiguration(s).voidconfigure(IConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry)Configure this layer, e.g.protected voidconfigureScaling(IDpiConverter horizontalConverter, IDpiConverter verticalConverter)Add the givenIDpiConverterto theIConfigRegistryso they can be used by painters and set the system properties to use the configured scaling for images.booleandoCommand(ILayerCommand command)Opportunity to respond to a command as it flows down the stack.voidfireLayerEvent(ILayerEvent event)Events can be fired to notify other components of the grid.ICellEditorgetActiveCellEditor()Returns the active cell editor that is currently open ornullif there is no editor active.org.eclipse.swt.graphics.RectanglegetBoundsByPosition(int columnPosition, int rowPosition)Calculates the bounds in pixel for the given cell position.ILayerCellgetCellByPosition(int columnPosition, int rowPosition)Returns the cell for the given coordinates on this layer.ICellPaintergetCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry)Return theICellPainterfor the givenILayerCellat the given coordinates out of the givenIConfigRegistry.IClientAreaProvidergetClientAreaProvider()intgetColumnCount()intgetColumnIndexByPosition(int columnPosition)Gets the underlying non-transformed column index for the given column position on this layer.intgetColumnPositionByX(int x)Returns the column position that contains the given x coordinate.intgetColumnWidthByPosition(int columnPosition)Returns the width in pixels of the given column.LabelStackgetConfigLabelsByPosition(int columnPosition, int rowPosition)Returns the config labels for the cell at the given coordinates.IConfigRegistrygetConfigRegistry()ObjectgetDataValueByPosition(int columnPosition, int rowPosition)Returns the data value for the cell at the given coordinates.DisplayModegetDisplayModeByPosition(int columnPosition, int rowPosition)Returns the activeDisplayModefor the cell at the given coordinates.intgetHeight()Returns the total height in pixels of this layer.StringgetID()InternalCellClipboardgetInternalCellClipboard()ILayergetLayer()ILayerPaintergetLayerPainter()List<IOverlayPainter>getOverlayPainters()intgetPreferredColumnCount()intgetPreferredHeight()intgetPreferredRowCount()intgetPreferredWidth()Collection<String>getProvidedLabels()Returns the labels that are used within this NatTable for conditional styling.LabelStackgetRegionLabelsByXY(int x, int y)Return theLabelStackcontaining the region labels for the cell at the given pixel position.intgetRowCount()intgetRowHeightByPosition(int rowPosition)Returns the height in pixels of the given row.intgetRowIndexByPosition(int rowPosition)Gets the underlying non-transformed row index for the given row position on this layer.intgetRowPositionByY(int y)Returns the row position that contains the given y coordinate.intgetStartXOfColumnPosition(int columnPosition)Returns the x offset in pixels of the given column.intgetStartYOfRowPosition(int rowPosition)Returns the y offset in pixels of the given row.UiBindingRegistrygetUiBindingRegistry()ILayergetUnderlyingLayerByPosition(int columnPosition, int rowPosition)Returns the layer that is directly below this layer for the given cell coordinate.Collection<ILayer>getUnderlyingLayersByColumnPosition(int columnPosition)Returns the layers that are directly below this layer for the given column position.Collection<ILayer>getUnderlyingLayersByRowPosition(int rowPosition)Returns the layers that are directly below this layer for the given row position.protected IEventConflatergetVisualChangeEventConflater()intgetWidth()Returns the total width in pixels of this layer.voidhandleLayerEvent(ILayerEvent event)Handle an event notification from anILayerbooleanhasLayerListener(Class<? extends ILayerListener> layerListenerClass)Check if anILayerListenerof the given type is registered on this layer or not.protected voidinitInternalListener()booleanisColumnPositionResizable(int columnPosition)Check if the column at the given position is resizable.booleanisRowPositionResizable(int rowPosition)Check if the row at the given position is resizable.voidloadState(String prefix, Properties properties)Restore the state of the underlying layers from the values in the properties object.intlocalToUnderlyingColumnPosition(int localColumnPosition)Convert a column position to the coordinates of the underlying layer.intlocalToUnderlyingRowPosition(int localRowPosition)Convert a row position to the coordinates of the underlying layer.voidpaintControl(org.eclipse.swt.events.PaintEvent event)voidrefresh()Refreshes the entire NatTable as every layer will be refreshed.voidrefresh(boolean structuralChange)Refreshes the entire NatTable as every layer will be refreshed.voidregisterCommandHandler(ILayerCommandHandler<?> commandHandler)Register anILayerCommandHandlerto handle a command in this layer.voidregisterPersistable(IPersistable persistable)Register anIPersistablethat can write its state to the statePropertiesinstance when the layer is persisted.voidremoveLayerListener(ILayerListener listener)Remove the givenILayerListenerfrom this layer.voidremoveOverlayPainter(IOverlayPainter overlayPainter)voidrepaintCell(int columnPosition, int rowPosition)Repaint only a specific cell in the grid.voidrepaintColumn(int columnPosition)Repaint only a specific column in the grid.voidrepaintHorizontalLeftOver()Repaint the area to the right of the last column in case there is more space available than columns to paint.voidrepaintRow(int rowPosition)Repaint only a specific row in the grid.voidrepaintVerticalLeftOver()Repaint the area to the bottom of the last row in case there is more space available than rows to paint.voidsaveState(String prefix, Properties properties)Save the state of the table to the properties object.voidsetClientAreaProvider(IClientAreaProvider clientAreaProvider)voidsetConfigRegistry(IConfigRegistry configRegistry)Sets theIConfigRegistrythat should be used to hold the configurations.voidsetLayer(ILayer layer)voidsetLayerPainter(ILayerPainter layerPainter)voidsetTheme(ThemeConfiguration themeConfiguration)Will unregister the style configurations that were applied before by anotherThemeConfigurationand register the style configurations of the givenThemeConfiguration.voidsetUiBindingRegistry(UiBindingRegistry uiBindingRegistry)intunderlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)Transforms the column position relative to the given underlying layer to this layer coordinates.Collection<Range>underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)Transforms the column position ranges relative to the given underlying layer to this layer coordinates.intunderlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)Transforms the row position relative to the given underlying layer to this layer coordinates.Collection<Range>underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)Transforms the row position ranges relative to the given underlying layer to this layer coordinates.voidunregisterCommandHandler(Class<? extends ILayerCommand> commandClass)Unregister theILayerCommandHandlerthat is registered for the givenILayerCommandclass.voidunregisterPersistable(IPersistable persistable)Unregister the givenIPersistable.voidupdateResize()-
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, 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, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, 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, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider
getClientArea
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
dispose, isDynamicSizeLayer
-
-
-
-
Field Detail
-
DEFAULT_STYLE_OPTIONS
public static final int DEFAULT_STYLE_OPTIONS
- See Also:
- Constant Field Values
-
INITIAL_PAINT_COMPLETE_FLAG
public static final String INITIAL_PAINT_COMPLETE_FLAG
Key that is used for loading NatTable states. Is set totruein case the initial painting is not finished yet. In this case there is no need to call refresh commands on loading.- See Also:
- Constant Field Values
-
configurations
protected final Collection<IConfiguration> configurations
-
id
protected String id
-
eventListenerLock
protected ReadWriteLock eventListenerLock
ReadWriteLockthat is used to ensure that no concurrent modifications happen on event handling- Since:
- 1.5
-
-
Constructor Detail
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, boolean autoconfigure)- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)autoconfigure- if set tofalseno auto configuration is done. Default settings are not loaded. Configuration(s) have to be manually added by invokingaddConfiguration(IConfiguration). At the minimum theDefaultNatTableStyleConfigurationmust be added for the table to render.
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, ILayer layer)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, ILayer layer, boolean autoconfigure)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, int style)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, int style, boolean autoconfigure)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer, boolean autoconfigure)
-
NatTable
public NatTable(org.eclipse.swt.widgets.Composite parent, int style, ILayer layer, EventConflaterChain chain, boolean autoconfigure)Only use this constructor to specify a custom EventConflaterChain with different refresh interval settings in case you are facing issues on rendering, e.g. low FPS (laggy) behavior on scrolling (refresh interval too high) or flickering UI (refresh interval too low).- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to constructDEFAULT_STYLE_OPTIONSlayer- theILayerthat should be rendered by this NatTablechain- theEventConflaterChainused to conflate events that trigger for example repainting. By default anEventConflaterChainis registered with a refresh interval specified viaEventConflaterChain.DEFAULT_REFRESH_INTERVAL.autoconfigure- if set tofalseno auto configuration is done. Default settings are not loaded. Configuration(s) have to be manually added by invokingaddConfiguration(IConfiguration). At the minimum theDefaultNatTableStyleConfigurationmust be added for the table to render.- Since:
- 1.5
-
-
Method Detail
-
getVisualChangeEventConflater
protected IEventConflater getVisualChangeEventConflater()
-
getLayer
public ILayer getLayer()
-
setLayer
public void setLayer(ILayer layer)
-
addConfiguration
public void addConfiguration(IConfiguration configuration)
Adds a configuration to the table.Configurations are processed when the
configure()method is invoked. Each configuration object then has a chance to configure the- ILayer
- ConfigRegistry
- UiBindingRegistry
- Parameters:
configuration- TheIConfigurationto add.
-
getConfigRegistry
public IConfigRegistry getConfigRegistry()
- Returns:
IConfigRegistryused to hold the configurations.
-
setConfigRegistry
public void setConfigRegistry(IConfigRegistry configRegistry)
Sets theIConfigRegistrythat should be used to hold the configurations. Can only be used if autoconfigure is turned off at NatTable creation. Should only be used in cases where anIConfigRegistryis needed forILayercreation BEFORE the NatTable can be created.- Parameters:
configRegistry- TheIConfigRegistrythat should be used to hold the configurations.
-
configureScaling
protected void configureScaling(IDpiConverter horizontalConverter, IDpiConverter verticalConverter)
Add the givenIDpiConverterto theIConfigRegistryso they can be used by painters and set the system properties to use the configured scaling for images.- Parameters:
horizontalConverter- TheIDpiConverterfor horizontal scaling.verticalConverter- TheIDpiConverterfor vertical scaling.- Since:
- 2.0
-
getUiBindingRegistry
public UiBindingRegistry getUiBindingRegistry()
- Returns:
- Registry holding all the UIBindings contributed by the underlying layers
-
setUiBindingRegistry
public void setUiBindingRegistry(UiBindingRegistry uiBindingRegistry)
-
getID
public String getID()
-
checkSubclass
protected void checkSubclass()
- Overrides:
checkSubclassin classorg.eclipse.swt.widgets.Composite
-
initInternalListener
protected void initInternalListener()
-
getOverlayPainters
public List<IOverlayPainter> getOverlayPainters()
-
addOverlayPainter
public void addOverlayPainter(IOverlayPainter overlayPainter)
-
removeOverlayPainter
public void removeOverlayPainter(IOverlayPainter overlayPainter)
-
paintControl
public void paintControl(org.eclipse.swt.events.PaintEvent event)
- Specified by:
paintControlin interfaceorg.eclipse.swt.events.PaintListener
-
getLayerPainter
public ILayerPainter getLayerPainter()
- Specified by:
getLayerPainterin interfaceILayer- Returns:
- The
ILayerPainterused to render this layer.
-
setLayerPainter
public void setLayerPainter(ILayerPainter layerPainter)
-
repaintColumn
public void repaintColumn(int columnPosition)
Repaint only a specific column in the grid. This method is optimized so that only the specific column is repainted and nothing else.- Parameters:
columnPosition- column of the grid to repaint
-
repaintRow
public void repaintRow(int rowPosition)
Repaint only a specific row in the grid. This method is optimized so that only the specific row is repainted and nothing else.- Parameters:
rowPosition- row of the grid to repaint
-
repaintCell
public void repaintCell(int columnPosition, int rowPosition)Repaint only a specific cell in the grid. This method is optimized so that only the specific cell is repainted and nothing else.- Parameters:
columnPosition- column position of the cell to repaintrowPosition- row position of the cell to repaint
-
repaintHorizontalLeftOver
public void repaintHorizontalLeftOver()
Repaint the area to the right of the last column in case there is more space available than columns to paint.
-
repaintVerticalLeftOver
public void repaintVerticalLeftOver()
Repaint the area to the bottom of the last row in case there is more space available than rows to paint.
-
updateResize
public void updateResize()
-
refresh
public void refresh()
Refreshes the entire NatTable as every layer will be refreshed. Used to update on structural changes.
-
refresh
public void refresh(boolean structuralChange)
Refreshes the entire NatTable as every layer will be refreshed.- Parameters:
structuralChange-trueif a structural refresh should be performed (same as callingrefresh()),falseif only a visual refresh should be performed, e.g. if configuration values have changed.- Since:
- 1.4
-
configure
public void configure(IConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry)
Description copied from interface:ILayerConfigure this layer, e.g. add any key/mouse bindings and other general configuration.This method is triggered by
configure()and executed down the layer stack.- Specified by:
configurein interfaceILayer- Parameters:
configRegistry- TheIConfigRegistryinstance owned by theNatTablethis layer is attached to.uiBindingRegistry- TheUiBindingRegistryinstance owned byNatTablethis layer is attached to.
-
configure
public void configure()
Processes all the registeredIConfiguration(s). All the underlying layers are walked and given a chance to configure. Note: all desired configuration tweaks must be done before this method is invoked.
-
handleLayerEvent
public void handleLayerEvent(ILayerEvent event)
Description copied from interface:ILayerListenerHandle an event notification from anILayer- Specified by:
handleLayerEventin interfaceILayerListener- Parameters:
event- the event
-
saveState
public void saveState(String prefix, Properties properties)
Save the state of the table to the properties object.IPersistable.saveState(String, Properties)is invoked on all the underlying layers. This properties object will be populated with the settings of all underlying layers and anyIPersistableregistered with those layers.- Specified by:
saveStatein interfaceIPersistable- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to save the state to.
-
loadState
public void loadState(String prefix, Properties properties)
Restore the state of the underlying layers from the values in the properties object.- Specified by:
loadStatein interfaceIPersistable- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to load the state from.- See Also:
saveState(String, Properties)
-
registerPersistable
public void registerPersistable(IPersistable persistable)
Description copied from interface:ILayerRegister anIPersistablethat can write its state to the statePropertiesinstance when the layer is persisted.- Specified by:
registerPersistablein interfaceILayer- Parameters:
persistable- The persistable that should be registered.- See Also:
ILayer.registerPersistable(IPersistable)
-
unregisterPersistable
public void unregisterPersistable(IPersistable persistable)
Description copied from interface:ILayerUnregister the givenIPersistable.- Specified by:
unregisterPersistablein interfaceILayer- Parameters:
persistable- The persistable to unregister.
-
doCommand
public boolean doCommand(ILayerCommand command)
Description copied from interface:ILayerOpportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.Note: Before the layer can process a command it must convert the command to its local coordinates using
ILayerCommand.convertToTargetLayer(ILayer)
-
registerCommandHandler
public void registerCommandHandler(ILayerCommandHandler<?> commandHandler)
Description copied from interface:ILayerRegister anILayerCommandHandlerto handle a command in this layer. Only oneILayerCommandHandlerperILayerCommandcan be registered per layer.- Specified by:
registerCommandHandlerin interfaceILayer- Parameters:
commandHandler- The command handler to register with this layer.
-
unregisterCommandHandler
public void unregisterCommandHandler(Class<? extends ILayerCommand> commandClass)
Description copied from interface:ILayerUnregister theILayerCommandHandlerthat is registered for the givenILayerCommandclass.- Specified by:
unregisterCommandHandlerin interfaceILayer- Parameters:
commandClass- TheILayerCommandclass for which theILayerCommandHandlershould be unregistered.
-
fireLayerEvent
public void fireLayerEvent(ILayerEvent event)
Description copied from interface:ILayerEvents can be fired to notify other components of the grid. Events travel up the layer stack and may cause a repaint.Example: When the contents of the grid change
IVisualChangeEventcan be fired to notify other layers to refresh their caches etc.- Specified by:
fireLayerEventin interfaceILayer- Parameters:
event- the event to fire
-
addLayerListener
public void addLayerListener(ILayerListener listener)
Description copied from interface:ILayerAdd a generalILayerListenerto handleILayerEvents on this layer.- Specified by:
addLayerListenerin interfaceILayer- Parameters:
listener- TheILayerListenerto add.
-
removeLayerListener
public void removeLayerListener(ILayerListener listener)
Description copied from interface:ILayerRemove the givenILayerListenerfrom this layer.- Specified by:
removeLayerListenerin interfaceILayer- Parameters:
listener- TheILayerListenerto remove.
-
hasLayerListener
public boolean hasLayerListener(Class<? extends ILayerListener> layerListenerClass)
Description copied from interface:ILayerCheck if anILayerListenerof the given type is registered on this layer or not.- Specified by:
hasLayerListenerin interfaceILayer- Parameters:
layerListenerClass- The type ofILayerListenerto check for.- Returns:
trueif thisILayerhas aILayerListenerof the specified type registered,falseif there is no such listener registered.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfaceILayer- Returns:
- The number of columns in this layer.
-
getPreferredColumnCount
public int getPreferredColumnCount()
- Specified by:
getPreferredColumnCountin interfaceILayer
-
getColumnIndexByPosition
public int getColumnIndexByPosition(int columnPosition)
Description copied from interface:ILayerGets the underlying non-transformed column index for the given column position on this layer.- Specified by:
getColumnIndexByPositionin interfaceILayer- Parameters:
columnPosition- The column position relative to this layer.- Returns:
- An underlying non-transformed column index, or -1 if the given column position does not exist within this coordinate system.
-
localToUnderlyingColumnPosition
public int localToUnderlyingColumnPosition(int localColumnPosition)
Description copied from interface:ILayerConvert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingColumnPositionin interfaceILayer- Parameters:
localColumnPosition- column position in local (the layer's own) coordinates- Returns:
- column position in the underlying layer's coordinates
-
underlyingToLocalColumnPosition
public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
Description copied from interface:ILayerTransforms the column position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositionin interfaceILayer- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given column position matches.underlyingColumnPosition- The column position in the given underlying layer that should be converted to a local column position.- Returns:
- The given column position transformed to be local to this layer.
-
underlyingToLocalColumnPositions
public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
Description copied from interface:ILayerTransforms the column position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositionsin interfaceILayer- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given column positions match.underlyingColumnPositionRanges- The column position ranges relative to the given underlying layer that should be converted to local column positions.- Returns:
- The given column position ranges transformed to this layer.
-
getWidth
public int getWidth()
Description copied from interface:ILayerReturns the total width in pixels of this layer.
-
getPreferredWidth
public int getPreferredWidth()
- Specified by:
getPreferredWidthin interfaceILayer
-
getColumnWidthByPosition
public int getColumnWidthByPosition(int columnPosition)
Description copied from interface:ILayerReturns the width in pixels of the given column. The width of invisible and non-existing columns is 0.- Specified by:
getColumnWidthByPositionin interfaceILayer- Parameters:
columnPosition- The column position in this layer.- Returns:
- The width of the column.
-
isColumnPositionResizable
public boolean isColumnPositionResizable(int columnPosition)
Description copied from interface:ILayerCheck if the column at the given position is resizable.- Specified by:
isColumnPositionResizablein interfaceILayer- Parameters:
columnPosition- The column position to check.- Returns:
trueif the column is resizable,falseif not.
-
getColumnPositionByX
public int getColumnPositionByX(int x)
Description copied from interface:ILayerReturns the column position that contains the given x coordinate.- Specified by:
getColumnPositionByXin interfaceILayer- Parameters:
x- A horizontal pixel location relative to the pixel boundary of this layer.- Returns:
- A column position relative to the associated coordinate system, or -1 if there is no column that contains x.
-
getStartXOfColumnPosition
public int getStartXOfColumnPosition(int columnPosition)
Description copied from interface:ILayerReturns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPositionin interfaceILayer- Parameters:
columnPosition- The column position in this layer.- Returns:
- The x offset of the column, or -1.
-
getUnderlyingLayersByColumnPosition
public Collection<ILayer> getUnderlyingLayersByColumnPosition(int columnPosition)
Description copied from interface:ILayerReturns the layers that are directly below this layer for the given column position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a column.- Specified by:
getUnderlyingLayersByColumnPositionin interfaceILayer- Parameters:
columnPosition- The column position for which the underlying layers are requested.- Returns:
- The layers that are directly below this layer for the given
column position or
nullif this layer has no underlying layers.
-
getRowCount
public int getRowCount()
- Specified by:
getRowCountin interfaceILayer- Returns:
- The number of rows in this layer.
-
getPreferredRowCount
public int getPreferredRowCount()
- Specified by:
getPreferredRowCountin interfaceILayer
-
getRowIndexByPosition
public int getRowIndexByPosition(int rowPosition)
Description copied from interface:ILayerGets the underlying non-transformed row index for the given row position on this layer.- Specified by:
getRowIndexByPositionin interfaceILayer- Parameters:
rowPosition- The row position relative to this layer.- Returns:
- An underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system.
-
localToUnderlyingRowPosition
public int localToUnderlyingRowPosition(int localRowPosition)
Description copied from interface:ILayerConvert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingRowPositionin interfaceILayer- Parameters:
localRowPosition- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
underlyingToLocalRowPosition
public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
Description copied from interface:ILayerTransforms the row position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositionin interfaceILayer- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given row position matches.underlyingRowPosition- The row position in the given underlying layer that should be converted to a local row position.- Returns:
- The given row position transformed to be local to this layer.
-
underlyingToLocalRowPositions
public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
Description copied from interface:ILayerTransforms the row position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositionsin interfaceILayer- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given row positions match.underlyingRowPositionRanges- The row position ranges relative to the given underlying layer that should be converted to local row positions.- Returns:
- The given row position ranges transformed to this layer.
-
getHeight
public int getHeight()
Description copied from interface:ILayerReturns the total height in pixels of this layer.
-
getPreferredHeight
public int getPreferredHeight()
- Specified by:
getPreferredHeightin interfaceILayer
-
getRowHeightByPosition
public int getRowHeightByPosition(int rowPosition)
Description copied from interface:ILayerReturns the height in pixels of the given row. The height of invisible and non-existing rows is 0.- Specified by:
getRowHeightByPositionin interfaceILayer- Parameters:
rowPosition- The row position in this layer.- Returns:
- The height of the row.
-
isRowPositionResizable
public boolean isRowPositionResizable(int rowPosition)
Description copied from interface:ILayerCheck if the row at the given position is resizable.- Specified by:
isRowPositionResizablein interfaceILayer- Parameters:
rowPosition- The row position to check.- Returns:
trueif the row is resizable,falseif not.
-
getRowPositionByY
public int getRowPositionByY(int y)
Description copied from interface:ILayerReturns the row position that contains the given y coordinate.- Specified by:
getRowPositionByYin interfaceILayer- Parameters:
y- a vertical pixel location relative to the pixel boundary of this layer- Returns:
- a row position relative to the associated coordinate system, or -1 if there is no row that contains y
-
getStartYOfRowPosition
public int getStartYOfRowPosition(int rowPosition)
Description copied from interface:ILayerReturns the y offset in pixels of the given row.- Specified by:
getStartYOfRowPositionin interfaceILayer- Parameters:
rowPosition- the row position in this layer- Returns:
- the y offset of the row, or -1
-
getUnderlyingLayersByRowPosition
public Collection<ILayer> getUnderlyingLayersByRowPosition(int rowPosition)
Description copied from interface:ILayerReturns the layers that are directly below this layer for the given row position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a row.- Specified by:
getUnderlyingLayersByRowPositionin interfaceILayer- Parameters:
rowPosition- The row position for which the underlying layers are requested.- Returns:
- The layers that are directly below this layer for the given row
position or
nullif this layer has no underlying layers.
-
getCellByPosition
public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayerReturns the cell for the given coordinates on this layer.- Specified by:
getCellByPositionin interfaceILayer- Parameters:
columnPosition- The column position of the requested cell.rowPosition- The row position of the requested cell.- Returns:
- The
ILayerCellfor the given coordinates in this layer ornullif the coordinates are invalid on this layer.
-
getBoundsByPosition
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition)Description copied from interface:ILayerCalculates the bounds in pixel for the given cell position.- Specified by:
getBoundsByPositionin interfaceILayer- Parameters:
columnPosition- the column position of the cellrowPosition- the row position of the cell- Returns:
- the bounds, or
nullif there are no valid bounds
-
getDisplayModeByPosition
public DisplayMode getDisplayModeByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayerReturns the activeDisplayModefor the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry. The default value isDisplayMode.NORMAL. The SelectionLayer for example overrides this to returnDisplayMode.SELECTfor cells that are currently selected.- Specified by:
getDisplayModeByPositionin interfaceILayer- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
DisplayModefor the cell at the given coordinates.
-
getConfigLabelsByPosition
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayerReturns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry.- Specified by:
getConfigLabelsByPositionin interfaceILayer- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The
LabelStackwith the config labels for the cell at the given coordinates.
-
getDataValueByPosition
public Object getDataValueByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayerReturns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPositionin interfaceILayer- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The data value for the cell at the given coordinates.
-
getCellPainter
public ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry)
Description copied from interface:ILayerReturn theICellPainterfor the givenILayerCellat the given coordinates out of the givenIConfigRegistry.- Specified by:
getCellPainterin interfaceILayer- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.cell- TheILayerCellfor which theICellPainteris requested.configRegistry- TheIConfigRegistryto retrieve the painter from.- Returns:
- The
ICellPainterfor the given cell at the given coordinates ornullif no painter is configured.
-
getRegionLabelsByXY
public LabelStack getRegionLabelsByXY(int x, int y)
Description copied from interface:ILayerReturn theLabelStackcontaining the region labels for the cell at the given pixel position.- Specified by:
getRegionLabelsByXYin interfaceILayer- Parameters:
x- the x pixel coordinatey- the y pixel coordinate- Returns:
- LabelStack containing the region labels for the cell at the given pixel position.
-
getUnderlyingLayerByPosition
public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayerReturns the layer that is directly below this layer for the given cell coordinate.- Specified by:
getUnderlyingLayerByPositionin interfaceILayer- Parameters:
columnPosition- The column position for which the underlying layer is requested.rowPosition- The row position for which the underlying layer is requested.- Returns:
- The layer that is directly below this layer for the given cell
coordinates or
nullif this layer has no underlying layers.
-
getClientAreaProvider
public IClientAreaProvider getClientAreaProvider()
- Specified by:
getClientAreaProviderin interfaceILayer- Returns:
- The
IClientAreaProviderthat specifies the rectangular area available on this layer.
-
setClientAreaProvider
public void setClientAreaProvider(IClientAreaProvider clientAreaProvider)
- Specified by:
setClientAreaProviderin interfaceILayer- Parameters:
clientAreaProvider- TheIClientAreaProviderthat specifies the rectangular area available on this layer.
-
addDragSupport
public void addDragSupport(int operations, org.eclipse.swt.dnd.Transfer[] transferTypes, org.eclipse.swt.dnd.DragSourceListener listener)Adds support for dragging items out of this control via a user drag-and-drop operation.- Parameters:
operations- a bitwise OR of the supported drag and drop operation types (DROP_COPY,DROP_LINK, andDROP_MOVE)transferTypes- the transfer types that are supported by the drag operationlistener- the callback that will be invoked to set the drag data and to cleanup after the drag and drop operation finishes- See Also:
DND
-
addDropSupport
public void addDropSupport(int operations, org.eclipse.swt.dnd.Transfer[] transferTypes, org.eclipse.swt.dnd.DropTargetListener listener)Adds support for dropping items into this control via a user drag-and-drop operation.- Parameters:
operations- a bitwise OR of the supported drag and drop operation types (DROP_COPY,DROP_LINK, andDROP_MOVE)transferTypes- the transfer types that are supported by the drop operationlistener- the callback that will be invoked after the drag and drop operation finishes- See Also:
DND
-
setTheme
public void setTheme(ThemeConfiguration themeConfiguration)
Will unregister the style configurations that were applied before by anotherThemeConfigurationand register the style configurations of the givenThemeConfiguration.- Parameters:
themeConfiguration- The ThemeConfiguration that contains the style configurations to apply.
-
getInternalCellClipboard
public InternalCellClipboard getInternalCellClipboard()
- Returns:
- The
InternalCellClipboardthat is used for internal copy & paste functionality. - Since:
- 1.4
-
getActiveCellEditor
public ICellEditor getActiveCellEditor()
Returns the active cell editor that is currently open ornullif there is no editor active.- Returns:
- the active editor or
null
-
commitAndCloseActiveCellEditor
public boolean commitAndCloseActiveCellEditor()
Checks if there is an active cell editor registered. If there is one, it is tried to commit the value that is currently entered there.- Returns:
falseif there is an open editor that can not be committed because of conversion/validation errors,trueif there is no active open editor or it could be closed after committing the value.
-
getProvidedLabels
public Collection<String> getProvidedLabels()
Returns the labels that are used within this NatTable for conditional styling.- Specified by:
getProvidedLabelsin interfaceILayer- Returns:
- The labels that are used within this NatTable for conditional styling.
- Since:
- 1.4
-
-