|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--ControlBeans.AbstractCommunicator | +--ControlBeans.TCPIPCommunicator
This class implements a control component which can send and receive
values over a TCP/IP network. For each value it wishes to send or
receive, it does so according to the following protocol:
Type: an integer value describing what type of value will follow.
Tag: an integer value to allow the recipient to determine where to
distribute the data.
Data: either an integer, double or string.
Time: an optional double value timestamp.
Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
protected static int |
DOUBLE_AND_TIME
Set if two doubles should be received or sent. |
protected static int |
INPUT_SOCKET_ERROR
Set if an inputsocket error has been caught. |
protected static int |
INPUT_STREAM_BROKEN_ERROR
Set if the inputstream has been broken. |
protected static int |
INPUT_STREAM_ERROR
Set if an inputstream error has been caught. |
protected static int |
INPUT_STREAM_LOST_ERROR
Set if the input stream disapeared for some reason. |
protected static int |
INT_AND_TIME
Set if both an integer and a double should be received or sent. |
protected static int |
ONLY_DOUBLE
Set if a single double has been received or should be sent. |
protected static int |
ONLY_INT
Set if a single integer has been received or should be sent. |
protected static int |
ONLY_STRING
Set if a single string has been received or should be sent. |
protected static int |
OUTPUT_SOCKET_ERROR
Set if an outputsocket error has been caught. |
protected static int |
OUTPUT_STREAM_BROKEN_ERROR
Set if the outputstream has been broken. |
protected static int |
OUTPUT_STREAM_ERROR
Set if an outputstream error has been caught. |
protected static int |
OUTPUT_STREAM_LOST_ERROR
Set if the output stream disapeared for some reason. |
protected static int |
PROTOCOL_ERROR
Set if the received data does not conform to the protocol. |
protected static int |
STRING_AND_TIME
Set if both a string and a double should be received or sent. |
protected static int |
UNKNOWN_HOST_ERROR
Set if host cannot be found. |
Fields inherited from class ControlBeans.AbstractCommunicator |
CURRENT_TIME,
myID |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
TCPIPCommunicator()
Constructs a new TCPIPCommunicator. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when the user either changes the value of one of the textfields or clicks the connectbutton. |
void |
finalize()
Closes everything at shutdown. |
void |
focusGained(java.awt.event.FocusEvent e)
Invoked when either of the textfields gain focus. |
void |
focusLost(java.awt.event.FocusEvent e)
Invoked when either of the textfields lose focus. |
boolean |
getEditable()
Gets whether or not the textfields within the communicator are visible and hence editable. |
java.lang.String |
getHostName()
Gets the name of host computer. |
int |
getReceiverPort()
Gets the number of the port used for incoming values. |
int |
getSenderPort()
Gets the number of the port used for outgoing values. |
boolean |
getStatusfield()
Gets whether or not the statusfield within the communicator is visible. |
protected void |
sendValue(double value,
int aTag,
double time)
Used for sending a double value over the network. |
protected void |
sendValue(int value,
int aTag,
double time)
Used for sending an integer value over the network. |
protected void |
sendValue(java.lang.String value,
int aTag,
double time)
Used for sending a string value over the network. |
void |
setEditable(boolean value)
Sets whether or not the textfields within the communicator should be visible and hence editable. |
void |
setHostName(java.lang.String value)
Sets the name of host computer. |
void |
setReceiverPort(int value)
Sets the number of the port used for incoming values. |
void |
setSenderPort(int value)
Sets the number of the port used for outgoing values. |
void |
setStatusfield(boolean value)
Sets whether or not the statusfield within the communicator should be visible. |
Methods inherited from class ControlBeans.AbstractCommunicator |
putValue,
putValue,
putValue,
registerComponentEvent,
requestValues |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext,
getUIClassID,
paramString,
updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getPreferredSize,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getWidth,
getVisibleRect,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintComponent,
paintImmediately,
paintImmediately,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected static final int ONLY_INT
protected static final int ONLY_DOUBLE
protected static final int ONLY_STRING
protected static final int INT_AND_TIME
protected static final int DOUBLE_AND_TIME
protected static final int STRING_AND_TIME
protected static final int OUTPUT_SOCKET_ERROR
protected static final int OUTPUT_STREAM_ERROR
protected static final int INPUT_SOCKET_ERROR
protected static final int INPUT_STREAM_ERROR
protected static final int OUTPUT_STREAM_BROKEN_ERROR
protected static final int INPUT_STREAM_BROKEN_ERROR
protected static final int PROTOCOL_ERROR
protected static final int UNKNOWN_HOST_ERROR
protected static final int OUTPUT_STREAM_LOST_ERROR
protected static final int INPUT_STREAM_LOST_ERROR
Constructor Detail |
public TCPIPCommunicator()
Method Detail |
public void finalize()
public boolean getEditable()
true
if the textfields are visible;
false
otherwise.public void setEditable(boolean value)
value
- true
if the textfields should be visible;
false
otherwise.public boolean getStatusfield()
true
if the stausfield is visible;
false
otherwise.public void setStatusfield(boolean value)
value
- true
if the statusfield should be visible;
false
otherwise.public java.lang.String getHostName()
public void setHostName(java.lang.String value)
value
- the desired name of the host computer.public int getReceiverPort()
public void setReceiverPort(int value)
value
- the desired port number.public int getSenderPort()
public void setSenderPort(int value)
value
- the desired port number.protected void sendValue(int value, int aTag, double time)
value
- the value to be transmittedaTag
- the tag of components to receive the valuetime
- a time tag for the valueprotected void sendValue(double value, int aTag, double time)
value
- the value to be transmittedaTag
- the tag of components to receive the valuetime
- a time tag for the valueprotected void sendValue(java.lang.String value, int aTag, double time)
value
- the value to be transmittedaTag
- the tag of components to receive the valuetime
- a time tag for the valuepublic void focusGained(java.awt.event.FocusEvent e)
e
- the event describing that a component gained focus.public void focusLost(java.awt.event.FocusEvent e)
e
- the event describing that a component gained focus.public void actionPerformed(java.awt.event.ActionEvent e)
e
- the event describing that someone either clicked the button
or changed the text in one of the textfields.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |