gov.sandia.ccaffeine.dc.user_iface.MVC
Class ViewSocket

java.lang.Object
  extended by gov.sandia.ccaffeine.dc.user_iface.MVC.ViewSocket
All Implemented Interfaces:
GuiListener, java.util.EventListener

public class ViewSocket
extends java.lang.Object
implements GuiListener

An MVC view. This view is used to send commands and data to the cca server.


Constructor Summary
ViewSocket(ClientSocket clientSocket)
          Create an MVC View.
 
Method Summary
 void componentProperties(ComponentPropertiesEvent event)
          Retrieve the value of a component property or set the value of a component property.
 void connect(ConnectEvent event)
          The GUI is asking the cca server to connect the Provides Port of a cca component to a Uses Port.
 void disconnect(DisconnectEvent event)
          The GUI is asking the cca server to disconnect the connection between a Provides Port of a cca component and a Uses Port.
 void display(DisplayEvent event)
          Request some information from the server.
 void displayComponent(DisplayComponentEvent event)
          Tell all GuiListeners that an entity wants some information on a cca component.
 void displayPalette(DisplayPaletteEvent event)
          Tell all GuiListeners that an entity wants wants to know what components are in the palette.
 void displayState(DisplayStateEvent event)
          Notify all GuiListeners that an entity wants to know what components are in the arena and what connections exist between the components.
 void exit(ExitEvent event)
          Notify all GuiListeners that an entity wants the application to exit.
 void getAllInstancesInArena(GetInstancesEvent event)
          An entity wants to get all of the instantiated cca components.
 void getComponentProperty(GetComponentPropertyEvent event)
          Notify all GuiListeners that an entity wants the the cca server to send the value of a property that is inside a component.
 void getPortParameter(ParamGetCurrentEvent event)
          Cca components contain ports.
 void go(GoEvent event)
          The end-user, via the GUI, wants to launch the application.
 void goComponentPort(GoComponentPortEvent event)
          Notify all GuiListeners that this entity wants to invoke the "go" command on a specific port that is located on a specific component.
 void heartbeat(HeartbeatEvent event)
          Notify all GuiListeners that an entity wants to emit a heartbeat.
 void instantiate(InstantiateEvent event)
          The end-user, via the GUI, wants to retrieve a cca component.
 void links(DisplayChainEvent event)
          Tell all GuiListeners that an entity wants to know what connections are in the arena.
 void nukeAll(NukeAllEvent event)
          Notify all GuiListeners that an entity wants to delete all components.
 void path(PathEvent event)
          Tell the cca server to change the path or tell the cca server to retrieve the path.
 void portParameter(ParamEvent event)
          Cca components contain ports.
 void portProperties(PortPropertiesEvent event)
          Retrieve the value of a port property or set the value of a port property.
 void remove(RemoveEvent event)
          The end-user wants to remove an instantiation of a cca component.
 void repository(RepositoryEvent event)
          Send a query to the cca server.
 void sendMessage(StringEvent event)
          Notify all GuiListeners that an entity wants to send a string to the cca server.
 void setComponentProperty(SetComponentPropertyEvent event)
          Notify all GuiListeners that an entity wants to set the value of a property that is inside a cca component.
 void setDebug(SetDebugEvent event)
          Tell all GuiListeners that an entity wants the debugging turned on.
 void setNoDebug(SetDebugEvent event)
          Tell all GuiListeners that an entity wants the debugging turned off.
 void setPortParameter(ParamCurrentEvent event)
          Cca components contain ports.
 void shell(ShellEvent event)
          Send an O.S.
 void write(java.lang.String message)
          Send a message to the cca server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewSocket

public ViewSocket(ClientSocket clientSocket)
Create an MVC View. This view writes commands and data to the cca server.

Parameters:
outputStream - The output stream that is used to send commands and data to the cca server.
Method Detail

write

public void write(java.lang.String message)
Send a message to the cca server

Parameters:
message - The string we are sending to the cca server.

remove

public void remove(RemoveEvent event)
The end-user wants to remove an instantiation of a cca component. We will respond by sending a message to the cca server.

Specified by:
remove in interface GuiListener
Parameters:
event - The event that is generated whenever the GUI wants to remove an instantiation of a cca component.

go

public void go(GoEvent event)
The end-user, via the GUI, wants to launch the application. A view entity might respond by launching the application

