net.sourceforge.webcompmath.draw.beans
Class WCMLimitControlPanelBean

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 net.sourceforge.webcompmath.draw.LimitControlPanel
                      extended by net.sourceforge.webcompmath.draw.beans.WCMLimitControlPanelBean
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, InputObject, Limits, Tieable

public class WCMLimitControlPanelBean
extends LimitControlPanel

This class is intended for use with GUI builders. Since many (like Eclipse VE) can't handle indexed properties, and enabling them to support "add" semantics for adding coordinateRects to a limitControlPanel, this class uses a bit of a hack by providing three DisplayCanvas's that can be added to the limitControlPanel via setters. If you need more than three (pretty unlikely) you will have to do some hand-coding. The button options are also exposed as properties by this class using set/get methods. Note that buttons can only be added, not removed, so the set methods have no effect if called with an argument of false. Since buttons are only added at the time the panel is created, having an argument of false is only used when the designer changes his/her mind at design time. The SetLimits button is included by default, and hence there is no set method for it.

Author:
Tom Downey
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class net.sourceforge.webcompmath.draw.LimitControlPanel
ALL_BUTTONS, animatorItems, buttonNames, buttons, coords, EQUALIZE, errorReporter, items, RESTORE, SAVE, serialNumber, SET_LIMITS, syncWith, twoColumn, xmax, xmin, ymax, ymin, ZOOM_IN, ZOOM_OUT
 
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
WCMLimitControlPanelBean()
          the default constructor
WCMLimitControlPanelBean(java.lang.String xminName, java.lang.String xmaxName, java.lang.String yminName, java.lang.String ymaxName, int buttonsToAdd, boolean useTwoColumnsIfPossible)
          Create a WCMLimitControlPanelBean containing input boxes labeled with the given names and containing whatever buttons are in the set buttonsToAdd.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Override to handle save/restore to include parametric parameters
 boolean getEqualize()
          Get the equilize option
 WCMParametricCurveBean getParametricCurve1()
          Get parametric curve controlled by this panel.
 WCMParametricCurveBean getParametricCurve2()
          Get parametric curve controlled by this panel.
 WCMParametricCurveBean getParametricCurve3()
          Get parametric curve controlled by this panel.
 boolean getParametricFields()
          Get whether parametric fields are used.
 java.lang.String getParamName()
          Get the name of the parameter variable.
 boolean getRestore()
          Get the restore option
 boolean getSave()
          Get the save option
 boolean getSetLimits()
          Get the set limits option
 int getTIntervals()
          Get the number of intervals.
 Value getTIntervalsValue()
          Returns as a Value the tIntervals VariableInput.
 double getTMax()
          Get the maximum parameter value.
 Value getTMaxValue()
          Returns as a Value the tMax VariableInput.
 double getTMin()
          Get the minimum parameter value.
 Value getTMinValue()
          Returns as a Value the tMin VariableInput.
 double getXMax()
          Get the xMax value.
 double getXMin()
          Get the xMin value.
 double getYMax()
          Get the yMax value.
 double getYMin()
          Get the yMin value.
 boolean getZoomIn()
          Get the zoom in option
 boolean getZoomOut()
          Get the zoom out option
 void notifyControllerOnChange(Controller c)
          Save the controller (used only for parametric fields).
 void removeSetLimitsButton()
          Used to remove the default Set Limits button, so you can add buttons in pairs for two column mode.
 void restoreParams()
          Restore tmin, tmax, and tintervals.
 void saveParams()
          Save the current tmin, tmax, and tintervals.
 void setCanvas1(DisplayCanvas dc)
          Set the canvas to be controlled by this limit control panel
 void setCanvas2(DisplayCanvas dc)
          Set the 2nd canvas to be controlled by this limit control panel
 void setCanvas3(DisplayCanvas dc)
          Set the 3rd canvas to be controlled by this limit control panel
 void setEqualize(boolean b)
          This represents a button that will equalize the scales on the axes (of the first CoordinateRect that was added to this panel).
 void setParametricCurve1(WCMParametricCurveBean pc)
          Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.
 void setParametricCurve2(WCMParametricCurveBean pc)
          Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.
 void setParametricCurve3(WCMParametricCurveBean pc)
          Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.
 void setParametricFields(boolean b)
          Set whether to use tmin, tmax, intervals fields.
 void setParamName(java.lang.String name)
          Set the name of the parameter variable.
 void setRestore(boolean b)
          This represents a button that will restore previously saved coordinates.
 void setSave(boolean b)
          This represents a button that will save the current limits, so they can be restored later with the restore button.
 void setTIntervals(int i)
          Set the number of intervals.
 void setTMax(double d)
          Set the maximum value for the parameter.
 void setTMin(double d)
          Set the minimum value for the parameter.
 void setXMax(double d)
          This method sets the xMax property.
 void setXMin(double d)
          This method sets the xMin property.
 void setYMax(double d)
          This method sets the yMax property.
 void setYMin(double d)
          This method sets the yMin property.
 void setZoomIn(boolean b)
          This represents a button that will zoom in on the center of the coordinate rect.
 void setZoomOut(boolean b)
          This represents a button that will zoom out from the center of the coordinate rect.
 
Methods inherited from class net.sourceforge.webcompmath.draw.LimitControlPanel
add, addAnimator, addButtons, addComponent, addComponentPair, addCoords, addCoords, addRange, checkInput, getButton, getButtonOptions, getErrorReporter, getLimits, getPreferredSize, getSerialNumber, getUseTwoColumnsIfPossible, paintComponent, processComponentEvent, setErrorReporter, setForeground, setLimits, setUseTwoColumnsIfPossible, sync
 
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, 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, 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, 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, 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, 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

WCMLimitControlPanelBean

public WCMLimitControlPanelBean()
the default constructor


WCMLimitControlPanelBean

public WCMLimitControlPanelBean(java.lang.String xminName,
                                java.lang.String xmaxName,
                                java.lang.String yminName,
                                java.lang.String ymaxName,
                                int buttonsToAdd,
                                boolean useTwoColumnsIfPossible)
Create a WCMLimitControlPanelBean containing input boxes labeled with the given names and containing whatever buttons are in the set buttonsToAdd. buttonsToAdd should be formed by or-ing together constants such as SET_LIMITS from this class. The last parameter specifies whether to show the components in two columns.

Parameters:
xminName - Name to be used as a label for the xmin input box.
xmaxName - Name to be used as a label for the xmax input box.
yminName - Name to be used as a label for the ymin input box.
ymaxName - Name to be used as a label for the ymax input box.
buttonsToAdd - The set of buttons to be added to the panel. Can consist of one or more of the constants SET_LIMITS, EQUALIZE, ZOOM_IN, ZOOM_OUT, SAVE, and RESTORE, or'ed together.
useTwoColumnsIfPossible - If this is true, then the components in the panel will be arranged into two columns instead of one (assuming that there is room).
Method Detail

setCanvas1

public void setCanvas1(DisplayCanvas dc)
Set the canvas to be controlled by this limit control panel

Parameters:
dc - the DisplayCanvas (or WCMDisplayCanvasBean) to controll

setCanvas2

public void setCanvas2(DisplayCanvas dc)
Set the 2nd canvas to be controlled by this limit control panel

Parameters:
dc - the DisplayCanvas (or WCMDisplayCanvasBean) to controll

setCanvas3

public void setCanvas3(DisplayCanvas dc)
Set the 3rd canvas to be controlled by this limit control panel

Parameters:
dc - the DisplayCanvas (or WCMDisplayCanvasBean) to controll

setEqualize

public void setEqualize(boolean b)
This represents a button that will equalize the scales on the axes (of the first CoordinateRect that was added to this panel).

Parameters:
b -

getEqualize

public boolean getEqualize()
Get the equilize option

Returns:
whether to add an equalize button

setZoomIn

public void setZoomIn(boolean b)
This represents a button that will zoom in on the center of the coordinate rect.

Parameters:
b -

getZoomIn

public boolean getZoomIn()
Get the zoom in option

Returns:
whether to add a zoom in button

setZoomOut

public void setZoomOut(boolean b)
This represents a button that will zoom out from the center of the coordinate rect.

Parameters:
b -

getZoomOut

public boolean getZoomOut()
Get the zoom out option

Returns:
whether to add a zoom out button

setSave

public void setSave(boolean b)
This represents a button that will save the current limits, so they can be restored later with the restore button.

Parameters:
b -

getSave

public boolean getSave()
Get the save option

Returns:
whether to add a save button

setRestore

public void setRestore(boolean b)
This represents a button that will restore previously saved coordinates. The coords are those that were saved with the save button, or if none were saved in that way, then the original coordinates that the CoordinateRect had when it was created.

Parameters:
b -

getRestore

public boolean getRestore()
Get the restore option

Returns:
whether to add a restore button

getSetLimits

public boolean getSetLimits()
Get the set limits option

Returns:
whether to add a set limits button

setXMin

public void setXMin(double d)
This method sets the xMin property.

Parameters:
d - the new value for xMin

getXMin

public double getXMin()
Get the xMin value.

Returns:
the value

setXMax

public void setXMax(double d)
This method sets the xMax property.

Parameters:
d - the new value for xMax

getXMax

public double getXMax()
Get the xMax value.

Returns:
the value

setYMin

public void setYMin(double d)
This method sets the yMin property.

Parameters:
d - the new value for yMin

getYMin

public double getYMin()
Get the yMin value.

Returns:
the value

setYMax

public void setYMax(double d)
This method sets the yMax property.

Parameters:
d - the new value for yMax

getYMax

public double getYMax()
Get the yMax value.

Returns:
the value

setParametricFields

public void setParametricFields(boolean b)
Set whether to use tmin, tmax, intervals fields.

Parameters:
b - true or false

getParametricFields

public boolean getParametricFields()
Get whether parametric fields are used.

Returns:
true or false

getParamName

public java.lang.String getParamName()
Get the name of the parameter variable.

Returns:
the name

setParamName

public void setParamName(java.lang.String name)
Set the name of the parameter variable.

Parameters:
name - the variable name, such as "t"

setTMin

public void setTMin(double d)
Set the minimum value for the parameter.

Parameters:
d - the min. value

getTMin

public double getTMin()
Get the minimum parameter value.

Returns:
the min. value

setTMax

public void setTMax(double d)
Set the maximum value for the parameter.

Parameters:
d - the maximum value.

getTMax

public double getTMax()
Get the maximum parameter value.

Returns:
the max. value

setTIntervals

public void setTIntervals(int i)
Set the number of intervals.

Parameters:
i - num. of intervals

getTIntervals

public int getTIntervals()
Get the number of intervals.

Returns:
num. of intervals

setParametricCurve1

public void setParametricCurve1(WCMParametricCurveBean pc)
Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.

Parameters:
pc - the parametric curve to be controlled by this panel

getParametricCurve1

public WCMParametricCurveBean getParametricCurve1()
Get parametric curve controlled by this panel.

Returns:
the curve

setParametricCurve2

public void setParametricCurve2(WCMParametricCurveBean pc)
Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.

Parameters:
pc - the parametric curve to be controlled by this panel

getParametricCurve2

public WCMParametricCurveBean getParametricCurve2()
Get parametric curve controlled by this panel.

Returns:
the curve

setParametricCurve3

public void setParametricCurve3(WCMParametricCurveBean pc)
Tell the parametric curve to use the fields in the limit control panel for its tmin, tmax, and tintervals.

Parameters:
pc - the parametric curve to be controlled by this panel

getParametricCurve3

public WCMParametricCurveBean getParametricCurve3()
Get parametric curve controlled by this panel.

Returns:
the curve

notifyControllerOnChange

public void notifyControllerOnChange(Controller c)
Save the controller (used only for parametric fields).

Specified by:
notifyControllerOnChange in interface InputObject
Overrides:
notifyControllerOnChange in class LimitControlPanel
Parameters:
c - controller to notify
See Also:
LimitControlPanel.notifyControllerOnChange(net.sourceforge.webcompmath.awt.Controller)

getTMinValue

public Value getTMinValue()
Returns as a Value the tMin VariableInput. This can be used to set the limits of a slider.

Returns:
tMin as a Value

getTMaxValue

public Value getTMaxValue()
Returns as a Value the tMax VariableInput. This can be used to set the limits of a slider.

Returns:
tMax as a Value

getTIntervalsValue

public Value getTIntervalsValue()
Returns as a Value the tIntervals VariableInput. This can be used to set the limits of a slider.

Returns:
tIntervals as a Value

removeSetLimitsButton

public void removeSetLimitsButton()
Used to remove the default Set Limits button, so you can add buttons in pairs for two column mode.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Override to handle save/restore to include parametric parameters

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class LimitControlPanel
Parameters:
evt - event created when user clicks a button
See Also:
LimitControlPanel.actionPerformed(java.awt.event.ActionEvent)

saveParams

public void saveParams()
Save the current tmin, tmax, and tintervals.


restoreParams

public void restoreParams()
Restore tmin, tmax, and tintervals.