uic.widgets
Class GroupBox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by uic.widgets.GroupBox
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GroupBox
extends JComponent
implements Accessible

See Also:
Serialized Form

Nested Class Summary
static class GroupBox.AbstractCollapsableBorder
          For a collapsable groupBox we show a border that, when clicked, will collapse the groupbox.
static interface GroupBox.PreviewHeader
          This interface is needed to be implemented on borders and headers for collapsable GroupBoxes.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String CONFIG_BORDER_FILL
           
static String CONFIG_BORDER_TYPE
           
static int FRAMESHADOW_PLAIN
           
static int FRAMESHADOW_RAISED
           
static int FRAMESHADOW_SUNKEN
           
static int FRAMESHAPE_BEVEL
           
static int FRAMESHAPE_ETCHED
           
static int FRAMESHAPE_NOFRAME
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GroupBox(LayoutManager layout, String title)
          Instanciate a GroupBox which is a box with a titled border around it.
GroupBox(String title)
          Instanciate a GroupBox which is a box with a titled border around it.
 
Method Summary
 AccessibleContext getAccessibleContext()
           
 boolean getCollapsed()
          Return if the groupBox is curently collapsed.
 Font getFont()
           
 LayoutManager getLayout()
           
 String getUIClassID()
           
 boolean isArmed()
          Returns if the component has been selected to be activated.
 boolean isCollapsable()
           
 boolean isGhosted()
          A groupbox itself does not get disabled, only its content will, this method returns if it is ghosted.
 void keyTypedSlot(char c, int modifiers, KeyEvent event)
           
 void paint(Graphics g)
           
 void repaintHeader()
           
 void setBorder(Border border)
           
 void setCollapsable(boolean on)
          Setting the groupbox to collapsable will allow the user to make the groupbox smaller.
 void setCollapsed(boolean collapsed)
          set the collapsed state of this groupbox.
 void setCollapsedHeader(GroupBox.PreviewHeader panel)
          For the collapsable functionality; set the Header panel that shows the summary.
 void setContentBorder(GroupBox.AbstractCollapsableBorder border)
          For the collapsable functionality; set the border that shows the 'collapse' button.
 void setEnabled(boolean enabled)
          Sets whether or not this GroupBox is enabled.
 void setFlat(boolean flat)
           
 void setFrameShadow(int frameShadow)
           
 void setFrameShape(int frameShape)
           
 void setLayout(LayoutManager mgr)
           
 void setTitle(String title)
          Sets a new title for this groupBox.
 void setValue(String value)
          For a collapsed groupbox the value will be shown, this can be different from the title.
 void updateUI()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
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, 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, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FRAMESHADOW_PLAIN

public static final int FRAMESHADOW_PLAIN
See Also:
Constant Field Values

FRAMESHADOW_RAISED

public static final int FRAMESHADOW_RAISED
See Also:
Constant Field Values

FRAMESHADOW_SUNKEN

public static final int FRAMESHADOW_SUNKEN
See Also:
Constant Field Values

FRAMESHAPE_NOFRAME

public static final int FRAMESHAPE_NOFRAME
See Also:
Constant Field Values

FRAMESHAPE_ETCHED

public static final int FRAMESHAPE_ETCHED
See Also:
Constant Field Values

FRAMESHAPE_BEVEL

public static final int FRAMESHAPE_BEVEL
See Also:
Constant Field Values

CONFIG_BORDER_TYPE

public static final String CONFIG_BORDER_TYPE
See Also:
Constant Field Values

CONFIG_BORDER_FILL

public static final String CONFIG_BORDER_FILL
See Also:
Constant Field Values
Constructor Detail

GroupBox

public GroupBox(String title)
Instanciate a GroupBox which is a box with a titled border around it.

Parameters:
title - the title shown on the top of the box.

GroupBox

public GroupBox(LayoutManager layout,
                String title)
Instanciate a GroupBox which is a box with a titled border around it.

Parameters:
title - the title shown on the top of the box.
Method Detail

setFlat

public void setFlat(boolean flat)

setCollapsable

public void setCollapsable(boolean on)
Setting the groupbox to collapsable will allow the user to make the groupbox smaller. If set to collapsable the user can click on a button, or the headline to make the box dissapear and only see a 'header' that summarizes the content of the box.

Parameters:
on - enable/disable collapsable.

updateUI

public void updateUI()
Overrides:
updateUI in class JComponent

isCollapsable

public boolean isCollapsable()

repaintHeader

public void repaintHeader()

keyTypedSlot

public void keyTypedSlot(char c,
                         int modifiers,
                         KeyEvent event)

setContentBorder

public void setContentBorder(GroupBox.AbstractCollapsableBorder border)
For the collapsable functionality; set the border that shows the 'collapse' button. Notice that the setCollapsable() method will call this one under water; you will only want to call this one if you want to set a specific border without listening to the user preferences.

Parameters:
border - the border.
See Also:
setCollapsable(boolean)

setCollapsedHeader

public void setCollapsedHeader(GroupBox.PreviewHeader panel)
For the collapsable functionality; set the Header panel that shows the summary. Notice that the setCollapsable() method will call this one under water; you will only want to call this one if you want to set a specific panel without listening to the user preferences.

Parameters:
panel - the panel that is visible when the groupBox is collapsed.
Throws:
IllegalArgumentException - if the panel does not extend a JComponent.
See Also:
setCollapsable(boolean)

getCollapsed

public boolean getCollapsed()
Return if the groupBox is curently collapsed.

Returns:
if the groupBox is curently collapsed.
See Also:
setCollapsable(boolean)

setCollapsed

public void setCollapsed(boolean collapsed)
set the collapsed state of this groupbox.

Throws:
IllegalStateException - when setCollapsable() has not been called with true.
See Also:
setCollapsable(boolean)

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent

setTitle

public void setTitle(String title)
Sets a new title for this groupBox.

Parameters:
title - the new title.

setValue

public void setValue(String value)
For a collapsed groupbox the value will be shown, this can be different from the title. When a groupBox is collapsed (See setCollapsable) the header can show a different text from the title; we propose to put the a summary of the groupbox in here.


setLayout

public void setLayout(LayoutManager mgr)
Overrides:
setLayout in class Container

getLayout

public LayoutManager getLayout()
Overrides:
getLayout in class Container

setBorder

public void setBorder(Border border)
Overrides:
setBorder in class JComponent

setFrameShape

public void setFrameShape(int frameShape)

setFrameShadow

public void setFrameShadow(int frameShadow)

isArmed

public boolean isArmed()
Returns if the component has been selected to be activated. Headers can display their action with a little offset or different color when we are armed.

Returns:
true if the component has been selected to be activated

isGhosted

public boolean isGhosted()
A groupbox itself does not get disabled, only its content will, this method returns if it is ghosted. Ghosted is a state where all children are disabled; and so its titlebar of 'header' should be painted in a ghosted color.


getUIClassID

public String getUIClassID()
Overrides:
getUIClassID in class JComponent

setEnabled

public void setEnabled(boolean enabled)
Sets whether or not this GroupBox is enabled. An enabled component can receive input events, a non enabled will not. Note: in contrast to the Swing JPanel this enable will enable child components as well.

Overrides:
setEnabled in class JComponent
Parameters:
enabled - true if this component should be enabled, false if it should be disabled.
See Also:
JComponent.setEnabled(boolean)

getFont

public Font getFont()
Specified by:
getFont in interface MenuContainer
Overrides:
getFont in class Component

getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence