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