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.JComponentTitle pane for Radiance look and feel.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRadianceTitlePane.CloseActionActions used toclosetheWindow.private classRadianceTitlePane.IconifyActionActions used toiconifytheFrame.private classRadianceTitlePane.MaximizeActionActions used torestoretheFrame.private classRadianceTitlePane.PropertyChangeHandlerPropertyChangeListener installed on the Window.classRadianceTitlePane.RadianceMenuBarClass responsible for drawing the system menu.private classRadianceTitlePane.RestoreActionActions used torestoretheFrame.protected classRadianceTitlePane.TitlePaneLayoutLayout manager for the title pane.private classRadianceTitlePane.WindowHandlerWindowListener 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.ImageappIconThe application icon to be displayed.private javax.swing.ActioncloseActionAction used to close the Window.private javax.swing.JButtoncloseButtonButton used to close the frame.private javax.swing.ActioniconifyActionAction used to iconify the Frame.private booleanisControlOnlyModeprivate javax.swing.ActionmaximizeActionAction to restore the Frame size.protected javax.swing.JMenuBarmenuBarJMenuBar, typically renders the system menu items.private javax.swing.JButtonminimizeButtonButton used to minimize the frameprivate intpreferredHeightprivate java.beans.PropertyChangeListenerpropertyChangeListenerPropertyChangeListener added to the JRootPane.private java.beans.PropertyChangeListenerpropertyListenerListens on changes tocomponentOrientationandRadianceSynapse.CONTENTS_MODIFIEDproperties.private javax.swing.ActionrestoreActionAction to restore the Frame size.protected javax.swing.JRootPanerootPaneJRootPane rendering for.private RadianceRootPaneUIrootPaneUIRadianceRootPaneUI that created us.private intstateBuffered Frame.state property.private TitlePaneButtonsProvidertitlePaneButtonsProviderprivate javax.swing.JButtontoggleButtonButton used to maximize or restore the frame.protected java.awt.WindowwindowWindow we're currently in.private java.awt.event.WindowListenerwindowListenerListens 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 voidaddMenuItems(javax.swing.JMenu menu)Adds the necessaryJMenuItems to the specified menu.voidaddNotify()private voidcreateActions()Create theActions that get associated with the buttons and menu items.private voidcreateButtons()Creates the Buttons that will be placed on the TitlePane.javax.swing.JButtoncreateControlButton()protected java.awt.LayoutManagercreateLayout()Returns theLayoutManagerthat should be installed on theRadianceTitlePane.private javax.swing.JMenucreateMenu()Returns theJMenudisplaying the appropriate menu items for manipulating the Frame.private javax.swing.JMenuBarcreateMenuBar()Returns theJMenuBardisplaying the appropriate system menu items.private javax.swing.JButtoncreateTitleButton()Returns aJButtonappropriate for placement on the TitlePane.javax.swing.AbstractButtongetCloseButton()private intgetControlButtonSize()private intgetControlButtonsLargeGap()private intgetControlButtonsSmallGap()java.awt.InsetsgetControlInsets()private java.lang.StringgetDisplayTitle()private java.awt.FramegetFrame()Returns the Frame rendering in.private intgetPaneHeight()javax.swing.JRootPanegetRootPane()Returns theJRootPanethis was created for.private java.lang.StringgetTitle()Returns the String to display as the title.private intgetWindowDecorationStyle()Returns the decoration style of theJRootPane.private voidinstallDefaults()Installs the fonts and necessary properties.private voidinstallListeners()Installs the necessary listeners.private voidinstallSubcomponents()Adds any sub-Components contained in theRadianceTitlePane.voidpaintComponent(java.awt.Graphics g)voidremoveNotify()private voidsetActive(boolean isActive)Updates state dependant upon the Window's active state.voidsetControlOnlyMode()voidsetPreferredHeight(int preferredHeight)private voidsetState(int state)Sets the state of the Window.private voidsetState(int state, boolean updateRegardless)Sets the state of the window.private voidsyncButtons()private voidsyncCloseButtonTooltip()Synchronizes the tooltip of the close button.voiduninstall()Uninstalls the necessary state.private voiduninstallListeners()Uninstalls the necessary listeners.private voidupdateAppIcon()Updates the application icon.private voidupdateToggleButton(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 tocomponentOrientationandRadianceSynapse.CONTENTS_MODIFIEDproperties.
-
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 theJRootPanethis was created for.- Overrides:
getRootPanein classjavax.swing.JComponent
-
getWindowDecorationStyle
private int getWindowDecorationStyle()
Returns the decoration style of theJRootPane.- Returns:
- Decoration style of the
JRootPane.
-
addNotify
public void addNotify()
- Overrides:
addNotifyin classjavax.swing.JComponent
-
removeNotify
public void removeNotify()
- Overrides:
removeNotifyin 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 theJMenuBardisplaying the appropriate system menu items.- Returns:
JMenuBardisplaying the appropriate system menu items.
-
createActions
private void createActions()
Create theActions that get associated with the buttons and menu items.
-
createMenu
private javax.swing.JMenu createMenu()
Returns theJMenudisplaying the appropriate menu items for manipulating the Frame.- Returns:
JMenudisplaying the appropriate menu items for manipulating the Frame.
-
addMenuItems
private void addMenuItems(javax.swing.JMenu menu)
Adds the necessaryJMenuItems to the specified menu.- Parameters:
menu- Menu.
-
createTitleButton
private javax.swing.JButton createTitleButton()
Returns aJButtonappropriate 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 theLayoutManagerthat 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. IfupdateRegardlessis 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 theJRootPaneis 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:
paintComponentin 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()
-
-