. First part of the Clipboard UI refactoring ready for AVM node support

- Clipboard actions now based on NodeRef not "id"
 - Added notion of "workspace" and "AVM" specific clipboard items
 - Clipboard bean supports creating different ClipboardItem types (workspace or avm)
. ActionLink parameters are now "toString()"ed rather than assumed String
. Optimization to Portal Tree Navigator support

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4924 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-24 18:41:49 +00:00
parent d40af2be67
commit bd25cfa86f
10 changed files with 294 additions and 141 deletions

View File

@@ -311,7 +311,8 @@
<image>/images/icons/cut.gif</image> <image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener> <action-listener>#{ClipboardBean.cutNode}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="protocol">#{actionContext.nodeRef.storeRef.protocol}</param>-->
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>--> <!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params> </params>
</action> </action>
@@ -322,36 +323,11 @@
<image>/images/icons/copy.gif</image> <image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener> <action-listener>#{ClipboardBean.copyNode}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>--> <!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params> </params>
</action> </action>
<!-- Cut a document or space to the clipboard, from space details screen -->
<!--<action id="cut_space_details">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>cut</label-id>
<image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
<param name="parent">#{SpaceDetailsBean.space}</param>
</params>
</action>-->
<!-- Copy a document or space to the clipboard, from space details screen -->
<!--<action id="copy_space_details">
<label-id>copy</label-id>
<image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
<param name="parent">#{SpaceDetailsBean.space}</param>
</params>
</action>-->
<!-- Paste All clipboard items into a space --> <!-- Paste All clipboard items into a space -->
<action id="paste_all"> <action id="paste_all">
<permissions> <permissions>

View File

@@ -28,7 +28,7 @@
<image>/images/icons/cut.gif</image> <image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener> <action-listener>#{ClipboardBean.cutNode}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>--> <!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params> </params>
</action> </action>
@@ -41,7 +41,7 @@
<image>/images/icons/copy.gif</image> <image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener> <action-listener>#{ClipboardBean.copyNode}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="ref">#{actionContext.nodeRef}</param>
<!--<param name="parent">#{NavigationBean.currentNodeId}</param>--> <!--<param name="parent">#{NavigationBean.currentNodeId}</param>-->
</params> </params>
</action> </action>

View File

@@ -42,6 +42,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
/** /**
@@ -98,6 +99,9 @@ public class InvokeCommand extends BaseAjaxCommand
// to cover this scenario we have to go through the names of // to cover this scenario we have to go through the names of
// all the objects in the session to find the bean we want. // all the objects in the session to find the bean we want.
Object bean = null; Object bean = null;
if (Application.inPortalServer())
{
Enumeration enumNames = request.getSession().getAttributeNames(); Enumeration enumNames = request.getSession().getAttributeNames();
while (enumNames.hasMoreElements()) while (enumNames.hasMoreElements())
{ {
@@ -112,6 +116,7 @@ public class InvokeCommand extends BaseAjaxCommand
break; break;
} }
} }
}
// if we didn't find the bean it may be a request scope bean, in which // if we didn't find the bean it may be a request scope bean, in which
// case go through the variable resolver to create it. // case go through the variable resolver to create it.

View File

@@ -0,0 +1,36 @@
/*
* 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.web.bean.clipboard;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Class representing an 'avm' store protocol clipboard item
*
* @author Kevin Roast
*/
public class AVMClipboardItem extends AbstractClipboardItem
{
/**
* @param ref
* @param mode
*/
public AVMClipboardItem(NodeRef ref, ClipboardStatus mode)
{
super(ref, mode);
}
}

View File

@@ -0,0 +1,129 @@
/*
* 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.web.bean.clipboard;
import javax.faces.context.FacesContext;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* Base class representing a single item added to the clipboard.
*
* @author Kevin Roast
*/
abstract class AbstractClipboardItem implements ClipboardItem
{
/**
* Constructor
*
* @param ref The ref of the item on the clipboard
* @param mode The ClipboardStatus enum value
*/
public AbstractClipboardItem(NodeRef ref, ClipboardStatus mode)
{
this.ref = ref;
this.mode = mode;
}
public ClipboardStatus getMode()
{
return this.mode;
}
public String getName()
{
if (this.name == null)
{
this.name = (String)getNodeService().getProperty(this.ref, ContentModel.PROP_NAME);
}
return this.name;
}
public QName getType()
{
if (this.type == null)
{
this.type = getNodeService().getType(this.ref);
}
return this.type;
}
public String getIcon()
{
if (this.icon == null)
{
this.icon = (String)getNodeService().getProperty(this.ref, ApplicationModel.PROP_ICON);
}
return this.icon;
}
public String getId()
{
return this.ref.getId();
}
public NodeRef getNodeRef()
{
return this.ref;
}
/**
* Override equals() to compare NodeRefs
*/
public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (obj instanceof ClipboardItem)
{
return ((ClipboardItem)obj).getNodeRef().equals(this.ref);
}
else
{
return false;
}
}
/**
* Override hashCode() to use the internal NodeRef hashcode instead
*/
public int hashCode()
{
return ref.hashCode();
}
protected static NodeService getNodeService()
{
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getNodeService();
}
protected NodeRef ref;
protected ClipboardStatus mode;
// cached values
private String name;
private QName type;
private String icon;
}

View File

