bibliothek.gui.dock.station.flap.button
Class ButtonContent

java.lang.Object
  extended by bibliothek.gui.dock.station.flap.button.ButtonContent

public class ButtonContent
extends Object

Tells what kind of information should be displayed on the buttons of a FlapDockStation. What is actually displayed also depends on the DockTitle that is used, but all the default titles support all the settings this class offers.

Author:
Benjamin Sigg

Field Summary
static ButtonContentCondition FALSE
          A ButtonContentCondition that is always false
static ButtonContent ICON_ACTIONS
          Only the icon and the actions are painted.
static ButtonContent ICON_AND_TEXT_ACTIONS
          Icon, title text and actions are painted.
static ButtonContent ICON_AND_TEXT_ONLY
          Only the icon and the title text are painted.
static ButtonContent ICON_ONLY
          Only the icon is painted.
static ButtonContent ICON_THEN_TEXT_ACTIONS
          The icon, or if not present the title text, and the actions are painted.
static ButtonContent ICON_THEN_TEXT_ONLY
          The icon, or if not present the title text, is painted.
static ButtonContentCondition IF_DOCKABLE
          A ButtonContentCondition that returns true if the element is not a DockStation.
static ButtonContentCondition IF_STATION
          A ButtonContentCondition that returns true if the element is a DockStation.
static ButtonContentCondition NOT_IF_ICON
          A ButtonContentCondition that returns true if a Dockable does not have an icon.
static ButtonContentCondition NOT_IF_TEXT
          A ButtonContentCondition that returns true if a Dockable does not have a title text.
static ButtonContent TEXT_ACTIONS
          Only the title text and the actions are painted.
static ButtonContent TEXT_ONLY
          Only the title text is painted.
static ButtonContent TEXT_THEN_ICON_ACTIONS
          The title text, or if not present the icon, and the actions are painted.
static ButtonContent TEXT_THEN_ICON_ONLY
          The title text, or if not present the icon, is painted.
static ButtonContentCondition THEME
          A ButtonContentCondition that always returns the value a DockTheme would choose
static ButtonContent THEME_DEPENDENT
          the look and feel completely depends on the current DockTheme.
static ButtonContentCondition TRUE
          A ButtonContentCondition that is always true
 
Constructor Summary
ButtonContent(ButtonContentCondition knob, ButtonContentCondition icon, ButtonContentCondition text, ButtonContentCondition children, ButtonContentCondition actions, ButtonContentCondition filterActions)
          Creates a new set of properties.
 
Method Summary
 void addListener(Dockable dockable, ButtonContentListener listener)
          Informs this ButtonContent that any change regarding dockable should be reported to listener.
 boolean filterActions(Dockable dockable, boolean theme)
          Tells whether actions should filtered before showing on the button of a FlapDockStation.
 ButtonContentCondition getActions()
          Gets the condition that decides the property for showActions(Dockable, boolean)
 ButtonContentCondition getChildren()
          Gets the condition that decides the property for showChildren(Dockable, boolean)
 ButtonContentCondition getFilterActions()
          Gets the condition that decides the property for filterActions(Dockable, boolean)
 ButtonContentCondition getIcon()
          Gets the condition that decides the property for showIcon(Dockable, boolean)
 ButtonContentCondition getKnob()
          Gets the condition that decides the property for showKnob(Dockable, boolean)
 ButtonContentCondition getText()
          Gets the condition that decides the property for showText(Dockable, boolean)
 void handleChange(Dockable dockable)
           
protected  ButtonContentListener[] listeners(Dockable dockable)
          Gets all the listeners that are currently monitoring dockable.
 void removeListener(Dockable dockable, ButtonContentListener listener)
          Informs this ButtonContent that listener no longer has to be observed.
 boolean showActions(Dockable dockable, boolean theme)
          Tells whether actions should be shown on the button of a FlapDockStation or not.
 boolean showChildren(Dockable dockable, boolean theme)
          Tells whether actions to focus a child of a DockStation should be shown
 boolean showIcon(Dockable dockable, boolean theme)
          Tells whether an icon should be shown.
 boolean showKnob(Dockable dockable, boolean theme)
          Tells whether a knob should be shown
 boolean showText(Dockable dockable, boolean theme)
          Tells whether text should be shown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final ButtonContentCondition TRUE
A ButtonContentCondition that is always true


FALSE

public static final ButtonContentCondition FALSE
A ButtonContentCondition that is always false


THEME

public static final ButtonContentCondition THEME
A ButtonContentCondition that always returns the value a DockTheme would choose


NOT_IF_ICON

public static final ButtonContentCondition NOT_IF_ICON
A ButtonContentCondition that returns true if a Dockable does not have an icon.


NOT_IF_TEXT

public static final ButtonContentCondition NOT_IF_TEXT
A ButtonContentCondition that returns true if a Dockable does not have a title text.


IF_STATION

public static final ButtonContentCondition IF_STATION
A ButtonContentCondition that returns true if the element is a DockStation.


IF_DOCKABLE

public static final ButtonContentCondition IF_DOCKABLE
A ButtonContentCondition that returns true if the element is not a DockStation.


THEME_DEPENDENT

