kaos.kpat.policyTemplates.editor
Class HTDefinedPolicyTemplate

java.lang.Object
  extended by kaos.kpat.policyTemplates.PolicyTemplate
      extended by kaos.kpat.policyTemplates.editor.HTDefinedPolicyTemplate
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, DefinedPolicyTemplate

public class HTDefinedPolicyTemplate
extends PolicyTemplate
implements java.io.Serializable, java.lang.Cloneable, DefinedPolicyTemplate

This class provides a user-defined hypertext policy template. The template is defined in terms of one or more policy templates called "subtemplates".

Author:
James Lott
See Also:
Serialized Form

Field Summary
 TunnelClient _tunnelClient
           
static java.lang.String SUBTEMPLATE_STATES
           
static java.lang.String TEMPLATE_DESC
           
static java.lang.String TEMPLATE_HTML
           
static java.lang.String TEMPLATE_NAME
           
static java.lang.String TEMPLATE_PATH_DELIM
           
 
Fields inherited from class kaos.kpat.policyTemplates.PolicyTemplate
_instanceId
 
Constructor Summary
HTDefinedPolicyTemplate()
           
 
Method Summary
 void addSubtemplate(PolicyTemplate template)
           
 java.lang.Object clone()
           
 void createPolicy(SubjectMsg optionalSubject)
          Update the display component to create a new policy.
 void editPolicy(PolicyTemplateResult existingPolicy)
          If this EditablePolictTemplate serves as a subtemplate for some other EditablePolictTemplate, then it needs to look at it's bindings and set the selection of ReferenceableTemplateComponent objects in the other EditablePolictTemplate accordingly.
 java.lang.String getDescription()
          Get the description of the PolicyTemplateEditor.
 java.awt.Component getDisplayComponent()
          Return the component to be displayed to the user
 java.lang.String getHTMLText()
           
 java.lang.String getName()
          Get the name of the PolicyTemplateEditor.
 PolicyTemplateResult getResult()
          Return the resultant policy(s) and optional policy set
 java.lang.Object getState()
           
 java.util.List getSubtemplates()
           
 java.lang.String getTemplateCreator()
          Get the creator of the PolicyTemplateEditor.
 java.lang.Object getTemplateState()
          This method is used if this template is a subtemplate
 void initialize(TunnelClient tunnelClient, java.util.Hashtable subjectTreeModels, PolicyTemplateFactory factory)
          Initialize the template In most instances, the GUI components should be built at this time
 void removeSubtemplate(PolicyTemplate template)
           
 void saveSubtemplateState()
           
 void setDescription(java.lang.String description)
           
 void setHTMLText(java.lang.String html)
           
 void setName(java.lang.String name)
           
 void setState(java.lang.Object o)
           
 void setTemplateEditor(HypertextEditor editor)
           
 void setTemplateState(java.lang.Object state)
          This method is used if this template is a subtemplate It should restore it's state from the state object returned above
 
Methods inherited from class kaos.kpat.policyTemplates.PolicyTemplate
addTemplateComponentReference, compareTo, getInstanceId, removeTemplateComponentReference, setTemplateComponentReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE_PATH_DELIM

public static final java.lang.String TEMPLATE_PATH_DELIM
See Also:
Constant Field Values

_tunnelClient

public transient TunnelClient _tunnelClient

TEMPLATE_NAME

public static final java.lang.String TEMPLATE_NAME
See Also:
Constant Field Values

TEMPLATE_DESC

public static final java.lang.String TEMPLATE_DESC
See Also:
Constant Field Values

TEMPLATE_HTML

public static final java.lang.String TEMPLATE_HTML
See Also:
Constant Field Values

SUBTEMPLATE_STATES

public static final java.lang.String SUBTEMPLATE_STATES
See Also:
Constant Field Values
Constructor Detail

HTDefinedPolicyTemplate

public HTDefinedPolicyTemplate()
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getHTMLText

public java.lang.String getHTMLText()

setHTMLText

public void setHTMLText(java.lang.String html)

setName

public void setName(java.lang.String name)

setDescription