Specified by:
go in interface GuiListener
Parameters:
event - The event that is generated whenever the GUI wants to launch the application.

instantiate

public void instantiate(InstantiateEvent event)
The end-user, via the GUI, wants to retrieve a cca component. A view entity might respond by sending a "pull down" message to the cca server.

Specified by:
instantiate in interface GuiListener
Parameters:
event -

connect

public void connect(ConnectEvent event)
Description copied from interface: GuiListener
The GUI is asking the cca server to connect the Provides Port of a cca component to a Uses Port. The Uses Port may be one the same component or may be on a different component.

Specified by:
connect in interface GuiListener
Parameters:
event - The event that is sent whenever the GUI wants to connect a Uses Port with a Provides Port.

disconnect

public void disconnect(DisconnectEvent event)
Description copied from interface: GuiListener
The GUI is asking the cca server to disconnect the connection between a Provides Port of a cca component and a Uses Port.

Specified by:
disconnect in interface GuiListener
Parameters:
event - The event that is sent whenever the GUI wants to connect a Uses Port with a Provides Port.

getAllInstancesInArena

public void getAllInstancesInArena(GetInstancesEvent event)
An entity wants to get all of the instantiated cca components. A view entity might respond by sending an "arena" or an "instances" message to the cca server.

Specified by:
getAllInstancesInArena in interface GuiListener
Parameters:
event - That event that is generated whenever an entity wants to get all of the instantiated cca components.

setPortParameter

public void setPortParameter(ParamCurrentEvent event)
Cca components contain ports. Some of the ports contain data fields. The end-user, via the GUI, wants to set the value of one of the data fields. A view entity might respond by sending a "config" or a "parameters" message to the cca server.

Specified by:
setPortParameter in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to set the value of a data field.

getPortParameter

public void getPortParameter(ParamGetCurrentEvent event)
Cca components contain ports. Some of the ports contain data fields. An entity wants to get the value of one of the data fields. A view entity might respond by sending a "configure" or a "parameters" message to the cca server.

Specified by:
getPortParameter in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wans the value of one of the data fields.

componentProperties

public void componentProperties(ComponentPropertiesEvent event)
Retrieve the value of a component property or set the value of a component property.

A view entity might respond by either displaying the current value of a component property or by setting the value of a component property.

An example of a component property is the "name" of the component.

Specified by:
componentProperties in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to either get or set the value of a component property.

portParameter

public void portParameter(ParamEvent event)
Cca components contain ports. Some of the ports contain data fields. An entity wants to get the value of one of the data fields. A view entity might respond by sending a "configure" or a "parameters" message to the cca server.

Specified by:
portParameter in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wans the value of one of the data fields.

setDebug

public void setDebug(SetDebugEvent event)
Tell all GuiListeners that an entity wants the debugging turned on. A view might respond by sending either a "debug" or "noisy" command to the cca server.

Specified by:
setDebug in interface GuiListener

setNoDebug

public void setNoDebug(SetDebugEvent event)
Tell all GuiListeners that an entity wants the debugging turned off. A view might respond by sending either a "nodebug" or "quiet" command to the cca server.

Specified by:
setNoDebug in interface GuiListener

display

public void display(DisplayEvent event)
Request some information from the server. We can request the following info:
    display palette
    display arena
    display chain
    display component
    display state

If the GUI wants to get information on the components that are in the palette, or on the components that are in the arena, or on the connections that are established inside the arena, or on a particular component, or on the components and the connections that are in the arena, then the GUI will encapsulate the request as a DisplayEvent and will then invoke this method. This method will send the request to the cca server.

Specified by:
display in interface GuiListener
Parameters:
DisplayEvent - The event that is generated whenever an entity is requesting some information from the server.

displayPalette

public void displayPalette(DisplayPaletteEvent event)
Tell all GuiListeners that an entity wants wants to know what components are in the palette. A palette is a menu of cca components; the end-user can drag components from the palette to the arena (workspace). A view might respond by rending icons in the palette. The end-user can drag icons from the palette onto the main workspace (the arena).

Specified by:
displayPalette in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to know what components are in the palette.

links

public void links(DisplayChainEvent event)
Tell all GuiListeners that an entity wants to know what connections are in the arena. The arena is the workspace canvas; the end-user can drag components from the palette to the arena. The end-user can connect components by drawing lines between the components. A view might respond drawing a line between two components that are rendered inside the main workspace (the arena).

