Class LayeredPane

All Implemented Interfaces:
IFigure
Direct Known Subclasses:
FreeformLayeredPane, ScalableLayeredPane

public class LayeredPane extends Layer
A figure capable of holding any number of layers. Only layers can be added to this figure. Layers are added to this figure with thier respective keys, which are used to identify them.
  • Constructor Details

    • LayeredPane

      public LayeredPane()
      Constructs a new layered pane with no layers in it.
  • Method Details

    • add

      public void add(IFigure figure, Object layerKey, int index)
      Adds the given layer figure, identifiable with the given key, at the specified index. While adding the layer, it informs the surrounding layers of the addition.
      Specified by:
      add in interface IFigure
      Overrides:
      add in class Figure
      Parameters:
      figure - the layer
      layerKey - the layer's key
      index - the index where the layer should be added
      Since:
      2.0
      See Also:
    • addLayerAfter

      public void addLayerAfter(Layer layer, Object key, Object after)
      Adds the given layer, identifiable with the given key, under the after layer provided in the input.
      Parameters:
      layer - the layer
      key - the layer's key
      after - the layer under which the input layer should be added
      Since:
      2.0
    • addLayerBefore

      public void addLayerBefore(Layer layer, Object key, Object before)
      Adds the given layer, identifiable with the given key, above the before layer provided in the input.
      Parameters:
      layer - the layer
      key - the layer's key
      before - the layer above which the input layer should be added
      Since:
      2.0
    • getLayer

      public Layer getLayer(Object key)
      Returns the layer identified by the key given in the input.
      Parameters:
      key - the key to identify the desired layer
      Returns:
      the desired layer
      Since:
      2.0
    • getLayer

      protected Layer getLayer(int index)
      Returns the layer at the specified index in this pane.
      Parameters:
      index - the index of the desired layer
      Returns:
      the desired layer
      Since:
      2.0
    • remove

      public void remove(IFigure figure)
      Description copied from class: Figure
      Removes the given child Figure from this Figure's hierarchy and revalidates this Figure. The child Figure's Figure.removeNotify() method is also called.
      Specified by:
      remove in interface IFigure
      Overrides:
      remove in class Figure
      Parameters:
      figure - The Figure to remove
      See Also:
    • removeLayer

      public void removeLayer(Object key)
      Removes the layer identified by the given key from this layered pane.
      Parameters:
      key - the key of the layer to be removed
      Since:
      2.0
    • removeLayer

      @Deprecated public void removeLayer(IFigure layer)
      Deprecated.
      Removes the given layer from this layered pane.
      Parameters:
      layer - the layer to be removed
      Since:
      2.0
    • removeLayer

      protected void removeLayer(int index)
      Removes the layer at the specified index from the list of layers in this layered pane. It collapses the layers, occupying the space vacated by the removed layer.
      Parameters:
      index - the index of the layer to be removed
      Since:
      2.0