com.alveole.studio.web.managers
Class Struts2ActionActionManager

java.lang.Object
  extended by com.alveole.studio.web.managers.Struts2ActionActionManager
All Implemented Interfaces:
ActionManager

public class Struts2ActionActionManager
extends java.lang.Object
implements ActionManager

This is the default implementation of action manager: a Struts2 action manager.

Author:
sylvain

Field Summary
static java.lang.String ID
          This plugin ID.
 
Constructor Summary
Struts2ActionActionManager()
           
 
Method Summary
 NodeAction copyAction(ProjectContext context, NodeAction source, NodePackage np)
          Create a copy of the action.
 void createAction(ProjectContext context, NodePackage np)
          Create a new node action, conforming to this driver.
 void deleteAction(NodeAction action)
          Delete this node.
 void editAction(NodeAction action, boolean shortView)
          Open GUI for edition.
static NodeAction getActionByPath(NodePackage np, java.lang.String path)
          Get an action by its path.
<T> T
getAdapter(NodeAction action, java.lang.Class<T> target)
          Get an adapter of the given class.
 java.awt.Image getNodeShape(NodeAction action)
          Gets this node's representation shape.
static void gotoActionMethod(ProjectContext context, NodeAction action2, Struts2CustomObject co, java.lang.String className, java.lang.String methodName, boolean fireChangeEvent)
          Opens Action Java Source file and focus on action method.
 void serialize(NodeAction action, org.w3c.dom.Element specific)
          Write data to XML file.
 void unserialize(NodeAction action, org.w3c.dom.Element specific)
          Load data from XML and populate this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID
This plugin ID.

See Also:
Constant Field Values
Constructor Detail

Struts2ActionActionManager

public Struts2ActionActionManager()
Method Detail

createAction

public void createAction(ProjectContext context,
                         NodePackage np)
Create a new node action, conforming to this driver.

Specified by:
createAction in interface ActionManager
Parameters:
context - The project context.
np - The package in which this node must be added.

getActionByPath

public static NodeAction getActionByPath(NodePackage np,
                                         java.lang.String path)
Get an action by its path.


copyAction

public NodeAction copyAction(ProjectContext context,
                             NodeAction source,
                             NodePackage np)
Create a copy of the action. If an action has the same path in the target package, then change it.

Specified by:
copyAction in interface ActionManager
Parameters:
context - The current project.
source - The original node.
np - The target package in which copied node must be dropped.
Returns:
the copy or null if cannot be copied.

deleteAction

public void deleteAction(NodeAction action)
Delete this node.

Specified by:
deleteAction in interface ActionManager
Parameters:
action - The node to delete.

gotoActionMethod

public static void gotoActionMethod(ProjectContext context,
                                    NodeAction action2,
                                    Struts2CustomObject co,
                                    java.lang.String className,
                                    java.lang.String methodName,
                                    boolean fireChangeEvent)
Opens Action Java Source file and focus on action method.

Parameters:
context - The project context.
action2 - The action to be edited.
co - The struts2 custom object (or a working copy).
className - The fully qualified name of the class to edit.
methodName - The name of the method to edit, or null if not defined.
fireChangeEvent - Specifies if a change event must be fired after class creation.

editAction

public void editAction(NodeAction action,
                       boolean shortView)
Open GUI for edition. If fastview, only open a light panel, else open target Java class (create it if necessary).

Specified by:
editAction in interface ActionManager
Parameters:
action - The node to be edited.
shortView - Specifies if the node was selected by single click or dbl-click.

serialize

public void serialize(NodeAction action,
                      org.w3c.dom.Element specific)
Write data to XML file.

Specified by:
serialize in interface ActionManager
Parameters:
action - The node to serialize (serialize only specific parts of this node).
specific - A DOM tag that is used to store all specific data.

unserialize

public void unserialize(NodeAction action,
                        org.w3c.dom.Element specific)
Load data from XML and populate this object.

Specified by:
unserialize in interface ActionManager
Parameters:
action - The action to fill with specific data.
specific - The DOM node that contains all specific stored properties.

getAdapter

public <T> T getAdapter(NodeAction action,
                        java.lang.Class<T> target)
Get an adapter of the given class.

Specified by:
getAdapter in interface ActionManager
Parameters:
action - The node to be adapted.
target - A target class.
Returns:
The adapted object or null.

getNodeShape

public java.awt.Image getNodeShape(NodeAction action)
Gets this node's representation shape.

Specified by:
getNodeShape in interface ActionManager
Parameters:
action - The node action.
Returns:
The image to represent this action.