Specified by:
links in interface GuiListener
Parameters:
event - The event that is created whenever the GUI wants to know what connections are in the arena.

displayComponent

public void displayComponent(DisplayComponentEvent event)
Tell all GuiListeners that an entity wants some information on a cca component. A view might respond by rendering a cca component in the main workspace (the arena). The end-user can drag the component to a new location, remove the component, draw a line to/from a different component, view or edit the component's properties, etc.

Specified by:
displayComponent in interface GuiListener
Parameters:
source - The entity that created this event.
componentInstanceName - The name of the cca component object. The instance name is usually the name of the component's java class (without the package name) concatenated with an index number. EXAMPLE: "StarterComponent0"
event - The event that is created whenever an entity wants some information on a cca component.

displayState

public void displayState(DisplayStateEvent event)
Notify all GuiListeners that an entity wants to know what components are in the arena and what connections exist between the components. The arena is the workspace canvas; the end-user can drag components from the palette to the arena. The end-user can connect components by drawing lines between the components. A view might respond by rendering cca components in the main workspace (the arena) and by rendering lines between components that are connected togeter. The end-user can drag components to a new location, remove components, draw lines between components, view or edit the properties of components, etc.

Specified by:
displayState in interface GuiListener
Parameters:
source - The entity that created this event.

goComponentPort

public void goComponentPort(GoComponentPortEvent event)
Notify all GuiListeners that this entity wants to invoke the "go" command on a specific port that is located on a specific component. A view might respond by sending a "go" or a "run" message to the cca server.

Specified by:
goComponentPort in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to invoke the "go" command.

nukeAll

public void nukeAll(NukeAllEvent event)
Notify all GuiListeners that an entity wants to delete all components. A view might respond by sending a "nuke" message to the cca server. param event The event that is created when an entity wants to to delete all components.

Specified by:
nukeAll in interface GuiListener

portProperties

public void portProperties(PortPropertiesEvent event)
Retrieve the value of a port property or set the value of a port property. A view entity might respond by either displaying the current value of a port property or by setting the value of a port property.

Specified by:
portProperties in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to either get or set the value of a port property.

getComponentProperty

public void getComponentProperty(GetComponentPropertyEvent event)
Notify all GuiListeners that an entity wants the the cca server to send the value of a property that is inside a component. A view entity might respond by sending a "property" message to the cca server.

Specified by:
getComponentProperty in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants the value of a property that is inside a component.

setComponentProperty

public void setComponentProperty(SetComponentPropertyEvent event)
Notify all GuiListeners that an entity wants to set the value of a property that is inside a cca component. A view entity might respond by sending a "properties" message to the cca server.

Specified by:
setComponentProperty in interface GuiListener
Parameters:
event - The event that is created whenever an entity wants to set the value of a property that is inside a component.

sendMessage

public void sendMessage(StringEvent event)
Notify all GuiListeners that an entity wants to send a string to the cca server.

Specified by:
sendMessage in interface GuiListener
Parameters:
event - The event that is created whenever an entity wants to send a string to the cca server.

heartbeat

public void heartbeat(HeartbeatEvent event)
Notify all GuiListeners that an entity wants to emit a heartbeat. A view might respond by sending a heartbeat to the cca srever.

Specified by:
heartbeat in interface GuiListener
Parameters:
event - The event that is fabricated whenever an entity wants to emit a heartbeat.

exit

public void exit(ExitEvent event)
Notify all GuiListeners that an entity wants the application to exit. A view might respond by sending a "exit" message to the cca server.

Specified by:
exit in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants to exit the application.

path

public void path(PathEvent event)
Tell the cca server to change the path or tell the cca server to retrieve the path.

Specified by:
path in interface GuiListener
Parameters:
event - The event that is generated whenever an entity wants either to set the path to a new value or to query for the path value.

repository

public void repository(RepositoryEvent event)
Send a query to the cca server. The query is a request either for a list of all components that are in the repository or for one specific component that is in the repository.

Specified by:
repository in interface GuiListener
Parameters:
event - The event that is created whenever an entity wants to get one component or all components from the repository,

shell

public void shell(ShellEvent event)
Send an O.S. command to the cca server. The cca server will execute the command.

Specified by:
shell in interface GuiListener
Parameters:
event - The event that is created whenever an entity wants an O.S. command executed.