Search in sources :

Example 36 with UIActionLink

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

the class BrowseBean method clickSpace.

/**
 * Action called when a folder space is clicked.
 * Navigate into the space.
 */
public void clickSpace(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        try {
            NodeRef ref = new NodeRef(Repository.getStoreRef(), id);
            // handle special folder link node case
            if (ApplicationModel.TYPE_FOLDERLINK.equals(this.getNodeService().getType(ref))) {
                ref = (NodeRef) this.getNodeService().getProperty(ref, ContentModel.PROP_LINK_DESTINATION);
            }
            clickSpace(ref);
        } catch (InvalidNodeRefException refErr) {
            Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] { id }));
        }
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) InvalidNodeRefException(org.alfresco.service.cmr.repository.InvalidNodeRefException)

Example 37 with UIActionLink

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

the class BrowseBean method setupMLContainerContentAction.

/**
 * Action event called by all actions that need to setup a <b>Multilingual</b> Content Document context on the
 * BrowseBean before an action page/wizard is called. The context will be a Node in
 * setDocument() which can be retrieved on the action page from BrowseBean.getDocument().
 */
public void setupMLContainerContentAction(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    NodeRef translation = new NodeRef(Repository.getStoreRef(), id);
    // remember the bean from which the action comes
    FacesContext fc = FacesContext.getCurrentInstance();
    DocumentDetailsDialog docDetails = (DocumentDetailsDialog) FacesHelper.getManagedBean(fc, "DocumentDetailsDialog");
    docDetails.setTranslationDocument(new MapNode(translation));
    MultilingualManageDialog mmDialog = (MultilingualManageDialog) FacesHelper.getManagedBean(fc, "MultilingualManageDialog");
    mmDialog.setTranslationDocument(docDetails.getTranslationDocument());
    // set the ml container as the current document
    NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(translation);
    setupContentAction(mlContainer.getId(), true);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) FacesContext(javax.faces.context.FacesContext) MultilingualManageDialog(org.alfresco.web.bean.ml.MultilingualManageDialog) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) DocumentDetailsDialog(org.alfresco.web.bean.content.DocumentDetailsDialog) MapNode(org.alfresco.web.bean.repository.MapNode)

Example 38 with UIActionLink

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

the class CheckinCheckoutDialog method editFile.

/**
 * Action handler called to calculate which editing screen to display based on the mimetype
 * of a document. If appropriate, the in-line editing screen will be shown.
 */
public void editFile(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    try {
        if (id != null && id.length() != 0) {
            boolean editingInline = false;
            Node node = setupContentDocument(id);
            if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) && node.getProperties().get(ApplicationModel.PROP_EDITINLINE) != null && ((Boolean) node.getProperties().get(ApplicationModel.PROP_EDITINLINE)).booleanValue() == true) {
                // retrieve the content reader for this node
                ContentReader reader = property.getContentService().getReader(node.getNodeRef(), ContentModel.PROP_CONTENT);
                if (reader != null) {
                    editingInline = true;
                    String mimetype = reader.getMimetype();
                    // calculate which editor screen to display
                    if (MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(mimetype) || MimetypeMap.MIMETYPE_XML.equals(mimetype) || MimetypeMap.MIMETYPE_TEXT_CSS.equals(mimetype) || MimetypeMap.MIMETYPE_JAVASCRIPT.equals(mimetype)) {
                        // make content available to the text editing screen
                        property.setEditorOutput(reader.getContentString());
                        // navigate to appropriate screen
                        FacesContext fc = FacesContext.getCurrentInstance();
                        this.navigator.setupDispatchContext(node);
                        fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editTextInline");
                    } else {
                        // make content available to the html editing screen
                        property.setDocumentContent(reader.getContentString());
                        property.setEditorOutput(null);
                        // navigate to appropriate screen
                        FacesContext fc = FacesContext.getCurrentInstance();
                        this.navigator.setupDispatchContext(node);
                        fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editHtmlInline");
                    }
                }
            }
            if (editingInline == false) {
                // normal downloadable document
                FacesContext fc = FacesContext.getCurrentInstance();
                this.navigator.setupDispatchContext(node);
                fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editFile");
            }
        }
    } catch (InvalidNodeRefException refErr) {
        Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] { id }));
    }
}
Also used : FacesContext(javax.faces.context.FacesContext) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) Node(org.alfresco.web.bean.repository.Node) ContentReader(org.alfresco.service.cmr.repository.ContentReader) InvalidNodeRefException(org.alfresco.service.cmr.repository.InvalidNodeRefException)

Example 39 with UIActionLink

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

the class EditOfflineDialog method setupContentAction.

/**
 * Action listener for handle offline editing action. E.g "edit_doc_offline"
 * action
 *
 * @param event ActionEvent
 */
public void setupContentAction(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String id = params.get("id");
    if (id != null && id.length() != 0) {
        super.setupContentDocument(id);
        checkoutFile(property.getDocument());
        if (userPreferencesBean.isDownloadAutomatically()) {
            FacesContext fc = FacesContext.getCurrentInstance();
            this.navigator.setupDispatchContext(property.getDocument());
            fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:editOfflineDialog");
        } else {
            FacesContext fc = FacesContext.getCurrentInstance();
            fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "dialog:close:browse");
        }
    } else {
        property.setDocument(null);
    }
    super.resetState();
}
Also used : FacesContext(javax.faces.context.FacesContext) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink)

Example 40 with UIActionLink

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

the class ClipboardBean method cutNode.

/**
 * Action handler called to add a node to the clipboard for a Cut operation
 */
public void cutNode(ActionEvent event) {
    UIActionLink link = (UIActionLink) event.getComponent();
    Map<String, String> params = link.getParameterMap();
    String ref = params.get("ref");
    String parent = params.get("parent");
    if (ref != null && ref.length() != 0) {
        NodeRef parentNodeRef = null;
        if (parent != null) {
            parentNodeRef = new NodeRef(Repository.getStoreRef(), parent);
            // Primary parent will be used later in FileFolderService#moveOrCopy method
            if (parentNodeRef.toString().equals(ref)) {
                parentNodeRef = null;
            }
        }
        addClipboardNode(new NodeRef(ref), parentNodeRef, ClipboardStatus.CUT);
    }
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) UIActionLink(org.alfresco.web.ui.common.component.UIActionLink)

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