@@ -17,7 +17,6 @@
package org.alfresco.web.bean.clipboard; package org.alfresco.web.bean.clipboard;
import java.io.Serializable; import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -37,16 +36,15 @@ import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.CopyService; import org.alfresco.service.cmr.repository.CopyService;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.QueryParameterDefinition; import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -128,10 +126,10 @@ public class ClipboardBean
{ {
UIActionLink link = (UIActionLink)event.getComponent(); UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap(); Map<String, String> params = link.getParameterMap();
String id = params.get("id"); String ref = params.get("ref");
if (id != null && id.length() != 0) if (ref != null && ref.length() != 0)
{ {
addClipboardNode(id, ClipboardStatus.COPY); addClipboardNode(new NodeRef(ref), ClipboardStatus.COPY);
} }
} }
@@ -142,10 +140,10 @@ public class ClipboardBean
{ {
UIActionLink link = (UIActionLink)event.getComponent(); UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap(); Map<String, String> params = link.getParameterMap();
String id = params.get("id"); String ref = params.get("ref");
if (id != null && id.length() != 0) if (ref != null && ref.length() != 0)
{ {
addClipboardNode(id, ClipboardStatus.CUT); addClipboardNode(new NodeRef(ref), ClipboardStatus.CUT);
} }
} }
@@ -195,7 +193,7 @@ public class ClipboardBean
for (int i=0; i<this.items.size(); i++) for (int i=0; i<this.items.size(); i++)
{ {
ClipboardItem item = this.items.get(i); ClipboardItem item = this.items.get(i);
if (item.Mode != ClipboardStatus.CUT) if (item.getMode() != ClipboardStatus.CUT)
{ {
newItems.add(item); newItems.add(item);
} }
@@ -208,7 +206,7 @@ public class ClipboardBean
// single paste operation // single paste operation
ClipboardItem item = this.items.get(index); ClipboardItem item = this.items.get(index);
performClipboardOperation(item, action); performClipboardOperation(item, action);
if (item.Mode == ClipboardStatus.CUT) if (item.getMode() == ClipboardStatus.CUT)
{ {
this.items.remove(index); this.items.remove(index);
} }
@@ -243,10 +241,10 @@ public class ClipboardBean
// the clipboard operation (e.g. the source folder) is specifically that parent node. // the clipboard operation (e.g. the source folder) is specifically that parent node.
// So does not allow for more than one possible parent node - or for linked objects! // So does not allow for more than one possible parent node - or for linked objects!
// This code should be refactored to use a parent ID when appropriate. // This code should be refactored to use a parent ID when appropriate.
ChildAssociationRef assocRef = this.nodeService.getPrimaryParent(item.Node.getNodeRef()); ChildAssociationRef assocRef = this.nodeService.getPrimaryParent(item.getNodeRef());
// initial name to attempt the copy of the item with // initial name to attempt the copy of the item with
String name = item.Node.getName(); String name = item.getName();
if (action == UIClipboardShelfItem.ACTION_PASTE_LINK) if (action == UIClipboardShelfItem.ACTION_PASTE_LINK)
{ {
// copy as link was specifically requested by the user // copy as link was specifically requested by the user
@@ -263,13 +261,13 @@ public class ClipboardBean
// attempt each copy/paste in its own transaction // attempt each copy/paste in its own transaction
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance()); tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
tx.begin(); tx.begin();
if (item.Mode == ClipboardStatus.COPY) if (item.getMode() == ClipboardStatus.COPY)
{ {
if (action == UIClipboardShelfItem.ACTION_PASTE_LINK) if (action == UIClipboardShelfItem.ACTION_PASTE_LINK)
{ {
// LINK operation // LINK operation
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Attempting to link node ID: " + item.Node.getId() + " into node ID: " + destRef.getId()); logger.debug("Attempting to link node ID: " + item.getId() + " into node ID: " + destRef.getId());
// we create a special Link Object node that has a property to reference the original // we create a special Link Object node that has a property to reference the original
// create the node using the nodeService (can only use FileFolderService for content) // create the node using the nodeService (can only use FileFolderService for content)
@@ -277,8 +275,8 @@ public class ClipboardBean
{ {
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f); Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(ContentModel.PROP_NAME, name + ".lnk"); props.put(ContentModel.PROP_NAME, name + ".lnk");
props.put(ContentModel.PROP_LINK_DESTINATION, item.Node.getNodeRef()); props.put(ContentModel.PROP_LINK_DESTINATION, item.getNodeRef());
if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT)) if (dd.isSubClass(item.getType(), ContentModel.TYPE_CONTENT))
{ {
// create File Link node // create File Link node
ChildAssociationRef childRef = this.nodeService.createNode( ChildAssociationRef childRef = this.nodeService.createNode(
@@ -320,21 +318,21 @@ public class ClipboardBean
{ {
// COPY operation // COPY operation
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Attempting to copy node ID: " + item.Node.getId() + " into node ID: " + destRef.getId()); logger.debug("Attempting to copy node ID: " + item.getId() + " into node ID: " + destRef.getId());
if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT) || if (dd.isSubClass(item.getType(), ContentModel.TYPE_CONTENT) ||
dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER)) dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER))
{ {
// copy the file/folder // copy the file/folder
// first check that we are not attempting to copy a duplicate into the same parent // first check that we are not attempting to copy a duplicate into the same parent
if (destRef.equals(assocRef.getParentRef()) && name.equals(item.Node.getName())) if (destRef.equals(assocRef.getParentRef()) && name.equals(item.getName()))
{ {
// manually change the name if this occurs // manually change the name if this occurs
String copyOf = Application.getMessage(FacesContext.getCurrentInstance(), MSG_COPY_OF); String copyOf = Application.getMessage(FacesContext.getCurrentInstance(), MSG_COPY_OF);
name = copyOf + ' ' + name; name = copyOf + ' ' + name;
} }
this.fileFolderService.copy( this.fileFolderService.copy(
item.Node.getNodeRef(), item.getNodeRef(),
destRef, destRef,
name); name);
} }
@@ -344,7 +342,7 @@ public class ClipboardBean
if (checkExists(name, destRef) == false) if (checkExists(name, destRef) == false)
{ {
this.copyService.copy( this.copyService.copy(
item.Node.getNodeRef(), item.getNodeRef(),
destRef, destRef,
ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS,
assocRef.getQName(), assocRef.getQName(),
@@ -360,14 +358,14 @@ public class ClipboardBean
{ {
// MOVE operation // MOVE operation
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Attempting to move node ID: " + item.Node.getId() + " into node ID: " + destRef.getId()); logger.debug("Attempting to move node ID: " + item.getId() + " into node ID: " + destRef.getId());
if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT) || if (dd.isSubClass(item.getType(), ContentModel.TYPE_CONTENT) ||
dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER)) dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER))
{ {
// move the file/folder // move the file/folder
this.fileFolderService.move( this.fileFolderService.move(
item.Node.getNodeRef(), item.getNodeRef(),
destRef, destRef,
name); name);
} }
@@ -375,7 +373,7 @@ public class ClipboardBean
{ {
// move the node // move the node
this.nodeService.moveNode( this.nodeService.moveNode(
item.Node.getNodeRef(), item.getNodeRef(),
destRef, destRef,
ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS,
assocRef.getQName()); assocRef.getQName());
@@ -387,7 +385,7 @@ public class ClipboardBean
} }
catch (FileExistsException fileExistsErr) catch (FileExistsException fileExistsErr)
{ {
if (item.Mode != ClipboardStatus.COPY) if (item.getMode() != ClipboardStatus.COPY)
{ {
// we should not rename an item when it is being moved - so exit // we should not rename an item when it is being moved - so exit
throw fileExistsErr; throw fileExistsErr;
@@ -439,27 +437,32 @@ public class ClipboardBean
return (nodeRefs.size() != 0); return (nodeRefs.size() != 0);
} }
/** Shallow search for nodes with a name pattern */
private static final String XPATH_QUERY_NODE_MATCH =
"./*" +
"[like(@cm:name, $cm:name, false)]";// +
//" and not (subtypeOf('" + ContentModel.TYPE_SYSTEM_FOLDER + "'))" +
//" and (subtypeOf('" + ContentModel.TYPE_FOLDER + "') or subtypeOf('" + ContentModel.TYPE_CONTENT + "'))]";
/** /**
* Add a clipboard node for an operation to the clipboard * Add a clipboard node for an operation to the clipboard
* *
* @param id ID of the node for the operation * @param ref NodeRef of the item for the operation
* @param mode ClipboardStatus for the operation * @param mode ClipboardStatus for the operation
*/ */
private void addClipboardNode(String id, ClipboardStatus mode) private void addClipboardNode(NodeRef ref, ClipboardStatus mode)
{ {
try // construct item based on store protocol
ClipboardItem item = null;
if (StoreRef.PROTOCOL_WORKSPACE.equals(ref.getStoreRef().getProtocol()))
{ {
NodeRef ref = new NodeRef(Repository.getStoreRef(), id); item = new WorkspaceClipboardItem(ref, mode);
}
else if (StoreRef.PROTOCOL_AVM.equals(ref.getStoreRef().getProtocol()))
{
item = new AVMClipboardItem(ref, mode);
}
else
{
logger.warn("Unable to add item to clipboard - unknown store protocol: " + ref.getStoreRef().getProtocol());
}
if (item != null)
{
// check for duplicates first // check for duplicates first
ClipboardItem item = new ClipboardItem(new Node(ref), mode);
boolean foundDuplicate = false; boolean foundDuplicate = false;
for (int i=0; i<items.size(); i++) for (int i=0; i<items.size(); i++)
{ {
@@ -477,11 +480,6 @@ public class ClipboardBean
items.add(item); items.add(item);
} }
} }
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {id}) );
}
} }
@@ -495,6 +493,9 @@ public class ClipboardBean
private static final String MSG_COPY_OF = "copy_of"; private static final String MSG_COPY_OF = "copy_of";
private static final String MSG_LINK_TO = "link_to"; private static final String MSG_LINK_TO = "link_to";
/** Shallow search for nodes with a name pattern */
private static final String XPATH_QUERY_NODE_MATCH = "./*[like(@cm:name, $cm:name, false)]";
/** The NodeService to be used by the bean */ /** The NodeService to be used by the bean */
protected NodeService nodeService; protected NodeService nodeService;

View File

@@ -16,53 +16,32 @@
*/ */
package org.alfresco.web.bean.clipboard; package org.alfresco.web.bean.clipboard;
import javax.faces.context.FacesContext;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/** /**
* Simple class representing a single item added to the clipboard.
*
* @author Kevin Roast * @author Kevin Roast
*/ */
public class ClipboardItem public interface ClipboardItem
{ {
/** public ClipboardStatus getMode();
* Constructor
*
* @param node The node on the clipboard
* @param mode The ClipboardStatus enum value
*/
public ClipboardItem(Node node, ClipboardStatus mode)
{
this.Node = node;
this.Mode = mode;
}
/** public String getName();
* Override equals() to compare NodeRefs
*/
public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (obj instanceof ClipboardItem)
{
return ((ClipboardItem)obj).Node.getNodeRef().equals(Node.getNodeRef());
}
else
{
return false;
}
}
/** public QName getType();
* Override hashCode() to use the internal NodeRef hashcode instead
*/
public int hashCode()
{
return Node.getNodeRef().hashCode();
}
public String getIcon();
public Node Node; public String getId();
public ClipboardStatus Mode;
public NodeRef getNodeRef();
} }

View File

@@ -0,0 +1,36 @@
/*
* 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.web.bean.clipboard;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Class representing a 'workspace' store protocol clipboard item
*
* @author Kevin Roast
*/
public class WorkspaceClipboardItem extends AbstractClipboardItem
{
/**
* @param ref
* @param mode
*/
public WorkspaceClipboardItem(NodeRef ref, ClipboardStatus mode)
{
super(ref, mode);
}
}

View File

@@ -96,16 +96,7 @@ public abstract class BaseRenderer extends Renderer
if (child instanceof UIParameter) if (child instanceof UIParameter)
{ {
final UIParameter param = (UIParameter)child; final UIParameter param = (UIParameter)child;
if (param.getValue() == null || param.getValue() instanceof String) params.put(param.getName(), param.getValue() != null ? param.getValue().toString() : null);
{
params.put(param.getName(), (String)param.getValue());
}
else
{
throw new ClassCastException("value of parameter " + param.getName() +
" is a " + param.getValue().getClass().getName() +
". Expected a " + String.class.getName());
}
} }
} }
return params; return params;

View File

@@ -160,7 +160,7 @@ public class UIClipboardShelfItem extends UIShelfItem
// start row with cut/copy state icon // start row with cut/copy state icon
out.write("<tr><td width=16>"); out.write("<tr><td width=16>");
if (item.Mode == ClipboardStatus.COPY) if (item.getMode() == ClipboardStatus.COPY)
{ {
out.write(Utils.buildImageTag(context, WebResources.IMAGE_COPY, 14, 16, bundle.getString(MSG_COPY), null, "absmiddle")); out.write(Utils.buildImageTag(context, WebResources.IMAGE_COPY, 14, 16, bundle.getString(MSG_COPY), null, "absmiddle"));
} }
@@ -170,10 +170,10 @@ public class UIClipboardShelfItem extends UIShelfItem
} }
out.write("</td><td width=16>"); out.write("</td><td width=16>");
if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER)) if (dd.isSubClass(item.getType(), ContentModel.TYPE_FOLDER))
{ {
// start row with correct node icon // start row with correct node icon
String icon = (String)item.Node.getProperties().get("app:icon"); String icon = (String)item.getIcon();
if (icon != null) if (icon != null)
{ {
icon = "/images/icons/" + icon + "-16.gif"; icon = "/images/icons/" + icon + "-16.gif";
@@ -186,21 +186,21 @@ public class UIClipboardShelfItem extends UIShelfItem
} }
else else
{ {
String image = Utils.getFileTypeImage(item.Node.getName(), true); String image = Utils.getFileTypeImage(item.getName(), true);
out.write(Utils.buildImageTag(context, image, null, "absmiddle")); out.write(Utils.buildImageTag(context, image, null, "absmiddle"));
} }
// output cropped item label - we also output with no breaks, this is ok // output cropped item label - we also output with no breaks, this is ok
// as the copped label will ensure a sensible maximum width // as the copped label will ensure a sensible maximum width
out.write("</td><td width=100%><nobr>&nbsp;"); out.write("</td><td width=100%><nobr>&nbsp;");
out.write(Utils.cropEncode(item.Node.getName())); out.write(Utils.cropEncode(item.getName()));
// output actions // output actions
out.write("</nobr></td><td align=right><nobr>"); out.write("</nobr></td><td align=right><nobr>");
out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE)); out.write(buildActionLink(ACTION_REMOVE_ITEM, i, bundle.getString(MSG_REMOVE_ITEM), WebResources.IMAGE_REMOVE));
out.write("&nbsp;"); out.write("&nbsp;");
out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE)); out.write(buildActionLink(ACTION_PASTE_ITEM, i, bundle.getString(MSG_PASTE_ITEM), WebResources.IMAGE_PASTE));
if (item.Mode == ClipboardStatus.COPY && dd.isSubClass(item.Node.getType(), ContentModel.TYPE_LINK) == false) if (item.getMode() == ClipboardStatus.COPY && dd.isSubClass(item.getType(), ContentModel.TYPE_LINK) == false)
{ {
out.write("&nbsp;"); out.write("&nbsp;");
out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK)); out.write(buildActionLink(ACTION_PASTE_LINK, i, bundle.getString(MSG_PASTE_LINK), WebResources.IMAGE_PASTE_LINK));