jMobileCore toolkit

com.jmobilecore.ui
Class IPv4Field

java.lang.Object
  extended by com.jmobilecore.ui.core.Component
      extended by com.jmobilecore.ui.core.TextComponent
          extended by com.jmobilecore.ui.core.TextField
              extended by com.jmobilecore.ui.IPv4Field

public class IPv4Field
extends TextField

This class displays one or two fields for the entry a TCP/IP address in specifield format

Author:
Igor Shevlyakov - initial implementation, Greg Gridin - redesign

Field Summary
static byte IP_ONLY
          IP address and no port information to display
static byte IP_PORT
          IP address and port information to display
 byte STYLE
          The current IPField formatting style.
 
Fields inherited from class com.jmobilecore.ui.core.TextField
adjustment, calculatedCaretPosition, calculatedCursorOffset, composer, currentLength, DEFAULT_SIZE, echoChar, HOFFSET, SCROLLABLE, VOFFSET
 
Fields inherited from class com.jmobilecore.ui.core.TextComponent
ALL_SPEC_CHARS, BORDER_GAP, BORDER_WIDTH, C_ALL_SPEC_CHARS, C_ALPHA, C_ALPHA_NUMERIC, C_ANY, C_EMAIL, C_EMAIL_SPEC_CHARS, C_LOWER_CASE, C_NO_CHARS, C_NUMERIC, C_SPACE, C_UPPER_CASE, cHandler, CHAR_OPTIONS, charOptionCounter, constraint, CURSOR_DELAY, CURSOR_TYPE_LINE, CURSOR_TYPE_SYMBOL, editable, EMAIL_SPEC_CHARS, insertMode, KEY_OPTIONS, lastKeyCode, LC_CHARS, NUMERIC_CHARS, SPACE_CHARS, UC_CHARS, validChars
 
Fields inherited from class com.jmobilecore.ui.core.Component
alignment, background, CENTER, focusable, focusedBackground, focusedForeground, font, foreground, height, isCompletelyVisible, isFocused, isVisible, LEFT, parentScreen, RIGHT, screenY, valid, width
 
Constructor Summary
IPv4Field()
          Constructs a new IPv4Field object.
IPv4Field(byte style)
          Constructs a new IPv4Field object of specified format.
IPv4Field(byte style, int host, int port)
          Constructs a new IPv4Field object of specified format and sets it to the specified value.
 
Method Summary
 java.lang.String getFormattedText()
          Get formatted representation of Ipv4Field value or null if IPv4Field object value is set to null or incomplete
protected  char[] getFormattedText(boolean calcCursorOffset)
           
 java.lang.String getHost()
          Returns the string representation of TCP/IP address host value that is presented by this component.
 int getIPv4Host()
          Returns the TCP/IP address host value that is presented by this component.
 long getIPv4Port()
          Returns the TCP/IP address port value that is presented by this component.
 java.lang.String getPort()
          Returns the string representation of TCP/IP address port value that is presented by this component.
protected  CustomFieldComposer initComposer()
          Initialize IPv4 field composer
 boolean isValid()
          Tests IPv4 field value for correctness
 boolean setIPv4(int host, long port)
          Sets the TCP/IP address that is presented by this IPv4 component to be the specified value.
 
Methods inherited from class com.jmobilecore.ui.core.TextField
adjust, destructor, getComposer, getCursorOffset, getText, init, keyPressed, paint, paintCursor, setHeight, setText
 
Methods inherited from class com.jmobilecore.ui.core.TextComponent
addValidChars, getCaretPosition, getKeyOption, initCursor, isCharValid, preProcessKeyCode, processKeyCode, resetCursor, resetCursorHandler, setCaretPosition
 
Methods inherited from class com.jmobilecore.ui.core.Component
getBackground, getFont, getForeground, getHeight, getWidth, invalidate, isFocusOwner, keyReleased, keyRepeated, paintBackground, pointerDragged, pointerPressed, pointerReleased, prepareForeground, releaseFocus, requestFocus, setFont
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IP_ONLY

public static final byte IP_ONLY
IP address and no port information to display

See Also:
Constant Field Values

IP_PORT

public static final byte IP_PORT
IP address and port information to display

See Also:
Constant Field Values

STYLE

public final byte STYLE
The current IPField formatting style.

Constructor Detail

IPv4Field

public IPv4Field()
Constructs a new IPv4Field object.


IPv4Field

public IPv4Field(byte style)
Constructs a new IPv4Field object of specified format.

Parameters:
style - the IP address format

IPv4Field

public IPv4Field(byte style,
                 int host,
                 int port)
Constructs a new IPv4Field object of specified format and sets it to the specified value.

Parameters:
style - the IP address format
host - the IP address host value
port - the IP address port value
Method Detail

getFormattedText

public java.lang.String getFormattedText()
Get formatted representation of Ipv4Field value or null if IPv4Field object value is set to null or incomplete

Returns:
the String representing bank card number

getFormattedText

protected char[] getFormattedText(boolean calcCursorOffset)
Overrides:
getFormattedText in class TextField

getHost

public java.lang.String getHost()
Returns the string representation of TCP/IP address host value that is presented by this component.

Returns:
the String value representing the host part of TCP/IP address or null if IPv4 field is invalid or incomplete

getIPv4Host

public int getIPv4Host()
Returns the TCP/IP address host value that is presented by this component.

Returns:
the int value representing the host part of TCP/IP address or -1 if IPv4 field is invalid or incomplete

getIPv4Port

public long getIPv4Port()
Returns the TCP/IP address port value that is presented by this component.

Returns:
the int value representing the port part of TCP/IP address or -1 if IPv4 field is invalid or incomplete

getPort

public java.lang.String getPort()
Returns the string representation of TCP/IP address port value that is presented by this component.

Returns:
the String value representing the port part of TCP/IP address or null if IPv4 field is invalid or incomplete

initComposer

protected CustomFieldComposer initComposer()
Initialize IPv4 field composer

Returns:
CustomFieldComposer for IPv4 field

isValid

public boolean isValid()
Tests IPv4 field value for correctness

Returns:
true if the IP address field is valid false otherwise

setIPv4

public boolean setIPv4(int host,
                       long port)
Sets the TCP/IP address that is presented by this IPv4 component to be the specified value.

Parameters:
host - the IP address host value
port - the IP address port value

jMobileCore toolkit