Daily merge.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2882 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-05-12 20:22:46 +00:00
parent 1250a0352c
commit 1dd2a7b72b
67 changed files with 1364 additions and 389 deletions

View File

@@ -18,8 +18,8 @@ package org.alfresco.web.config;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -29,6 +29,7 @@ import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigException;
import org.alfresco.config.element.ConfigElementAdapter;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Repository;
/**
* Action config element.
@@ -71,15 +72,58 @@ public class ActionsConfigElement extends ConfigElementAdapter
*/
public ConfigElement combine(ConfigElement configElement)
{
ActionsConfigElement existingElement = (ActionsConfigElement)configElement;
ActionsConfigElement newElement = (ActionsConfigElement)configElement;
ActionsConfigElement combinedElement = new ActionsConfigElement();
// add the existing action definitions
combinedElement.actionDefs.putAll(this.actionDefs);
combinedElement.actionDefs.putAll(existingElement.actionDefs);
// overwrite any existing action definitions i.e. don't combine
combinedElement.actionDefs.putAll(newElement.actionDefs);
// add the existing action groups
combinedElement.actionGroups.putAll(this.actionGroups);
combinedElement.actionGroups.putAll(existingElement.actionGroups);
// any new action groups with the same name must be combined
for (ActionGroup newGroup : newElement.actionGroups.values())
{
if (combinedElement.actionGroups.containsKey(newGroup.getId()))
{
// there is already a group with this id, combine it
// with the new one
ActionGroup combinedGroup = combinedElement.actionGroups.get(newGroup.getId());
if (newGroup.ShowLink != combinedGroup.ShowLink)
{
combinedGroup.ShowLink = newGroup.ShowLink;
}
if (newGroup.Style != null)
{
combinedGroup.Style = newGroup.Style;
}
if (newGroup.StyleClass != null)
{
combinedGroup.StyleClass = newGroup.StyleClass;
}
// add all the actions from the new group to the combined one
for (String actionRef : newGroup.getAllActions())
{
combinedGroup.addAction(actionRef);
}
// add all the hidden actions from the new group to the combined one
for (String actionRef : newGroup.getHiddenActions())
{
combinedGroup.hideAction(actionRef);
}
}
else
{
// it's a new group so just add it
combinedElement.actionGroups.put(newGroup.getId(), newGroup);
}
}
return combinedElement;
}
@@ -210,17 +254,43 @@ public class ActionsConfigElement extends ConfigElementAdapter
return id;
}
public void addAction(String actionId)
/**
* @return Iterator over the visible ActionDefinition IDs referenced by this group
*/
public Iterator<String> iterator()
{
// create a list of the visible actions and return it's iterator
ArrayList<String> visibleActions = new ArrayList<String>(
this.actions.size() - this.hiddenActions.size());
for (String actionId : this.actions)
{
if (this.hiddenActions.contains(actionId) == false)
{
visibleActions.add(actionId);
}
}
return visibleActions.iterator();
}
/*package*/ void addAction(String actionId)
{
actions.add(actionId);
}
/**
* @return Iterator over the ActionDefinition IDs referenced by this group
*/
public Iterator<String> iterator()
/*package*/ void hideAction(String actionId)
{
return actions.iterator();
this.hiddenActions.add(actionId);
}
/*package*/ Set<String> getAllActions()
{
return this.actions;
}
/*pacakge*/ Set<String> getHiddenActions()
{
return this.hiddenActions;
}
private String id;
@@ -229,6 +299,9 @@ public class ActionsConfigElement extends ConfigElementAdapter
than one action with the same Id and that the insertion order is preserved */
private Set<String> actions = new LinkedHashSet<String>(16, 1.0f);
/** the actions that have been hidden */
private Set<String> hiddenActions = new HashSet<String>(4, 1.0f);
public boolean ShowLink;
public String Style;
public String StyleClass;