Search in sources :

Example 51 with UIActionLink

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

the class TopicDetailsDialog method nextItem.

public void nextItem(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 next = null;
        if (nodes.size() > 1) {
            String currentSortColumn = this.browseBean.getSpacesRichList().getCurrentSortColumn();
            boolean currentSortDescending = this.browseBean.getSpacesRichList().isCurrentSortDescending();
            Collections.sort(nodes, new NodePropertyComparator(currentSortColumn, !currentSortDescending));
            next = NodeListUtils.nextItem(nodes, id);
            this.browseBean.setupSpaceAction(next.getId(), false);
        }
        if (next == 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)

Example 52 with UIActionLink

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

the class GroupsDialog method removeUser.

/**
 * Remove specified user from the current group
 */
public void removeUser(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String authority = params.get("id");
    if (authority != null && authority.length() != 0) {
        UserTransaction tx = null;
        try {
            FacesContext context = FacesContext.getCurrentInstance();
            tx = Repository.getUserTransaction(context);
            tx.begin();
            this.getAuthorityService().removeAuthority(this.group, authority);
            // commit the transaction
            tx.commit();
            // refresh UI after change
            contextUpdated();
        } catch (Throwable err) {
            Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
            try {
                if (tx != null) {
                    tx.rollback();
                }
            } catch (Exception tex) {
            }
        }
    }
}
Also used : UserTransaction(javax.transaction.UserTransaction) FacesContext(javax.faces.context.FacesContext) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink)

Example 53 with UIActionLink

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

the class GroupsDialog method clickGroup.

// ------------------------------------------------------------------------------
// Action handlers
/**
 * Action called when a Group folder is clicked.
 * Navigate into the Group and show child Groups and child Users.
 */
public void clickGroup(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String group = params.get("id");
    if (group != null && group.length() != 0) {
        // refresh UI based on node selection
        updateUILocation(group);
        setGroupsSearchCriteria(null);
    }
}
Also used : UIActionLink(org.alfresco.web.ui.common.component.UIActionLink)

Example 54 with UIActionLink

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

the class NewEditionWizard method skipFirstStep.

/**
 * Force the the lang of the new pivot translation for the new edition and skip the first step
 */
public void skipFirstStep(ActionEvent event) {
    skipFirstStep = true;
    // Get the lang of the new
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String lang = params.get("lang");
    // test if the parameter is valid
    ParameterCheck.mandatoryString("The lang of the node", lang);
    // set the current mlContainer
    setMLContainer();
    setStartingItem(lang.toLowerCase());
}
Also used : UIActionLink(org.alfresco.web.ui.common.component.UIActionLink)

Example 55 with UIActionLink

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

the class SpacePreviewBean 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