public void setDescription(java.lang.String description)

addSubtemplate

public void addSubtemplate(PolicyTemplate template)

removeSubtemplate

public void removeSubtemplate(PolicyTemplate template)

saveSubtemplateState

public void saveSubtemplateState()
                          throws KAoSPolicyBuilder.PolicyBuildingNotCompleted,
                                 TemplateBuildingNotCompleted
Throws:
KAoSPolicyBuilder.PolicyBuildingNotCompleted
TemplateBuildingNotCompleted

getSubtemplates

public java.util.List getSubtemplates()

initialize

public void initialize(TunnelClient tunnelClient,
                       java.util.Hashtable subjectTreeModels,
                       PolicyTemplateFactory factory)
                throws java.lang.Exception
Description copied from class: PolicyTemplate
Initialize the template In most instances, the GUI components should be built at this time

Specified by:
initialize in class PolicyTemplate
Throws:
java.lang.Exception

setTemplateEditor

public void setTemplateEditor(HypertextEditor editor)

getName

public java.lang.String getName()
Description copied from class: PolicyTemplate
Get the name of the PolicyTemplateEditor.

Specified by:
getName in class PolicyTemplate
Returns:
String Represents the policy template editor name.

getDescription

public java.lang.String getDescription()
Description copied from class: PolicyTemplate
Get the description of the PolicyTemplateEditor.

Specified by:
getDescription in class PolicyTemplate
Returns:
String Represents the policy template editor name.

getTemplateCreator

public java.lang.String getTemplateCreator()
Description copied from class: PolicyTemplate
Get the creator of the PolicyTemplateEditor.

Specified by:
getTemplateCreator in class PolicyTemplate
Returns:
String Represents the policy template editor creator.

getResult

public PolicyTemplateResult getResult()
                               throws KAoSPolicyBuilder.PolicyBuildingNotCompleted
Description copied from class: PolicyTemplate
Return the resultant policy(s) and optional policy set

Specified by:
getResult in class PolicyTemplate
Returns:
PolicyTemplateEditorResult the resultant policy(s)
Throws:
KAoSPolicyBuilder.PolicyBuildingNotCompleted

getDisplayComponent

public java.awt.Component getDisplayComponent()
Description copied from class: PolicyTemplate
Return the component to be displayed to the user

Specified by:
getDisplayComponent in class PolicyTemplate

createPolicy

public void createPolicy(SubjectMsg optionalSubject)
                  throws java.lang.Exception
Description copied from class: PolicyTemplate
Update the display component to create a new policy. Also called when a template is edited or created. This second usage exists to ensure that the selections of template components in the template is reset to their default values. If your template requires a subject, you should override the requiresSubject() method to return true;

Specified by:
createPolicy in class PolicyTemplate
Parameters:
optionalSubject - The subject if the editor was invoked for it
Throws:
java.lang.Exception

editPolicy

public void editPolicy(PolicyTemplateResult existingPolicy)
                throws java.lang.Exception
If this EditablePolictTemplate serves as a subtemplate for some other EditablePolictTemplate, then it needs to look at it's bindings and set the selection of ReferenceableTemplateComponent objects in the other EditablePolictTemplate accordingly.

Specified by:
editPolicy in class PolicyTemplate
Parameters:
existingPolicy - Contains information about the existing policy(s) (and optionally policy set)
Throws:
java.lang.Exception

getTemplateState

public java.lang.Object getTemplateState()
                                  throws TemplateBuildingNotCompleted
Description copied from class: PolicyTemplate
This method is used if this template is a subtemplate

Overrides:
getTemplateState in class PolicyTemplate
Throws:
TemplateBuildingNotCompleted

setTemplateState

public void setTemplateState(java.lang.Object state)
Description copied from class: PolicyTemplate
This method is used if this template is a subtemplate It should restore it's state from the state object returned above

Overrides:
setTemplateState in class PolicyTemplate

getState

public java.lang.Object getState()
Specified by:
getState in interface DefinedPolicyTemplate

setState

public void setState(java.lang.Object o)
Specified by:
setState in interface DefinedPolicyTemplate