Class CContentArea

All Implemented Interfaces:
CStationContainer, ImageObserver, MenuContainer, Serializable, Accessible

public class CContentArea extends JPanel implements CStationContainer
A component that is normally set into the center of the main- JFrame. This component can display and manage some CDockables.
This component contains in the center a SplitDockStation allowing to show several CDockables at the same time. At each border a FlapDockStation allows to show "minimized" CDockables.
Note: clients should not create CContentAreas directly, they should use CControl.getContentArea() to get the default content area, or CControl.createContentArea(String) to create a new content area.
Author:
Benjamin Sigg
See Also:
  • Field Details

  • Constructor Details

    • CContentArea

      public CContentArea(CControl control, String uniqueId)
      Creates a new content area.
      Parameters:
      control - the control for which this area will be used
      uniqueId - a unique identifier of this center
  • Method Details

    • addStations

      protected void addStations(CStation<?>... stations)
      Adds additional stations to the array of CStation. This method should only be called by subclasses.
      Parameters:
      stations - the additional stations to store
    • getUniqueId

      public String getUniqueId()
      Gets the unique id of this center.
      Specified by:
      getUniqueId in interface CStationContainer
      Returns:
      the unique id
    • getComponent

      public Component getComponent()
      Description copied from interface: CStationContainer
      Gets a Component whose children are all the CStations of this CStationContainer.
      Specified by:
      getComponent in interface CStationContainer
      Returns:
      the parent of all CStations, not null
    • addStationContainerListener

      public void addStationContainerListener(CStationContainerListener listener)
      Description copied from interface: CStationContainer
      Adds the observer listener to this container. The listener is to be informed whenever a CStation is added or removed from this container.
      Specified by:
      addStationContainerListener in interface CStationContainer
      Parameters:
      listener - the new listener, not null
    • removeStationContainerListener

      public void removeStationContainerListener(CStationContainerListener listener)
      Description copied from interface: CStationContainer
      Removes the observer listener from this container.
      Specified by:
      removeStationContainerListener in interface CStationContainer
      Parameters:
      listener - the listener to remove
    • getControl

      public CControl getControl()
      Gets the CControl for which this content area was created.
      Returns:
      the owner of this area
    • getStations

      public CStation<?>[] getStations()
      Gets an independent array of all stations that are used on this CContentArea.
      Returns:
      the list of stations
    • getStationCount

      public int getStationCount()
      Description copied from interface: CStationContainer
      Gets the number of CStations that are currently in this container.
      Specified by:
      getStationCount in interface CStationContainer
      Returns:
      the number of stations, at least 0
    • getStation

      public CStation<?> getStation(int index)
      Description copied from interface: CStationContainer
      Gets the index'th child of this container.
      Specified by:
      getStation in interface CStationContainer
      Parameters:
      index - the index of the child, between 0 and CStationContainer.getStationCount()
      Returns:
      the child, not null
    • indexOf

      public int indexOf(CStation<?> child)
      Gets the index of child.
      Parameters:
      child - a child CStation of this area.
      Returns:
      the index of child or -1 if not found
    • getDefaultStation

      public CStation<?> getDefaultStation()
      Description copied from interface: CStationContainer
      Gets the preferred default CStation of this container. Children with no location are usually made visible on such a default station.
      Specified by:
      getDefaultStation in interface CStationContainer
      Returns:
      the default station or null
    • getDefaultStation

      public CStation<?> getDefaultStation(ExtendedMode mode)
      Description copied from interface: CStationContainer
      Gets the preferred default CStation of this container for children in mode mode.
      Specified by:
      getDefaultStation in interface CStationContainer
      Parameters:
      mode - the mode for which a station is searched
      Returns:
      a child of this CStationContainer that can show Dockables in mode mode, can be null
    • deploy

      public void deploy(CGrid grid)
      Exchanges all the CDockables on the center panel by the elements of grid.
      Parameters:
      grid - a grid containing some new Dockables
    • setCornerComponent

      public void setCornerComponent(Component component, CContentArea.Corner corner, boolean horizontal)
      Puts component in one corner of this area.
      Parameters:
      component - the component, can be null
      corner - the corner into which to put component
      horizontal - whether component should be horizontally or vertically.
    • getCornerComponent

      public Component getCornerComponent(CContentArea.Corner corner, boolean horizontal)
      Gets the component of a corner.
      Parameters:
      corner - the corner in which to search
      horizontal - whether the component is horizontally or vertically
      Returns:
      the component or null
    • setMinimumAreaSize

      public void setMinimumAreaSize(Dimension size)
      Sets the minimum size of the four areas in which minimized Dockables are shown. Clients could also call get'Side'().setMinimumSize( size ).
      There is no method getMinimumAreaSize because the result might not be the same for all stations.
      Parameters:
      size - the new minimum size or null to revert to the default value.
      See Also:
    • getCenter

      public SplitDockStation getCenter()
      Gets the station in the center of this CContentArea.
      Returns:
      the central station
    • getCenterArea

      public CGridArea getCenterArea()
      Gets the station in the center of this CContentArea.
      Returns:
      the central station
    • getNorth

      public FlapDockStation getNorth()
      Gets the station in the north of this CContentArea
      Returns:
      the station in the north
    • getNorthArea

      public CMinimizeArea getNorthArea()
      Gets the station in the north of this CContentArea
      Returns:
      the station in the north
    • getSouth

      public FlapDockStation getSouth()
      Gets the station in the south of this CContentArea
      Returns:
      the station in the south
    • getSouthArea

      public CMinimizeArea getSouthArea()
      Gets the station in the south of this CContentArea
      Returns:
      the station in the south
    • getEast

      public FlapDockStation getEast()
      Gets the station in the east of this CContentArea
      Returns:
      the station in the east
    • getEastArea

      public CMinimizeArea getEastArea()
      Gets the station in the east of this CContentArea
      Returns:
      the station in the east
    • getWest

      public FlapDockStation getWest()
      Gets the station in the west of this CContentArea
      Returns:
      the station in the west
    • getWestArea

      public CMinimizeArea getWestArea()
      Gets the station in the west of this CContentArea
      Returns:
      the station in the west
    • getCenterIdentifier

      public String getCenterIdentifier()
      Gets the global identifier for the panel in the center.
      Returns:
      the identifier
    • getCenterIdentifier

      public static String getCenterIdentifier(String uniqueCenterId)
      Creates the global identifier of a panel in the center.
      Parameters:
      uniqueCenterId - the unique if of the owning CContentArea.
      Returns:
      the global identifier
    • getNorthIdentifier

      public String getNorthIdentifier()
      Gets the global identifier for the panel in the north.
      Returns:
      the identifier
    • getNorthIdentifier

      public static String getNorthIdentifier(String uniqueCenterId)
      Creates the global identifier of a panel in the north.
      Parameters:
      uniqueCenterId - the unique id of the owning CContentArea.
      Returns:
      the global identifier
    • getSouthIdentifier

      public String getSouthIdentifier()
      Gets the global identifier for the panel in the south.
      Returns:
      the identifier
    • getSouthIdentifier

      public static String getSouthIdentifier(String uniqueCenterId)
      Creates the global identifier of a panel in the south.
      Parameters:
      uniqueCenterId - the unique id of the owning CContentArea.
      Returns:
      the global identifier
    • getEastIdentifier

      public String getEastIdentifier()
      Gets the global identifier for the panel in the east.
      Returns:
      the identifier
    • getEastIdentifier

      public static String getEastIdentifier(String uniqueCenterId)
      Creates the global identifier of a panel in the east.
      Parameters:
      uniqueCenterId - the unique id of the owning CContentArea.
      Returns:
      the global identifier
    • getWestIdentifier

      public String getWestIdentifier()
      Gets the global identifier for the panel in the west.
      Returns:
      the identifier
    • getWestIdentifier

      public static String getWestIdentifier(String uniqueCenterId)
      Creates the global identifier of a panel in the west.
      Parameters:
      uniqueCenterId - the unique id of the owning CContentArea.
      Returns:
      the global identifier
    • getMatchingStation

      public CStation<?> getMatchingStation(CStationContainer container, CStation<?> station)
      Description copied from interface: CStationContainer
      Assuming container is a type of CStationContainer that is known to this, and assuming station is a child of container: this method returns one of this children that has the same relative location in respect to this as station has to container. For example if station is the center area of a CGridArea, and this is a CGridArea as well, then this method would return the center area of this.
      Specified by:
      getMatchingStation in interface CStationContainer
      Parameters:
      container - some kind of CStationContainer, may be a type that is known to this or not.
      station - some child of container
      Returns:
      a child of this, such that the location of the child in relation to this is equivalent to the location of station in relation to container. A value of null indicates that this method did not find a suitable child. If possible the result of this method and station should be of the same type.