Search in sources :

Example 56 with UIActionLink

use of org.alfresco.web.ui.common.component.UIActionLink in project acs-community-packaging by Alfresco.

the class ForumDetailsDialog method previousItem.

public void previousItem(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
        List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
        Node previous = null;
        if (nodes.size() > 1) {
            String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn();
            boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending();
            Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
            previous = NodeListUtils.previousItem(nodes, id);
            this.browseBean.setupSpaceAction(previous.getId(), false);
        }
        if (previous == null) {
            Node currNode = new Node(currNodeRef);
            this.navigator.setupDispatchContext(currNode);
        }
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) Node(org.alfresco.web.bean.repository.Node) NodePropertyComparator(org.alfresco.web.ui.common.NodePropertyComparator)

Aggregations

UIActionLink (org.alfresco.web.ui.common.component.UIActionLink)56 NodeRef (org.alfresco.service.cmr.repository.NodeRef)31 Node (org.alfresco.web.bean.repository.Node)28 NodePropertyComparator (org.alfresco.web.ui.common.NodePropertyComparator)18 FacesContext (javax.faces.context.FacesContext)11 InvalidNodeRefException (org.alfresco.service.cmr.repository.InvalidNodeRefException)9 MapNode (org.alfresco.web.bean.repository.MapNode)7 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)4 ArrayList (java.util.ArrayList)3 UserTransaction (javax.transaction.UserTransaction)3 UIComponent (javax.faces.component.UIComponent)2 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)2 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)2 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)2 Version (org.alfresco.service.cmr.version.Version)2 Writer (java.io.Writer)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ResourceBundle (java.util.ResourceBundle)1 FacesMessage (javax.faces.application.FacesMessage)1