RSE
Release 3.3

org.eclipse.rse.ui.validators
Class ValidatorIntegerInput

java.lang.Object
  extended by org.eclipse.rse.ui.validators.ValidatorIntegerInput
All Implemented Interfaces:
IInputValidator, ICellEditorValidator, ISystemValidator
Direct Known Subclasses:
ValidatorIntegerRangeInput, ValidatorPortInput

public class ValidatorIntegerInput
extends Object
implements ISystemValidator

For editable numeric properties. Ensures only digits are entered.


Field Summary
protected  boolean allowBlank
           
protected  SystemMessage currentMessage
           
protected  SystemMessage emptyMsg
           
protected  SystemMessage invalidMsg
           
protected  int number
           
 
Constructor Summary
ValidatorIntegerInput()
          Constructor to use when the default error messages are ok
ValidatorIntegerInput(SystemMessage emptyMsg)
          Constructor to use when wanting to specify the "value required" error message, but use the default for the "Value not valid" error message
ValidatorIntegerInput(SystemMessage emptyMsg, SystemMessage invalidMsg)
          Constructor to use when wanting to specify both error messages
 
Method Summary
 int getMaximumNameLength()
          Return the max length for this name, or -1 if no max.
 int getNumber()
          If validation is true, you can call this to get the input as a number
 SystemMessage getSystemMessage()
          When isValid returns non-null, call this to get the SystemMessage object for the error versus the simple string message.
 String isValid(Object input)
           
 String isValid(String input)
           
 void setBlankAllowed(boolean allowBlank)
          Specify if an empty field is ok or not.
 void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
          Set the error messages, overriding the defaults
 SystemMessage validate(String text)
          For convenience, this is a shortcut to calling: if (isValid(text) !
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowBlank

protected boolean allowBlank

number

protected int number

emptyMsg

protected SystemMessage emptyMsg

invalidMsg

protected SystemMessage invalidMsg

currentMessage

protected SystemMessage currentMessage
Constructor Detail

ValidatorIntegerInput

public ValidatorIntegerInput()
Constructor to use when the default error messages are ok

See Also:
setBlankAllowed(boolean)

ValidatorIntegerInput

public ValidatorIntegerInput(SystemMessage emptyMsg)
Constructor to use when wanting to specify the "value required" error message, but use the default for the "Value not valid" error message

See Also:
setBlankAllowed(boolean)

ValidatorIntegerInput

public ValidatorIntegerInput(SystemMessage emptyMsg,
                             SystemMessage invalidMsg)
Constructor to use when wanting to specify both error messages

See Also:
setBlankAllowed(boolean)
Method Detail

setBlankAllowed

public void setBlankAllowed(boolean allowBlank)
Specify if an empty field is ok or not. The default is not, and will result in an error message.


setErrorMessages

public void setErrorMessages(SystemMessage emptyMsg,
                             SystemMessage invalidMsg)
Set the error messages, overriding the defaults


isValid

public String isValid(Object input)
Specified by:
isValid in interface ICellEditorValidator
See Also:
ICellEditorValidator.isValid(java.lang.Object)

isValid

public String isValid(String input)
Specified by:
isValid in interface IInputValidator
See Also:
IInputValidator.isValid(java.lang.String), getSystemMessage()

getSystemMessage

public SystemMessage getSystemMessage()
When isValid returns non-null, call this to get the SystemMessage object for the error versus the simple string message.

Specified by:
getSystemMessage in interface ISystemValidator

getMaximumNameLength

public int getMaximumNameLength()
Return the max length for this name, or -1 if no max. For integers, the maximum is +- 2 to the 16th, so we set the max at 11 (to include the sign).

Specified by:
getMaximumNameLength in interface ISystemValidator

validate

public SystemMessage validate(String text)
For convenience, this is a shortcut to calling:

  if (isValid(text) != null)
    msg = getSystemMessage();
 

Specified by:
validate in interface ISystemValidator

getNumber

public int getNumber()
If validation is true, you can call this to get the input as a number


RSE
Release 3.3

Copyright (c) IBM Corporation and others 2000, 2011. All Rights Reserved.