Class AbstractLayer

    • Constructor Detail

      • AbstractLayer

        public AbstractLayer()
    • Method Detail

      • dispose

        public void dispose()
        Description copied from interface: ILayer
        Dispose any resource allocated by this layer.
        Specified by:
        dispose in interface ILayer
      • getRegionLabelsByXY

        public LabelStack getRegionLabelsByXY​(int x,
                                              int y)
        Description copied from interface: ILayer
        Return the LabelStack containing the region labels for the cell at the given pixel position.
        Specified by:
        getRegionLabelsByXY in interface ILayer
        Parameters:
        x - the x pixel coordinate
        y - the y pixel coordinate
        Returns:
        LabelStack containing the region labels for the cell at the given pixel position.
      • getRegionName

        public String getRegionName()
      • setRegionName

        public void setRegionName​(String regionName)
      • getConfigLabelsByPosition

        public LabelStack getConfigLabelsByPosition​(int columnPosition,
                                                    int rowPosition)
        Description copied from interface: ILayer
        Returns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of the IConfigRegistry.
        Specified by:
        getConfigLabelsByPosition in interface ILayer
        Parameters:
        columnPosition - The column position of the cell.
        rowPosition - The row position of the cell.
        Returns:
        The LabelStack with the config labels for the cell at the given coordinates.
      • setConfigLabelAccumulator

        public void setConfigLabelAccumulator​(IConfigLabelAccumulator cellLabelAccumulator)
      • saveState

        public void saveState​(String prefix,
                              Properties properties)
        Description copied from interface: IPersistable
        Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
        Specified by:
        saveState in interface IPersistable
        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)
        Description copied from interface: IPersistable
        Restore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
        Specified by:
        loadState in interface IPersistable
        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.
      • registerPersistable

        public void registerPersistable​(IPersistable persistable)
        Description copied from interface: ILayer
        Register an IPersistable that can write its state to the state Properties instance when the layer is persisted.
        Specified by:
        registerPersistable in interface ILayer
        Parameters:
        persistable - The persistable that should be registered.
      • addConfiguration

        public void addConfiguration​(IConfiguration configuration)
      • clearConfiguration

        public void clearConfiguration()
      • doCommand

        public boolean doCommand​(ILayerCommand command)
        Description copied from interface: ILayer
        Opportunity 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)

        Specified by:
        doCommand in interface ILayer
        Parameters:
        command - The command to execute.
        Returns:
        true if the command has been handled and was therefore consumed, false otherwise.
      • registerCommandHandlers

        protected void registerCommandHandlers()
        Layers should use this method to register their command handlers and call it from their constructor. This allows easy overriding if required of command handlers
      • hasLayerListener

        public boolean hasLayerListener​(Class<? extends ILayerListener> layerListenerClass)
        Description copied from interface: ILayer
        Check if an ILayerListener of the given type is registered on this layer or not.
        Specified by:
        hasLayerListener in interface ILayer
        Parameters:
        layerListenerClass - The type of ILayerListener to check for.
        Returns:
        true if this ILayer has a ILayerListener of the specified type registered, false if there is no such listener registered.
      • handleLayerEvent

        public void handleLayerEvent​(ILayerEvent event)
        Handle layer event notification. Convert it to your context and propagate UP. If you override this method you MUST NOT FORGET to raise the event up the layer stack by calling super.fireLayerEvent(event) - unless you plan to eat the event yourself.
        Specified by:
        handleLayerEvent in interface ILayerListener
        Parameters:
        event - the event
      • registerEventHandler

        public void registerEventHandler​(ILayerEventHandler<?> eventHandler)
      • unregisterEventHandler

        public void unregisterEventHandler​(ILayerEventHandler<?> eventHandler)
      • fireLayerEvent

        public void fireLayerEvent​(ILayerEvent event)
        Pass the event to all the ILayerListener registered on this layer. A cloned copy is passed to each listener.
        Specified by:
        fireLayerEvent in interface ILayer
        Parameters:
        event - the event to fire
      • setLayerPainter

        public void setLayerPainter​(ILayerPainter layerPainter)
      • getCellByPosition

        public ILayerCell getCellByPosition​(int columnPosition,
                                            int rowPosition)
        Description copied from interface: ILayer
        Returns the cell for the given coordinates on this layer.
        Specified by:
        getCellByPosition in interface ILayer
        Parameters:
        columnPosition - The column position of the requested cell.
        rowPosition - The row position of the requested cell.
        Returns:
        The ILayerCell for the given coordinates in this layer or null if the coordinates are invalid on this layer.
      • getBoundsByPosition

        public org.eclipse.swt.graphics.Rectangle getBoundsByPosition​(int columnPosition,
                                                                      int rowPosition)
        Description copied from interface: ILayer
        Calculates the bounds in pixel for the given cell position.
        Specified by:
        getBoundsByPosition in interface ILayer
        Parameters:
        columnPosition - the column position of the cell
        rowPosition - the row position of the cell
        Returns:
        the bounds, or null if there are no valid bounds
      • getDisplayModeByPosition

        public DisplayMode getDisplayModeByPosition​(int columnPosition,
                                                    int rowPosition)
        Description copied from interface: ILayer
        Returns the active DisplayMode for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of the IConfigRegistry. The default value is DisplayMode.NORMAL. The SelectionLayer for example overrides this to return DisplayMode.SELECT for cells that are currently selected.
        Specified by:
        getDisplayModeByPosition in interface ILayer
        Parameters:
        columnPosition - The column position of the cell.
        rowPosition - The row position of the cell.
        Returns:
        DisplayMode for the cell at the given coordinates.
      • isDynamicSizeLayer

        public boolean isDynamicSizeLayer()
        Specified by:
        isDynamicSizeLayer in interface ILayer
        Returns:
        true if the layer has a dynamic size (e.g. viewport) or a fixed size.
        Since:
        1.4
      • getProvidedLabels

        public Collection<String> getProvidedLabels()
        Specified by:
        getProvidedLabels in interface ILayer
        Returns:
        The collection of labels that are provided by this layer.
        Since:
        1.4