Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class EditmaskPlainView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.PlainView
          extended by com.ibm.etools.iseries.ui.EditmaskPlainView
All Implemented Interfaces:
SwingConstants, TabExpander

public class EditmaskPlainView
extends PlainView

EditmaskPlainView extends PlainView. It serves as the view model in an MVC relationship of JFormattedTextField. EditmaskPlainView can change the view to an editmask setting. For example, if editword is set to "(bbb)bbb-bbbb" (where b is a blank), and editmask is "&bbb&bbb&bbbb", the view of the field will be "(bbb)bbb-bbbb". This forces the characters that correspond to the '&'s in the editmask to be anchored in the field. Thus, the parentheses ( and ), and hyphen (-) characters will be part of the view and the field will show "(bbb)bbb-bbbb" before you enter any data into the field. When you enter data in the JFormattedTextField, the cursor will automatically skip over the parentheses ( and ), and hyphen (-) editmask characters.

See Also:
EditmaskAttributes, EditmaskViewBasicTextFieldUI, EditmaskViewMetalTextFieldUI, EditmaskViewWindowsTextFieldUI

Field Summary
static String Copyright
           
 
Fields inherited from class javax.swing.text.PlainView
metrics
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
EditmaskPlainView(Element elem)
          Constructs a new EditmaskPlainView with the specified Element.
EditmaskPlainView(Element elem, EditmaskAttributes attributes)
          Constructs a new EditmaskPlainView with the specified Element and EditmaskAttributes Please note that the second parameter must be an instance of com.ibm.etools.iseries.ui.EditmaskAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.
 
Method Summary
static String Copyright()
          This method returns the copyright notice for this class.
protected  int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
          Renders the given range in the model as normal unselected text.
 EditmaskAttributes getEditmaskAttributes()
          Gets the editmaskAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 String getFormattedText()
          Return the input text in the format of an editmask view.
protected  Rectangle lineToRect(Shape s, int line)
          Form the rectangular shape of the text field.
 Shape modelToView(int pos, Shape a, Position.Bias b)
          Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
 void setEditmaskAttributes(EditmaskAttributes attrib)
          Sets the editmaskAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 void setFormattedText(String formatText)
          Replace formatted text.
 
Methods inherited from class javax.swing.text.PlainView
changedUpdate, damageLineRange, drawLine, drawSelectedText, getLineBuffer, getPreferredSpan, getTabSize, insertUpdate, nextTabStop, paint, removeUpdate, setSize, updateDamage, updateMetrics, viewToModel
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, updateChildren, updateLayout, viewToModel
 
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
Constructor Detail

EditmaskPlainView

public EditmaskPlainView(Element elem)
Constructs a new EditmaskPlainView with the specified Element.

Parameters:
elem - javax.swing.text.Element

EditmaskPlainView

public EditmaskPlainView(Element elem,
                         EditmaskAttributes attributes)
Constructs a new EditmaskPlainView with the specified Element and EditmaskAttributes Please note that the second parameter must be an instance of com.ibm.etools.iseries.ui.EditmaskAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
elem - javax.swing.text.Element
attributes - com.ibm.etools.iseries.ui.EditmaskAttributes
Method Detail

Copyright

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

Returns:
java.lang.String

drawUnselectedText

protected int drawUnselectedText(Graphics g,
                                 int x,
                                 int y,
                                 int p0,
                                 int p1)
                          throws BadLocationException
Renders the given range in the model as normal unselected text.

Overrides:
drawUnselectedText in class PlainView
Parameters:
g - the graphics context
x - the starting X coordinate >= 0
y - the starting Y coordinate >= 0
p0 - the beginning position in the model >= 0
p1 - the ending position in the model >= 0
Returns:
int
Throws:
BadLocationException - If the range is invalid.

getEditmaskAttributes

public EditmaskAttributes getEditmaskAttributes()
Gets the editmaskAttributes property (com.ibm.etools.iseries.ui.Attributes) value.

Returns:
The editmaskAttributes property value.
See Also:
setEditmaskAttributes(com.ibm.etools.iseries.ui.EditmaskAttributes)

getFormattedText

public String getFormattedText()
Return the input text in the format of an editmask view.

Returns:
java.lang.String

lineToRect

protected Rectangle lineToRect(Shape s,
                               int line)
Form the rectangular shape of the text field.

Overrides:
lineToRect in class PlainView
Parameters:
a - java.awt.Shape
line - int
Returns:
java.awt.Rectangle

modelToView

public Shape modelToView(int pos,
                         Shape a,
                         Position.Bias b)
                  throws BadLocationException
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.

Overrides:
modelToView in class PlainView
Parameters:
pos - the position to convert >= 0
a - the allocated region to render into
Returns:
the bounding box of the given position
Throws:
BadLocationException - if the given position does not represent a valid location in the associated document
See Also:
View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)

setEditmaskAttributes

public void setEditmaskAttributes(EditmaskAttributes attrib)
Sets the editmaskAttributes property (com.ibm.etools.iseries.ui.Attributes) value. Please note that the parameter must be an instance of com.ibm.etools.iseries.ui.EditmaskAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
editmaskAttributes - The new value for the property.
See Also:
getEditmaskAttributes()

setFormattedText

public void setFormattedText(String formatText)
Replace formatted text.

Parameters:
formatText - java.lang.String

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.