Class RadianceRootPaneUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.RootPaneUI
javax.swing.plaf.basic.BasicRootPaneUI
org.pushingpixels.radiance.theming.internal.ui.RadianceRootPaneUI
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
- Direct Known Subclasses:
RadianceRibbonRootPaneUI
UI for root panes in Radiance look and feel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
private class
MouseInputHandler is responsible for handling resize/moving of the Window.protected class
A custom layout manager that is responsible for the layout of layeredPane, glassPane, menuBar and titlePane, if one has been installed.private class
Mouse handler on the title pane. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Region from edges that dragging is active from.private static final int
The amount of space (in pixels) that the cursor is changed on.private GraphicsConfiguration
The graphics configuration that contains the top-left corner of the window (fix for defect 213).private static final int[]
Maps from positions to cursor type.private boolean
private Cursor
Cursor
used to track the cursor set by the user.private LayoutManager
TheLayoutManager
that is set on theJRootPane
.private Window
The current window.private HierarchyListener
Hierarchy listener to keep track of the associated top-level window.private MouseInputListener
MouseInputListener
that is added to the parentWindow
theJRootPane
is contained in.private PropertyChangeListener
private MouseInputListener
Mouse listener on the title pane (dragging).private ComponentListener
Component listener to keep track of the primary graphics configuration (for recomputing the maximized bounds) - fix for defect 213.private WindowListener
Window listener that stops all Radiance threads when the last frame is disposed.private JRootPane
JRootPane
providing the look and feel for.private static int
Optimization to speed up theRadianceCoreUtilities.getSkin(Component)
implementation.private LayoutManager
LayoutManager
of theJRootPane
before we replaced it.private Set
<RadianceThemingWidget<JComponent>> private RadianceTitlePane
JComponent
providing window decorations.private Window
Window theJRootPane
is in. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LayoutManager
Returns aLayoutManager
that will be set on theJRootPane
.protected RadianceTitlePane
createTitlePane
(JRootPane root) Returns theJComponent
to render the window decoration style.static ComponentUI
createUI
(JComponent comp) Creates a UI for aJRootPane
.private MouseInputListener
Returns aMouseListener
that will be added to theWindow
containing theJRootPane
.void
protected JRootPane
Returns theJRootPane
we're providing the look and feel for.Returns theJComponent
rendering the title pane.static boolean
void
installBorder
(JRootPane root) Installs the appropriateBorder
onto theJRootPane
.private void
Installs the necessary state onto the JRootPane to render client decorations.protected void
installComponents
(JRootPane root) protected void
private void
installLayout
(JRootPane root) Installs the appropriate LayoutManager on theJRootPane
to render the window decorations.protected void
installListeners
(JRootPane root) void
Invokes supers implementation ofinstallUI
to install the necessary state onto the passed inJRootPane
to render the metal look and feel implementation ofRootPaneUI
.private void
installWindowListeners
(JRootPane root, Component parent) Installs the necessary Listeners on the parentWindow
, if there is one.private boolean
private void
void
void
setPreferredTitlePaneHeight
(int preferredTitlePaneHeight) private void
setTitlePane
(JRootPane root, RadianceTitlePane titlePane) Sets the window title pane -- the JComponent used to provide a plaf a way to override the native operating system's window title pane with one whose look and feel are controlled by the plaf.private void
uninstallBorder
(JRootPane root) Removes any border that may have been installed.private void
Uninstalls any state thatinstallClientDecorations
has installed.protected void
uninstallComponents
(JRootPane root) protected void
uninstallDefaults
(JRootPane root) private void
uninstallLayout
(JRootPane root) Uninstalls the previously installedLayoutManager
.protected void
uninstallListeners
(JRootPane root) void
Invokes super implementation to uninstall any of its state.private void
Uninstalls the necessary Listeners on theWindow
the Listeners were last installed on.void
update
(Graphics g, JComponent c) Methods inherited from class javax.swing.plaf.basic.BasicRootPaneUI
installKeyboardActions, uninstallKeyboardActions
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint
-
Field Details
-
CORNER_DRAG_WIDTH
private static final int CORNER_DRAG_WIDTHThe amount of space (in pixels) that the cursor is changed on.- See Also:
-
BORDER_DRAG_THICKNESS
private static final int BORDER_DRAG_THICKNESSRegion from edges that dragging is active from.- See Also:
-
window
Window theJRootPane
is in. -
titlePane
JComponent
providing window decorations. This will be null if not providing window decorations. -
isContentExtendingIntoTitlePane
private boolean isContentExtendingIntoTitlePane -
radianceMouseInputListener
MouseInputListener
that is added to the parentWindow
theJRootPane
is contained in. -
radianceTitleMouseInputListener
Mouse listener on the title pane (dragging). -
layoutManager
TheLayoutManager
that is set on theJRootPane
. -
savedOldLayout
LayoutManager
of theJRootPane
before we replaced it. -
root
JRootPane
providing the look and feel for. -
radianceWindowListener
Window listener that stops all Radiance threads when the last frame is disposed. -
radianceCurrentWindow
The current window. -
radianceHierarchyListener
Hierarchy listener to keep track of the associated top-level window. -
radianceWindowComponentListener
Component listener to keep track of the primary graphics configuration (for recomputing the maximized bounds) - fix for defect 213. -
currentRootPaneGC
The graphics configuration that contains the top-left corner of the window (fix for defect 213). -
radiancePropertyChangeListener
-
lastCursor
Cursor
used to track the cursor set by the user. This is initiallyCursor.DEFAULT_CURSOR
. -
rootPanesWithCustomSkin
private static int rootPanesWithCustomSkinOptimization to speed up theRadianceCoreUtilities.getSkin(Component)
implementation. -
themingWidgets
-
cursorMapping
private static final int[] cursorMappingMaps from positions to cursor type. Refer to calculateCorner and calculatePosition for details of this.
-
-
Constructor Details
-
RadianceRootPaneUI
protected RadianceRootPaneUI()
-
-
Method Details
-
createUI
Creates a UI for aJRootPane
.- Parameters:
comp
- the JRootPane the RootPaneUI will be created for- Returns:
- the RootPaneUI implementation for the passed in JRootPane
-
installUI
Invokes supers implementation ofinstallUI
to install the necessary state onto the passed inJRootPane
to render the metal look and feel implementation ofRootPaneUI
. If thewindowDecorationStyle
property of theJRootPane
is other thanJRootPane.NONE
, this will add a customComponent
to render the widgets toJRootPane
, as well as installing a customBorder
andLayoutManager
on theJRootPane
.- Overrides:
installUI
in classBasicRootPaneUI
- Parameters:
c
- the JRootPane to install state onto
-
uninstallUI
Invokes super implementation to uninstall any of its state. This will also reset theLayoutManager
of theJRootPane
. If aComponent
has been added to theJRootPane
to render the window decoration style, this method will remove it. Similarly, this will revert the Border and LayoutManager of theJRootPane
to what it was beforeinstallUI
was invoked.- Overrides:
uninstallUI
in classBasicRootPaneUI
- Parameters:
c
- the JRootPane to uninstall state from
-
installBorder
Installs the appropriateBorder
onto theJRootPane
.- Parameters:
root
- Root pane.
-
uninstallBorder
Removes any border that may have been installed.- Parameters:
root
- Root pane.
-
installDefaults
- Overrides:
installDefaults
in classBasicRootPaneUI
-
uninstallDefaults
- Overrides:
uninstallDefaults
in classBasicRootPaneUI
-
update
- Overrides:
update
in classComponentUI
-
installWindowListeners
Installs the necessary Listeners on the parentWindow
, if there is one.This takes the parent so that cleanup can be done from
removeNotify
, at which point the parent hasn't been reset yet.- Parameters:
root
- Root pane.parent
- The parent of the JRootPane
-
uninstallWindowListeners
private void uninstallWindowListeners()Uninstalls the necessary Listeners on theWindow
the Listeners were last installed on.- Parameters:
root
- Root pane.
-
installLayout
Installs the appropriate LayoutManager on theJRootPane
to render the window decorations.- Parameters:
root
- Root pane.
-
installListeners
- Overrides:
installListeners
in classBasicRootPaneUI
-
uninstallListeners
- Overrides:
uninstallListeners
in classBasicRootPaneUI
-
installComponents
- Overrides:
installComponents
in classBasicRootPaneUI
-
uninstallComponents
- Overrides:
uninstallComponents
in classBasicRootPaneUI
-
uninstallLayout
Uninstalls the previously installedLayoutManager
.- Parameters:
root
- Root pane.
-
installClientDecorations
Installs the necessary state onto the JRootPane to render client decorations. This is ONLY invoked if theJRootPane
has a decoration style other thanJRootPane.NONE
.- Parameters:
root
- Root pane.
-
uninstallClientDecorations
Uninstalls any state thatinstallClientDecorations
has installed.NOTE: This may be called if you haven't installed client decorations yet (ie before
installClientDecorations
has been invoked).- Parameters:
root
- Root pane.
-
createTitlePane
Returns theJComponent
to render the window decoration style.- Parameters:
root
- Root pane.- Returns:
- The title pane component.
-
createWindowMouseInputListener
Returns aMouseListener
that will be added to theWindow
containing theJRootPane
.- Returns:
- Window mouse listener.
-
createLayoutManager
Returns aLayoutManager
that will be set on theJRootPane
.- Returns:
- Layout manager.
-
setTitlePane
Sets the window title pane -- the JComponent used to provide a plaf a way to override the native operating system's window title pane with one whose look and feel are controlled by the plaf. The plaf creates and sets this value; the default is null, implying a native operating system window title pane.- Parameters:
root
- Root panetitlePane
- TheJComponent
to use for the window title pane.
-
getTitlePane
Returns theJComponent
rendering the title pane. If this returns null, it implies there is no need to render window decorations. This method is for internal use only.- Returns:
- Title pane.
- See Also:
-
createTitlePaneControlButton
-
getTitlePaneControlInsets
-
extendContentIntoTitlePane
public void extendContentIntoTitlePane() -
setPreferredTitlePaneHeight
public void setPreferredTitlePaneHeight(int preferredTitlePaneHeight) -
getRootPane
Returns theJRootPane
we're providing the look and feel for.- Returns:
- The associated root pane.
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classBasicRootPaneUI
-
propagateModificationState
private void propagateModificationState() -
hasCustomSkinOnAtLeastOneRootPane
public static boolean hasCustomSkinOnAtLeastOneRootPane() -
isMouseEventInExtendedTitlePane
-