All Implemented Interfaces:
ILayer, ILayerListener, IPersistable
Direct Known Subclasses:
ColumnStructureUpdatesExampleGridLayer, DefaultGridLayer, FilterRowExampleGridLayer, GlazedListsGridLayer, GlazedListsGridLayer, SelectionExampleGridLayer, StaticFilterExampleGridLayer

public class GridLayer extends CompositeLayer
Top level layer. It is composed of the smaller child layers: RowHeader, ColumnHeader, Corner and Body It does not have its own coordinate system unlike the other layers. It simply delegates most functions to its child layers.
  • Constructor Details

    • GridLayer

      public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer)
    • GridLayer

      public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration)
    • GridLayer

      protected GridLayer(boolean useDefaultConfiguration)
  • Method Details

    • init

      protected void init(boolean useDefaultConfiguration)
    • registerCommandHandlers

      protected void registerCommandHandlers()
      Description copied from class: AbstractLayer
      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
      Overrides:
      registerCommandHandlers in class AbstractLayer
    • doCommandOnChildLayers

      protected boolean doCommandOnChildLayers(ILayerCommand command)
      How the GridLayer processes commands is very important. Do not change this unless you know what you are doing and understand the full ramifications of your change. Otherwise your grid will not behave correctly! The Body is always given the first chance to process a command. There are two reasons for this: (1) most commands (80%) are destined for the body anyways so it's faster to check there first (2) the other layers all transitively depend on the body so it's not wise to ask them to do stuff until after the body has done it. This is especially true of grid initialization where the body must be initialized before any of its dependent layers. Because of this, if you want to intercept well-known commands to implement custom behavior (for example, you want to intercept the SelectCellCommand) then you must inject your special layer into the body. An injected column or row header will never see the command because it will be consumed first by the body. In practice, it's a good idea to implement all your command-handling logic in the body.
      Overrides:
      doCommandOnChildLayers in class CompositeLayer
    • getCornerLayer

      public ILayer getCornerLayer()
    • setCornerLayer

      public void setCornerLayer(ILayer cornerLayer)
    • getColumnHeaderLayer

      public ILayer getColumnHeaderLayer()
    • setColumnHeaderLayer

      public void setColumnHeaderLayer(ILayer columnHeaderLayer)
    • getRowHeaderLayer

      public ILayer getRowHeaderLayer()
    • setRowHeaderLayer

      public void setRowHeaderLayer(ILayer rowHeaderLayer)
    • getBodyLayer

      public ILayer getBodyLayer()
    • setBodyLayer

      public void setBodyLayer(ILayer bodyLayer)
    • toString

      public String toString()
      Overrides:
      toString in class AbstractLayer
    • doCommand

      public boolean doCommand(ILayerCommand command)
      Description copied from class: CompositeLayer
      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) Handle commands

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