Class DefaultCDockable

java.lang.Object
bibliothek.gui.dock.common.intern.AbstractCDockable
bibliothek.gui.dock.common.intern.DefaultCDockable
All Implemented Interfaces:
CDockable
Direct Known Subclasses:
DefaultMultipleCDockable, DefaultSingleCDockable

@FrameworkOnly public class DefaultCDockable extends AbstractCDockable
An CDockable that uses a DefaultCommonDockable to show its content.
Subclasses may override createCommonDockable() to provide a custom subclass of DefaultCommonDockable, note that createCommonDockable() is called as soon as the internal representation is required, e.g. for setting a property like the title or the icon.
Author:
Benjamin Sigg
  • Constructor Details

    • DefaultCDockable

      public DefaultCDockable()
      Creates a new dockable
    • DefaultCDockable

      public DefaultCDockable(DefaultCDockable.Permissions permission)
      Creates a new dockable.
      Parameters:
      permission - the permissions of this dockable
  • Method Details

    • createCommonDockable

      protected DefaultCommonDockable createCommonDockable()
      Description copied from class: AbstractCDockable
      Creates the CommonDockable that is associated with this dockable, called the first time the CommonDockable is required for an operation.
      Specified by:
      createCommonDockable in class AbstractCDockable
      Returns:
      the new dockable
    • getContentPane

      public Container getContentPane()
      Gets the container on which the client can pack its components.
      Returns:
      the panel showing the content
    • setLayout

      public void setLayout(LayoutManager layout)
      Sets the LayoutManager of the content pane.
      Parameters:
      layout - the new layout manager
    • add

      public void add(Component component)
      Adds component to the content pane.
      Parameters:
      component - the new component
    • add

      public void add(Component component, Object constraints)
      Adds component to the content pane.
      Parameters:
      component - the new component
      constraints - constraints for the layout manager
    • remove

      public void remove(Component component)
      Removes component from the content pane.
      Parameters:
      component - the component to remove
    • setTitleText

      public void setTitleText(String text)
      Sets the text that is shown as title.
      Parameters:
      text - the title
    • getTitleText

      public String getTitleText()
      Gets the text that is shown as title.
      Returns:
      the title
    • setTitleToolTip

      public void setTitleToolTip(String text)
      Sets the tooltip that should be shown on the title of this dockable.
      Parameters:
      text - the new tooltip, can be null
    • getTitleToolTip

      public String getTitleToolTip()
      Gets the tooltip that is shown on the title of this dockable.
      Returns:
      the tooltip or null
    • setTitleIconHandling

      public void setTitleIconHandling(IconHandling handling)
      Sets the behavior of setTitleIcon(Icon) in case of a null argument. Either the icon is replaced by the default icon, or just not shown.
      Parameters:
      handling - the new behavior, not null
    • getTitleIconHandling

      public IconHandling getTitleIconHandling()
      Gets the behavior of setTitleIcon(Icon).
      Returns:
      the behavior, not null
    • setTitleIcon

      public void setTitleIcon(Icon icon)
      Sets the icon that is shown in the title of this CDockable. The exact behavior of this method depends on the IconHandling that was set by setTitleIconHandling(IconHandling).
      Parameters:
      icon - the title-icon
    • getTitleIcon

      public Icon getTitleIcon()
      Gets the icon that is shown in the title.
      Returns:
      the title-icon, might be null
    • isMinimizable

      public boolean isMinimizable()
      Description copied from interface: CDockable
      Tells whether this CDockable can be minimized by the user.
      Returns:
      true if this element can be minimized
    • setMinimizable

      public void setMinimizable(boolean minimizable)
      Sets whether the user can minimize this dockable.
      Parameters:
      minimizable - true if the user can minimize this element
    • isMaximizable

      public boolean isMaximizable()
      Description copied from interface: CDockable
      Tells whether this CDockable can be maximized by the user.
      Returns:
      true if this element can be maximized
    • setMaximizable

      public void setMaximizable(boolean maximizable)
      Sets whether the user can maximize this dockable.
      Parameters:
      maximizable - true if the user can maximize this element
    • isExternalizable

      public boolean isExternalizable()
      Description copied from interface: CDockable
      Tells whether this CDockable can be externalized by the user.
      Returns:
      true if this element can be externalized
    • setExternalizable

      public void setExternalizable(boolean externalizable)
      Sets whether the user can externalize this dockable.
      Parameters:
      externalizable - true if the user can externalize this element
    • isCloseable

      public boolean isCloseable()
      Description copied from interface: CDockable
      Tells whether this CDockable can be closed by the user. A close-button has to be provided by the CDockable itself. The best way to do that is to instantiate a CloseActionSource and include this source in the array that is returned by CommonDockable.getSources().
      Returns:
      true if this element can be closed
    • setStackable

      public void setStackable(boolean stackable)
      Sets whether this element can be combined with other dockable to create a stack. Note that this property is ignored if this element is already in a stack.
      Parameters:
      stackable - true if this element can be combined.
    • isStackable

      public boolean isStackable()
      Description copied from interface: CDockable
      Tells whether this CDockable can be combined with another Dockable to create a stack.
      Returns:
      true if this element can be combined with another Dockable, normally true should be the answer.
    • setCloseable

      public void setCloseable(boolean closeable)
      Sets whether the user can close this dockable.
      Parameters:
      closeable - true if the user can close this element
    • addAction

      public void addAction(CAction action)
      Adds an action to this dockable. The action will be shown in the popup-menu which belongs to this dockable, and also as button in some titles of this dockable.
      Parameters:
      action - the new action
    • insertAction

      public void insertAction(int index, CAction action)
      Adds a new action to this dockable.
      Parameters:
      index - the location of the action
      action - the action
      See Also:
    • addSeparator

      public void addSeparator()
      Adds a separator to the list of CActions of this dockable.
    • insertSeparator

      public void insertSeparator(int index)
      Adds a separator to the list of CActions of this dockable.
      Parameters:
      index - the location of the action
    • removeAction

      public void removeAction(int index)
      Removes an action from this dockable
      Parameters:
      index - the location of the action
    • removeAction

      public void removeAction(CAction action)
      Removes an action from this dockable.
      Parameters:
      action - the action to remove
    • getActionCount

      public int getActionCount()
      Gets the number of CActions that were added to this dockable.
      Returns:
      the number of actions
    • getAction

      public CAction getAction(int index)
      Gets the index'th action of this dockable. Be aware that the result might be CSeparator.SEPARATOR.
      Parameters:
      index - the location of an action
      Returns:
      the action
    • intern

      public DefaultCommonDockable intern()
      Description copied from class: AbstractCDockable
      Gets the intern representation of this dockable.
      Specified by:
      intern in interface CDockable
      Overrides:
      intern in class AbstractCDockable
      Returns:
      the intern representation.
    • asStation

      public CStation<?> asStation()
      Description copied from interface: CDockable
      Gets this or an object representing this as CStation.
      Returns:
      this as station or null