public abstract class BasicDropDownButtonModel extends BasicButtonModel
BasicButtonModel
that can handle the properties needed
to represent a DropDownAction
.Constructor and Description |
---|
BasicDropDownButtonModel(javax.swing.JComponent owner,
BasicDropDownButtonTrigger trigger,
BasicResourceInitializer initializer)
Creates a new model.
|
BasicDropDownButtonModel(javax.swing.JComponent owner,
BasicDropDownButtonTrigger trigger,
BasicResourceInitializer initializer,
boolean createListener)
Creates a new model.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.Icon |
getPaintIcon()
Gets the icon which should be painted on the view.
|
protected abstract boolean |
inDropDownArea(int x,
int y)
Tells whether the location x/y is over the dropdown area of the view or not.
|
boolean |
isMouseOverDropDown()
Tells whether the mouse is currently over the dropdown area of
the view or not.
|
boolean |
isSelectionEnabled()
Tells whether the selected child-action of the represented
DropDownAction is currently enabled 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 void |
popupTriggered()
Triggers the drop down menu to open.
|
protected void |
setMouseInside(boolean mouseInside)
Changes the
mouseInside property. |
protected void |
setMouseOverDropDown(boolean overDropDown)
Sets whether the mouse is currently over the dropdown area of the
view or not.
|
void |
setSelectionEnabled(boolean selectionEnabled)
Sets whether the selected child-action of the represented
DropDownAction
is currently enabled or not. |
addListener, changed, clearIcons, getAction, getBackground, getBackgroundComponent, getBorder, getDockable, getIconContexts, getMaxIconSize, getOrientation, getOwner, getPaintIcon, getText, isEnabled, isMouseInside, isMousePressed, isSelected, listeners, removeListener, setBackground, setBorder, setController, setDockableRepresentative, setEnabled, setIcon, setMousePressed, setOrientation, setSelected, setText, setToolTipText, trigger
public BasicDropDownButtonModel(javax.swing.JComponent owner, BasicDropDownButtonTrigger trigger, BasicResourceInitializer initializer)
owner
- the view of this modelinitializer
- a strategy to lazily initialize resourcestrigger
- the callback used when the user clicks on the viewpublic BasicDropDownButtonModel(javax.swing.JComponent owner, BasicDropDownButtonTrigger 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 resourcescreateListener
- whether the model should add a MouseListener
and
a MouseMotionListener
to the view or not.protected java.util.List<Triple<javax.swing.KeyStroke,java.lang.String,javax.swing.Action>> listActions()
BasicButtonModel
KeyStroke
s, String keys and Action
s which
are to be applied to the owner
of this model.listActions
in class BasicButtonModel
protected void setMouseInside(boolean mouseInside)
BasicButtonModel
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.setMouseInside
in class BasicButtonModel
mouseInside
- whether the mouse is insideprotected void setMouseOverDropDown(boolean overDropDown)
overDropDown
- whether the mouse is over the dropdown areapublic boolean isMouseOverDropDown()
public void setSelectionEnabled(boolean selectionEnabled)
DropDownAction
is currently enabled or not.selectionEnabled
- whether the action is enabledpublic boolean isSelectionEnabled()
DropDownAction
is currently enabled or not.public javax.swing.Icon getPaintIcon()
BasicButtonModel
getPaintIcon
in class BasicButtonModel
null
protected abstract boolean inDropDownArea(int x, int y)
owner's
coordinate-system.x
- the x-coordinatey
- the y-coordinatetrue
if a click with the mouse should open the
selection-menu of the DropDownAction
protected void popupTriggered()