Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class EditcodeEditwordFormatter

java.lang.Object
  extended by com.ibm.etools.iseries.ui.AbstractFormatter
      extended by com.ibm.etools.iseries.ui.EditcodeEditwordFormatter
All Implemented Interfaces:
Formatter, PropertyChangeListener, VetoableChangeListener, Serializable, EventListener

public class EditcodeEditwordFormatter
extends AbstractFormatter
implements PropertyChangeListener, VetoableChangeListener, Serializable

EditcodeEditwordFormatter extends AbstractFormatter. This formatter is particularly designed for AS/400 users to set the format of a string for JFormattedTextField, JFormattedLabel and JFormattedComboBox. It depends on the DataAttributes values and the editcode or editword property values to determine the format of a string. The following is a table of the available edit codes:

EditCode EditCodeParameterType Sample Positive Value Sample Negative Value Sample Zero Value (qdecfmtJValue is false) Sample Zero Value (qdecfmtJValue is true)
1 None 4,567.89 4,567.89 .00 0.00
1 Currency $4,567.89 $4,567.89 $.00 $0.00
1 Asterisk ****4,567.89 ****4,567.89 ********.00 *******0.00
2 None 4,567.89 4,567.89 blank blank
2 Currency $4,567.89 $4,567.89 blank blank
2 Asterisk ****4,567.89 ****4,567.89 *********** ***********
3 None 4567.89 4567.89 .00 0.00
3 Currency $4567.89 $4567.89 $.00 $0.00
3 Asterisk ****4567.89 ****4567.89 ********.00 *******0.00
4 None 4567.89 4567.89 blank blank
4 Currency $4567.89 $4567.89 blank blank
4 Asterisk ****4567.89 ****4567.89 *********** ***********
A None 4,567.89 4,567.89CR .00 0.00
A Currency $4,567.89 $4,567.89CR $.00 $0.00
A Asterisk ****4,567.89 ****4,567.89CR *********.00 ********0.00
B None 4,567.89 4,567.89CR blank blank
B Currency $4,567.89 $4,567.89CR blank blank
B Asterisk ****4,567.89 ****4,567.89CR ************ ************
C None 4567.89 4567.89CR .00 0.00
C Currency $4567.89 $4567.89CR $.00 $0.00
C Asterisk ****4567.89 ****4567.89CR ********.00 *******0.00
D None 4567.89 4567.89CR blank blank
D Currency $4567.89 $4567.89CR blank blank
D Asterisk ****4567.89 ****4567.89CR *********** ***********
J None 4,567.89 4,567.89- .00 0.00
J Currency $4,567.89 $4,567.89- $.00 $0.00
J Asterisk ****4,567.89 ****4,567.89- *********.00 ********0.00
K None 4,567.89 4,567.89- blank blank
K Currency $4,567.89 $4,567.89- blank blank
K Asterisk ****4,567.89 ****4,567.89- ************ ************
L None 4567.89 4567.89- .00 0.00
L Currency $4567.89 $4567.89- $.00 $0.00
L Asterisk ****4567.89 ****4567.89- ********.00 *******0.00
M None 4567.89 4567.89- blank blank
M Currency $4567.89 $4567.89- blank blank
M Asterisk ****4567.89 ****4567.89- *********** ***********
N None 4,567.89 -4,567.89 .00 0.00
N Currency $4,567.89 -$4,567.89 $.00 $0.00
N Asterisk ****4,567.89 ****-4,567.89 *********.00 ********0.00
O None 4,567.89 -4,567.89 blank blank
O Currency $4,567.89 -$4,567.89 blank blank
O Asterisk *****4,567.89 ****-4,567.89 ************* *************
P None 4567.89 -4567.89 .00 0.00
P Currency $4567.89 -$4567.89 $.00 $0.00
P Asterisk *****4567.89 ****-4567.89 *********.00 ********0.00
Q None 4567.89 -4567.89 blank blank
Q Currency $4567.89 -$4567.89 blank blank
Q Asterisk *****4567.89 ****-4567.89 ************ ************
W None 4567/89 4567/89 0/00 0/00
X None 000456789 000456789- 000000000 000000000
Y None 01/23/2000 01/23/2000 0/00/0000 0/00/0000
Z None 456789 456789 blank blank

The following is a table of some sample editwords:

