CS 1705 Library

cs1705.web
Class RobotViewer

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Window
                  extended by cs1705.web.Window
                      extended by cs1705.web.RobotViewer
All Implemented Interfaces:
Serializable, Cloneable, HtmlBasedComponent, Component, AfterCompose, IdSpace, ComponentCtrl, Window, XulElement

public class RobotViewer
extends Window
implements AfterCompose

A component that presents the viewable contents of a robot task on a web page. It can be given a robot, or a task, or a class name, and will run any that it is given.

A <robot-viewer> tag supports the following properties:

Parameters
task - The task to monitor. It can be any Java expression, or any EL expression (i.e., ${...}), but may not be a bound data value (no @{...}). The viewer will monitor the output of the robot returned by the task's getRobot() method.
taskClass - Instead of a task object, you can provide a Java class name. The viewer will create its own instance of this class and then monitor it.
robot - Instead of a task, You can provide a robot object directly. To do anything useful, the robot should implement its own WebBot.run() method. this property can be any Java expression, or any EL expression (i.e., ${...}), but may not be a bound data value (no @{...}).
robotClass - Finally, instead of providing a robot object, you can even provide a Java class name. The viewer will create its own instance of this class and then monitor its output.
robotUrl - If you provide a robotClass, you can use this optional property to specify a URL parameter to pass to the robot's constructor. The viewer will use then use this URL when creating its own instance of your robot class. If you do not specify a robotClass, this property is ignored.
interactive - If you provide a true value for this optional property, the viewer will continue to listen to the robot's output channel and update its display, even after the robot task (or robot) completes. The default is false, which means the viewer will stop refreshing itself with any output updates as soon as the task (or robot) finishes.

Examples:

 <!-- With your class name -->
 <robot-viewer taskClass="MySuperRobotTask"/>

 <!-- With a custom robot -->
 <robot-viewer robot="new MySuperRobot(200, "http://localhost/")"/>

 <!-- A longer version, so you don't have to escape the quotes. -->
 <robot-viewer>
   <attribute name="robot">
     new MySuperRobot(200, "http://very.cool.com/a/very/long/url")
   </attribute>
 </variable>
 

Version:
2007.08.13
Author:
Stephen Edwards
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
RobotViewer()
          Create a RobotViewer component.
RobotViewer(String title, String border, boolean closable)
          Create a RobotViewer component.
 
Method Summary
 void afterCompose()
          Creates the robot and/or task if necessary, starts it running, and creates the output widgets.
 boolean getInteractive()
          Accessor for the interactive property.
 WebBot getRobot()
          Accessor for the robot property.
 String getRobotClass()
          Accessor for the robotClass property.
 String getRobotUrl()
          Accessor for the robotUrl property.
 RobotTask getTask()
          Accessor for the task property.
 String getTaskClass()
          Accessor for the taskClass property.
 void setInteractive(boolean value)
          Mutator for the interactive property.
 void setRobot(String bot)
          Mutator for the robot property.
 void setRobot(WebBot bot)
          Mutator for the robot property.
 void setRobotClass(String className)
          Mutator for the robotClass property.
 void setRobotUrl(String url)
          Mutator for the robotUrl property.
 void setTask(RobotTask task)
          Mutator for the task property.
 void setTask(String task)
          Mutator for the task property.
 void setTaskClass(String className)
          Mutator for the taskClass property.
 void updateRobotMsg()
          Update the text output with the current output history of the robot.
 
Methods inherited from class cs1705.web.Window
insertBefore, setBorder, setTitle
 
Methods inherited from class org.zkoss.zul.Window
clone, doEmbedded, doHighlighted, doModal, doOverlapped, doPopup, getBorder, getCaption, getCaptionApi, getContentSclass, getContentStyle, getDefaultActionOnShow, getMinheight, getMinwidth, getMode, getOuterAttrs, getPosition, getTitle, getTitleSclass, getZclass, inEmbedded, inHighlighted, inModal, inOverlapped, inPopup, isClosable, isMaximizable, isMaximized, isMinimizable, isMinimized, isSizable, onChildRemoved, onClose, onModal, onPageDetached, setClosable, setContentSclass, setContentStyle, setDefaultActionOnShow, setDraggable, setMaximizable, setMaximized, setMinheight, setMinimizable, setMinimized, setMinwidth, setMode, setMode, setPosition, setSizable, setVisible
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, redraw, setClass, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getCommand, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onDrawNewChild, onPageAttached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, toString, unsetVariable
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.IdSpace
getFellow, getFellowIfAny, getFellows, hasFellow
 
Methods inherited from interface org.zkoss.zul.impl.api.XulElement
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setParent, setVariable, unsetVariable
 

Constructor Detail

RobotViewer

public RobotViewer()
Create a RobotViewer component.


RobotViewer

public RobotViewer(String title,
                   String border,
                   boolean closable)
Create a RobotViewer component.

Parameters:
title - the window title to use
border - either "normal" or "none"
closable - is this window closable?
Method Detail

getRobot

public WebBot getRobot()
Accessor for the robot property.

Returns:
This viewer's robot

setRobot

public void setRobot(WebBot bot)
Mutator for the robot property.

Parameters:
bot - The new value

setRobot

public void setRobot(String bot)
Mutator for the robot property.

Parameters:
bot - The new value as a string of Java code to be interpreted

getTask

public RobotTask getTask()
Accessor for the task property.

Returns:
This viewer's robot task

setTask

public void setTask(RobotTask task)
Mutator for the task property.

Parameters:
task - The new value

setTask

public void setTask(String task)
Mutator for the task property.

Parameters:
task - The new value as a string of Java code to be interpreted

getRobotClass

public String getRobotClass()
Accessor for the robotClass property.

Returns:
This viewer's robot class name

setRobotClass

public void setRobotClass(String className)
Mutator for the robotClass property.

Parameters:
className - The new value

getTaskClass

public String getTaskClass()
Accessor for the taskClass property.

Returns:
This viewer's task class name

setTaskClass

public void setTaskClass(String className)
Mutator for the taskClass property.

Parameters:
className - The new value

getRobotUrl

public String getRobotUrl()
Accessor for the robotUrl property.

Returns:
This viewer's robot URL parameter

setRobotUrl

public void setRobotUrl(String url)
Mutator for the robotUrl property.

Parameters:
url - The new value

getInteractive

public boolean getInteractive()
Accessor for the interactive property.

Returns:
This viewer's interactive setting

setInteractive

public void setInteractive(boolean value)
Mutator for the interactive property.

Parameters:
value - The new value

afterCompose

public void afterCompose()
Creates the robot and/or task if necessary, starts it running, and creates the output widgets.

Specified by:
afterCompose in interface AfterCompose

updateRobotMsg

public void updateRobotMsg()
Update the text output with the current output history of the robot.


Last updated: Wed, Apr 1, 2009 • 12:29 AM EDT

Copyright © 2009 Virginia Tech.