Package com.iizigo.validator
Class ControlValidator
java.lang.Object
com.iizigo.validator.ValidationAdapter
com.iizigo.validator.ControlValidator
- All Implemented Interfaces:
IValidator,EventListener,org.eclipse.swt.events.FocusListener,org.eclipse.swt.events.ModifyListener,org.eclipse.swt.events.SelectionListener,org.eclipse.swt.events.VerifyListener,org.eclipse.swt.internal.SWTEventListener
public class ControlValidator extends ValidationAdapter implements org.eclipse.swt.events.ModifyListener, org.eclipse.swt.events.VerifyListener, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.events.FocusListener
Control validator class for dialog boxes.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFlags.static final intstatic final intstatic final intFields inherited from class com.iizigo.validator.ValidationAdapter
hasBeenModifiedMethod Summary
Modifier and TypeMethodDescriptionvoidfocusGained(org.eclipse.swt.events.FocusEvent e) Sent when a control gets focus.voidfocusLost(org.eclipse.swt.events.FocusEvent e) Sent when a control loses focus.static org.eclipse.swt.graphics.ImagegetImage(int type) Gets the required image.Gets the message.intGets the type of message (ERROR, WARNING, INFORMATION or NONE).voidmodifyText(org.eclipse.swt.events.ModifyEvent e) Handles modifications.voidreset()Resets the validator before performing all validations in the manager.voidsetAtomNameValidator(PropCnr container, GProp<?> property, boolean allowLeadingDollar) Assigns the callback to be an Atom Name Validator.voidsetDecoratedControl(org.eclipse.swt.widgets.Control control) Place the control decorator on this component instead of the control.setErrorMessage(String message) Sets an error message.setInformationMessage(String message) Sets a warning message.setRequiredMessage(String message) Sets a required message.voidsetType(int flags) Sets the type.voidSets the description and flags.voidsetValidatorCallback(ValidatorCallback callback) Sets the callback validator.setWarningMessage(String message) Sets a warning message.booleanvalidate()Performs validation.voidverifyText(org.eclipse.swt.events.VerifyEvent e) Verifies input for for upper case and numeric only.voidwidgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) Not processed.voidwidgetSelected(org.eclipse.swt.events.SelectionEvent e) Selection changes (spinner).Methods inherited from class com.iizigo.validator.ValidationAdapter
hasBeenModified, setModified
Field Details
MUST_BE_SPECIFIED
public static final int MUST_BE_SPECIFIEDFlags.- See Also:
UPPER_CASE
public static final int UPPER_CASE- See Also:
LOWER_CASE
public static final int LOWER_CASE- See Also:
NUMERIC_ONLY
public static final int NUMERIC_ONLY- See Also:
NUMERIC_INT_RANGE
public static final int NUMERIC_INT_RANGE- See Also:
CHECK_FOCUS_LOST
public static final int CHECK_FOCUS_LOST- See Also:
Method Details
getImage
public static org.eclipse.swt.graphics.Image getImage(int type) Gets the required image.- Parameters:
type- Image type: NONE, INFORMATION, WARNING or ERROR.
setDecoratedControl
public void setDecoratedControl(org.eclipse.swt.widgets.Control control) Place the control decorator on this component instead of the control.- Parameters:
control- The control, if e.g. a composite is wrapping an entry field.
setValidatorCallback
Sets the callback validator.setType
Sets the description and flags.setType
public void setType(int flags) Sets the type.getMessage
Gets the message.- Specified by:
getMessagein interfaceIValidator
setRequiredMessage
Sets a required message.setInformationMessage
Sets a warning message.setWarningMessage
Sets a warning message.setErrorMessage
Sets an error message.getMessageType
public int getMessageType()Gets the type of message (ERROR, WARNING, INFORMATION or NONE).- Specified by:
getMessageTypein interfaceIValidator
modifyText
public void modifyText(org.eclipse.swt.events.ModifyEvent e) Handles modifications.- Specified by:
modifyTextin interfaceorg.eclipse.swt.events.ModifyListener
verifyText
public void verifyText(org.eclipse.swt.events.VerifyEvent e) Verifies input for for upper case and numeric only.- Specified by:
verifyTextin interfaceorg.eclipse.swt.events.VerifyListener
widgetSelected
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) Selection changes (spinner).- Specified by:
widgetSelectedin interfaceorg.eclipse.swt.events.SelectionListener
widgetDefaultSelected
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) Not processed.- Specified by:
widgetDefaultSelectedin interfaceorg.eclipse.swt.events.SelectionListener
reset
public void reset()Resets the validator before performing all validations in the manager.- Specified by:
resetin interfaceIValidator
validate
public boolean validate()Performs validation.- Specified by:
validatein interfaceIValidator- Returns:
- true for success, false for failure.
setAtomNameValidator
Assigns the callback to be an Atom Name Validator.- Parameters:
container- Property container where the name must not exist, null for no check.property- The property (name) being edited, null for none.allowLeadingDollar- Flag indicating leading dollar is allowed or not.
focusGained
public void focusGained(org.eclipse.swt.events.FocusEvent e) Sent when a control gets focus.- Specified by:
focusGainedin interfaceorg.eclipse.swt.events.FocusListener- Parameters:
e- An event containing information about the focus change.
focusLost
public void focusLost(org.eclipse.swt.events.FocusEvent e) Sent when a control loses focus.- Specified by:
focusLostin interfaceorg.eclipse.swt.events.FocusListener- Parameters:
e- An event containing information about the focus change.