|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
public abstract class AbstractLayer
Base layer implementation with common methods for managing listeners and caching, etc.
Field Summary | |
---|---|
protected Map<Class<? extends ILayerCommand>,ILayerCommandHandler<? extends ILayerCommand>> |
commandHandlers
|
protected Map<Class<? extends ILayerEvent>,ILayerEventHandler<? extends ILayerEvent>> |
eventHandlers
|
protected ILayerPainter |
layerPainter
|
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable |
---|
DOT, VALUE_SEPARATOR |
Constructor Summary | |
---|---|
AbstractLayer()
|
Method Summary | |
---|---|
void |
addConfiguration(IConfiguration configuration)
|
void |
addLayerListener(ILayerListener listener)
|
void |
clearConfiguration()
|
void |
configure(ConfigRegistry configRegistry,
UiBindingRegistry uiBindingRegistry)
Every layer gets this call back, starting at the top of the stack. |
void |
dispose()
|
boolean |
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack. |
void |
fireLayerEvent(ILayerEvent event)
Pass the event to all the ILayerListener registered on this
layer. |
org.eclipse.swt.graphics.Rectangle |
getBoundsByPosition(int columnPosition,
int rowPosition)
Calculates the bounds in pixel for the given cell position. |
ILayerCell |
getCellByPosition(int columnPosition,
int rowPosition)
|
ICellPainter |
getCellPainter(int columnPosition,
int rowPosition,
ILayerCell cell,
IConfigRegistry configRegistry)
|
IClientAreaProvider |
getClientAreaProvider()
|
IConfigLabelAccumulator |
getConfigLabelAccumulator()
|
LabelStack |
getConfigLabelsByPosition(int columnPosition,
int rowPosition)
|
String |
getDisplayModeByPosition(int columnPosition,
int rowPosition)
|
ILayerPainter |
getLayerPainter()
|
LabelStack |
getRegionLabelsByXY(int x,
int y)
Layer can apply its own labels to any cell it wishes. |
String |
getRegionName()
|
void |
handleLayerEvent(ILayerEvent event)
Handle layer event notification. |
boolean |
hasLayerListener(Class<? extends ILayerListener> layerListenerClass)
|
void |
loadState(String prefix,
Properties properties)
Restore the state out of the given Properties identified by the specified prefix. |
void |
registerCommandHandler(ILayerCommandHandler<?> commandHandler)
|
protected void |
registerCommandHandlers()
Layers should use this method to register their command handlers and call it from their constructor. |
void |
registerEventHandler(ILayerEventHandler<?> eventHandler)
|
void |
registerPersistable(IPersistable persistable)
Persistables registered with a layer will have a chance to write their data out to the Properties instance when the layer is persisted. |
void |
removeLayerListener(ILayerListener listener)
|
void |
saveState(String prefix,
Properties properties)
Saves the state to the given Properties using the specified prefix. |
void |
setClientAreaProvider(IClientAreaProvider clientAreaProvider)
|
void |
setConfigLabelAccumulator(IConfigLabelAccumulator cellLabelAccumulator)
|
void |
setLayerPainter(ILayerPainter layerPainter)
|
void |
setRegionName(String regionName)
|
String |
toString()
|
void |
unregisterCommandHandler(Class<? extends ILayerCommand> commandClass)
|
void |
unregisterEventHandler(ILayerEventHandler<?> eventHandler)
|
void |
unregisterPersistable(IPersistable persistable)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ILayerPainter layerPainter
protected final Map<Class<? extends ILayerCommand>,ILayerCommandHandler<? extends ILayerCommand>> commandHandlers
protected final Map<Class<? extends ILayerEvent>,ILayerEventHandler<? extends ILayerEvent>> eventHandlers
Constructor Detail |
---|
public AbstractLayer()
Method Detail |
---|
public void dispose()
dispose
in interface ILayer
public LabelStack getRegionLabelsByXY(int x, int y)
ILayer
getRegionLabelsByXY
in interface ILayer
x
- the x pixel coordinatey
- the y pixel coordinate
public String getRegionName()
public void setRegionName(String regionName)
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
getConfigLabelsByPosition
in interface ILayer
public IConfigLabelAccumulator getConfigLabelAccumulator()
public void setConfigLabelAccumulator(IConfigLabelAccumulator cellLabelAccumulator)
public void saveState(String prefix, Properties properties)
IPersistable
saveState
in interface IPersistable
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.public void loadState(String prefix, Properties properties)
IPersistable
loadState
in interface IPersistable
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.public void registerPersistable(IPersistable persistable)
ILayer
Properties
instance when the layer is persisted.
registerPersistable
in interface ILayer
persistable
- the persistable to be registeredpublic void unregisterPersistable(IPersistable persistable)
unregisterPersistable
in interface ILayer
public void addConfiguration(IConfiguration configuration)
public void clearConfiguration()
public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry)
ILayer
NatTable.configure()
method. This is an
opportunity to add any key/mouse bindings and other general
configuration.
configure
in interface ILayer
configRegistry
- instance owned by NatTable
uiBindingRegistry
- instance owned by NatTable
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
command
- the command to perform
protected void registerCommandHandlers()
public void registerCommandHandler(ILayerCommandHandler<?> commandHandler)
registerCommandHandler
in interface ILayer
public void unregisterCommandHandler(Class<? extends ILayerCommand> commandClass)
unregisterCommandHandler
in interface ILayer
public void addLayerListener(ILayerListener listener)
addLayerListener
in interface ILayer
public void removeLayerListener(ILayerListener listener)
removeLayerListener
in interface ILayer
public boolean hasLayerListener(Class<? extends ILayerListener> layerListenerClass)
hasLayerListener
in interface ILayer
layerListenerClass
- The type of ILayerListener
to check for existence
true
if this ILayer
has a
ILayerListener
registered for the specified type,
false
if there is no such listener registered
alreadypublic void handleLayerEvent(ILayerEvent event)
super.fireLayerEvent(event)
- unless you plan to eat the
event yourself.
handleLayerEvent
in interface ILayerListener
event
- the eventpublic void registerEventHandler(ILayerEventHandler<?> eventHandler)
public void unregisterEventHandler(ILayerEventHandler<?> eventHandler)
public void fireLayerEvent(ILayerEvent event)
ILayerListener
registered on this
layer. A cloned copy is passed to each listener.
fireLayerEvent
in interface ILayer
event
- the event to firepublic ILayerPainter getLayerPainter()
getLayerPainter
in interface ILayer
ILayerPainter
. Defaults to
GridLineCellLayerPainter
public void setLayerPainter(ILayerPainter layerPainter)
public IClientAreaProvider getClientAreaProvider()
getClientAreaProvider
in interface ILayer
public void setClientAreaProvider(IClientAreaProvider clientAreaProvider)
setClientAreaProvider
in interface ILayer
public String toString()
toString
in class Object
public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
getCellByPosition
in interface ILayer
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition)
ILayer
getBoundsByPosition
in interface ILayer
columnPosition
- the column position of the cellrowPosition
- the row position of the cell
null
if there are no valid boundspublic String getDisplayModeByPosition(int columnPosition, int rowPosition)
getDisplayModeByPosition
in interface ILayer
columnPosition
- the column position of the cellrowPosition
- the row position of the cell
DisplayMode
for the cell at the given position. The
DisplayMode
affects the settings out of the
ConfigRegistry
. Display mode is NORMAL by default.
Example: SelectionLayer
overrides this to return
the SELECT label for cells which are selected.
public ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry)
getCellPainter
in interface ILayer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |