com.japisoft.xmlpad.action
Class ActionModel

java.lang.Object
  |
  +--com.japisoft.xmlpad.action.ActionModel

public class ActionModel
extends java.lang.Object

ActionModel

Here a model managing available action for the XMLContainer. This class manage actions and actionGroup. An ActionGroup is a set of Action. As example, inside the XMLContainer component a group is delimited by a separator inside the main toolbar.

This ActionModel is initialized using the 'xmlpad.properties' file. This properties are managed by the XMLPadProperties class, thus with it user can avoid the file usage working directly in memory.

Version:
1.1
Author:
A.Brillant

Field Summary
static java.lang.String COMMENT_ACTION
          Comment action
static java.lang.String COPY_ACTION
          Copy action
static java.lang.String CUT_ACTION
          Cut action
static java.lang.String EDIT_GROUP
          Edit group
static java.lang.String FILE_GROUP
          File group
static java.lang.String FORMAT_ACTION
          Format action
static java.lang.String LOAD_ACTION
          Load action
static java.lang.String NEW_ACTION
          New action
static java.lang.String OTHER_GROUP
          Other group
static java.lang.String PASTE_ACTION
          Paste action
static java.lang.String REDO_ACTION
          Redo action
static java.lang.String REFRESH_ACTION
          Refresh action
static java.lang.String SAVE_ACTION
          Save action
static java.lang.String SAVEAS_ACTION
          SaveAs action
static java.lang.String SEARCH_ACTION
          Search action
static java.lang.String SEARCH_GROUP
          Search group
static java.lang.String SPLIT_ACTION
          Split action
static java.lang.String UNDO_ACTION
          Undo action
static java.lang.String XML_GROUP
          XML group
 
Constructor Summary
ActionModel()
           
 
Method Summary
static boolean activeActionByName(java.lang.String name)
          Active an action by its name
static void addActionForGroup(java.lang.String groupName, java.lang.String actionClass)
          Add a new action for this groupName.
static void addActionForGroup(java.lang.String groupName, XMLAction a)
          Add this action 'a' for the followed groupName.
static void addGroup(ActionGroup group)
          Insert a new group of actions
static XMLAction getActionByName(java.lang.String name)
           
static java.util.Enumeration getGroups()
           
static boolean hasFeature(java.lang.String actionName, java.lang.String featureName)
          Check a feature for this action name
static boolean isEnabledAction(java.lang.String name)
           
static void removeActionForGroup(java.lang.String groupName, XMLAction a)
          Remove this action 'a' from the following groupName.
static void removeGroup(ActionGroup group)
          Remove a group of action
static void replaceActionByName(java.lang.String name, XMLAction newAction)
          Replace an action matching the name by the newAction
static void resetActionState(XMLEditor editor, XMLContainer container)
          Reset the current Action state for this editor and this container, thus action will work on the good editor
static void setEnabledAction(java.lang.String name, boolean enabled)
          Enabled/Disabled an action by its name
static void setFeature(java.lang.String actionName, java.lang.String featureName, boolean enabled)
          Set a feature for this action name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW_ACTION

public static java.lang.String NEW_ACTION
New action


UNDO_ACTION

public static java.lang.String UNDO_ACTION
Undo action


REDO_ACTION

public static java.lang.String REDO_ACTION
Redo action


COPY_ACTION

public static java.lang.String COPY_ACTION
Copy action


CUT_ACTION

public static java.lang.String CUT_ACTION
Cut action


PASTE_ACTION

public static java.lang.String PASTE_ACTION
Paste action


REFRESH_ACTION

public static java.lang.String REFRESH_ACTION
Refresh action


SEARCH_ACTION

public static java.lang.String SEARCH_ACTION
Search action


COMMENT_ACTION

public static java.lang.String COMMENT_ACTION
Comment action


SAVEAS_ACTION

public static java.lang.String SAVEAS_ACTION
SaveAs action


SAVE_ACTION

public static java.lang.String SAVE_ACTION
Save action


LOAD_ACTION

public static java.lang.String LOAD_ACTION
Load action


SPLIT_ACTION

public static java.lang.String SPLIT_ACTION
Split action


FORMAT_ACTION

public static java.lang.String FORMAT_ACTION
Format action


FILE_GROUP

public static java.lang.String FILE_GROUP
File group


EDIT_GROUP

public static java.lang.String EDIT_GROUP
Edit group


SEARCH_GROUP

public static java.lang.String SEARCH_GROUP
Search group


XML_GROUP

public static java.lang.String XML_GROUP
XML group


OTHER_GROUP

public static java.lang.String OTHER_GROUP
Other group

Constructor Detail

ActionModel

public ActionModel()
Method Detail

resetActionState

public static void resetActionState(XMLEditor editor,
                                    XMLContainer container)
Reset the current Action state for this editor and this container, thus action will work on the good editor

Parameters:
editor -
container -

addGroup

public static void addGroup(ActionGroup group)
Insert a new group of actions


removeGroup

public static void removeGroup(ActionGroup group)
Remove a group of action


addActionForGroup

public static void addActionForGroup(java.lang.String groupName,
                                     XMLAction a)
Add this action 'a' for the followed groupName. If the groupName is not known then the action a is added to a new ActionGroup getting the groupName.

Parameters:
groupName - existing group name
a - XML action

addActionForGroup

public static void addActionForGroup(java.lang.String groupName,
                                     java.lang.String actionClass)
                              throws java.lang.ClassNotFoundException
Add a new action for this groupName. If the action is not found a ClassNotFoundException will be thrown

java.lang.ClassNotFoundException

removeActionForGroup

public static void removeActionForGroup(java.lang.String groupName,
                                        XMLAction a)
Remove this action 'a' from the following groupName. If no action group is found then then nothing is done.

Parameters:
groupName -
a -

getActionByName

public static XMLAction getActionByName(java.lang.String name)
Returns:
current action by name

replaceActionByName

public static void replaceActionByName(java.lang.String name,
                                       XMLAction newAction)
Replace an action matching the name by the newAction


setEnabledAction

public static void setEnabledAction(java.lang.String name,
                                    boolean enabled)
Enabled/Disabled an action by its name


isEnabledAction

public static boolean isEnabledAction(java.lang.String name)
Returns:
the current action state. If the action is not know it will return false

activeActionByName

public static boolean activeActionByName(java.lang.String name)
Active an action by its name

Returns:
true is the action is possible else false if something is wrong

getGroups

public static java.util.Enumeration getGroups()
Returns:
available groups

setFeature

public static void setFeature(java.lang.String actionName,
                              java.lang.String featureName,
                              boolean enabled)
Set a feature for this action name


hasFeature

public static boolean hasFeature(java.lang.String actionName,
                                 java.lang.String featureName)
Check a feature for this action name