. Merge horrors fixed

. Code compile issue fixed

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4669 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-12-20 10:03:44 +00:00
parent e6f28374a5
commit ec80a72900
11 changed files with 1932 additions and 1926 deletions

View File

@@ -93,6 +93,7 @@ public class TemplateNode implements Serializable
private String displayPath = null;
private String mimetype = null;
private Long size = null;
protected TemplateImageResolver imageResolver = null;
private TemplateNode parent = null;
private ChildAssociationRef primaryParentAssoc = null;
private Boolean isCategory = null;
@@ -108,7 +109,7 @@ public class TemplateNode implements Serializable
* @param services The ServiceRegistry the TemplateNode can use to access services
* @param resolver Image resolver to use to retrieve icons
*/
public TemplateNode(NodeRef nodeRef, ServiceRegistry services)
public TemplateNode(NodeRef nodeRef, ServiceRegistry services, TemplateImageResolver resolver)
{
if (nodeRef == null)
{
@@ -123,6 +124,7 @@ public class TemplateNode implements Serializable
this.nodeRef = nodeRef;
this.id = nodeRef.getId();
this.services = services;
this.imageResolver = resolver;
this.properties = new QNameMap<String, Object>(this.services.getNamespaceService());
}
@@ -131,14 +133,6 @@ public class TemplateNode implements Serializable
// ------------------------------------------------------------------------------
// Node API
/**
* Gets the image resolver
*/
public TemplateImageResolver getImageResolver()
{
return imageResolver;
}
/**
* @return The GUID for the node
*/
@@ -208,7 +202,7 @@ public class TemplateNode implements Serializable
for (ChildAssociationRef ref : childRefs)
{
// create our Node representation from the NodeRef
TemplateNode child = new TemplateNode(ref.getChildRef(), this.services);
TemplateNode child = new TemplateNode(ref.getChildRef(), this.services, this.imageResolver);
this.children.add(child);
}
}
@@ -235,7 +229,7 @@ public class TemplateNode implements Serializable
nodes = new ArrayList<TemplateNode>(4);
this.assocs.put(ref.getTypeQName().toString(), nodes);
}
nodes.add( new TemplateNode(ref.getTargetRef(), this.services) );
nodes.add( new TemplateNode(ref.getTargetRef(), this.services, this.imageResolver) );
}
}
@@ -258,7 +252,7 @@ public class TemplateNode implements Serializable
{
// NodeRef object properties are converted to new TemplateNode objects
// so they can be used as objects within a template
propValue = new TemplateNode(((NodeRef)propValue), this.services);
propValue = new TemplateNode(((NodeRef)propValue), this.services, this.imageResolver);
}
else if (propValue instanceof ContentData)
{
@@ -392,7 +386,7 @@ public class TemplateNode implements Serializable
// handle root node (no parent!)
if (parentRef != null)
{
parent = new TemplateNode(parentRef, this.services);
parent = new TemplateNode(parentRef, this.services, this.imageResolver);
}
}
@@ -549,7 +543,21 @@ public class TemplateNode implements Serializable
*/
public String getIcon16()
{
return "/images/filetypes/_default.gif";
if (this.imageResolver != null)
{
if (getIsDocument())
{
return this.imageResolver.resolveImagePathForName(getName(), true);
}
else
{
return "/images/icons/space_small.gif";
}
}
else
{
return "/images/filetypes/_default.gif";
}
}
/**
@@ -557,7 +565,29 @@ public class TemplateNode implements Serializable
*/
public String getIcon32()
{
return "/images/filetypes32/_default.gif";
if (this.imageResolver != null)
{
if (getIsDocument())
{
return this.imageResolver.resolveImagePathForName(getName(), false);
}
else
{
String icon = (String)getProperties().get("app:icon");
if (icon != null)
{
return "/images/icons/" + icon + ".gif";
}
else
{
return "/images/icons/space-icon-default.gif";
}
}
}
else
{
return "/images/filetypes32/_default.gif";
}
}
@@ -661,6 +691,14 @@ public class TemplateNode implements Serializable
// ------------------------------------------------------------------------------
// Misc helpers
/**
* @return the image resolver instance used by this node
*/
public TemplateImageResolver getImageResolver()
{
return this.imageResolver;
}
/**
* Override Object.toString() to provide useful debug output
*/