|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel bibliothek.gui.dock.util.BackgroundPanel bibliothek.gui.dock.util.ConfiguredBackgroundPanel bibliothek.gui.dock.themes.basic.BasicDockableDisplayer
public class BasicDockableDisplayer
A panel which shows one Dockable
and one DockTitle
. The location
of the DockTitle
is always at one of the four borders (left,
right, top, bottom). The title may be null
, in this case only
the Dockable
is shown.
Clients using a displayer should try to set the controller
and the station
property.
Subclasses may override getComponent(Dockable)
and/or getComponent(DockTitle)
if they want to introduce a completely new layout needing more Containers
.
DisplayerCollection
,
DisplayerFactory
,
Serialized FormNested Class Summary | |
---|---|
protected class |
BasicDockableDisplayer.DisplayerBorder
The border of this displayer. |
protected class |
BasicDockableDisplayer.Hints
This implementation of DockableDisplayerHints forwards
any changes to its BasicDockableDisplayer . |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Nested classes/interfaces inherited from interface bibliothek.gui.dock.station.DockableDisplayer |
---|
DockableDisplayer.Location |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
|
BasicDockableDisplayer(DockStation station)
Creates a new displayer |
protected |
BasicDockableDisplayer(DockStation station,
boolean initialize)
Creates a new displayer but does not set the properties of the displayer. |
|
BasicDockableDisplayer(DockStation station,
Dockable dockable,
DockTitle title)
Creates a new displayer, sets the title and the content. |
|
BasicDockableDisplayer(DockStation station,
Dockable dockable,
DockTitle title,
DockableDisplayer.Location location)
Creates a new displayer, sets the title, its location and the content. |
Method Summary | |
---|---|
void |
addDockableDisplayerListener(DockableDisplayerListener listener)
Adds listener to this displayer. |
protected DisplayerContentPane |
createContentPane()
Creates a new DisplayerContentPane which will be used to show the contents of this
displayer. |
protected BasicDockableDisplayerDecorator |
createMinimalDecorator()
Creates a new MinimalDecorator that will be shown on this displayer. |
protected DockComponentRootHandler |
createRootHandler()
Creates the DockComponentRootHandler for this displayer. |
protected BasicDockableDisplayerDecorator |
createStackedDecorator()
Creates a new decorator that will be shown in this displayer if the displayer is shown alongside a tab (@see setStacked(boolean) ). |
protected BasicDockableDisplayerDecorator |
createStackedDecorator(PropertyKey<DockActionDistributor> distributor)
Creates a new MinimalDecorator that uses a restricted set of DockAction s. |
protected BasicDockableDisplayerDecorator |
createTabDecorator()
Creates a new TabDecorator that will be shown on this displayer. |
protected void |
fireMoveableElementChanged()
Calls DockableDisplayerListener.moveableElementChanged(DockableDisplayer) on any
listener that is registered. |
Component |
getComponent()
Gets the Component which is to be painted. |
protected Component |
getComponent(Dockable dockable)
Gets the Component which should be used to layout the current Dockable. |
protected Component |
getComponent(DockTitle title)
Gets the Component which should be used to layout the current DockTitle. |
DockComponentConfiguration |
getComponentConfiguration()
Gets the currently applied configuration. |
DockController |
getController()
Gets the controller for which this displayer is used. |
protected Border |
getDefaultBorder()
Gets the default border for this displayer. |
boolean |
getDefaultBorderHint()
Gets the default value for the show border hint. |
Dockable |
getDockable()
Gets the Dockable which is shown on this displayer. |
Insets |
getDockableInsets()
Gets an estimate of the insets around the Dockable of this
displayer compared to the whole size of this displayer. |
protected BasicDockableDisplayer.Hints |
getHints()
Gets the set of hints for displaying this component. |
DockElementRepresentative |
getMoveableElement()
Gets a representation of the Dockable that can
be used for grabbing and moving around the displayer. |
DockStation |
getStation()
Gets the station on which this displayer might be shown. |
DockTitle |
getTitle()
Gets the title which is shown on this displayer. |
Point |
getTitleCenter()
Gets the center point of the title or any Component that
behaves as if it would be the title. |
DockableDisplayer.Location |
getTitleLocation()
Gets the location of the title in respect to the Dockable. |
protected void |
init(DockStation station,
Dockable dockable,
DockTitle title,
DockableDisplayer.Location location)
Initialises all properties of this DockableDisplayer. |
boolean |
isRespectBorderHint()
Whether the show border hint is respected by this displayer. |
boolean |
isSingleTabShowing()
Tells whether this displayer currently is showing a single tab. |
boolean |
isSingleTabShowInnerBorder()
Tells whether an inner border is shown if a single tab is in use. |
boolean |
isSingleTabShowOuterBorder()
Tells whether an outer border is shown if a single tab is in use. |
boolean |
isStacked()
Tells this displayer that it is used inside a tabbed environment. |
boolean |
isTabInside()
Tells whether the tab is shown below the title, if there is a tab and a title. |
protected DockableDisplayerListener[] |
listeners()
Gets a list of all listeners currently registered at this displayer. |
protected DockTitle.Orientation |
orientation(DockableDisplayer.Location location)
Determines the orientation of a DockTitle according to its
location on this displayer. |
DisplayerCombinerTarget |
prepareCombination(CombinerSource source,
Enforcement force)
This method tells how this displayer would like to combine itself with a Dockable that is dropped
over it. |
void |
removeDockableDisplayerListener(DockableDisplayerListener listener)
Removes listener from this displayer. |
protected void |
resetDecorator()
Resets the decorator, this method removes all Component s from this displayer, then adds them again
in the order that is necessary according to the current settings |
void |
setBaseBorder(Border border)
Sets the border that wraps around the entire displayer. |
void |
setComponentConfiguration(DockComponentConfiguration configuration)
Sets a configuration which is to be applied to all Component s (and maybe their children) of this DockComponentRoot . |
void |
setContentBorder(Border border)
Sets the border that wraps around the content component. |
void |
setController(DockController controller)
Sets the controller for which this displayer is used. |
protected void |
setDecorator(BasicDockableDisplayerDecorator decorator)
Exchanges the decorator of this displayer. |
void |
setDefaultBorderHint(boolean defaultBorderHint)
Sets the default value for the show border hint. |
void |
setDockable(Dockable dockable)
Sets the Dockable which should be shown on this displayer. |
void |
setRespectBorderHint(boolean respectBorderHint)
Tells this displayer whether the show border hint of getHints() should be respected or not. |
void |
setSingleTabShowInnerBorder(boolean singleTabShowInnerBorder)
Sets whether an inner border should be shown if a single tab is in use. |
void |
setSingleTabShowOuterBorder(boolean singleTabShowOuterBorder)
Sets whether an outer border should be shown if a single tab is in use. |
void |
setStacked(boolean stacked)
Tells this displayer that it is used inside a tabbed environment. |
void |
setStation(DockStation station)
Sets the station on which this displayer is shown. |
void |
setTabInside(boolean tabInside)
Sets the location of the tab (if present) in respect to the title (if present). |
void |
setTitle(DockTitle title)
Sets the title of this displayer. |
void |
setTitleLocation(DockableDisplayer.Location location)
Sets the location of the title in respect to the Dockable. |
boolean |
titleContains(int x,
int y)
Tells whether the point x/y is inside the title of this
displayer or not. |
protected void |
updateBorder()
Called when the hint, whether a border should be shown or not, has changed. |
protected void |
updateDecorator()
Replaces the current decorator if necessary. |
protected void |
updateDecorator(boolean force)
Replaces the current decorator if necessary. |
void |
updateUI()
|
Methods inherited from class bibliothek.gui.dock.util.ConfiguredBackgroundPanel |
---|
configure, setupRenderingHints |
Methods inherited from class bibliothek.gui.dock.util.BackgroundPanel |
---|
getBackgroundAlgorithm, getTransparency, paint, paintBackground, paintBorder, paintChildren, paintComponent, paintForeground, paintOverlay, setBackground, setTransparency |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicDockableDisplayer(DockStation station)
station
- the station for which this displayer is neededpublic BasicDockableDisplayer(DockStation station, Dockable dockable, DockTitle title)
station
- the station for which this displayer is neededdockable
- the content, may be null
title
- the title, may be null
public BasicDockableDisplayer(DockStation station, Dockable dockable, DockTitle title, DockableDisplayer.Location location)
station
- the station for which this displayer is neededdockable
- the content, may be null
title
- the title of dockable
, can be null
location
- the location of the title, can be null
protected BasicDockableDisplayer(DockStation station, boolean initialize)
init
to initialize all variables of the new displayer.
station
- the station for which this displayer is neededinitialize
- true
if all properties should be set
to default, false
if nothing should happen, and
init
will be called.Method Detail |
---|
protected void init(DockStation station, Dockable dockable, DockTitle title, DockableDisplayer.Location location)
DockableDisplayer( false )
.
station
- the station for which this displayer is neededdockable
- the content, may be null
title
- the title of dockable
, can be null
location
- the location of the title, can be null
protected DockComponentRootHandler createRootHandler()
DockComponentRootHandler
for this displayer. The root handler is required to inform the client
about all the Component
s that are related to this displayer.
protected DisplayerContentPane createContentPane()
DisplayerContentPane
which will be used to show the contents of this
displayer.
null
protected void setDecorator(BasicDockableDisplayerDecorator decorator)
decorator
- the new decoratorprotected void updateDecorator()
decorator
if necessary.
protected void updateDecorator(boolean force)
decorator
if necessary.
force
- whether to force an updatepublic boolean isSingleTabShowing()
public void setStacked(boolean stacked)
createStackedDecorator()
instead of createMinimalDecorator()
.
stacked
- whether this displayer is part of a stack of displayersspublic boolean isStacked()
createStackedDecorator()
instead of createMinimalDecorator()
.
protected BasicDockableDisplayerDecorator createMinimalDecorator()
MinimalDecorator
that will be shown on this displayer.
protected BasicDockableDisplayerDecorator createStackedDecorator()
setStacked(boolean)
). The default implementation
return createMinimalDecorator()
. Subclasses may call createStackedDecorator(PropertyKey)
to easily create a fitting decorator.
createStackedDecorator(PropertyKey)
protected BasicDockableDisplayerDecorator createStackedDecorator(PropertyKey<DockActionDistributor> distributor)
MinimalDecorator
that uses a restricted set of DockAction
s.
distributor
- the key to the filter for the actions
protected BasicDockableDisplayerDecorator createTabDecorator()
TabDecorator
that will be shown on this displayer.
public void setController(DockController controller)
DockableDisplayer
setController
in interface DockableDisplayer
controller
- the controller, can be null
public DockController getController()
DockableDisplayer
getController
in interface DockableDisplayer
null
public void setComponentConfiguration(DockComponentConfiguration configuration)
DockComponentRoot
Component
s (and maybe their children) of this DockComponentRoot
.
setComponentConfiguration
in interface DockComponentRoot
configuration
- the new configuration or null
.public DockComponentConfiguration getComponentConfiguration()
DockComponentRoot
getComponentConfiguration
in interface DockComponentRoot
null
public void addDockableDisplayerListener(DockableDisplayerListener listener)
DockableDisplayer
listener
to this displayer.
addDockableDisplayerListener
in interface DockableDisplayer
listener
- the new listener, not null
public void removeDockableDisplayerListener(DockableDisplayerListener listener)
DockableDisplayer
listener
from this displayer.
removeDockableDisplayerListener
in interface DockableDisplayer
listener
- the listener to removeprotected DockableDisplayerListener[] listeners()
protected void fireMoveableElementChanged()
DockableDisplayerListener.moveableElementChanged(DockableDisplayer)
on any
listener that is registered.
public void setStation(DockStation station)
DockableDisplayer
setStation
in interface DockableDisplayer
station
- the station or null
public DockStation getStation()
DockableDisplayer
getStation
in interface DockableDisplayer
null
public Dockable getDockable()
DockableDisplayer
getDockable
in interface DockableDisplayer
null
public void setDockable(Dockable dockable)
DockableDisplayer
null
means that no Dockable should be visible at all.
setDockable
in interface DockableDisplayer
dockable
- the child, can be null
protected void resetDecorator()
Component
s from this displayer, then adds them again
in the order that is necessary according to the current settings
public DockableDisplayer.Location getTitleLocation()
DockableDisplayer
getTitleLocation
in interface DockableDisplayer
public void setTitleLocation(DockableDisplayer.Location location)
DockableDisplayer
setTitleLocation
in interface DockableDisplayer
location
- the location, a value of null
is transformed
into the default-valueprotected DockTitle.Orientation orientation(DockableDisplayer.Location location)
DockTitle
according to its
location on this displayer.
location
- the location on this displayer
public DockTitle getTitle()
DockableDisplayer
getTitle
in interface DockableDisplayer
null
public void setTitle(DockTitle title)
DockableDisplayer
null
,
no title is visible. The displayer will change the
orientation
of the title.
setTitle
in interface DockableDisplayer
title
- the title or null
public DockElementRepresentative getMoveableElement()
DockableDisplayer
representation
of the Dockable
that can
be used for grabbing and moving around the displayer. The result of this method should be
the first match of this list:
DockTitle
DockElementRepresentative
Dockable
itselfnull
DockableDisplayerListener
s.
getMoveableElement
in interface DockableDisplayer
null
public Point getTitleCenter()
DockableDisplayer
title
or any Component
that
behaves as if it would be the title. Some DockStation
s may use this information
to make sure, that the user can always grab and move around the Dockable
.
getTitleCenter
in interface DockableDisplayer
null
protected Component getComponent(Dockable dockable)
dockable
- the current Dockable, never null
dockable
protected Component getComponent(DockTitle title)
title
- the current DockTitle, never null
title
public boolean titleContains(int x, int y)
DockableDisplayer
x/y
is inside the title of this
displayer or not.
titleContains
in interface DockableDisplayer
x
- the x-coordinate, relatively to this componenty
- the y-coordinate, relatively to this component
true
if the title contains the pointpublic Component getComponent()
PaintableComponent
Component
which is to be painted.
getComponent
in interface DockableDisplayer
getComponent
in interface PaintableComponent
getComponent
in class BackgroundPanel
public Insets getDockableInsets()
DockableDisplayer
Dockable
of this
displayer compared to the whole size of this displayer.
getDockableInsets
in interface DockableDisplayer
protected BasicDockableDisplayer.Hints getHints()
public void setRespectBorderHint(boolean respectBorderHint)
getHints()
should be respected or not. The default value
is false
.
respectBorderHint
- true
if the hint should be respected,
false
if not.public boolean isRespectBorderHint()
true
if the hint is respectedsetRespectBorderHint(boolean)
public void setDefaultBorderHint(boolean defaultBorderHint)
defaultBorderHint
- the default valuepublic boolean getDefaultBorderHint()
public void setSingleTabShowInnerBorder(boolean singleTabShowInnerBorder)
singleTabShowInnerBorder
- whether the inner border should be visiblepublic boolean isSingleTabShowInnerBorder()
public void setSingleTabShowOuterBorder(boolean singleTabShowOuterBorder)
singleTabShowOuterBorder
- whether the outer border should be visiblepublic boolean isSingleTabShowOuterBorder()
public boolean isTabInside()
false
public void setTabInside(boolean tabInside)
tabInside
- true
if the tab is to be shown nearer to the center than the titlepublic void updateUI()
updateUI
in class JPanel
protected void updateBorder()
public void setBaseBorder(Border border)
border
- the new border, can be null
public void setContentBorder(Border border)
border
- the new border, can be null
public DisplayerCombinerTarget prepareCombination(CombinerSource source, Enforcement force)
DockableDisplayer
Dockable
that is dropped
over it. This method is usually called by a Combiner
or by a DockStation
, but other modules
may call this method as well.
prepareCombination
in interface DockableDisplayer
source
- information about the dockable that is dropped, the location of the mouse, etc...force
- tells how much the caller would like the result not to be null
, if the
force
property is high, then the result should more likely not be null
.
Note that a result of null
is always a valid result, even if the caller does not like it.
null
if this displayer does not
have any specific informationprotected Border getDefaultBorder()
null
.
The standard implementation just returns a new instance of of
BevelBorder
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |