SilverStream
Application Server 3.5

com.sssw.rt.form
Class AgcIntegerSpinnerField

java.lang.Object
 |
 +--java.awt.Component
       |
       +--java.awt.Container
             |
             +--javax.swing.JComponent
                   |
                   +--javax.swing.JPanel
                         |
                         +--com.sssw.rt.atlas.AtPanel
                               |
                               +--com.sssw.rt.form.PvBasePanel
                                     |
                                     +--com.sssw.rt.form.AgcIntegerSpinnerField
All Implemented Interfaces:
Accessible, AgiControl, AgiHelpInfo, AgiTabstopHandler, AgiValueChangingListener, EventListener, FocusListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, PropertyChangeListener, Serializable, TextListener

public class AgcIntegerSpinnerField
extends PvBasePanel
implements TextListener, AgiValueChangingListener, PropertyChangeListener, KeyListener, MouseListener, MouseMotionListener, FocusListener, AgiTabstopHandler

The AgcIntegerSpinnerField control (Integer Spinner) represents an integer whose value the user can increment or decrement. The value can optionally be limited to a certain range.

This class fires a valueChanging event each time the control's value changes and the user is still interacting with the control. For example, if the user clicks and holds down one of the arrow buttons, the value of the control changes continually, and the control fires a valueChanging event after every change. When the user releases the spinner's arrow button, the control fires a valueChanged event.

Properties:
Background Color, Control Type, Data Column, Display Format, Editable, Enabled, Font Name, Font Size, Font Style, Height, Help Page, Increment, Left, Max Value, Min Value, Name, Text Color, Tool Tip, Top, Validation Rules, Visible, Width
Events:
focusGained, focusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, validationFailed, validationTest, valueChanged, valueChanging
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
static int NO_LIMIT
          This value represents no maximum or no minimum limit.
 
Fields inherited from class com.sssw.rt.atlas.AtPanel
BGIMAGE_DRAW_CENTERED, BGIMAGE_DRAW_NORMAL, BGIMAGE_DRAW_STRETCH, BGIMAGE_DRAW_TILED
 
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
 
Constructor Summary
AgcIntegerSpinnerField()
           
 
Method Summary
 void addAgiValueChangingListener(AgiValueChangingListener listener)
           
 Color getBackgroundColor()
          Returns the Color object associated with the control's background.
 String getDisplayPattern()
          Returns a String that identifies the pattern that the control uses to display the data.
 int getDisplayStyle()
          Obtains the control's display style.
 boolean getEditable()
          Returns a boolean that indicates whether or not the user can edit the control's text.
 Color getForeground()
          A Java method that returns the Color object associated with the control's foreground.
 int getIncrement()
          Returns an integer that specifies the amount by which the AgcIntegerSpinnerField is incremented (or decremented) when the user presses one of the control's buttons.
 Integer getIntegerValue()
           
 int getMaxValue()
          Returns an integer that represents the highest value that the control can be set to.
 int getMinValue()
          Returns an integer that represents the lowest value that the control can be set to.
 String getSelectedText()
          Returns a String containing the current selection.
 int getSelectionEnd()
          Returns an integer that represents the end of the user's selection in the control.
 int getSelectionStart()
          Returns an integer that represents the beginning of the user's selection in the control.
 String getText()
          Returns a String that contains the control's text.
 Color getTextColor()
          Deprecated. replaced by AgcIntegerSpinnerField.getForeground().
 int getValue()
          Get the field value as a primitive integer.
 void removeAgiValueChangingListener(AgiValueChangingListener listener)
           
 void select(int start, int end)
          Selects text within the edit control portion of the spinner.
 void selectAll()
          Selects everything.
 void setBackgroundColor(Color backgroundcolor)
          Assigns the control's background Color.
 void setDisplayPattern(String pattern)
          Assigns the control's display format.
 void setDisplayStyle(int style)
          Assigns the control's display style.
 void setEditable(boolean b)
          Assigns a boolean value that determines whether the user can edit the control.
 void setIncrement(int increment)
          Assigns an integer value by which the AgcIntegerSpinnerField is incremented (or decremented) each time the user presses the spin button or one of the arrow keys.
 void setIntegerValue(Integer value)
           
 void setMaxValue(int value)
          Assigns the highest int value that the control can be set to.
 void setMinValue(int value)
          Assigns the lowest int value that the control can be set to.
 void setText(String value)
          Assigns the control's text.
 void setTextColor(Color color)
          Deprecated. use Component.setForeground(Color) to assign an instance of java.awt.Color to the control's text.
 void setValue(int value)
          Assigns the control's value.
 
Methods inherited from class com.sssw.rt.form.PvBasePanel
getFontIdentifier, setFontIdentifier
 
Methods inherited from class com.sssw.rt.atlas.AtPanel
addImpl, addNotify, clientPaint, clientPaint, deliverMouseEvent, deliverMouseMoveEvent, doAtCommand, drawTiledImage, enableAtCommands, getBackgroundImage, getBackgroundImageMode, getHelper, getTransparent, hide, hideToolTip, imageUpdate, isFocusTraversable, isOptimizedDrawingEnabled, ownedImage, paintBorder, paintComponent, paintImmediately, paintImmediately, paintNow, preprocessKeyEvent, processEvent, reshape, setBackgroundImage, setBackgroundImageMode, setTransparent, show, showToolTip
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.form.AgiControl
getComponent, getHelpInfo, setHelpInfo
 
Methods implemented from interface com.sssw.rt.util.AgiTabstopHandler
getTabOrder
 
Methods implemented from interface com.sssw.rt.event.AgiValueChangingListener
valueChanging
 
Methods implemented from interface java.awt.event.FocusListener
focusGained, focusLost
 
Methods implemented from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
 
Methods implemented from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods implemented from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
 
Methods implemented from interface java.beans.PropertyChangeListener
propertyChange
 
Methods implemented from interface java.awt.event.TextListener
textValueChanged
 

Field Detail

NO_LIMIT

public static final int NO_LIMIT
This value represents no maximum or no minimum limit.
See Also:
AgcIntegerSpinnerField.setMaxValue(int), AgcIntegerSpinnerField.setMinValue(int)
Constructor Detail

AgcIntegerSpinnerField

public AgcIntegerSpinnerField()
Method Detail

setIncrement

public void setIncrement(int increment)
Assigns an integer value by which the AgcIntegerSpinnerField is incremented (or decremented) each time the user presses the spin button or one of the arrow keys.
Parameters:
increment - specifies the amount by which the control is incremented (or decremented) when the user presses the spin button or one of the arrow keys.
Usage:

Use the getIncrement() method to retrieve this value at runtime.

Example:

The following example illustrates how to set the increment value to 3.

  ControlName1.setIncrement(3);
 
See Also:
AgcIntegerSpinnerField.getIncrement()

getIncrement

public int getIncrement()
Returns an integer that specifies the amount by which the AgcIntegerSpinnerField is incremented (or decremented) when the user presses one of the control's buttons.
Usage:

Use the setIncrement() method to assign this value at runtime.

Example:

The following example illustrates how to obtain the current increment value.

  int increment;
  increment = ControlName1.getIncrement();
 
See Also:
AgcIntegerSpinnerField.setIncrement(int)

addAgiValueChangingListener

public void addAgiValueChangingListener(AgiValueChangingListener listener)
Parameters:
listener -  

removeAgiValueChangingListener

public void removeAgiValueChangingListener(AgiValueChangingListener listener)
Parameters:
listener -  

getEditable

public boolean getEditable()
Returns a boolean that indicates whether or not the user can edit the control's text.
Usage:

When getEditable returns true, the user can edit the text. If the control is enabled but not editable, the user cannot change the value of the text, but can select, copy, and scroll the text.

Example:

The following code fragment illustrates how to use the getEditable() method.

  boolean editable;
  editable = ControlName1.getEditable();
 
See Also:
AgcIntegerSpinnerField.setEditable(boolean)

setEditable

public void setEditable(boolean b)
Assigns a boolean value that determines whether the user can edit the control.
Parameters:
b - specifies whether the control is editable.
Usage:

Specifies whether the text field portion of the spinner is editable. When the value is true, the user can edit the control.

Example:

The following code fragment illustrates how to make a control editable.

 ControlName1.setEditable(true);
 
See Also:
AgcIntegerSpinnerField.getEditable()

getTextColor

public Color getTextColor()
Deprecated. replaced by AgcIntegerSpinnerField.getForeground().

Returns the Color of the control's text.
Example:

The following code fragment illustrates how to use the getTextColor() method.

  Color c;
  c = ControlName1.getTextColor();
 
See Also:
AgcIntegerSpinnerField.setTextColor(Color)

getForeground

public Color getForeground()
A Java method that returns the Color object associated with the control's foreground.
Overrides:
getForeground in class Component
Example:

This example illustrates how to obtain the foreground Color of a control.

  Color bgColor;
  bgColor = ControlName1.getForeground();
 
See Also:
Component.setForeground(Color)

setTextColor

public void setTextColor(Color color)
Deprecated. use Component.setForeground(Color) to assign an instance of java.awt.Color to the control's text.

Parameters:
color -  
See Also:
Component.setForeground(Color), AgcIntegerSpinnerField.getTextColor()

getBackgroundColor

public Color getBackgroundColor()
Deprecated. replaced by Component.getBackground().

Description copied from class: PvBasePanel
Returns the Color object associated with the control's background.
Overrides:
getBackgroundColor in class PvBasePanel
See Also:
Component.getBackground()

setBackgroundColor

public void setBackgroundColor(Color backgroundcolor)
Deprecated. replaced by Component.setBackground(Color).

Description copied from class: PvBasePanel
Assigns the control's background Color.
Overrides:
setBackgroundColor in class PvBasePanel
See Also:
Component.setBackground(Color)

select

public void select(int start,
                   int end)
Selects text within the edit control portion of the spinner.
Parameters:
start - specifies the start of the text selection.
end - specifies the end of the text selection.
Usage:

The select() method can be useful to require a user to replace some invalid text.

See Also:
AgcIntegerSpinnerField.selectAll(), JComponent.requestFocus(), AgcIntegerSpinnerField.getSelectionStart(), AgcIntegerSpinnerField.getSelectionEnd()

selectAll

public void selectAll()
Selects everything.
Example:

The following code fragment illustrates how to use the selectAll() method.

  ControlName1.selectAll();
 
See Also:
AgcIntegerSpinnerField.select(int,int)

getSelectionStart

public int getSelectionStart()
Returns an integer that represents the beginning of the user's selection in the control.
Usage:

Returns the starting character index of the current selection.

Example:

The following code fragment illustrates how to obtain the start of the currently selected text.

  int start;
  start = ControlName1.getSelectionStart();
 
See Also:
AgcIntegerSpinnerField.getSelectionEnd(), AgcIntegerSpinnerField.select(int,int)

getSelectionEnd

public int getSelectionEnd()
Returns an integer that represents the end of the user's selection in the control.
Usage:

Returns the ending character index of the current selection.

Example:

The following code fragment illustrates how to obtain the end of the currently selected text.

  int end;
  end = ControlName1.getSelectionEnd();
 
See Also:
AgcIntegerSpinnerField.getSelectionStart(), AgcIntegerSpinnerField.select(int,int)

getSelectedText

public String getSelectedText()
Returns a String containing the current selection.
Usage:

The getSelectedText() method affects the textbox portion of the control only. For drop-down or combobox style controls, it does not affect the listbox portion.

Example:

The following code fragment illustrates how to obtain the currently selected text.

  String s;
  s = ControlName1.getSelectedText();
 
See Also:
AgcIntegerSpinnerField.getSelectionStart(), AgcIntegerSpinnerField.getSelectionEnd()

getText

public String getText()
Returns a String that contains the control's text.
Example:

The following code fragment illustrates how to call getText().

   String s;
   s = ControlName1.getText();
 
See Also:
AgcIntegerSpinnerField.setText(String)

setText

public void setText(String value)
Assigns the control's text.
Parameters:
value - specifies the text to assign to the control.
Usage:

For the AgcChoice and AgcComboBox controls, this method programmatically assigns the selected row, but does not update or modify the text. Use getText() to obtain the control's text at runtime.

Example:

The following code fragment illustrates how to use the setText() method.

  ControlName1.setText("Add");
 
See Also:
AgcIntegerSpinnerField.getText()

getDisplayPattern

public String getDisplayPattern()
Returns a String that identifies the pattern that the control uses to display the data.
Usage:
For information on display patterns and styles, see Formatting Patterns and Styles in the online General Reference.

Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.

Example:
  String pattern;
  pattern = ControlName1.getDisplayPattern();
 
See Also:
AgcIntegerSpinnerField.setDisplayPattern(String), AgcIntegerSpinnerField.getDisplayStyle(), AgcIntegerSpinnerField.setDisplayStyle(int)

setDisplayPattern

public void setDisplayPattern(String pattern)
Assigns the control's display format.
Parameters:
pattern - specifies the pattern.
Usage:
For information on display patterns and styles, see Formatting Patterns and Styles in the online General Reference. For Integer and Floating Point fields, see also DecimalFormat. For Time, Date and Timestamp fields, see also SimpleDateFormat.

Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.

