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:
java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
RadianceRibbonRootPaneUI
public class RadianceRootPaneUI extends javax.swing.plaf.basic.BasicRootPaneUIUI for root panes in Radiance look and feel.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRadianceRootPaneUI.CursorStateprivate classRadianceRootPaneUI.MouseInputHandlerMouseInputHandler is responsible for handling resize/moving of the Window.protected classRadianceRootPaneUI.RadianceRootLayoutA custom layout manager that is responsible for the layout of layeredPane, glassPane, menuBar and titlePane, if one has been installed.private classRadianceRootPaneUI.TitleMouseInputHandlerMouse handler on the title pane.
-
Field Summary
Fields Modifier and Type Field Description private static intBORDER_DRAG_THICKNESSRegion from edges that dragging is active from.private static intCORNER_DRAG_WIDTHThe amount of space (in pixels) that the cursor is changed on.private java.awt.GraphicsConfigurationcurrentRootPaneGCThe graphics configuration that contains the top-left corner of the window (fix for defect 213).private static int[]cursorMappingMaps from positions to cursor type.private booleanisContentExtendingIntoTitlePaneprivate java.awt.CursorlastCursorCursorused to track the cursor set by the user.private java.awt.LayoutManagerlayoutManagerTheLayoutManagerthat is set on theJRootPane.private java.awt.WindowradianceCurrentWindowThe current window.private java.awt.event.HierarchyListenerradianceHierarchyListenerHierarchy listener to keep track of the associated top-level window.private javax.swing.event.MouseInputListenerradianceMouseInputListenerMouseInputListenerthat is added to the parentWindowtheJRootPaneis contained in.private java.beans.PropertyChangeListenerradiancePropertyChangeListenerprivate javax.swing.event.MouseInputListenerradianceTitleMouseInputListenerMouse listener on the title pane (dragging).private java.awt.event.ComponentListenerradianceWindowComponentListenerComponent listener to keep track of the primary graphics configuration (for recomputing the maximized bounds) - fix for defect 213.private java.awt.event.WindowListenerradianceWindowListenerWindow listener that stops all Radiance threads when the last frame is disposed.private javax.swing.JRootPanerootJRootPaneproviding the look and feel for.private static introotPanesWithCustomSkinOptimization to speed up theRadianceCoreUtilities.getSkin(Component)implementation.private java.awt.LayoutManagersavedOldLayoutLayoutManagerof theJRootPanebefore we replaced it.private java.util.Set<RadianceThemingWidget<javax.swing.JComponent>>themingWidgetsprivate RadianceTitlePanetitlePaneJComponentproviding window decorations.private java.awt.WindowwindowWindow theJRootPaneis in.
-
Constructor Summary
Constructors Modifier Constructor Description protectedRadianceRootPaneUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.LayoutManagercreateLayoutManager()Returns aLayoutManagerthat will be set on theJRootPane.protected RadianceTitlePanecreateTitlePane(javax.swing.JRootPane root)Returns theJComponentto render the window decoration style.javax.swing.JButtoncreateTitlePaneControlButton()static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent comp)Creates a UI for aJRootPane.private javax.swing.event.MouseInputListenercreateWindowMouseInputListener()Returns aMouseListenerthat will be added to theWindowcontaining theJRootPane.voidextendContentIntoTitlePane()protected javax.swing.JRootPanegetRootPane()Returns theJRootPanewe're providing the look and feel for.javax.swing.JComponentgetTitlePane()Returns theJComponentrendering the title pane.java.awt.InsetsgetTitlePaneControlInsets()static booleanhasCustomSkinOnAtLeastOneRootPane()voidinstallBorder(javax.swing.JRootPane root)Installs the appropriateBorderonto theJRootPane.private voidinstallClientDecorations(javax.swing.JRootPane root)Installs the necessary state onto the JRootPane to render client decorations.protected voidinstallComponents(javax.swing.JRootPane root)protected voidinstallDefaults(javax.swing.JRootPane c)private voidinstallLayout(javax.swing.JRootPane root)Installs the appropriate LayoutManager on theJRootPaneto render the window decorations.protected voidinstallListeners(javax.swing.JRootPane root)voidinstallUI(javax.swing.JComponent c)Invokes supers implementation ofinstallUIto install the necessary state onto the passed inJRootPaneto render the metal look and feel implementation ofRootPaneUI.private voidinstallWindowListeners(javax.swing.JRootPane root, java.awt.Component parent)Installs the necessary Listeners on the parentWindow, if there is one.private booleanisMouseEventInExtendedTitlePane(java.awt.event.MouseEvent ev)private voidpropagateModificationState()voidpropertyChange(java.beans.PropertyChangeEvent e)voidsetPreferredTitlePaneHeight(int preferredTitlePaneHeight)private voidsetTitlePane(javax.swing.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(javax.swing.JRootPane root)Removes any border that may have been installed.private voiduninstallClientDecorations(javax.swing.JRootPane root)Uninstalls any state thatinstallClientDecorationshas installed.protected voiduninstallComponents(javax.swing.JRootPane root)protected voiduninstallDefaults(javax.swing.JRootPane root)private voiduninstallLayout(javax.swing.JRootPane root)Uninstalls the previously installedLayoutManager.protected voiduninstallListeners(javax.swing.JRootPane root)voiduninstallUI(javax.swing.JComponent c)Invokes super implementation to uninstall any of its state.private voiduninstallWindowListeners()Uninstalls the necessary Listeners on theWindowthe Listeners were last installed on.voidupdate(java.awt.Graphics g, javax.swing.JComponent c)-
Methods inherited from class javax.swing.plaf.basic.BasicRootPaneUI
installKeyboardActions, uninstallKeyboardActions
-
-
-
-
Field Detail
-
CORNER_DRAG_WIDTH
private static final int CORNER_DRAG_WIDTH
The amount of space (in pixels) that the cursor is changed on.- See Also:
- Constant Field Values
-
BORDER_DRAG_THICKNESS
private static final int BORDER_DRAG_THICKNESS
Region from edges that dragging is active from.- See Also:
- Constant Field Values
-
window
private java.awt.Window window
Window theJRootPaneis in.
-
titlePane
private RadianceTitlePane titlePane
JComponentproviding window decorations. This will be null if not providing window decorations.
-
isContentExtendingIntoTitlePane
private boolean isContentExtendingIntoTitlePane
-
radianceMouseInputListener
private javax.swing.event.MouseInputListener radianceMouseInputListener
MouseInputListenerthat is added to the parentWindowtheJRootPaneis contained in.
-
radianceTitleMouseInputListener
private javax.swing.event.MouseInputListener radianceTitleMouseInputListener
Mouse listener on the title pane (dragging).
-
layoutManager
private java.awt.LayoutManager layoutManager
TheLayoutManagerthat is set on theJRootPane.
-
savedOldLayout
private java.awt.LayoutManager savedOldLayout
LayoutManagerof theJRootPanebefore we replaced it.
-
root
private javax.swing.JRootPane root
JRootPaneproviding the look and feel for.
-
radianceWindowListener
private java.awt.event.WindowListener radianceWindowListener
Window listener that stops all Radiance threads when the last frame is disposed.
-
radianceCurrentWindow
private java.awt.Window radianceCurrentWindow
The current window.
-
radianceHierarchyListener
private java.awt.event.HierarchyListener radianceHierarchyListener
Hierarchy listener to keep track of the associated top-level window.
-
radianceWindowComponentListener
private java.awt.event.ComponentListener radianceWindowComponentListener
Component listener to keep track of the primary graphics configuration (for recomputing the maximized bounds) - fix for defect 213.
-
currentRootPaneGC
private java.awt.GraphicsConfiguration currentRootPaneGC
The graphics configuration that contains the top-left corner of the window (fix for defect 213).
-
radiancePropertyChangeListener
private java.beans.PropertyChangeListener radiancePropertyChangeListener
-
lastCursor
private java.awt.Cursor lastCursor
Cursorused to track the cursor set by the user. This is initiallyCursor.DEFAULT_CURSOR.
-
rootPanesWithCustomSkin
private static int rootPanesWithCustomSkin
Optimization to speed up theRadianceCoreUtilities.getSkin(Component)implementation.
-
themingWidgets
private java.util.Set<RadianceThemingWidget<javax.swing.JComponent>> themingWidgets
-
cursorMapping
private static final int[] cursorMapping
Maps from positions to cursor type. Refer to calculateCorner and calculatePosition for details of this.
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
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
public void installUI(javax.swing.JComponent c)
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 classjavax.swing.plaf.basic.BasicRootPaneUI- Parameters:
c- the JRootPane to install state onto
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
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 classjavax.swing.plaf.basic.BasicRootPaneUI- Parameters:
c- the JRootPane to uninstall state from
-
installBorder
public void installBorder(javax.swing.JRootPane root)
Installs the appropriateBorderonto theJRootPane.- Parameters:
root- Root pane.
-
uninstallBorder
private void uninstallBorder(javax.swing.JRootPane root)
Removes any border that may have been installed.- Parameters:
root- Root pane.
-
installDefaults
protected void installDefaults(javax.swing.JRootPane c)
- Overrides:
installDefaultsin classjavax.swing.plaf.basic.BasicRootPaneUI
-
uninstallDefaults
protected void uninstallDefaults(javax.swing.JRootPane root)
- Overrides:
uninstallDefaultsin classjavax.swing.plaf.basic.BasicRootPaneUI
-
update
public void update(java.awt.Graphics g, javax.swing.JComponent c)- Overrides:
updatein classjavax.swing.plaf.ComponentUI
-
installWindowListeners
private void installWindowListeners(javax.swing.JRootPane root, java.awt.Component parent)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
private void installLayout(javax.swing.JRootPane root)
Installs the appropriate LayoutManager on theJRootPaneto render the window decorations.- Parameters:
root- Root pane.
-
installListeners
protected void installListeners(javax.swing.JRootPane root)
- Overrides:
installListenersin classjavax.swing.plaf.basic.BasicRootPaneUI
-
uninstallListeners
protected void uninstallListeners(javax.swing.JRootPane root)
- Overrides:
uninstallListenersin classjavax.swing.plaf.basic.BasicRootPaneUI
-
installComponents
protected void installComponents(javax.swing.JRootPane root)
- Overrides:
installComponentsin classjavax.swing.plaf.basic.BasicRootPaneUI
-
uninstallComponents
protected void uninstallComponents(javax.swing.JRootPane root)
- Overrides:
uninstallComponentsin classjavax.swing.plaf.basic.BasicRootPaneUI
-
uninstallLayout
private void uninstallLayout(javax.swing.JRootPane root)
Uninstalls the previously installedLayoutManager.- Parameters:
root- Root pane.
-
installClientDecorations
private void installClientDecorations(javax.swing.JRootPane root)
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
private void uninstallClientDecorations(javax.swing.JRootPane root)
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
protected RadianceTitlePane createTitlePane(javax.swing.JRootPane root)
Returns theJComponentto render the window decoration style.- Parameters:
root- Root pane.- Returns:
- The title pane component.
-
createWindowMouseInputListener
private javax.swing.event.MouseInputListener createWindowMouseInputListener()
Returns aMouseListenerthat will be added to theWindowcontaining theJRootPane.- Returns:
- Window mouse listener.
-
createLayoutManager
protected java.awt.LayoutManager createLayoutManager()
Returns aLayoutManagerthat will be set on theJRootPane.- Returns:
- Layout manager.
-
setTitlePane
private void setTitlePane(javax.swing.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. 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
public javax.swing.JComponent 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:
setTitlePane(javax.swing.JRootPane, org.pushingpixels.radiance.theming.internal.utils.RadianceTitlePane)
-
createTitlePaneControlButton
public javax.swing.JButton createTitlePaneControlButton()
-
getTitlePaneControlInsets
public java.awt.Insets getTitlePaneControlInsets()
-
extendContentIntoTitlePane
public void extendContentIntoTitlePane()
-
setPreferredTitlePaneHeight
public void setPreferredTitlePaneHeight(int preferredTitlePaneHeight)
-
getRootPane
protected javax.swing.JRootPane getRootPane()
Returns theJRootPanewe're providing the look and feel for.- Returns:
- The associated root pane.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein classjavax.swing.plaf.basic.BasicRootPaneUI
-
propagateModificationState
private void propagateModificationState()
-
hasCustomSkinOnAtLeastOneRootPane
public static boolean hasCustomSkinOnAtLeastOneRootPane()
-
isMouseEventInExtendedTitlePane
private boolean isMouseEventInExtendedTitlePane(java.awt.event.MouseEvent ev)
-
-