kaos.kpat.policyTemplates.editor
Class EditablePolicyTemplate

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

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

This class provides an editable policy template. The template is defined in terms of one or more policy templates called "subtemplates".

See Also:
Serialized Form

Field Summary
static java.lang.String TEMPLATE_PATH_DELIM
           
 
Fields inherited from class kaos.kpat.policyTemplates.PolicyTemplate
_instanceId
 
Constructor Summary
EditablePolicyTemplate()
           
 
Method Summary
 void addListener(EditablePolicyTemplateListener ls)
           
 void addSubtemplate(PolicyTemplate template)
           
 void addTemplateComponent(int index, TemplateComponent tempComp)
           
 void addTemplateComponent(TemplateComponent tempComp)
           
 void addTemplateComponentReference(TemplateComponentReference tcr)
           
 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 getName()
          Get the name of the PolicyTemplateEditor.
 PolicyTemplateResult getResult()
          Return the resultant policy(s) and optional policy set
 java.util.List getSubtemplates()
           
 java.util.List getTemplateComponents()
           
 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 removeBindingsFrom(TemplateComponentReference tcr)
           
 void removeListener(EditablePolicyTemplateListener ls)
           
 void removeSubtemplate(PolicyTemplate template)
           
 void removeTemplateComponent(TemplateComponent tempComp)
           
 void removeTemplateComponentReference(TemplateComponentReference tcr)
           
 void saveSubtemplateState()
           
 void setDescription(java.lang.String description)
           
 void setName(java.lang.String name)
           
 void setTemplateComponentReferences(java.util.List refs)
           
 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
static kaos.kpat.policyTemplates.editor.EditablePolicyTemplate.State stateBothSelectionsAndBindings(EditablePolicyTemplate template)
           
static kaos.kpat.policyTemplates.editor.EditablePolicyTemplate.State stateOnlySelections(EditablePolicyTemplate template)
           
 
Methods inherited from class kaos.kpat.policyTemplates.PolicyTemplate
compareTo, getInstanceId
 
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
Constructor Detail

EditablePolicyTemplate

public EditablePolicyTemplate()
Method Detail

clone

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

addListener

public void addListener(EditablePolicyTemplateListener ls)

removeListener

public void removeListener(EditablePolicyTemplateListener ls)

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 PolicyBuildingNotCompleted,
                                 TemplateBuildingNotCompleted
Throws:
PolicyBuildingNotCompleted
TemplateBuildingNotCompleted

addTemplateComponent

public void addTemplateComponent(TemplateComponent tempComp)

addTemplateComponent

public void addTemplateComponent(int index,
                                 TemplateComponent tempComp)

removeTemplateComponent

public void removeTemplateComponent(TemplateComponent tempComp)

getSubtemplates

public java.util.List getSubtemplates()

getTemplateComponents

public java.util.List getTemplateComponents()

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

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.

getResult

public PolicyTemplateResult getResult()
                               throws 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:
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
Throws:
java.lang.Exception

addTemplateComponentReference

public void addTemplateComponentReference(TemplateComponentReference tcr)
Overrides:
addTemplateComponentReference in class PolicyTemplate

removeTemplateComponentReference

public void removeTemplateComponentReference(TemplateComponentReference tcr)
Overrides:
removeTemplateComponentReference in class PolicyTemplate

setTemplateComponentReferences

public void setTemplateComponentReferences(java.util.List refs)
Overrides:
setTemplateComponentReferences in class PolicyTemplate

removeBindingsFrom

public void removeBindingsFrom(TemplateComponentReference tcr)

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

stateOnlySelections

public static kaos.kpat.policyTemplates.editor.EditablePolicyTemplate.State stateOnlySelections(EditablePolicyTemplate template)

stateBothSelectionsAndBindings

public static kaos.kpat.policyTemplates.editor.EditablePolicyTemplate.State stateBothSelectionsAndBindings(EditablePolicyTemplate template)