public static final ButtonContent THEME_DEPENDENT
the look and feel completely depends on the current DockTheme.


ICON_ONLY

public static final ButtonContent ICON_ONLY
Only the icon is painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


TEXT_ONLY

public static final ButtonContent TEXT_ONLY
Only the title text is painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


ICON_AND_TEXT_ONLY

public static final ButtonContent ICON_AND_TEXT_ONLY
Only the icon and the title text are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


ICON_THEN_TEXT_ONLY

public static final ButtonContent ICON_THEN_TEXT_ONLY
The icon, or if not present the title text, is painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


TEXT_THEN_ICON_ONLY

public static final ButtonContent TEXT_THEN_ICON_ONLY
The title text, or if not present the icon, is painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


ICON_ACTIONS

public static final ButtonContent ICON_ACTIONS
Only the icon and the actions are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


TEXT_ACTIONS

public static final ButtonContent TEXT_ACTIONS
Only the title text and the actions are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


ICON_AND_TEXT_ACTIONS

public static final ButtonContent ICON_AND_TEXT_ACTIONS
Icon, title text and actions are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


ICON_THEN_TEXT_ACTIONS

public static final ButtonContent ICON_THEN_TEXT_ACTIONS
The icon, or if not present the title text, and the actions are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.


TEXT_THEN_ICON_ACTIONS

public static final ButtonContent TEXT_THEN_ICON_ACTIONS
The title text, or if not present the icon, and the actions are painted. Please note that this constant only remains for backwards compatibility, creating a new ButtonContent would have the exact same effect.

Constructor Detail

ButtonContent

public ButtonContent(ButtonContentCondition knob,
                     ButtonContentCondition icon,
                     ButtonContentCondition text,
                     ButtonContentCondition children,
                     ButtonContentCondition actions,
                     ButtonContentCondition filterActions)
Creates a new set of properties. All arguments can have a value of null, in which case they default to THEME

Parameters:
knob - whether to paint a "knob" where the user can grab the title and move around. A knob really is only required if neither icon nor text is painted
icon - whether to paint the icon of a Dockable
text - whether to paint the title text of a Dockable
children - whether to add a button for each child of a DockStation. The button allows user to open the station and focus one of its children with on click. If the represented Dockable is not a station, then only one button is painted.
actions - whether to show the normal DockActions of a Dockable
filterActions - whether only important DockActions, as defined by ButtonContentFilter, should be shown
Method Detail

addListener

public void addListener(Dockable dockable,
                        ButtonContentListener listener)
Informs this ButtonContent that any change regarding dockable should be reported to listener.

Parameters:
dockable - the element to observe
listener - the listener that monitors dockable

removeListener

public void removeListener(Dockable dockable,
                           ButtonContentListener listener)
Informs this ButtonContent that listener no longer has to be observed.

Parameters:
dockable - the element that was observed
listener - the listener that is no longer required

listeners

protected ButtonContentListener[] listeners(Dockable dockable)
Gets all the listeners that are currently monitoring dockable.

Parameters:
dockable - the element which may be monitored
Returns:
all the listeners, may be an empty array but not null

handleChange

public void handleChange(Dockable dockable)

showKnob

public boolean showKnob(Dockable dockable,
                        boolean theme)
Tells whether a knob should be shown

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if the knob should be visible

getKnob

public ButtonContentCondition getKnob()
Gets the condition that decides the property for showKnob(Dockable, boolean)

Returns:
the condition, not null

showActions

public boolean showActions(Dockable dockable,
                           boolean theme)
Tells whether actions should be shown on the button of a FlapDockStation or not.

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if the actions should be shown

getActions

public ButtonContentCondition getActions()
Gets the condition that decides the property for showActions(Dockable, boolean)

Returns:
the condition, not null

filterActions

public boolean filterActions(Dockable dockable,
                             boolean theme)
Tells whether actions should filtered before showing on the button of a FlapDockStation. If showActions(Dockable, boolean) returns false for dockable, then this method is ignored.

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if the actions should be filtered by the current ButtonContentFilter

getFilterActions

public ButtonContentCondition getFilterActions()
Gets the condition that decides the property for filterActions(Dockable, boolean)

Returns:
the condition, not null

showIcon

public boolean showIcon(Dockable dockable,
                        boolean theme)
Tells whether an icon should be shown.

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if icons should be shown

getIcon

public ButtonContentCondition getIcon()
Gets the condition that decides the property for showIcon(Dockable, boolean)

Returns:
the condition, not null

showText

public boolean showText(Dockable dockable,
                        boolean theme)
Tells whether text should be shown.

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if text should be shown

getText

public ButtonContentCondition getText()
Gets the condition that decides the property for showText(Dockable, boolean)

Returns:
the condition, not null

showChildren

public boolean showChildren(Dockable dockable,
                            boolean theme)
Tells whether actions to focus a child of a DockStation should be shown

Parameters:
dockable - the element for which the property is requested
theme - what the theme would do
Returns:
true if the buttons should be shown

getChildren

public ButtonContentCondition getChildren()
Gets the condition that decides the property for showChildren(Dockable, boolean)

Returns:
the condition, not null