|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.themes.basic.action.BasicButtonModel
public class BasicButtonModel
A class containing all properties and methods needed to handle a button-component
that shows the contents of a DockAction
.
A model is normally instantiated by a JComponent
which uses this
as argument for the constructor of the model. The component can use a subclass
of the model to override changed()
, which is invoked every time when
a property of this model changes. The model will add some listeners to
the button and update its properties when necessary.
Constructor Summary | |
---|---|
BasicButtonModel(javax.swing.JComponent owner,
BasicTrigger trigger,
BasicResourceInitializer initializer)
Creates a new model. |
|
BasicButtonModel(javax.swing.JComponent owner,
BasicTrigger trigger,
BasicResourceInitializer initializer,
boolean createListener)
Creates a new model. |
Method Summary | |
---|---|
void |
addListener(BasicButtonModelListener listener)
Adds a listener to this model. |
void |
changed()
Called whenever a property of the model has been changed. |
BackgroundPaint |
getBackground()
Gets the algorithm which should be used to paint the background of components. |
BackgroundComponent |
getBackgroundComponent()
Gets the source of getBackground() . |
BorderModifier |
getBorder(java.lang.String key)
Gets the border which is used for the state key . |
java.awt.Dimension |
getMaxIconSize()
Gets the maximum size the icons need. |
DockTitle.Orientation |
getOrientation()
Gets the orientation of the DockTitle on which the view of
this model is displayed. |
javax.swing.JComponent |
getOwner()
Gets the view which paints the properties of this model. |
javax.swing.Icon |
getPaintIcon()
Gets the icon which should be painted on the view. |
javax.swing.Icon |
getPaintIcon(boolean enabled)
Gets the icon which should be painted on the view. |
boolean |
isEnabled()
Tells whether this model reacts on mouse-clicks or not. |
boolean |
isMouseInside()
Tells whether the mouse currently is inside the owner
or not. |
boolean |
isMousePressed()
Tells whether the left mouse button is currently pressed or not. |
boolean |
isSelected()
Tells whether this model is selected or not. |
protected java.util.List<Triple<javax.swing.KeyStroke,java.lang.String,javax.swing.Action>> |
listActions()
Gets a list of KeyStroke s, String keys and Action s which
are to be applied to the owner of this model. |
protected BasicButtonModelListener[] |
listeners()
Gets all the listeners that are known to this model. |
void |
removeListener(BasicButtonModelListener listener)
Removes a listener from this model. |
void |
setBackground(BackgroundPaint background,
BackgroundComponent backgroundComponent)
Sets the algorithm which should be used to paint the background of the owner. |
void |
setBorder(java.lang.String key,
BorderModifier border)
Sets the border for some state of the component that displays this model. |
void |
setDisabledIcon(javax.swing.Icon icon)
Sets the icon which is shown on the view if this model is not enabled . |
void |
setDockableRepresentative(Dockable dockable)
Sets the Dockable for which a DockElementRepresentative has to be installed. |
void |
setEnabled(boolean enabled)
Sets the enabled property of this model. |
void |
setIcon(javax.swing.Icon icon)
Sets the icon which is normally shown on the view. |
protected void |
setMouseInside(boolean mouseInside)
Changes the mouseInside property. |
protected void |
setMousePressed(boolean mousePressed)
Changes the mousePressed property. |
void |
setOrientation(DockTitle.Orientation orientation)
Tells this model which orientation the DockTitle has, on which
the view of this model is displayed. |
void |
setSelected(boolean selected)
Sets the selected property. |
void |
setSelectedDisabledIcon(javax.swing.Icon icon)
Sets the icon which is shown on the view if this model is not enabled , but selected . |
void |
setSelectedIcon(javax.swing.Icon icon)
Sets the icon which is shown on the view if this model is selected . |
void |
setToolTipText(java.lang.String tooltip)
Sets the text which should be used as tooltip. |
protected void |
trigger()
Called when the left mouse button has been pressed and released within the owner and when this model is enabled . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicButtonModel(javax.swing.JComponent owner, BasicTrigger trigger, BasicResourceInitializer initializer)
owner
- the view of this modeltrigger
- the callback used when the user clicks on the viewinitializer
- a strategy to lazily initialize resources, can be null
public BasicButtonModel(javax.swing.JComponent owner, BasicTrigger trigger, BasicResourceInitializer initializer, boolean createListener)
owner
- the view of this modeltrigger
- the callback used when the user clicks on the viewinitializer
- a strategy to lazily initialize resources, can be null
createListener
- whether to create and add a MouseListener
and
a MouseMotionListener
to owner
. If this argument
is false
, then the client is responsible to update all
properties of this model.Method Detail |
---|
protected java.util.List<Triple<javax.swing.KeyStroke,java.lang.String,javax.swing.Action>> listActions()
KeyStroke
s, String keys and Action
s which
are to be applied to the owner
of this model.
public void addListener(BasicButtonModelListener listener)
listener
- the new listenerpublic void removeListener(BasicButtonModelListener listener)
listener
- the listener to removeprotected BasicButtonModelListener[] listeners()
public javax.swing.JComponent getOwner()
public void setBackground(BackgroundPaint background, BackgroundComponent backgroundComponent)
background
- the background algorithm, can be null
backgroundComponent
- the source of background
. Must not be null
if
background
is not null
, must represents getOwner()
as Component
.public BackgroundPaint getBackground()
null
public BackgroundComponent getBackgroundComponent()
getBackground()
.
null
if getBackground()
returns null
public void setBorder(java.lang.String key, BorderModifier border)
key
are actually used depends on that component.
key
- the key of the borderborder
- the new border or null
public BorderModifier getBorder(java.lang.String key)
key
. The exact value of
key depends on the component which shows this model.
key
- the key for some border
null
if not foundpublic void setIcon(javax.swing.Icon icon)
icon
- the new icon, can be null
public void setSelectedIcon(javax.swing.Icon icon)
selected
.
icon
- the icon, can be null
public void setDisabledIcon(javax.swing.Icon icon)
enabled
.
icon
- the icon, can be null
public void setSelectedDisabledIcon(javax.swing.Icon icon)
enabled
, but selected
.
icon
- the icon, can be null
public void setSelected(boolean selected)
selected
property. The view may be painted in
a different way dependent on this value.
selected
- the new valuepublic boolean isSelected()
public void setEnabled(boolean enabled)
enabled
property of this model. A model will not
react on a mouse-click if it is not enabled.
enabled
- the valuepublic boolean isEnabled()
public void setToolTipText(java.lang.String tooltip)
owner
of this model using
setToolTipText
.
tooltip
- the text, can be null
public void setOrientation(DockTitle.Orientation orientation)
DockTitle
has, on which
the view of this model is displayed.
orientation
- the orientation, not null
public void setDockableRepresentative(Dockable dockable)
Dockable
for which a DockElementRepresentative
has to be installed.
dockable
- the dockable to monitor, can be null
public DockTitle.Orientation getOrientation()
DockTitle
on which the view of
this model is displayed.
setOrientation(DockTitle.Orientation)
public void changed()
repaint
of the owner
. Clients are encouraged to override
this method.
public java.awt.Dimension getMaxIconSize()
public javax.swing.Icon getPaintIcon()
null
public javax.swing.Icon getPaintIcon(boolean enabled)
enabled
- whether the enabled or the disabled version of the
icon is requested.
null
protected void setMouseInside(boolean mouseInside)
mouseInside
property. The property tells whether
the mouse is currently inside the border of the owner
or not. Clients should not call this method unless they handle all
mouse events.
mouseInside
- whether the mouse is insidepublic boolean isMouseInside()
owner
or not.
true
if the mouse is insideprotected void setMousePressed(boolean mousePressed)
mousePressed
property. The property tells
whether the left mouse button is currently pressed or not. Clients
should not invoke this method unless they handle all mouse events.
mousePressed
- whether button 1 is pressedpublic boolean isMousePressed()
true
if the button is pressedprotected void trigger()
owner
and when this model is enabled
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |