drcl.comp.lib
Class Talk
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.comp.Component
|
+--drcl.comp.lib.Talk
- All Implemented Interfaces:
- ActiveComponent, java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
- public class Talk
- extends Component
- implements ActiveComponent
A simple chat client component. It is a frame with two areas inside: a display area
and an input area. Whenever a line is formed in the input area, the line is sent out
from the "inout" port. And whenever a message is received from the port, it is displayed
in the display area.
Ports (in addition to those defined in drcl.comp.Component):
- "inout" port: First, it sends out one line of messages when a line is inputed
from the user. The line is prepended with the ID + ": ". Second, the component
displays any message comes in from this port.
- See Also:
- Serialized Form
| Fields inherited from class drcl.comp.Component |
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, lockHead, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND |
|
Constructor Summary |
Talk()
Constructor. |
Talk(java.lang.String id_)
Constructor. |
|
Method Summary |
protected void |
_start()
Invoked when the component is run()ed. |
void |
duplicate(java.lang.Object source_)
Copies the content from the source_ to this component. |
java.lang.String |
info()
Script interface which reveals the internal states of the component. |
boolean |
isAnonymous()
|
boolean |
isEchoEnabled()
|
void |
process(java.lang.Object data_,
Port inPort_)
Invoked when data_ arrives this component at the inPort_ port. |
protected void |
processLine(java.lang.String line_)
|
void |
reset()
Resets this component to the initial state for use anew. |
void |
setAnonymous(boolean v_)
|
void |
setDisplaySize(int rows_,
int cols_)
Sets the number of rows and columns of the display text area. |
void |
setEchoEnabled(boolean v_)
|
void |
setInputSize(int rows_,
int cols_)
Sets the number of rows and columns of the input text area. |
| Methods inherited from class drcl.comp.Component |
_resume, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
INOUT_PORT_ID
public static final java.lang.String INOUT_PORT_ID
port
protected Port port
taDisplay
protected java.awt.TextArea taDisplay
taInput
protected java.awt.TextArea taInput
Talk
public Talk()
- Constructor.
Talk
public Talk(java.lang.String id_)
- Constructor.
process
public void process(java.lang.Object data_,
Port inPort_)
- Invoked when
data_ arrives this component at the inPort_ port.
- Overrides:
process in class Component
- Following copied from class:
drcl.comp.Component
- Parameters:
data_ - the arrival data.inPort_ - the port where the data arrives.
reset
public void reset()
- Resets this component to the initial state for use anew.
Must call
super.reset() in the beginning.
- Overrides:
reset in class Component
duplicate
public void duplicate(java.lang.Object source_)
- Copies the content from the
source_ to this component.
Must call super.duplicate() in the beginning.
- Overrides:
duplicate in class Component
_start
protected void _start()
- Invoked when the component is
run()ed.
- Overrides:
_start in class Component
info
public java.lang.String info()
- Script interface which reveals the internal states of the component.
It is for debugging and demonstration purpose.
- Overrides:
info in class Component
setAnonymous
public void setAnonymous(boolean v_)
isAnonymous
public boolean isAnonymous()
setEchoEnabled
public void setEchoEnabled(boolean v_)
isEchoEnabled
public boolean isEchoEnabled()
setDisplaySize
public void setDisplaySize(int rows_,
int cols_)
- Sets the number of rows and columns of the display text area.
The number of columns also affects that of the input text area.
- Parameters:
rows_ - number of rows; no effect if nonpositive value is given.cols_ - number of columns; no effect if nonpositive value is given.
setInputSize
public void setInputSize(int rows_,
int cols_)
- Sets the number of rows and columns of the input text area.
The number of columns also affects that of the display text area.
- Parameters:
rows_ - number of rows; no effect if nonpositive value is given.cols_ - number of columns; no effect if nonpositive value is given.
processLine
protected void processLine(java.lang.String line_)
Copyright © 2001 - DRCL, OSU ~ Back to JavaSim Home ~