. First pass of a new style for the header area in the web-client UI

- Reclaims a large ammount of unused vertical space at the top of the application

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2474 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-02-23 10:13:05 +00:00
parent 2477598fcf
commit 5459a8bb36
3 changed files with 96 additions and 181 deletions

View File

@@ -1,40 +0,0 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.repo.rule;
import java.util.List;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.rule.Rule;
/**
* Rule cache interface
*
* @author Roy Wetherall
*/
public interface RuleCache
{
List<Rule> getRules(NodeRef nodeRef);
List<Rule> getInheritedRules(NodeRef nodeRef);
void setRules(NodeRef nodeRef, List<Rule> rules);
void setInheritedRules(NodeRef nodeRef, List<Rule> rules);
void dirtyRules(NodeRef nodeRef);
}

View File

@@ -104,11 +104,6 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
*/
RuntimeActionService runtimeActionService;
/**
* The rule cahce (set by default to an inactive rule cache)
*/
private RuleCache ruleCache = new InactiveRuleCache();
/**
* List of disabled node refs. The rules associated with these nodes will node be added to the pending list, and
* therefore not fired. This list is transient.
@@ -181,16 +176,6 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
this.searchService = searchService;
}
/**
* Set the rule cache
*
* @param ruleCache the rule cache
*/
public void setRuleCache(RuleCache ruleCache)
{
this.ruleCache = ruleCache;
}
/**
* Set the dictionary service
*
@@ -314,62 +299,81 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
*/
public List<Rule> getRules(NodeRef nodeRef, boolean includeInherited, String ruleTypeName)
{
List<Rule> rules = new ArrayList<Rule>();
List<Rule> rules = new ArrayList<Rule>();
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
{
if (includeInherited == true)
{
// Get any inherited rules
for (Rule rule : getInheritedRules(nodeRef, ruleTypeName, null))
{
// Ensure rules are not duplicated in the list
if (rules.contains(rule) == false)
{
rules.add(rule);
}
}
}
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
{
if (includeInherited == true)
{
// Get any inherited rules
for (Rule rule : getInheritedRules(nodeRef, ruleTypeName, null))
{
// Ensure rules are not duplicated in the list
if (rules.contains(rule) == false)
{
rules.add(rule);
}
}
}
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
{
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
{
NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
if (ruleFolder != null)
{
List<Rule> allRules = this.ruleCache.getRules(nodeRef);
if (allRules == null)
{
allRules = new ArrayList<Rule>();
List<Rule> allRules = new ArrayList<Rule>();
// Get the rules for this node
List<ChildAssociationRef> ruleChildAssocRefs =
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs)
{
// Create the rule and add to the list
NodeRef ruleNodeRef = ruleChildAssocRef.getChildRef();
Rule rule = createRule(nodeRef, ruleNodeRef);
allRules.add(rule);
}
// Get the rules for this node
List<ChildAssociationRef> ruleChildAssocRefs =
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs)
{
// Create the rule and add to the list
NodeRef ruleNodeRef = ruleChildAssocRef.getChildRef();
Rule rule = createRule(nodeRef, ruleNodeRef);
allRules.add(rule);
}
// Add the list to the cache
this.ruleCache.setRules(nodeRef, allRules);
}
// Build the list of rules that is returned to the client
for (Rule rule : allRules)
{
if ((rules.contains(rule) == false) &&
(ruleTypeName == null || ruleTypeName.equals(rule.getRuleTypeName()) == true))
{
rules.add(rule);
}
}
// Build the list of rules that is returned to the client
for (Rule rule : allRules)
{
if ((rules.contains(rule) == false) &&
(ruleTypeName == null || ruleTypeName.equals(rule.getRuleTypeName()) == true))
{
rules.add(rule);
}
}
}
}
}
}
}
return rules;
return rules;
}
/**
* @see org.alfresco.service.cmr.rule.RuleService#countRules(org.alfresco.service.cmr.repository.NodeRef)
*/
public int countRules(NodeRef nodeRef)
{
int ruleCount = 0;
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
{
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
{
NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
if (ruleFolder != null)
{
// Get the rules for this node
List<ChildAssociationRef> ruleChildAssocRefs =
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
ruleCount = ruleChildAssocRefs.size();
}
}
}
return ruleCount;
}
/**
@@ -421,35 +425,28 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
{
visitedNodeRefs.add(nodeRef);
List<Rule> allInheritedRules = this.ruleCache.getInheritedRules(nodeRef);
if (allInheritedRules == null)
List<Rule> allInheritedRules = new ArrayList<Rule>();
List<ChildAssociationRef> parents = this.runtimeNodeService.getParentAssocs(nodeRef);
for (ChildAssociationRef parent : parents)
{
allInheritedRules = new ArrayList<Rule>();
List<ChildAssociationRef> parents = this.runtimeNodeService.getParentAssocs(nodeRef);
for (ChildAssociationRef parent : parents)
List<Rule> rules = getRules(parent.getParentRef(), false);
for (Rule rule : rules)
{
List<Rule> rules = getRules(parent.getParentRef(), false);
for (Rule rule : rules)
// Add is we hanvn't already added and it should be applied to the children
if (rule.isAppliedToChildren() == true && allInheritedRules.contains(rule) == false)
{
// Add is we hanvn't already added and it should be applied to the children
if (rule.isAppliedToChildren() == true && allInheritedRules.contains(rule) == false)
{
allInheritedRules.add(rule);
}
}
for (Rule rule : getInheritedRules(parent.getParentRef(), ruleTypeName, visitedNodeRefs))
{
// Ensure that we don't get any rule duplication (don't use a set cos we want to preserve order)
if (allInheritedRules.contains(rule) == false)
{
allInheritedRules.add(rule);
}
allInheritedRules.add(rule);
}
}
// Add the list of inherited rules to the cache
this.ruleCache.setInheritedRules(nodeRef, allInheritedRules);
for (Rule rule : getInheritedRules(parent.getParentRef(), ruleTypeName, visitedNodeRefs))
{
// Ensure that we don't get any rule duplication (don't use a set cos we want to preserve order)
if (allInheritedRules.contains(rule) == false)
{
allInheritedRules.add(rule);
}
}
}
if (ruleTypeName == null)
@@ -903,54 +900,4 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
}
}
}
/**
* Inactive rule cache
*
* @author Roy Wetherall
*/
private class InactiveRuleCache implements RuleCache
{
/**
* @see org.alfresco.repo.rule.RuleCache#getRules(org.alfresco.service.cmr.repository.NodeRef)
*/
public List<Rule> getRules(NodeRef nodeRef)
{
// do nothing
return null;
}
/**
* @see org.alfresco.repo.rule.RuleCache#setRules(org.alfresco.service.cmr.repository.NodeRef, List<Rule>)
*/
public void setRules(NodeRef nodeRef, List<Rule> rules)
{
// do nothing
}
/**
* @see org.alfresco.repo.rule.RuleCache#dirtyRules(org.alfresco.service.cmr.repository.NodeRef)
*/
public void dirtyRules(NodeRef nodeRef)
{
// do nothing
}
/**
* @see org.alfresco.repo.rule.RuleCache#getInheritedRules(org.alfresco.service.cmr.repository.NodeRef)
*/
public List<Rule> getInheritedRules(NodeRef nodeRef)
{
// do nothing
return null;
}
/**
* @see org.alfresco.repo.rule.RuleCache#setInheritedRules(org.alfresco.service.cmr.repository.NodeRef, List<Rule>)
*/
public void setInheritedRules(NodeRef nodeRef, List<Rule> rules)
{
// do nothing
}
}
}

View File

@@ -117,7 +117,7 @@ public interface RuleService
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertied);
/**
* Get the rules associatied with an actionable node that are of a specific rule type.
* Get the rules associated with an actionable node that are of a specific rule type.
*
* @param nodeRef the node reference
* @param includeInhertiedRuleType indicates whether the inherited rules should be included in
@@ -128,6 +128,14 @@ public interface RuleService
*/
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName);
/**
* Count the number of rules associated with an actionable node.
*
* @param nodeRef the node reference
* @return a list of the rules associated with the node
*/
public int countRules(NodeRef nodeRef);
/**
* Get the rule given its id.
*