Example:
 ControlName1.setDisplayPattern("$#,##0.00;($#,##0.00)");
 
See Also:
AgcIntegerSpinnerField.getDisplayPattern(), AgcIntegerSpinnerField.setDisplayStyle(int)

getDisplayStyle

public int getDisplayStyle()
Obtains the control's display style.
Usage:
For information on display patterns and styles, see Formatting Patterns and Styles in the online General Reference.

Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.

Example:
  int style;
  style = ControlName1.getDisplayStyle();
 
See Also:
AgcIntegerSpinnerField.setDisplayStyle(int), AgcIntegerSpinnerField.getDisplayPattern()

setDisplayStyle

public void setDisplayStyle(int style)
Assigns the control's display style.
Parameters:
style - specifies a Style constant.
Usage:
For information on display patterns and styles, see Formatting Patterns and Styles in the online General Reference.

A note about the numeric style PERCENTSTYLE: "63%" represents a value of .63, not 63. So this style makes little sense for integer fields (it could only display 100%, 200%, etc).

Note that a display pattern overrides a display style. If the display pattern is null, then the display style is used.

Example:
  ControlName1.setDisplayStyle(AgFormat.CURRENCYSTYLE);
 
See Also:
AgcIntegerSpinnerField.getDisplayStyle(), AgcIntegerSpinnerField.setDisplayPattern(String)

getValue

public int getValue()
Get the field value as a primitive integer.
Example:
  int value;
  value = ControlName1.getValue();
 
See Also:
AgcIntegerSpinnerField.setValue(int)

setValue

public void setValue(int value)
Assigns the control's value.
Parameters:
value - specifies the value to assign to the control.
Example:

The following code fragment illustrates how to set the current value of an Integer Spinner field to four.

  ControlName1.setValue(4);
 
See Also:
AgcIntegerSpinnerField.getValue()

getIntegerValue

public Integer getIntegerValue()

setIntegerValue

public void setIntegerValue(Integer value)

getMaxValue

public int getMaxValue()
Returns an integer that represents the highest value that the control can be set to.
Usage:

Use the setMaxValue() method to assign this value.

Example:

The following code fragment illustrates how to obtain the maximum value.

  int MaxValue;
  MaxValue = ControlName1.getMaxValue();
 
See Also:
AgcIntegerSpinnerField.getMinValue(), AgcIntegerSpinnerField.setMaxValue(int), AgcIntegerSpinnerField.setMinValue(int)

getMinValue

public int getMinValue()
Returns an integer that represents the lowest value that the control can be set to.
Usage:

Use the setMinValue() method to assign this value.

Example:

The following code fragment illustrates how to obtain the minimum value.

  int MinValue;
  MinValue = ControlName1.getMinValue();
 
See Also:
AgcIntegerSpinnerField.getMaxValue(), AgcIntegerSpinnerField.setMinValue(int), AgcIntegerSpinnerField.setMaxValue(int)

setMaxValue

public void setMaxValue(int value)
Assigns the highest int value that the control can be set to.
Parameters:
value - specifies the control's maximum value.
Usage:

If the user tries to enter a larger value, a ValidationFailed event is fired. Use the constant AgcIntegerSpinnerField.NO_LIMIT to disable the limit.

Example:

The following code fragment illustrates how to assign a maximum value to the Integer Spinner control.

  ControlName1.setMaxValue(5);
 
See Also:
AgcIntegerSpinnerField.NO_LIMIT, AgcIntegerSpinnerField.getMaxValue(), AgcIntegerSpinnerField.setMinValue(int)

setMinValue

public void setMinValue(int value)
Assigns the lowest int value that the control can be set to.
Parameters:
value - an integer that represents the lowest value that the control can be set to.
Usage:

If the user tries to enter a lower value, a ValidationFailed event is fired. Use the constant AgcIntegerSpinnerField.NO_LIMIT to disable the limit.

Example:

The following code fragment illustrates how to assign a minimum value to an Integer Spinner control (AgcIntegerSpinnerField).

  ControlName1.setMinValue(5);
 
See Also:
AgcIntegerSpinnerField.NO_LIMIT, AgcIntegerSpinnerField.getMaxValue(), AgcIntegerSpinnerField.setMaxValue(int), AgcIntegerSpinnerField.getMinValue()

SilverStream
Application Server 3.5