Sample Editword Data Type Unformatted Value Formatted Value
"bbb,bbb.bb" (b is a blank) Numeric 654321 6,543.21
"bbb,b0b.bb" Numeric 27 0.27
"0bb:bb:bb" Numeric 71223 07:12:23
"0bbb-bb-bbbb" Numeric 23456789 023-45-6789
"0bbb-bb-bbbb" Character bcdefghij 0bc-de-ghij
"0(bbb)&bbb-bbbb" Numeric 125529404 (012) 552-9404

You can select an editcode or specify an editword. If a non-zero ('0' or None) editcode as well as an editword are specified, then the editcode has precedence over the editword. If the editcode is set to '0' or None, and editword is not specified, then there will be no formatting.

See Also:
DefaultFormatter, AbstractFormatter, Formatter, Serialized Form

Field Summary
static String Copyright
           
static int EDITCODEPARM_ASTERISK
          Editcode parameter type is '*'
static int EDITCODEPARM_CURRENCY
          Editcode parameter type is the currency symbol
static int EDITCODEPARM_NONE
          Editcode parameter type is none.
protected  PropertyChangeSupport propertyChange
           
protected  VetoableChangeSupport vetoPropertyChange
           
 
Fields inherited from interface com.ibm.etools.iseries.ui.Formatter
copyright
 
Constructor Summary
EditcodeEditwordFormatter()
          Constructs a new EditcodeEditwordFormatter.
EditcodeEditwordFormatter(Attributes dataAttributes)
          Constructs a new EditcodeEditwordFormatter with the specified DataAttributes.
EditcodeEditwordFormatter(Attributes dataAttributes, char editCode, int editCodeParmType, String editWord)
          Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type and editword.
EditcodeEditwordFormatter(Attributes dataAttributes, char editCode, int editCodeParmType, String editWord, char currencySymbol, char thousandSeparator, char dateSeparator)
          Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator and dataSpearator.
EditcodeEditwordFormatter(Attributes dataAttributes, char editCode, int editCodeParmType, String editWord, char currencySymbol, char thousandSeparator, char dateSeparator, boolean qdecfmtJValue)
          Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator, dataSpearator and qdecfmtJValue.
EditcodeEditwordFormatter(Attributes dataAttributes, char editCode, int editCodeParmType, String editWord, String currencySymbolStr, char thousandSeparator, char dateSeparator)
          Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator and dataSpearator.
EditcodeEditwordFormatter(Attributes dataAttributes, char editCode, int editCodeParmType, String editWord, String currencySymbolStr, char thousandSeparator, char dateSeparator, boolean qdecfmtJValue)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addVetoableChangeListener(VetoableChangeListener l)
          Add a vetoableChangeListener.
static String Copyright()
          This method returns the copyright notice for this class.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          The firePropertyChange method was generated to support the propertyChange field.
 String formatString(String strInput)
          Return the formatted string given an unformatted string.
 char getCurrencySymbol()
          Gets the currencySymbol property (char) value.
 String getCurrencySymbolStr()
          Gets the currencySymbolStr property (String) value.
 Attributes getDataAttributes()
          Gets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 char getDateSeparator()
          Gets the dateSeparator property (char) value.
 char getEditCode()
          Gets the editCode property (char) value.
 int getEditCodeParmType()
          Gets the editCodeParmType property (int) value.
 String getEditWord()
          Gets the editWord property (java.lang.String) value.
protected  PropertyChangeSupport getPropertyChange()
          Accessor for the propertyChange field.
 boolean getQdecfmtJValue()
          Gets the qdecfmtJValue property (boolean) value.
 char getThousandSeparator()
          Gets the thousandSeparator property (char) value.
 void propertyChange(PropertyChangeEvent e)
          Examine the PropertyChangeEvent and decides what to do on a particular event.
 void removePropertyChangeListener(PropertyChangeListener l)
          Removes a propertyChangeListener.
 void removeVetoableChangeListener(VetoableChangeListener l)
          Removes a vetoableChangeListener.
 void setCurrencySymbol(char symbol)
          Sets the currencySymbol property (char) value.
 void setCurrencySymbolStr(String symbol)
          Sets the currencySymbolStr property (String) value.
 void setDataAttributes(Attributes a)
          Sets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 void setDateSeparator(char dateSep)
          Sets the dateSeparator property (char) value.
 void setEditCode(char code)
          Sets the editCode property (char) value.
 void setEditCodeParmType(int editCodeParameterType)
          Sets the editCodeParmType property (int) value.
 void setEditWord(String eWord)
          Sets the editWord property (java.lang.String) value.
 void setQdecfmtJValue(boolean value)
          Sets the qdecfmtJValue property (char) value.
 void setThousandSeparator(char thouSeparator)
          Sets the thousandSeparator property (char) value.
 void vetoableChange(PropertyChangeEvent e)
          This method gets called when a constrained property is changed.
 
Methods inherited from class com.ibm.etools.iseries.ui.AbstractFormatter
fireVetoableChange, getVetoPropertyChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

EDITCODEPARM_NONE

public static final int EDITCODEPARM_NONE
Editcode parameter type is none.

See Also:
Constant Field Values

EDITCODEPARM_ASTERISK

public static final int EDITCODEPARM_ASTERISK
Editcode parameter type is '*'

See Also:
Constant Field Values

EDITCODEPARM_CURRENCY

public static final int EDITCODEPARM_CURRENCY
Editcode parameter type is the currency symbol

See Also:
Constant Field Values

propertyChange

protected transient PropertyChangeSupport propertyChange

vetoPropertyChange

protected transient VetoableChangeSupport vetoPropertyChange
Constructor Detail

EditcodeEditwordFormatter

public EditcodeEditwordFormatter()
Constructs a new EditcodeEditwordFormatter.


EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes)
Constructs a new EditcodeEditwordFormatter with the specified DataAttributes. Please note that the parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes

EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes,
                                 char editCode,
                                 int editCodeParmType,
                                 String editWord)
Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type and editword. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
editCode - char
editCodeParmType - int
editWord - java.lang.String

EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes,
                                 char editCode,
                                 int editCodeParmType,
                                 String editWord,
                                 char currencySymbol,
                                 char thousandSeparator,
                                 char dateSeparator)
Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator and dataSpearator. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
editCode - char
editCodeParmType - int
editWord - java.lang.String
currencySymbol - char
thousandSeparator - char
dateSeparator - char

EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes,
                                 char editCode,
                                 int editCodeParmType,
                                 String editWord,
                                 String currencySymbolStr,
                                 char thousandSeparator,
                                 char dateSeparator)
Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator and dataSpearator. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
editCode - char
editCodeParmType - int
editWord - java.lang.String
currencySymbolStr - String
thousandSeparator - char
dateSeparator - char

EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes,
                                 char editCode,
                                 int editCodeParmType,
                                 String editWord,
                                 char currencySymbol,
                                 char thousandSeparator,
                                 char dateSeparator,
                                 boolean qdecfmtJValue)
Constructs a new EditcodeEditwordFormatter with the specified DataAttributes, editcode, editcode parameter type, editword, currencySymbol, thousandSeparator, dataSpearator and qdecfmtJValue. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
editCode - char
editCodeParmType - int
editWord - java.lang.String
currencySymbol - char
thousandSeparator - char
dateSeparator - char
qdecfmtJValue - boolean

EditcodeEditwordFormatter

public EditcodeEditwordFormatter(Attributes dataAttributes,
                                 char editCode,
                                 int editCodeParmType,
                                 String editWord,
                                 String currencySymbolStr,
                                 char thousandSeparator,
                                 char dateSeparator,
                                 boolean qdecfmtJValue)
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener l)
Add a vetoableChangeListener.

Overrides:
addVetoableChangeListener in class AbstractFormatter
Parameters:
l - java.beans.VetoableChangeListener

Copyright

public static String Copyright()
This method returns the copyright notice for this class.

Returns:
java.lang.String

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
The firePropertyChange method was generated to support the propertyChange field.


formatString

public String formatString(String strInput)
Return the formatted string given an unformatted string. The system's decimal point symbol is used to find the decimal point. A number typed in by an end user can be formatted based on the end user's system's decimal point symbol. Only a sign character, a decimal symbol character, and numerals are allowed in the input string.

Specified by:
formatString in interface Formatter
Specified by:
formatString in class AbstractFormatter
Parameters:
strInput - String
Returns:
formatted string

getCurrencySymbol

public char getCurrencySymbol()
Gets the currencySymbol property (char) value.

Returns:
The currencySymbol property value.
See Also:
setCurrencySymbol(char)

getCurrencySymbolStr

public String getCurrencySymbolStr()
Gets the currencySymbolStr property (String) value.

Returns:
The currencySymbol property value.
See Also:
setCurrencySymbolStr(java.lang.String)

getDataAttributes

public Attributes getDataAttributes()
Gets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.

