Class WCMPanelBean

  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by net.sourceforge.webcompmath.awt.beans.WCMPanelBean
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, javax.accessibility.Accessible
Direct Known Subclasses:

public class WCMPanelBean
extends javax.swing.JPanel

This class is intended for use with GUI builders, such as the Eclipse Visual Editor (VE). It extends JPanel and provides some additional methods to make using GUI builders easier. In particular, it's goal is to hide WCM controllers and error reporters from the applet developer by automatically adding appropriate child objects to the controller and setting their controller-to-notify and error reporters when appropriate. This class builds a tree of controllers that mimics the tree of nested WCMPanelBeans. As child panels get added to parent panels, the child controllers get added to parent controllers. All input objects are set to notify the controller at the top of the tree. By default, the first canvas added will be used as the error reporter, and set for all controllers and limit control panels. If there is no display canvas, then each WCMPanel has its own MessagePopup as a default error reporter.

Tom Downey
See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
Nested classes/interfaces inherited from class java.awt.Container
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Field Summary
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
          The default constructor, used by VE; just calls the default in WCMPanel, which creates a panel with a BorderLayout and an inset gap of 3.
Method Summary
protected  void addImpl(java.awt.Component comp, java.lang.Object constraints, int index)
          Override add methods to handle specific "wiring up" of various WCM objects.
 Controller getController()
          Return the controller associated with this WCMPanelBean
static Controller getMainController()
          Get the main controller for all the WCMPanelBeans.
protected  void paintComponent(java.awt.Graphics g)
          Override the paintComponent method, just to make sure that compute gets called at least once on the main controller before the first display.
 void remove(java.awt.Component comp)
          Handle removing the wiring for components
 void setController(Controller c)
          Set the controller for this WCMPanelBean
 void setTie1(Tie t)
          Convenience setter method to add a tie to the controller for a panel.
 void setTie2(Tie t)
          Convenience setter method to add a tie to the controller for a panel.
 void setTie3(Tie t)
          Convenience setter method to add a tie to the controller for a panel.
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, 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, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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, 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, add, addContainerListener, 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, 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, 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, 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, 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

Constructor Detail


public WCMPanelBean()
The default constructor, used by VE; just calls the default in WCMPanel, which creates a panel with a BorderLayout and an inset gap of 3. It creates a default controller with a messge popup as the error reporter.

Method Detail


public Controller getController()
Return the controller associated with this WCMPanelBean

the controller


public void setController(Controller c)
Set the controller for this WCMPanelBean

c - the controller to use


protected void addImpl(java.awt.Component comp,
                       java.lang.Object constraints,
                       int index)
Override add methods to handle specific "wiring up" of various WCM objects.

addImpl in class java.awt.Container
See Also:
Container.addImpl(java.awt.Component, java.lang.Object, int)


public void remove(java.awt.Component comp)
Handle removing the wiring for components

remove in class java.awt.Container


public void setTie1(Tie t)
Convenience setter method to add a tie to the controller for a panel. Generally, use this only for the top level panel. If you need more than three ties, you will need to do some hand-coding.

t - the tie to add


public void setTie2(Tie t)
Convenience setter method to add a tie to the controller for a panel.

t - the tie to add


public void setTie3(Tie t)
Convenience setter method to add a tie to the controller for a panel.

t - the tie to add


protected void paintComponent(java.awt.Graphics g)
Override the paintComponent method, just to make sure that compute gets called at least once on the main controller before the first display. Note that if the programmer has wired up controllers manually, then the programmer needs to make sure that compute gets called (typically at the end of an applets init()). Also call compute if it is design time in a GUI builder, to make sure that displays get updated.

paintComponent in class javax.swing.JComponent
See Also:


public static Controller getMainController()
Get the main controller for all the WCMPanelBeans.

the main controller