JavaGantt 2011.1 API

eu.beesoft.gaia.swing.form
Class Form

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by eu.beesoft.gaia.swing.form.Form
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class Form
extends javax.swing.JPanel

This is the form component (it holds and layouts components in one form). It uses java.awt.GridBagLayout as a default layout and instances of CellConstraints as the component constraints (instead of the GridBagConstraints). Each inserted component has its border replaced by EditableComponentBorder to show the user if component is editable. For editable components you can set the background color by method setEditableComponentBackground(Color) and border color by method setEditableComponentBorderColor(Color).

The Form instance has the ability to paint the horizontal and / or vertical lines around the component cells, if it is set in CellConstraints instance(s) (variables like leftBorder, topBorder, etc.). This gives the "table" look to the form. The color of the cell borders can be set by method setCellBorderColor(Color).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Color DEFAULT_BACKGROUND
          Constant for default background for editable components.
 
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
Form()
          Create a new instance of Form.
 
Method Summary
 void add(java.awt.Component component, java.lang.Object constraints)
          Adds a component to this form.
 java.awt.Color getCellBorderColor()
          Returns the color of the cell border.
 java.awt.Color getEditableComponentBackground()
          Returns the background color of the editable components.
 java.awt.Color getEditableComponentBorderColor()
          Returns the border color of the editable components.
 java.awt.Insets getInsets()
          Returns the insets of this form.
protected  boolean isEditable(java.awt.Component component)
          Checks if given component is editable.
protected  void paintEditableBackground(java.awt.Component component, java.awt.Graphics g)
          Paints a background for the component with color given by getEditableComponentBackground() method.
 void paintChildren(java.awt.Graphics g)
          Overriden to paint the cell borders.
 void setCellBorderColor(java.awt.Color cellBorderColor)
          Sets the new cell border color.
 void setEditableComponentBackground(java.awt.Color editableComponentBackground)
          Sets the background color for the editable components.
 void setEditableComponentBorderColor(java.awt.Color editableComponentBorderColor)
           
 void setInsets(java.awt.Insets insets)
          Sets the insets for this form.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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, paint, paintBorder, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, 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, 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
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, 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, getFont, 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, checkImage, checkImage, 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

DEFAULT_BACKGROUND

public static final java.awt.Color DEFAULT_BACKGROUND
Constant for default background for editable components.

Constructor Detail

Form

public Form()
Create a new instance of Form.

Method Detail

getCellBorderColor

public java.awt.Color getCellBorderColor()
Returns the color of the cell border.

Returns:
the cell border color

setCellBorderColor

public void setCellBorderColor(java.awt.Color cellBorderColor)
Sets the new cell border color.

Parameters:
cellBorderColor - - the cell border color to set

getEditableComponentBackground

public java.awt.Color getEditableComponentBackground()
Returns the background color of the editable components.

Returns:
the background color of editable components

setEditableComponentBackground

public void setEditableComponentBackground(java.awt.Color editableComponentBackground)
Sets the background color for the editable components.

Parameters:
editableComponentBackground - - the background color for editable components to set

getEditableComponentBorderColor

public java.awt.Color getEditableComponentBorderColor()
Returns the border color of the editable components.

Returns:
the border color of the editable components

setEditableComponentBorderColor

public void setEditableComponentBorderColor(java.awt.Color editableComponentBorderColor)
Parameters:
editableComponentBorderColor - - the border color of the editable components to set

getInsets

public java.awt.Insets getInsets()
Returns the insets of this form.

Overrides:
getInsets in class javax.swing.JComponent
Returns:
the insets

setInsets

public void setInsets(java.awt.Insets insets)
Sets the insets for this form.

Parameters:
insets - - the insets to set

add

public void add(java.awt.Component component,
                java.lang.Object constraints)
Adds a component to this form. Overriden to check that constraints arre instace of CellConstraints and to set EditableComponentBorder as border to component

Overrides:
add in class java.awt.Container
Parameters:
component - - the component to add
constraints - - must be an instance of CellConstraints
Throws:
java.lang.RuntimeException - if cell is not an instance of CellConstraints

paintChildren

public void paintChildren(java.awt.Graphics g)
Overriden to paint the cell borders.

Overrides:
paintChildren in class javax.swing.JComponent
Parameters:
g - - graphics to paint on

isEditable

protected boolean isEditable(java.awt.Component component)
Checks if given component is editable. If given component is a JScrollPane, it obtains its view component. A component is editable if: Override this method for specific components.

Parameters:
component - - the component to check
Returns:
true if given component is editable

paintEditableBackground

protected void paintEditableBackground(java.awt.Component component,
                                       java.awt.Graphics g)
Paints a background for the component with color given by getEditableComponentBackground() method.

Parameters:
component - - component for which is background painted
g - - graphics to paint on

JavaGantt 2011.1 API