Clipboard Changes: When an item is added to the clipboard a status message is now displayed (which can be turned off in config). The Paste All action now also automatically clears the clipboard (again this behaviour can be turned off in config). This is to allow users to navigate around the app copying and pasting without having to ever see the clipboard.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5065 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-02-07 12:30:38 +00:00
parent cda0d4761f
commit bb1973354e
14 changed files with 257 additions and 61 deletions

View File

@@ -16,10 +16,12 @@
*/
package org.alfresco.web.bean.clipboard;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
@@ -135,6 +137,8 @@ public class ClipboardBean
*/
private void performPasteItems(int index, int action)
{
FacesContext context = FacesContext.getCurrentInstance();
try
{
if (index == -1)
@@ -152,7 +156,12 @@ public class ClipboardBean
}
}
}
// TODO: after a paste all - remove items from the clipboard...? or not. ask linton
// if configured to do so clear the clipboard after a paste all
if (Application.getClientConfig(context).isPasteAllAndClearEnabled())
{
this.items.clear();
}
}
else
{
@@ -169,12 +178,12 @@ public class ClipboardBean
}
// refresh UI on success
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
UIContextService.getInstance(context).notifyBeans();
}
catch (Throwable err)
{
Utils.addErrorMessage(Application.getMessage(
FacesContext.getCurrentInstance(), MSG_ERROR_PASTE) + err.getMessage(), err);
Utils.addErrorMessage(Application.getMessage(context,
MSG_ERROR_PASTE) + err.getMessage(), err);
}
}
@@ -268,6 +277,16 @@ public class ClipboardBean
{
items.add(item);
}
// add a message to inform the user of the clipboard state now if configured
FacesContext context = FacesContext.getCurrentInstance();
if (Application.getClientConfig(context).isClipboardStatusVisible())
{
String pattern = Application.getMessage(context, "node_added_clipboard");
String msg = MessageFormat.format(pattern, items.size());
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
context.addMessage(null, facesMsg);
}
}
}
}