superwaba.ext.xplat.ui
Class MultiEdit

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Container
              |
              +--superwaba.ext.xplat.ui.MultiEdit

public class MultiEdit
extends Container

MultiEdit is an Edit with support for multiple lines. A static scrollbar is added, but disabled/enabled as needed.

Here is an example showing an Edit control being used:

 import superwaba.ext.xplat.ui.MultiEdit;

 public class MyProgram extends MainWindow
 {
    MultiEdit mEdit;

    public void onStart()
    {
       // the constructor method is called with the mask, the number of lines
       // and the vertical interval in pixel between two lines
       mEdit = new MultiEdit("",3,1);
       add(mEdit,LEFT,TOP);
       // add/setRect must precede setText
       mEdit.setText("What text you want"); //eventually
    }
 }
 


Field Summary
static char ENTER
           
 int gap
           
 boolean hasCursorWhenNotEditable
          Set to false if you don't want the cursor to blink when the edit is not editable
protected  String mask
           
static MultiEditMenu menu
           
 
Fields inherited from class waba.ui.Container
BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, tail
 
Fields inherited from class waba.ui.Control
AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2
 
Constructor Summary
MultiEdit(int rowCount, int spaceBetweenLines)
          Constructor for a text Edit with a vertical scroll Bar, gap is 1 by default and control's bounds must be given with a setRect.
MultiEdit(String mask, int rowCount, int spaceBetweenLines)
          Constructor for a text Edit with a vertical scroll Bar, gap is 1 by default and control's bounds must be given with a setRect.
 
Method Summary
protected  void draw(Graphics g, boolean cursorOnly)
           
 int getNumberOfTextLines()
          Gets total number of lines in the text
 int getPreferredHeight()
          Returns the preffered height of this control.
 int getPreferredWidth()
          Returns the preffered width of this control.
 String getText()
          Returns the text displayed in the edit control.
 boolean isEditable()
          Gets if the control accepts input from the user
protected  void onBoundsChanged()
          Called after an setRect.
protected  void onColorsChanged(boolean colorsChanged)
          Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
 void onEvent(Event event)
          Called by the system to pass events to the edit control.
protected  void onFontChanged()
          Called after a setFont
 void onPaint(Graphics g)
          Draws the border (if any).
protected  void onWindowPaintFinished()
          Called after the window has finished a paint.
protected  void popPosState()
           
 void popupKCC()
          user method to popup the keyboard/calendar/calculator for this edit.
 void popupMenu()
           
protected  void pushPosState()
           
 void restoreText()
          Restores the contents of this TextArea from the file MEme.PROV.DATA.
 void saveText()
          Saves the contents of this TextArea to the file MEme.PROV.DATA.
 void setCapitaliseMode(byte cap)
          Sets the capitalise settings for this MultiEdit.
 void setDrawDots(boolean on)
          If true, a dotted line appears under each row of text (on by default)
 void setEditable(boolean on)
          Sets if the control accepts input from the user
 void setKeyboard(byte kbd)
          Used to change the default keyboard to be used with this Edit control.
 void setMaxLength(int length)
          Sets the desired maximum length for text entered in the Edit.
 void setNumberOfRows(int rowCount)
          Used to set the number of rows of this MultiEdit.
 void setRect(int x, int y, int width, int height)
          Sets the rect for this MultiEdit.
 void setText(String s)
          Sets the text displayed in the edit control.
 void setValidChars(String validCharsString)
          sets the valid chars that can be entered in this edit. if null is passed, any char can be entered. (case insensitive). added by guich
 
Methods inherited from class waba.ui.Container
add, add, add, broadcastEvent, findChild, getChildren, getClientRect, onStart, paintChildren, remove, setBorderStyle, setEnabled
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

ENTER

public static final char ENTER

hasCursorWhenNotEditable

public boolean hasCursorWhenNotEditable
Set to false if you don't want the cursor to blink when the edit is not editable

mask

protected String mask

menu

public static MultiEditMenu menu

gap

public int gap
Constructor Detail

MultiEdit

public MultiEdit(int rowCount,
                 int spaceBetweenLines)
