|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.common.action.CAction bibliothek.gui.dock.common.intern.action.CDecorateableAction<CPanelPopup.PanelPopup> bibliothek.gui.dock.common.action.CPanelPopup
public class CPanelPopup
This action shows some kind of popup (for example a JDialog
) filled
with any content the client likes. This action is intended to be shown
as button in a title, but can also be used as menu item in a menu.
Clients may override the various onXYZ
-methods and create
and show their custom popup. In such a case they should call openPopup(PanelPopupWindow)
to ensure that only one window is open at a time.
As long as the user works on the popup-window it does not close automatically,
clients can call closePopup()
to explicitly close it. The
window closes automatically if it loses the focus, clients can call
setCloseOnFocusLost(boolean)
to change that behavior.
Note: this action does not support being child of a drop down menu
Nested Class Summary | |
---|---|
static class |
CPanelPopup.ButtonBehavior
When the popup should show up if the action is displayed as button. |
static class |
CPanelPopup.MenuBehavior
Tells how a CPanelPopup behaves if it is a child
of a menu. |
class |
CPanelPopup.PanelPopup
A custom action shows some dialog or window when triggered |
Field Summary | |
---|---|
static ActionType<CPanelPopup.PanelPopup> |
PANEL_POPUP
the kind of action this class represents |
Constructor Summary | |
---|---|
CPanelPopup()
Creates a new action. |
Method Summary | |
---|---|
void |
closePopup()
Makes the current popup invisible. |
protected DialogWindow |
createDialogWindow(Component owner)
Creates a new window which will be used as popup for this CPanelPopup . |
protected MenuWindow |
createMenuWindow(JPopupMenu menu)
Creates a new window which will be used as popup for this CPanelPopup . |
protected void |
executeOneDockableHasFocus(Dockable dockable,
Runnable run)
Calls run once the owning Dockable of this action has the focus |
CPanelPopup.ButtonBehavior |
getButtonBehavior()
Tells how this action behaves if displayed as button. |
JComponent |
getContent()
Gets the contents of this action. |
CPanelPopup.MenuBehavior |
getMenuBehavior()
Tells how this action behaves if in a menu. |
boolean |
isCloseOnFocusLost()
Tells whether the window is automatically closed if the focus is lost. |
boolean |
isOpen()
Tells whether the content of this action is currently being showed. |
protected void |
onMenuItemTrigger(Dockable dockable)
Called if the menu-item representing this action has been hit. |
protected void |
onMenuTrigger(JPopupMenu menu)
Called if a menu is opening a submenu in which the content
is to be shown. |
protected void |
onMousePressed(Dockable dockable,
JComponent item,
DockTitle.Orientation orientation)
Called if the mouse is pressed on the button item of
of a DockTitle which has orientation orientation . |
protected void |
onMouseReleased(Dockable dockable,
JComponent item,
DockTitle.Orientation orientation)
Called if the mouse is released of the button item of
of a DockTitle which has orientation orientation . |
protected void |
onTrigger(Dockable dockable,
JComponent item,
DockTitle.Orientation orientation)
Called if the button item of a DockTitle which has
orientation orientation was triggered. |
protected void |
openDialog(Dockable dockable,
JComponent item,
DockTitle.Orientation orientation)
Opens a new undecorated dialog below or aside of item . |
void |
openPopup(PanelPopupWindow window)
Informs this CPanelPopup that its content is shown and
allows this to handle the closing event. |
void |
setButtonBehavior(CPanelPopup.ButtonBehavior button)
Tells this action how to handle buttons. |
void |
setCloseOnFocusLost(boolean closeOnFocusLost)
Whether the window should be closed if focus is lost. |
void |
setContent(JComponent content)
Sets the component that is shown on a popup dialog/menu/window... |
void |
setMenuBehavior(CPanelPopup.MenuBehavior menu)
Tells this action how to behave if it is in a menu. |
Methods inherited from class bibliothek.gui.dock.common.intern.action.CDecorateableAction |
---|
addDecorateableActionListener, getAccelerator, getDisabledHoverIcon, getDisabledIcon, getDisabledPressedIcon, getHoverIcon, getIcon, getPressedIcon, getText, getTooltip, init, intern, isEnabled, isShowTextOnButtons, removeDecorateableActionListener, setAccelerator, setDisabledHoverIcon, setDisabledIcon, setDisabledPressedIcon, setEnabled, setHoverIcon, setIcon, setPressedIcon, setShowTextOnButtons, setText, setTooltip |
Methods inherited from class bibliothek.gui.dock.common.action.CAction |
---|
init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ActionType<CPanelPopup.PanelPopup> PANEL_POPUP
Constructor Detail |
---|
public CPanelPopup()
Method Detail |
---|
public void setContent(JComponent content)
CPanelPopup
.
content
- the content, may be null
public JComponent getContent()
public void setMenuBehavior(CPanelPopup.MenuBehavior menu)
menu
- the behavior, not null
public CPanelPopup.MenuBehavior getMenuBehavior()
null
public void setButtonBehavior(CPanelPopup.ButtonBehavior button)
button
- when to open a popuppublic CPanelPopup.ButtonBehavior getButtonBehavior()
null
public void setCloseOnFocusLost(boolean closeOnFocusLost)
closeOnFocusLost
- true
if it should close automaticallypublic boolean isCloseOnFocusLost()
public void openPopup(PanelPopupWindow window)
CPanelPopup
that its content is shown and
allows this to handle the closing event.
window
- the window
IllegalArgumentException
- if PanelPopupWindow.isOpen()
return false
public void closePopup()
public boolean isOpen()
true
if the content is visibleprotected void onMousePressed(Dockable dockable, JComponent item, DockTitle.Orientation orientation)
item
of
of a DockTitle
which has orientation orientation
.
dockable
- the element for which this panel is shownitem
- the pressed componentorientation
- the orientation of the titleprotected void onMouseReleased(Dockable dockable, JComponent item, DockTitle.Orientation orientation)
item
of
of a DockTitle
which has orientation orientation
.
dockable
- the element for which this panel is shownitem
- the released componentorientation
- the orientation of the titleprotected void onTrigger(Dockable dockable, JComponent item, DockTitle.Orientation orientation)
item
of a DockTitle
which has
orientation orientation
was triggered.
dockable
- the element for which this panel is shownitem
- the triggered buttonorientation
- the orientation of the titleprotected void openDialog(Dockable dockable, JComponent item, DockTitle.Orientation orientation)
item
. This method
does nothing if isOpen()
return true
.
dockable
- the element for which this panel is shownitem
- the owner of the new dialogorientation
- the orientation of the title which shows item
protected void onMenuItemTrigger(Dockable dockable)
dockable
- the source of the eventprotected DialogWindow createDialogWindow(Component owner)
CPanelPopup
.
owner
- the owner of the window
null
protected void onMenuTrigger(JPopupMenu menu)
the content
is to be shown.
menu
- the new parent of the contentprotected MenuWindow createMenuWindow(JPopupMenu menu)
CPanelPopup
.
menu
- the owner of the window
null
protected void executeOneDockableHasFocus(Dockable dockable, Runnable run)
run
once the owning Dockable
of this action has the focus
dockable
- the element for which this panel is shownrun
- some piece of code to run, usually it will open the popup-dialog created by createDialogWindow(Component)
.
Should be called by the EDT
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |