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 enumprivate classMouseInputHandler is responsible for handling resize/moving of the Window.protected classA custom layout manager that is responsible for the layout of layeredPane, glassPane, menuBar and titlePane, if one has been installed.private classMouse handler on the title pane. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intRegion from edges that dragging is active from.private static final intThe amount of space (in pixels) that the cursor is changed on.private GraphicsConfigurationThe 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 booleanprivate CursorCursorused to track the cursor set by the user.private LayoutManagerTheLayoutManagerthat is set on theJRootPane.private WindowThe current window.private HierarchyListenerHierarchy listener to keep track of the associated top-level window.private MouseInputListenerMouseInputListenerthat is added to the parentWindowtheJRootPaneis contained in.private PropertyChangeListenerprivate MouseInputListenerMouse listener on the title pane (dragging).private ComponentListenerComponent listener to keep track of the primary graphics configuration (for recomputing the maximized bounds) - fix for defect 213.private WindowListenerWindow listener that stops all Radiance threads when the last frame is disposed.private JRootPaneJRootPaneproviding the look and feel for.private static intOptimization to speed up theRadianceCoreUtilities.getSkin(Component)implementation.private LayoutManagerLayoutManagerof theJRootPanebefore we replaced it.private Set<RadianceThemingWidget<JComponent>> private RadianceTitlePaneJComponentproviding window decorations.private WindowWindow theJRootPaneis in. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LayoutManagerReturns aLayoutManagerthat will be set on theJRootPane.protected RadianceTitlePanecreateTitlePane(JRootPane root) Returns theJComponentto render the window decoration style.static ComponentUIcreateUI(JComponent comp) Creates a UI for aJRootPane.private MouseInputListenerReturns aMouseListenerthat will be added to theWindowcontaining theJRootPane.voidprotected JRootPaneReturns theJRootPanewe're providing the look and feel for.Returns theJComponentrendering the title pane.static booleanvoidinstallBorder(JRootPane root) Installs the appropriateBorderonto theJRootPane.private voidInstalls the necessary state onto the JRootPane to render client decorations.protected voidinstallComponents(JRootPane root) protected voidprivate voidinstallLayout(JRootPane root) Installs the appropriate LayoutManager on theJRootPaneto render the window decorations.protected voidinstallListeners(JRootPane root) voidInvokes supers implementation ofinstallUIto install the necessary state onto the passed inJRootPaneto render the metal look and feel implementation ofRootPaneUI.private voidinstallWindowListeners(JRootPane root, Component parent) Installs the necessary Listeners on the parentWindow, if there is one.private booleanprivate voidvoidvoidsetPreferredTitlePaneHeight(int preferredTitlePaneHeight) private voidsetTitlePane(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 voiduninstallBorder(JRootPane root) Removes any border that may have been installed.private voidUninstalls any state thatinstallClientDecorationshas installed.protected voiduninstallComponents(JRootPane root) protected voiduninstallDefaults(JRootPane root) private voiduninstallLayout(JRootPane root) Uninstalls the previously installedLayoutManager.protected voiduninstallListeners(JRootPane root) voidInvokes super implementation to uninstall any of its state.private voidUninstalls the necessary Listeners on theWindowthe Listeners were last installed on.voidupdate(Graphics g, JComponent c) Methods inherited from class BasicRootPaneUI
installKeyboardActions, uninstallKeyboardActionsMethods inherited from class 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 theJRootPaneis in. -
titlePane
JComponentproviding window decorations. This will be null if not providing window decorations. -
isContentExtendingIntoTitlePane
private boolean isContentExtendingIntoTitlePane -
radianceMouseInputListener
MouseInputListenerthat is added to the parentWindowtheJRootPaneis contained in. -
radianceTitleMouseInputListener
Mouse listener on the title pane (dragging). -
layoutManager
TheLayoutManagerthat is set on theJRootPane. -
savedOldLayout
LayoutManagerof theJRootPanebefore we replaced it. -
root
JRootPaneproviding 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
Cursorused 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 ofinstallUIto install the necessary state onto the passed inJRootPaneto render the metal look and feel implementation ofRootPaneUI. If thewindowDecorationStyleproperty of theJRootPaneis other thanJRootPane.NONE, this will add a customComponentto render the widgets toJRootPane, as well as installing a customBorderandLayoutManageron theJRootPane.- Overrides:
installUIin classBasicRootPaneUI- Parameters:
c- the JRootPane to install state onto
-
uninstallUI
Invokes super implementation to uninstall any of its state. This will also reset theLayoutManagerof theJRootPane. If aComponenthas been added to theJRootPaneto render the window decoration style, this method will remove it. Similarly, this will revert the Border and LayoutManager of theJRootPaneto what it was beforeinstallUIwas invoked.- Overrides:
uninstallUIin classBasicRootPaneUI- Parameters:
c- the JRootPane to uninstall state from
-
installBorder
Installs the appropriateBorderonto theJRootPane.- Parameters:
root- Root pane.
-
uninstallBorder
Removes any border that may have been installed.- Parameters:
root- Root pane.
-
installDefaults
- Overrides:
installDefaultsin classBasicRootPaneUI
-
uninstallDefaults
- Overrides:
uninstallDefaultsin classBasicRootPaneUI
-
update
- Overrides:
updatein 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 theWindowthe Listeners were last installed on. -
installLayout
Installs the appropriate LayoutManager on theJRootPaneto render the window decorations.- Parameters:
root- Root pane.
-
installListeners
- Overrides:
installListenersin classBasicRootPaneUI
-
uninstallListeners
- Overrides:
uninstallListenersin classBasicRootPaneUI
-
installComponents
- Overrides:
installComponentsin classBasicRootPaneUI
-
uninstallComponents
- Overrides:
uninstallComponentsin 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 theJRootPanehas a decoration style other thanJRootPane.NONE.- Parameters:
root- Root pane.
-
uninstallClientDecorations
Uninstalls any state thatinstallClientDecorationshas installed.NOTE: This may be called if you haven't installed client decorations yet (ie before
installClientDecorationshas been invoked).- Parameters:
root- Root pane.
-
createTitlePane
Returns theJComponentto render the window decoration style.- Parameters:
root- Root pane.- Returns:
- The title pane component.
-
createWindowMouseInputListener
Returns aMouseListenerthat will be added to theWindowcontaining theJRootPane.- Returns:
- Window mouse listener.
-
createLayoutManager
Returns aLayoutManagerthat 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- TheJComponentto use for the window title pane.
-
getTitlePane
Returns theJComponentrendering 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 theJRootPanewe're providing the look and feel for.- Returns:
- The associated root pane.
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classBasicRootPaneUI
-
propagateModificationState
private void propagateModificationState() -
hasCustomSkinOnAtLeastOneRootPane
public static boolean hasCustomSkinOnAtLeastOneRootPane() -
isMouseEventInExtendedTitlePane
-