lib
Class ActionElement

java.lang.Object
  extended by lib.ActionElement
All Implemented Interfaces:
IEditableElement

public class ActionElement
extends java.lang.Object
implements IEditableElement

An action element is either an action primitive or composite name, or alternatively is a boolean sense primitive, possibly with a value and predicate.

Version:
1.0
Author:
CobaltSoftware (abode.devteam@cobaltsoftware.net)

Field Summary
private  boolean bIsSense
           
private  java.lang.String strComparator
           
private  java.lang.String strElementName
           
private  java.lang.String strValue
           
 
Constructor Summary
ActionElement(boolean isSense, java.lang.String elementName)
          Create an action element with a comp/prim name only
ActionElement(java.lang.String strSense, java.lang.String strVal)
          Create an action element with a sense name and a value.
ActionElement(java.lang.String strSense, java.lang.String strVal, java.lang.String pred)
          Create an action element with a sense name, value and predicate
 
Method Summary
static JTreeNode actionListToTree(java.lang.String text, java.lang.String subText, java.util.ArrayList triggerList, JTreeNode start, IEditableElement bindTo)
          Convert an arraylist of actionelements into a tree representation.
 JTreeNode buildTree(JTreeNode root, LearnableActionPattern lap, boolean detailed, boolean expanded)
          Convert this element into a tree branch
 java.lang.String getElementName()
          Get the name of the element or sense we'return referring to
 boolean getIsSense()
          Return whether or not we represent a sense
 java.lang.String getPredicate()
          Get the predicate we're using
 ActionElement getSelf()
          For accesing local references via inner class
 java.lang.String getValue()
          Get the value of the argument of this element
 void onSelect(JAbode mainGui, JEditorWindow subGui, JDiagram diagram)
          When we click this Action Element in the GUI populate the properties panel with the various attributes and setup listeners to catch modifications that are made.
 void setElementName(java.lang.String val)
          Set the name of the element, action primitive or composite we refer to
 void setIsSense(boolean isSense)
          Set whether or not we're a sense
 void setPredicate(java.lang.String pred)
          Set the predicate this action element uses
 void setValue(java.lang.String val)
          Set the value to compare against
 void showContextMenu(JTreeNode showOn, LearnableActionPattern lap, JEditorWindow window, JDiagram diagram)
          Produce and show a context menu for this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bIsSense

private boolean bIsSense

strElementName

private java.lang.String strElementName

strValue

private java.lang.String strValue

strComparator

private java.lang.String strComparator
Constructor Detail

ActionElement

public ActionElement(boolean isSense,
                     java.lang.String elementName)
Create an action element with a comp/prim name only

Parameters:
isSense - Is this a sense primitive or not?
elementName - The name of this comp

ActionElement

public ActionElement(java.lang.String strSense,
                     java.lang.String strVal)
Create an action element with a sense name and a value.

Parameters:
strSense - Name of the sense we're constructing
strVal - Value of the element

ActionElement

public ActionElement(java.lang.String strSense,
                     java.lang.String strVal,
                     java.lang.String pred)
Create an action element with a sense name, value and predicate

Parameters:
strSense - Name of the sense we're constructing
strVal - Value comparing against
pred - Predicate used for comparison (i.e. < or >)
Method Detail

getElementName

public java.lang.String getElementName()
Get the name of the element or sense we'return referring to

Returns:
Name of this action or sense

getIsSense

public boolean getIsSense()
Return whether or not we represent a sense

Returns:
True if we're a sense, false if we're an action or composite.

getPredicate

public java.lang.String getPredicate()
Get the predicate we're using

Returns:
The predicate used for comparisons or null if none is specified.

getValue

public java.lang.String getValue()
Get the value of the argument of this element

Returns:
Value we're being compared against

setElementName

public void setElementName(java.lang.String val)
Set the name of the element, action primitive or composite we refer to

Parameters:
val - Name to set our element to

setIsSense

public void setIsSense(boolean isSense)
Set whether or not we're a sense


setPredicate

public void setPredicate(java.lang.String pred)
Set the predicate this action element uses


setValue

public void setValue(java.lang.String val)
Set the value to compare against


getSelf

public ActionElement getSelf()
For accesing local references via inner class


onSelect

public void onSelect(JAbode mainGui,
                     JEditorWindow subGui,
                     JDiagram diagram)
When we click this Action Element in the GUI populate the properties panel with the various attributes and setup listeners to catch modifications that are made.

Specified by:
onSelect in interface IEditableElement
Parameters:
mainGui - The reference to the outer GUI
subGui - The internal frame we're referring to
diagram - The diagram we're being select on.

showContextMenu

public void showContextMenu(JTreeNode showOn,
                            LearnableActionPattern lap,
                            JEditorWindow window,
                            JDiagram diagram)
Produce and show a context menu for this object

Specified by:
showContextMenu in interface IEditableElement
Parameters:
showOn - The tree node invoking us
lap - The file we're a part of
window - The window we're being dispalyed in
diagram - The diagram in the window we'return being shown on

actionListToTree

public static JTreeNode actionListToTree(java.lang.String text,
                                         java.lang.String subText,
                                         java.util.ArrayList triggerList,
                                         JTreeNode start,
                                         IEditableElement bindTo)
Convert an arraylist of actionelements into a tree representation.

Parameters:
text - Text to show on this list's header node
subText - Text to show as the subtitle of lists header node
triggerList - List of elements comprising this trigger/ap
start - The point of the tree we'return attatching ourselves to.
bindTo - The editable widget we're linked to
Returns:
A constructed subtree showing the specified arraylist of action elements in some desirable form

buildTree

public JTreeNode buildTree(JTreeNode root,
                           LearnableActionPattern lap,
                           boolean detailed,
                           boolean expanded)
Convert this element into a tree branch

Specified by:
buildTree in interface IEditableElement
Parameters:
root - The root of this sub-tree
lap - The learnable action pattern file we're part of.
detailed - Is the diagram detailed (i.e. decorative nodes)
expanded - Is this diagram expanded (i.e. show sub-tree chained elements)
Returns:
A constructed sub-tree showing this element and any sub-elements that need to be demonstrated.