amber.server.component
Class TextComponentHandler

java.lang.Object
  |
  +--java.awt.Component
        |
        +--amber.server.component.ComponentHandler
              |
              +--amber.server.component.TextComponentHandler
All Implemented Interfaces:
ApplicationInterface, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
TextAreaHandler, TextFieldHandler

public abstract class TextComponentHandler
extends ComponentHandler
implements java.io.Serializable

This class handles the requirements for the manipulation of the packets moving to and from a Text Component. It is the base class for the text controls and corresponds to the TextComponent in normal Java.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
ApplicationInterface, ComponentHandler, Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static byte GetCaret
           
static byte GetCaretResponse
           
static byte GetSelectedText
           
static byte GetSelectedTextResponse
           
static byte GetSelection
           
static byte GetSelectionResponse
           
static byte GetText
           
static byte GetTextResponse
           
static byte Select
           
static byte SelectAll
          Constant defining which select operation will occur.
static byte SelectBoth
          Constant defining which select operation will occur.
static byte SelectEnd
          Constant defining which select operation will occur.
static byte SelectStart
          Constant defining which select operation will occur.
static byte SetCaret
           
static byte SetEditable
           
static byte SetText
           
static byte TextComponentNextAvailableCommand
           
 
Fields inherited from class amber.server.component.ComponentHandler
actionCommand, active, ApplicationId, CancelReturn, dataEncoder, DefaultTimeout, enabledState, encoderBytes, id, InvalidId, MaximumId, NoReturn, OkCancelType, OkReturn, OkType, OkYesReturn, parentPage, responsePackets, timeoutValue, UnchangeableInvalidId, visibleState, YesNoCancelType, YesNoType, YesReturn
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TextComponentHandler()
          Default constructor.
TextComponentHandler(ApplicationInterface pageHandler)
          The initialising constructor.
TextComponentHandler(int id, ApplicationInterface pageHandler)
          The initialising constructor.
 
Method Summary
 int getCaretPosition()
          Gets the location of the text cursor in the text.
 java.lang.String getSelectedText()
          Gets the selected text from the text component.
 int getSelectionEnd()
          Gets the location of the last character selected in the text.
protected  Pair getSelectionPoints()
          This function gets the selection start and end points.
 int getSelectionStart()
          Gets the location of the first character selected in the text.
 java.lang.String getText()
          Returns the text in the component.
 boolean isEditable()
          Returns the state of whether the text field can be edited.
 void select(int start, int end)
          This function selects the text between the specified start and end positions.
 void selectAll()
          Selects all the text in this text component.
 void setCaretPosition(int position)
          Sets the position of the cursor in the text.
 void setEditable(boolean state)
          Defines whether the text field can be edited.
 void setSelectionEnd(int end)
          Sets the location of the last character selected in the text.
protected  void setSelectionPoints(int type, int start, int end)
          This function gets the selection start and end points.
 void setSelectionStart(int start)
          Sets the location of the first character selected in the text.
 void setText(java.lang.String item)
          Sets the text in the control to the specified value.
 
Methods inherited from class amber.server.component.ComponentHandler
addActionListener, addComponentListener, addEventMask, addFocusListener, addItemListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addReceivedPacket, addTextListener, addWindowListener, booleanToInt, createDataInput, directPacket, displayMessageBox, fireWindowActivated, fireWindowClosed, fireWindowClosing, fireWindowDeactivated, fireWindowDeiconified, fireWindowEvent, fireWindowIconified, fireWindowOpened, forceComponentGetUrl, forceComponentGetUrl, forwardEventPacket, generateActionEvent, generateFocusEvent, generateItemEvent, generateKeyEvent, generateMouseEvent, getActionCommand, getBounds, getComponentStructure, getDefaultParameters, getEventMask, getFontCharacteristics, getFontCharacteristics, getFontCharacteristics, getFontCharacteristics, getFontStyle, getId, getLocation, getLog, getModalObject, getPanelType, getParentApplication, getParentContainer, getParentServer, getResponsePacket, getSelectedObjects, getSize, getTimeout, getValidId, getX, getY, handleMessages, handlePacket, internalForwardPacket, internalGetBounds, intToBoolean, isActive, isApplicationActive, isComponentModal, isConnected, isEnabled, isMyId, isVisible, processActionEvent, processComponentEvent, processCurrentPacket, processEvent, processFocusEvent, processItemEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processNormalResponse, processTextEvent, queryMessageBox, removeActionListener, removeComponentListener, removeEventMask, removeFocusListener, removeItemListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removeTextListener, removeWindowListener, requestFocus, resetState, restart, sendPacket, sendPacketAndBlock, sendPendingPackets, setActionCommand, setActive, setBackground, setComponentModal, setConnectedState, setCursor, setEnabled, setEventMask, setFont, setFont, setFontStyle, setForeground, setForegroundBackground, setId, setLog, setModalObject, setParentApplication, setParentContainer, setParentServer, setTimeout, setVisible, setX, setY, shutDown, shutDownClient, shutDownClient, start
 
Methods inherited from class java.awt.Component
action, add, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getToolkit, getTreeLock, getWidth, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SetText

public static final byte SetText

GetText

public static final byte GetText

GetTextResponse

public static final byte GetTextResponse

GetCaret

public static final byte GetCaret

GetCaretResponse

public static final byte GetCaretResponse

GetSelectedText

public static final byte GetSelectedText

GetSelectedTextResponse

public static final byte GetSelectedTextResponse

GetSelection

public static final byte GetSelection

GetSelectionResponse

public static final byte GetSelectionResponse

Select

public static final byte Select

SetCaret

public static final byte SetCaret

SetEditable

public static final byte SetEditable

TextComponentNextAvailableCommand

public static final byte TextComponentNextAvailableCommand

SelectStart

public static final byte SelectStart
Constant defining which select operation will occur.

SelectEnd

public static final byte SelectEnd
Constant defining which select operation will occur.

SelectBoth

public static final byte SelectBoth
Constant defining which select operation will occur.

SelectAll

public static final byte SelectAll
Constant defining which select operation will occur.
Constructor Detail

TextComponentHandler

public TextComponentHandler()
Default constructor.

TextComponentHandler

public TextComponentHandler(ApplicationInterface pageHandler)
The initialising constructor. This constructor dynamically requests a valid ID value from the ApplicationInterface.
Parameters:
pageHandler - The handle to the main ApplicationInterface which handles the functions of page overall. residing on the browser.

TextComponentHandler

public TextComponentHandler(int id,
                            ApplicationInterface pageHandler)
The initialising constructor.
Parameters:
id - The int containing the id of the corresponding remote component residing on the browser.
pageHandler - The handle to the main ApplicationInterface which handles the functions of page overall.
Method Detail

setText

public void setText(java.lang.String item)
             throws ComponentHandlerException
Sets the text in the control to the specified value.
Parameters:
item - String containing the text to set the control to.
Throws:
ComponentHandlerException - with any errors.

isEditable

public boolean isEditable()
Returns the state of whether the text field can be edited.
Returns:
boolean indicates the field to editable when true.

setEditable

public void setEditable(boolean state)
                 throws ComponentHandlerException
Defines whether the text field can be edited.
Parameters:
state - boolean sets the field to editable when true.
Throws:
ComponentHandlerException - contains any errors performing this command.

getText

public java.lang.String getText()
                         throws ComponentHandlerException
Returns the text in the component.
Returns:
String containing the text in the component.
Throws:
ComponentHandlerException - with any errors.

getCaretPosition

public int getCaretPosition()
                     throws ComponentHandlerException
Gets the location of the text cursor in the text.
Returns:
int containing the position of the cursor.
Throws:
ComponentHandlerException - with errors.

getSelectedText

public java.lang.String getSelectedText()
                                 throws ComponentHandlerException
Gets the selected text from the text component.
Returns:
String containing the selected text.
Throws:
ComponentHandlerException - with errors.

getSelectionEnd

public int getSelectionEnd()
                    throws ComponentHandlerException
Gets the location of the last character selected in the text.
Returns:
int containing the location of the end of the selected text.
Throws:
ComponentHandlerException - with errors.

getSelectionStart

public int getSelectionStart()
                      throws ComponentHandlerException
Gets the location of the first character selected in the text.
Returns:
int containing the location of the start of the selected text.
Throws:
ComponentHandlerException - with errors.

select

public void select(int start,
                   int end)
            throws ComponentHandlerException
This function selects the text between the specified start and end positions. The function does the following:

Should these criteria be violated they are silently corrected.

Parameters:
start - int starting location to select.
end - int ending location to select.
Throws:
ComponentHandlerException - with errors.

selectAll

public void selectAll()
               throws ComponentHandlerException
Selects all the text in this text component.

setCaretPosition

public void setCaretPosition(int position)
                      throws ComponentHandlerException
Sets the position of the cursor in the text.
Parameters:
position - int position to place the cursor.
Throws:
ComponentHandlerException - with errors.

setSelectionEnd

public void setSelectionEnd(int end)
                     throws ComponentHandlerException
Sets the location of the last character selected in the text.
Parameters:
end - int containing the location of the end of the selected text.
Throws:
ComponentHandlerException - with errors.

setSelectionStart

public void setSelectionStart(int start)
                       throws ComponentHandlerException
Sets the location of the first character selected in the text.
Parameters:
start - int containing the location of the start of the selected text.
Throws:
ComponentHandlerException - with errors.

getSelectionPoints

protected Pair getSelectionPoints()
                           throws ComponentHandlerException
This function gets the selection start and end points.
Returns:
amber.type.server.Pair containing two Integers with the required values.
Throws:
ComponentHandlerException - with errors.

setSelectionPoints

protected void setSelectionPoints(int type,
                                  int start,
                                  int end)
                           throws ComponentHandlerException
This function gets the selection start and end points.
Parameters:
type - The type of selection operation to perform. This matches the selection constants listed in this class.
start - The int starting location of the selection, may be optional.
end - The int ending location of the selection, may be optional.
Throws:
ComponentHandlerException - with errors.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.