Search in sources :

Example 1 with LinkerSelectionContext

use of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext in project jahia by Jahia.

the class DownloadActionItem method handleNewLinkerSelection.

public void handleNewLinkerSelection() {
    LinkerSelectionContext lh = linker.getSelectionContext();
    setEnabled(lh.getSingleSelection() != null && hasPermission(lh.getSingleSelection()) && lh.isFile() && super.isNodeTypeAllowed(lh.getSingleSelection()));
}
Also used : LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)

Example 2 with LinkerSelectionContext

use of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext in project jahia by Jahia.

the class EditSourceContentActionItem method handleNewLinkerSelection.

public void handleNewLinkerSelection() {
    LinkerSelectionContext lh = linker.getSelectionContext();
    final GWTJahiaNode singleSelection = lh.getSingleSelection();
    boolean enabled = singleSelection != null && singleSelection.isReference() && !lh.isRootNode() && hasPermission(lh.getSelectionPermissions()) && PermissionsUtils.isPermitted("jcr:modifyProperties", lh.getSelectionPermissions());
    setEnabled(enabled);
    if (enabled) {
        ModuleHelper.checkCanUseComponentForEdit(singleSelection.getReferencedNode().getNodeTypes().get(0), new CanUseComponentForEditCallback() {

            @Override
            public void handle(boolean canUseComponentForEdit) {
                if (isEnabled() && !canUseComponentForEdit) {
                    setEnabled(false);
                }
            }
        });
    }
}
Also used : GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext) CanUseComponentForEditCallback(org.jahia.ajax.gwt.client.widget.edit.mainarea.ModuleHelper.CanUseComponentForEditCallback)

Example 3 with LinkerSelectionContext

use of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext in project jahia by Jahia.

the class ExportActionItem method onComponentSelection.

public void onComponentSelection() {
    LinkerSelectionContext lh = linker.getSelectionContext();
    new ContentExport(linker, lh.getSingleSelection()).show();
}
Also used : ContentExport(org.jahia.ajax.gwt.client.widget.content.ContentExport) LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)

Example 4 with LinkerSelectionContext

use of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext in project jahia by Jahia.

the class TranslateActionItem method handleNewLinkerSelection.

public void handleNewLinkerSelection() {
    LinkerSelectionContext lh = linker.getSelectionContext();
    setEnabled(lh.getSingleSelection() != null && ModuleHelper.canUseComponentForEdit(ModuleHelper.getNodeType(lh.getSingleSelection().getNodeTypes().get(0))) && !lh.isRootNode() && !lh.isLocked() && hasPermission(lh.getSelectionPermissions()) && PermissionsUtils.isPermitted("jcr:modifyProperties", lh.getSelectionPermissions()));
}
Also used : LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)

Example 5 with LinkerSelectionContext

use of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext in project jahia by Jahia.

the class TranslateMenuActionItem method initMenu.

private void initMenu(final Linker linker) {
    boolean notEmpty = false;
    menu.removeAll();
    final String currentLanguage = JahiaGWTParameters.getLanguage();
    for (final GWTJahiaLanguage sourceLang : JahiaGWTParameters.getSiteLanguages()) {
        for (final GWTJahiaLanguage destLang : JahiaGWTParameters.getSiteLanguages()) {
            if (!destLang.getDisplayName().equals(sourceLang.getDisplayName()) && (destLang.getLanguage().equals(currentLanguage) || sourceLang.getLanguage().equals(currentLanguage))) {
                final LinkerSelectionContext lh = linker.getSelectionContext();
                if (PermissionsUtils.isPermitted("jcr:modifyProperties_" + JahiaGWTParameters.getWorkspace() + "_" + destLang.getLanguage(), lh.getSelectionPermissions())) {
                    final GWTJahiaNode selection = lh.getSingleSelection();
                    if (selection != null && (!selection.isLocked() || !selection.getLockInfos().containsKey(destLang.getLanguage()))) {
                        MenuItem item = new MenuItem(sourceLang.getDisplayName() + "->" + destLang.getDisplayName());
                        item.addSelectionListener(new SelectionListener<MenuEvent>() {

                            @Override
                            public void componentSelected(MenuEvent ce) {
                                new TranslateContentEngine(selection, linker, sourceLang, destLang).show();
                            }
                        });
                        item.addStyleName("toolbar-item-translatemenu-item");
                        menu.add(item);
                        notEmpty = true;
                    }
                }
            }
        }
    }
    if (notEmpty) {
        setSubMenu(menu);
    }
    setEnabled(notEmpty);
}
Also used : GWTJahiaLanguage(org.jahia.ajax.gwt.client.data.GWTJahiaLanguage) TranslateContentEngine(org.jahia.ajax.gwt.client.widget.contentengine.TranslateContentEngine) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) MenuEvent(com.extjs.gxt.ui.client.event.MenuEvent)

Aggregations

LinkerSelectionContext (org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)64 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)27 EditLinker (org.jahia.ajax.gwt.client.widget.edit.EditLinker)6 HashMap (java.util.HashMap)4 DeleteItemWindow (org.jahia.ajax.gwt.client.widget.content.DeleteItemWindow)4 Map (java.util.Map)3 CompareEngine (org.jahia.ajax.gwt.client.widget.content.compare.CompareEngine)3 MenuEvent (com.extjs.gxt.ui.client.event.MenuEvent)2 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)2 EmptyLinker (org.jahia.ajax.gwt.client.EmptyLinker)2 GWTJahiaWorkflowDefinition (org.jahia.ajax.gwt.client.data.workflow.GWTJahiaWorkflowDefinition)2 GWTJahiaWorkflowType (org.jahia.ajax.gwt.client.data.workflow.GWTJahiaWorkflowType)2 Linker (org.jahia.ajax.gwt.client.widget.Linker)2 Module (org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)2 MessageBoxEvent (com.extjs.gxt.ui.client.event.MessageBoxEvent)1 Dialog (com.extjs.gxt.ui.client.widget.Dialog)1 FillLayout (com.extjs.gxt.ui.client.widget.layout.FillLayout)1 HBoxLayout (com.extjs.gxt.ui.client.widget.layout.HBoxLayout)1 Menu (com.extjs.gxt.ui.client.widget.menu.Menu)1 RunAsyncCallback (com.google.gwt.core.client.RunAsyncCallback)1