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 }));
}
}
}
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);
}
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 }));
}
}
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();
}
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);
}
}
Aggregations