Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.validators
Class ValidatorSpecialChar


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

public class ValidatorSpecialChar
extends Object
implements ISystemValidator

This class is used in dialogs that prompt for string, where the string is not allowed to content special characters, as supplied to this class. The IInputValidator interface is used by jface's InputDialog class and numerous other platform and system classes.


Field Summary
protected   SystemMessage currentMessage
           
static boolean EMPTY_ALLOWED_NO
           
static boolean EMPTY_ALLOWED_YES
           
protected   SystemMessage msg_Empty
           
protected   SystemMessage msg_Invalid
           
protected   StringBuffer specialChars
           
 
Constructor Summary
ValidatorSpecialChar ( String specialChars, boolean isEmptyAllowed)
          Constructor
ValidatorSpecialChar ( String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid)
          Constructor
ValidatorSpecialChar ( String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid, SystemMessage msg_Empty)
          Constructor
 
Method Summary
protected  boolean containsSpecialCharacters ( String newText)
           
protected   String doMessageSubstitution ( SystemMessage msg, String substitution)
          Helper method to substitute data into a message
 int getMaximumNameLength ()
          Return the max length for this name, or -1 if no max
  SystemMessage getSystemMessage ()
          When isValid returns non-null, call this to get the SystemMessage object for the error versus the simple string message.
protected   String getSystemMessageText ( SystemMessage msg)
          Helper method to set the current system message and return its level one text
  SystemMessage isSyntaxOk ( String newText)
          Override in child to do your own syntax checking.
  String isValid ( Object newValue)
          As required by ICellEditor
  String isValid ( String newText)
          Validate each character.
 void setErrorMessages ( SystemMessage msg_Empty, SystemMessage msg_Invalid)
          Supply your own error message text.
  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

EMPTY_ALLOWED_NO

public static final boolean EMPTY_ALLOWED_NO
See Also:
Constant Field Values

EMPTY_ALLOWED_YES

public static final boolean EMPTY_ALLOWED_YES
See Also:
Constant Field Values

specialChars

protected 
StringBuffer specialChars

msg_Invalid

protected 
SystemMessage msg_Invalid

msg_Empty

protected 
SystemMessage msg_Empty

currentMessage

protected 
SystemMessage currentMessage
Constructor Detail

ValidatorSpecialChar

public ValidatorSpecialChar(
String specialChars,
                            boolean isEmptyAllowed)
Constructor

Parameters:
specialChars - String containing special characters to test for.
isEmptyAllowed - true if an empty string is valid

ValidatorSpecialChar

public ValidatorSpecialChar(
String specialChars,
                            boolean isEmptyAllowed,
                            
SystemMessage msg_Invalid)
Constructor

Parameters:
specialChars - String containing special characters to test for.
isEmptyAllowed - true if an empty string is valid
msg_Invalid - error message when invalid characters entered

ValidatorSpecialChar

public ValidatorSpecialChar(
String specialChars,
                            boolean isEmptyAllowed,
                            
SystemMessage msg_Invalid,
                            
SystemMessage msg_Empty)
Constructor

Parameters:
specialChars - String containing special characters to test for.
isEmptyAllowed - true if an empty string is valid
msg_Invalid - error message when invalid characters entered
msg_Empty - error message when empty string
Method Detail

setErrorMessages

public void setErrorMessages(
SystemMessage msg_Empty,
                             
SystemMessage msg_Invalid)
Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.

Parameters:
msg_Empty - error message when entry field is empty or null if to keep the default
msg_Invalid - error message when value entered is not valid, or null if to keep the default

doMessageSubstitution

protected 
String doMessageSubstitution(
SystemMessage msg,
                                       
String substitution)
Helper method to substitute data into a message


getSystemMessageText

protected 
String getSystemMessageText(
SystemMessage msg)
Helper method to set the current system message and return its level one text


isValid

public 
String isValid(
String newText)
Validate each character.

Specified by:
isValid in interface IInputValidator

isValid

public 
String isValid(
Object newValue)
As required by ICellEditor

Specified by:
isValid in interface ICellEditorValidator

containsSpecialCharacters

protected boolean containsSpecialCharacters(
String newText)

isSyntaxOk

public 
SystemMessage isSyntaxOk(
String newText)
Override in child to do your own syntax checking.


getMaximumNameLength

public int getMaximumNameLength()
Return the max length for this name, or -1 if no max

Specified by:
getMaximumNameLength in interface ISystemValidator

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

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

RSE
Release 3.0

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire