public class DockUI extends Object
Modifier and Type | Field and Description |
---|---|
static String |
OVERFLOW_MENU_ICON
Key for an
Icon stored in the IconManager for the action-overflow-menu. |
Modifier | Constructor and Description |
---|---|
protected |
DockUI()
Creates a new DockUI
|
Modifier and Type | Method and Description |
---|---|
void |
addLookAndFeelColorsListener(LookAndFeelColorsListener listener)
Adds a listener which gets informed when a color of the current
LookAndFeelColors changes. |
static Color |
getColor(String key)
|
LookAndFeelColors |
getColors()
Gets the current source of colors that depend on the
LookAndFeel . |
static DockUI |
getDefaultDockUI()
Gets the default instance of DockUI.
|
ThemeFactory |
getDefaultTheme()
Gets the default-theme to be used by all
DockController s when
nothing else is specified. |
static JDesktopPane |
getDesktopPane(Component component)
|
ThemeFactory[] |
getThemes()
Gets the list of all available themes.
|
static boolean |
isOverlapping(Component above,
Component under)
Tells whether
above overlaps under . |
boolean |
isSecureEnvironment()
Tells whether this application runs in a restricted environment or not.
|
void |
registerColors(String lookAndFeelClassNameRegex,
LookAndFeelColors colors)
Registeres a new
LookAndFeelColors . |
<T extends DockTheme> |
registerTheme(Class<T> theme)
Registers a factory for
theme . |
void |
registerTheme(ThemeFactory factory)
Stores a new theme.
|
void |
removeLookAndFeelColorsListener(LookAndFeelColorsListener listener)
Removes a listener from this
DockUI . |
protected LookAndFeelColors |
selectBestMatchingColors()
Gets the
LookAndFeelColors which matches the current
LookAndFeel best. |
void |
setSecureEnvironment(boolean secureEnvironment)
Overrides the result of
isSecureEnvironment() , any future call of that method will
return secureEnvironment . |
void |
unregisterTheme(ThemeFactory factory)
Removes an earlier added factory from the set of theme-factories.
|
protected void |
updateLookAndFeelColors()
Updates the currently used
LookAndFeelColors to the best
matching colors. |
static <D extends DockStation,L> |
updateTheme(D station,
DockFactory<D,?,L> factory)
Removes all children of
station and then adds
the children again. |
protected void |
updateUI()
Called when the
LookAndFeel changed. |
public static final String OVERFLOW_MENU_ICON
Icon
stored in the IconManager
for the action-overflow-menu. This menu is shown if there
are too many DockAction
s to show.public static DockUI getDefaultDockUI()
protected void updateUI()
LookAndFeel
changed.public ThemeFactory getDefaultTheme()
DockController
s when
nothing else is specified.public ThemeFactory[] getThemes()
public <T extends DockTheme> void registerTheme(Class<T> theme)
theme
.T
- the type of the DockTheme
.theme
- A class which must have the annotation
ThemeProperties
public void registerTheme(ThemeFactory factory)
factory
- the new themepublic void unregisterTheme(ThemeFactory factory)
factory
- the factory to removepublic void registerColors(String lookAndFeelClassNameRegex, LookAndFeelColors colors)
LookAndFeelColors
. The lookAndFeelClassNameRegex
is a regular expression. If a LookAndFeel
is active whose class name
matches
lookAndFeelClassNameRegex
,
then colors
becomes the selected source for colors. If more
then one regex matches, the last one that was added to this DockUI
is taken. So generally one would first add the most general regexes, and
the more detailed ones later.lookAndFeelClassNameRegex
- a description of a class namecolors
- the new set of colorspublic void addLookAndFeelColorsListener(LookAndFeelColorsListener listener)
LookAndFeelColors
changes. This listener gets not informed
about any changes when the LookAndFeel
itself gets replaced.
This listener will automatically be transfered when another
LookAndFeelColors
gets selected.listener
- the new listener, not null
public void removeLookAndFeelColorsListener(LookAndFeelColorsListener listener)
DockUI
.listener
- the listener to removeprotected void updateLookAndFeelColors()
LookAndFeelColors
to the best
matching colors.protected LookAndFeelColors selectBestMatchingColors()
LookAndFeelColors
which matches the current
LookAndFeel
best.public LookAndFeelColors getColors()
LookAndFeel
.public static Color getColor(String key)
key
- the name of the colornull
public static <D extends DockStation,L> void updateTheme(D station, DockFactory<D,?,L> factory) throws IOException
station
and then adds
the children again. Reading the children ensures that all components are
build up again with the current theme of the stationD
- the type of the stationL
- the type of the layout needed to describe the contents
of the stationstation
- the station to updatefactory
- a factory used to remove and to add the elementsIOException
- if the factory throws an exceptionpublic static JDesktopPane getDesktopPane(Component component)
component
- the component whose parent is searchedJDesktopPane
or null
if not foundpublic static boolean isOverlapping(Component above, Component under)
above
overlaps under
. This method
assumes that both components have a mutual parent. The method checks the location
and the z-order of both components.above
- the component that is supposed to be above under
under
- the component that is supposed to be under above
true
is above
is overlapping under
public boolean isSecureEnvironment()
public void setSecureEnvironment(boolean secureEnvironment)
isSecureEnvironment()
, any future call of that method will
return secureEnvironment
.secureEnvironment
- Whether global AWTEventListener
s are allowed or not, a value of true
indicates that listeners are not allowed