Constructor for a text Edit with a vertical scroll Bar, gap is 1 by default and control's bounds must be given with a setRect. Space between lines may be 0.

MultiEdit

public MultiEdit(String mask,
                 int rowCount,
                 int spaceBetweenLines)
Constructor for a text Edit with a vertical scroll Bar, gap is 1 by default and control's bounds must be given with a setRect. Space between lines may be 0. The mask is used to compute the PREFERRED width of the control. Note that the mask does not masks the input. If mask is "", the FILL width is choosen.
Method Detail

getPreferredHeight

public int getPreferredHeight()
Description copied from class: Control
Returns the preffered height of this control.
Overrides:
getPreferredHeight in class Control

getPreferredWidth

public int getPreferredWidth()
Description copied from class: Control
Returns the preffered width of this control.
Overrides:
getPreferredWidth in class Control

setKeyboard

public void setKeyboard(byte kbd)
Used to change the default keyboard to be used with this Edit control. Use the constants Edit.KBD_NONE and Edit.KBD_KEYBOARD.

setDrawDots

public void setDrawDots(boolean on)
If true, a dotted line appears under each row of text (on by default)

setNumberOfRows

public void setNumberOfRows(int rowCount)
Used to set the number of rows of this MultiEdit. You must call setRect after this to resize the control in height

setCapitaliseMode

public void setCapitaliseMode(byte cap)
Sets the capitalise settings for this MultiEdit. Use Edit.ALL_NORMAL, Edit.ALL_UPPER and Edit.ALL_LOWER. Text entered will made as is, uppercase or lowercase

setValidChars

public void setValidChars(String validCharsString)
sets the valid chars that can be entered in this edit. if null is passed, any char can be entered. (case insensitive). added by guich

setMaxLength

public void setMaxLength(int length)
Sets the desired maximum length for text entered in the Edit. @since SuperWaba2.0beta4

getText

public String getText()
Returns the text displayed in the edit control.

setText

public void setText(String s)
Sets the text displayed in the edit control.

saveText

public void saveText()
Saves the contents of this TextArea to the file MEme.PROV.DATA. Used with command+S.

restoreText

public void restoreText()
Restores the contents of this TextArea from the file MEme.PROV.DATA. Used with command+R.

setEditable

public void setEditable(boolean on)
Sets if the control accepts input from the user

isEditable

public boolean isEditable()
Gets if the control accepts input from the user

getNumberOfTextLines

public int getNumberOfTextLines()
Gets total number of lines in the text

popupKCC

public void popupKCC()
user method to popup the keyboard/calendar/calculator for this edit.

popupMenu

public void popupMenu()

onBoundsChanged

protected void onBoundsChanged()
Description copied from class: Control
Called after an setRect.
Overrides:
onBoundsChanged in class Control

onEvent

public void onEvent(Event event)
Called by the system to pass events to the edit control.
Overrides:
onEvent in class Control
Tags copied from class: Control
Parameters:
event - the event to process
See Also:
Event, KeyEvent, PenEvent

draw

protected void draw(Graphics g,
                    boolean cursorOnly)

onWindowPaintFinished

protected void onWindowPaintFinished()
Description copied from class: Control
Called after the window has finished a paint.
Overrides:
onWindowPaintFinished in class Control

onPaint

public void onPaint(Graphics g)
Description copied from class: Container
Draws the border (if any). If you override this method, be sure to call super.onPaint(g);, or the border will not be drawn.
Overrides:
onPaint in class Container
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics

pushPosState

protected void pushPosState()

popPosState

protected void popPosState()

onColorsChanged

protected void onColorsChanged(boolean colorsChanged)
Description copied from class: Control
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
Overrides:
onColorsChanged in class Container

setRect

public void setRect(int x,
                    int y,
                    int width,
                    int height)
Sets the rect for this MultiEdit. Note that height is recomputed based in the value for rowCount given in the constructor if the height is PREFERRED
Overrides:
setRect in class Control

onFontChanged

protected void onFontChanged()
Description copied from class: Control
Called after a setFont
Overrides:
onFontChanged in class Control