Class RadianceTitlePane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- org.pushingpixels.radiance.theming.internal.utils.RadianceTitlePane
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
- Direct Known Subclasses:
RadianceRibbonFrameTitlePane
public class RadianceTitlePane extends javax.swing.JComponent
Title pane for Radiance look and feel.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
RadianceTitlePane.CloseAction
Actions used toclose
theWindow
.private class
RadianceTitlePane.IconifyAction
Actions used toiconify
theFrame
.private class
RadianceTitlePane.MaximizeAction
Actions used torestore
theFrame
.private class
RadianceTitlePane.PropertyChangeHandler
PropertyChangeListener installed on the Window.class
RadianceTitlePane.RadianceMenuBar
Class responsible for drawing the system menu.private class
RadianceTitlePane.RestoreAction
Actions used torestore
theFrame
.protected class
RadianceTitlePane.TitlePaneLayout
Layout manager for the title pane.private class
RadianceTitlePane.WindowHandler
WindowListener installed on the Window, updates the state as necessary.-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Image
appIcon
The application icon to be displayed.private javax.swing.Action
closeAction
Action used to close the Window.private javax.swing.JButton
closeButton
Button used to close the frame.private javax.swing.Action
iconifyAction
Action used to iconify the Frame.private boolean
isControlOnlyMode
private javax.swing.Action
maximizeAction
Action to restore the Frame size.protected javax.swing.JMenuBar
menuBar
JMenuBar, typically renders the system menu items.private javax.swing.JButton
minimizeButton
Button used to minimize the frameprivate int
preferredHeight
private java.beans.PropertyChangeListener
propertyChangeListener
PropertyChangeListener added to the JRootPane.private java.beans.PropertyChangeListener
propertyListener
Listens on changes tocomponentOrientation
andRadianceSynapse.CONTENTS_MODIFIED
properties.private javax.swing.Action
restoreAction
Action to restore the Frame size.protected javax.swing.JRootPane
rootPane
JRootPane rendering for.private RadianceRootPaneUI
rootPaneUI
RadianceRootPaneUI that created us.private int
state
Buffered Frame.state property.private TitlePaneButtonsProvider
titlePaneButtonsProvider
private javax.swing.JButton
toggleButton
Button used to maximize or restore the frame.protected java.awt.Window
window
Window we're currently in.private java.awt.event.WindowListener
windowListener
Listens for changes in the state of the Window listener to update the state of the widgets.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description RadianceTitlePane(javax.swing.JRootPane root, RadianceRootPaneUI ui)
Creates a new title pane.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addMenuItems(javax.swing.JMenu menu)
Adds the necessaryJMenuItem
s to the specified menu.void
addNotify()
private void
createActions()
Create theAction
s that get associated with the buttons and menu items.private void
createButtons()
Creates the Buttons that will be placed on the TitlePane.javax.swing.JButton
createControlButton()
protected java.awt.LayoutManager
createLayout()
Returns theLayoutManager
that should be installed on theRadianceTitlePane
.private javax.swing.JMenu
createMenu()
Returns theJMenu
displaying the appropriate menu items for manipulating the Frame.private javax.swing.JMenuBar
createMenuBar()
Returns theJMenuBar
displaying the appropriate system menu items.private javax.swing.JButton
createTitleButton()
Returns aJButton
appropriate for placement on the TitlePane.javax.swing.AbstractButton
getCloseButton()
private int
getControlButtonSize()
private int
getControlButtonsLargeGap()
private int
getControlButtonsSmallGap()
java.awt.Insets
getControlInsets()
private java.lang.String
getDisplayTitle()
private java.awt.Frame
getFrame()
Returns the Frame rendering in.private int
getPaneHeight()
javax.swing.JRootPane
getRootPane()
Returns theJRootPane
this was created for.private java.lang.String
getTitle()
Returns the String to display as the title.private int
getWindowDecorationStyle()
Returns the decoration style of theJRootPane
.private void
installDefaults()
Installs the fonts and necessary properties.private void
installListeners()
Installs the necessary listeners.private void
installSubcomponents()
Adds any sub-Components contained in theRadianceTitlePane
.void
paintComponent(java.awt.Graphics g)
void
removeNotify()
private void
setActive(boolean isActive)
Updates state dependant upon the Window's active state.void
setControlOnlyMode()
void
setPreferredHeight(int preferredHeight)
private void
setState(int state)
Sets the state of the Window.private void
setState(int state, boolean updateRegardless)
Sets the state of the window.private void
syncButtons()
private void
syncCloseButtonTooltip()
Synchronizes the tooltip of the close button.void
uninstall()
Uninstalls the necessary state.private void
uninstallListeners()
Uninstalls the necessary listeners.private void
updateAppIcon()
Updates the application icon.private void
updateToggleButton(javax.swing.Action action, javax.swing.Icon icon, java.lang.String tooltip)
Updates the toggle button to contain the Iconicon
, and Actionaction
.-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
propertyChangeListener
private java.beans.PropertyChangeListener propertyChangeListener
PropertyChangeListener added to the JRootPane.
-
menuBar
protected javax.swing.JMenuBar menuBar
JMenuBar, typically renders the system menu items.
-
isControlOnlyMode
private boolean isControlOnlyMode
-
preferredHeight
private int preferredHeight
-
titlePaneButtonsProvider
private TitlePaneButtonsProvider titlePaneButtonsProvider
-
closeAction
private javax.swing.Action closeAction
Action used to close the Window.
-
iconifyAction
private javax.swing.Action iconifyAction
Action used to iconify the Frame.
-
restoreAction
private javax.swing.Action restoreAction
Action to restore the Frame size.
-
maximizeAction
private javax.swing.Action maximizeAction
Action to restore the Frame size.
-
toggleButton
private javax.swing.JButton toggleButton
Button used to maximize or restore the frame.
-
minimizeButton
private javax.swing.JButton minimizeButton
Button used to minimize the frame
-
closeButton
private javax.swing.JButton closeButton
Button used to close the frame.
-
windowListener
private java.awt.event.WindowListener windowListener
Listens for changes in the state of the Window listener to update the state of the widgets.
-
window
protected java.awt.Window window
Window we're currently in.
-
rootPane
protected javax.swing.JRootPane rootPane
JRootPane rendering for.
-
state
private int state
Buffered Frame.state property. As state isn't bound, this is kept to determine when to avoid updating widgets.
-
rootPaneUI
private RadianceRootPaneUI rootPaneUI
RadianceRootPaneUI that created us.
-
propertyListener
private java.beans.PropertyChangeListener propertyListener
Listens on changes tocomponentOrientation
andRadianceSynapse.CONTENTS_MODIFIED
properties.
-
appIcon
private java.awt.Image appIcon
The application icon to be displayed.
-
-
Constructor Detail
-
RadianceTitlePane
public RadianceTitlePane(javax.swing.JRootPane root, RadianceRootPaneUI ui)
Creates a new title pane.- Parameters:
root
- Root pane.ui
- Root pane UI.
-
-
Method Detail
-
uninstall
public void uninstall()
Uninstalls the necessary state.
-
installListeners
private void installListeners()
Installs the necessary listeners.
-
uninstallListeners
private void uninstallListeners()
Uninstalls the necessary listeners.
-
getRootPane
public javax.swing.JRootPane getRootPane()
Returns theJRootPane
this was created for.- Overrides:
getRootPane
in classjavax.swing.JComponent
-
getWindowDecorationStyle
private int getWindowDecorationStyle()
Returns the decoration style of theJRootPane
.- Returns:
- Decoration style of the
JRootPane
.
-
addNotify
public void addNotify()
- Overrides:
addNotify
in classjavax.swing.JComponent
-
removeNotify
public void removeNotify()
- Overrides:
removeNotify
in classjavax.swing.JComponent
-
installSubcomponents
private void installSubcomponents()
Adds any sub-Components contained in theRadianceTitlePane
.
-
installDefaults
private void installDefaults()
Installs the fonts and necessary properties.
-
createMenuBar
private javax.swing.JMenuBar createMenuBar()
Returns theJMenuBar
displaying the appropriate system menu items.- Returns:
JMenuBar
displaying the appropriate system menu items.
-
createActions
private void createActions()
Create theAction
s that get associated with the buttons and menu items.
-
createMenu
private javax.swing.JMenu createMenu()
Returns theJMenu
displaying the appropriate menu items for manipulating the Frame.- Returns:
JMenu
displaying the appropriate menu items for manipulating the Frame.
-
addMenuItems
private void addMenuItems(javax.swing.JMenu menu)
Adds the necessaryJMenuItem
s to the specified menu.- Parameters:
menu
- Menu.
-
createTitleButton
private javax.swing.JButton createTitleButton()
Returns aJButton
appropriate for placement on the TitlePane.- Returns:
- Title button.
-
createButtons
private void createButtons()
Creates the Buttons that will be placed on the TitlePane.
-
createLayout
protected java.awt.LayoutManager createLayout()
Returns theLayoutManager
that should be installed on theRadianceTitlePane
.- Returns:
- Layout manager.
-
setActive
private void setActive(boolean isActive)
Updates state dependant upon the Window's active state.- Parameters:
isActive
- iftrue
, the window is in active state.
-
setState
private void setState(int state)
Sets the state of the Window.- Parameters:
state
- Window state.
-
setState
private void setState(int state, boolean updateRegardless)
Sets the state of the window. IfupdateRegardless
is true and the state has not changed, this will update anyway.- Parameters:
state
- Window state.updateRegardless
- iftrue
, the update is done in any case.
-
updateToggleButton
private void updateToggleButton(javax.swing.Action action, javax.swing.Icon icon, java.lang.String tooltip)
Updates the toggle button to contain the Iconicon
, and Actionaction
.- Parameters:
action
- Action.icon
- Icon.
-
getFrame
private java.awt.Frame getFrame()
Returns the Frame rendering in. This will return null if theJRootPane
is not contained in aFrame
.- Returns:
- Frame.
-
getTitle
private java.lang.String getTitle()
Returns the String to display as the title.- Returns:
- Display title.
-
getDisplayTitle
private java.lang.String getDisplayTitle()
-
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponent
in classjavax.swing.JComponent
-
syncCloseButtonTooltip
private void syncCloseButtonTooltip()
Synchronizes the tooltip of the close button.
-
syncButtons
private void syncButtons()
-
updateAppIcon
private void updateAppIcon()
Updates the application icon.
-
getCloseButton
public javax.swing.AbstractButton getCloseButton()
-
getControlButtonSize
private int getControlButtonSize()
-
getControlButtonsSmallGap
private int getControlButtonsSmallGap()
-
getControlButtonsLargeGap
private int getControlButtonsLargeGap()
-
setControlOnlyMode
public void setControlOnlyMode()
-
setPreferredHeight
public void setPreferredHeight(int preferredHeight)
-
createControlButton
public javax.swing.JButton createControlButton()
-
getPaneHeight
private int getPaneHeight()
-
getControlInsets
public java.awt.Insets getControlInsets()
-
-