Specified by:
getDataAttributes in interface Formatter
Specified by:
getDataAttributes in class AbstractFormatter
Returns:
The dataAttributes property value.
See Also:
setDataAttributes(com.ibm.etools.iseries.ui.Attributes)

getDateSeparator

public char getDateSeparator()
Gets the dateSeparator property (char) value.

Returns:
The dateSeparator property value.
See Also:
setDateSeparator(char)

getEditCode

public char getEditCode()
Gets the editCode property (char) value.

Returns:
The editCode property value.
See Also:
setEditCode(char)

getEditCodeParmType

public int getEditCodeParmType()
Gets the editCodeParmType property (int) value.

Returns:
The editCodeParmType property value.
See Also:
setEditCodeParmType(int)

getEditWord

public String getEditWord()
Gets the editWord property (java.lang.String) value.

Returns:
The editWord property value.
See Also:
setEditWord(java.lang.String)

getPropertyChange

protected PropertyChangeSupport getPropertyChange()
Accessor for the propertyChange field.


getThousandSeparator

public char getThousandSeparator()
Gets the thousandSeparator property (char) value.

Returns:
The thousandSeparator property value.
See Also:
setThousandSeparator(char)

propertyChange

public void propertyChange(PropertyChangeEvent e)
Examine the PropertyChangeEvent and decides what to do on a particular event.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - java.beans.PropertyChangeEvent

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Removes a propertyChangeListener.

Parameters:
l - PropertyChangeListener

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener l)
Removes a vetoableChangeListener.

Overrides:
removeVetoableChangeListener in class AbstractFormatter
Parameters:
l - java.beans.VetoableChangeListener

setCurrencySymbol

public void setCurrencySymbol(char symbol)
Sets the currencySymbol property (char) value.

Parameters:
currencySymbol - The new value for the property.
See Also:
getCurrencySymbol()

setCurrencySymbolStr

public void setCurrencySymbolStr(String symbol)
Sets the currencySymbolStr property (String) value.

Parameters:
currencySymbolStr - The new value for the property.
See Also:
getCurrencySymbolStr()

setDataAttributes

public void setDataAttributes(Attributes a)
                       throws PropertyVetoException
Sets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value. Please note that the parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Specified by:
setDataAttributes in interface Formatter
Specified by:
setDataAttributes in class AbstractFormatter
Parameters:
dataAttributes - The new value for the property.
Throws:
PropertyVetoException
See Also:
getDataAttributes()

setDateSeparator

public void setDateSeparator(char dateSep)
Sets the dateSeparator property (char) value.

Parameters:
dateSeparator - The new value for the property.
See Also:
getDateSeparator()

setEditCode

public void setEditCode(char code)
                 throws PropertyVetoException
Sets the editCode property (char) value.

Parameters:
editCode - The new value for the property.
Throws:
PropertyVetoException
See Also:
getEditCode()

setEditCodeParmType

public void setEditCodeParmType(int editCodeParameterType)
                         throws PropertyVetoException
Sets the editCodeParmType property (int) value.

Parameters:
editCodeParmType - The new value for the property.
Throws:
PropertyVetoException
See Also:
getEditCodeParmType()

setEditWord

public void setEditWord(String eWord)
Sets the editWord property (java.lang.String) value.

Parameters:
editWord - The new value for the property.
See Also:
getEditWord()

setThousandSeparator

public void setThousandSeparator(char thouSeparator)
Sets the thousandSeparator property (char) value.

Parameters:
thousandSeparator - The new value for the property.
See Also:
getThousandSeparator()

vetoableChange

public void vetoableChange(PropertyChangeEvent e)
                    throws PropertyVetoException
This method gets called when a constrained property is changed.

Specified by:
vetoableChange in interface VetoableChangeListener
Parameters:
e - java.beans.PropertyChangeEvent a PropertyChangeEvent object describing the event source and the property that has changed.
Throws:
PropertyVetoException - if the recipient wishes the property change to be rolled back.

getQdecfmtJValue

public boolean getQdecfmtJValue()
Gets the qdecfmtJValue property (boolean) value. When qdecfmtJValue is true, the zero suppression will work as if the JValue of QDECFMT system value is set.

Returns:
The qdecfmtJValue property value.
See Also:
setQdecfmtJValue(boolean)

setQdecfmtJValue

public void setQdecfmtJValue(boolean value)
Sets the qdecfmtJValue property (char) value.

Parameters:
value - True for J value of QDECFMT system value is set, false for J value of QDECFMT system value is not set,
See Also:
getQdecfmtJValue()

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.