com.ephox.editlive.custom
Class ActionController

java.lang.Object
  extended by com.ephox.editlive.custom.ActionController

public final class ActionController
extends Object

Central point for managing menubar and toolbar items from the configuration file. Menu items and toolbar buttons are both created referencing an EphoxAction - see AbstractButton.setAction(Action) for more details on Action / Button interaction.

Action instances are unique, so changing one action will automatically update any menu items or toolbar buttons that reference it.

Action instances are indexed using the name from the configuration file. Valid actions that can be accessed are:

Instance available via ELJBean.getActionController().

NOTE: Methods on this class must not be called before the editor has finished loading.

Since:
7.0

Method Summary
 EphoxAction getAction(Map<String,String> map)
          Get an action and override existing settings.
 EphoxAction getAction(String name)
          Get the action with the specified name.
 EphoxAction getMenuAction(String name)
          Returns the first menu whose name matches the given name, or null if none match.
 List<List<EphoxAction>> getToolbarFromConfigItem(ConfigItem configItem)
          Returns a representation of EphoxAction's on a toolbar.
 EphoxAction updateAction(String name, Map<String,?> actionSettings)
          Populate an action from a map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAction

public EphoxAction getAction(String name)
Get the action with the specified name.

Parameters:
name - the name of the action to retrieve.
Returns:
the EphoxAction matching name or null if no action is defined with that name.

getAction

public EphoxAction getAction(Map<String,String> map)
Get an action and override existing settings. Valid settings that can be overridden are listed in the customToolbarButton documentation.

Parameters:
map - Action definition to search for and update
Returns:
Action that has been updated, or null if no Action matches the name specified in the map

updateAction

public EphoxAction updateAction(String name,
                                Map<String,?> actionSettings)
Populate an action from a map.

If the name refers to a valid action, this calls Action.putValue(String, Object) for each item in the map and then returns the action.

This differs from getAction(Map) in that everything in the map is passed to the Action, not just valid custom settings.

Parameters:
name - Action to update
actionSettings - Map of settings to put in the action
Returns:
Updated action, or null if no action is defined with that name

getMenuAction

public EphoxAction getMenuAction(String name)
Returns the first menu whose name matches the given name, or null if none match. Match is case-insensitive.

Parameters:
name -
Returns:
EphoxAction if found, otherwise null.
Since:
8.1.0.118

getToolbarFromConfigItem

public List<List<EphoxAction>> getToolbarFromConfigItem(ConfigItem configItem)
Returns a representation of EphoxAction's on a toolbar. Each group (between separators) on the toolbar is a separate list. Useful for passing to ToolbarFactory.createInlineToolbar(List, boolean)

Parameters:
configItem - Configuration reference for the parent "toolbar" or "inlineToolbar" configuration element
Since:
9.0 - return type changed

Copyright (c) 2005-2013 Ephox Pty Ltd. All rights reserved.