Package org.jahia.ajax.gwt.client.widget

Examples of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext


        private LinkerSelectionContext ctx;

        public SidePanelLinker(AbstractStoreSelectionModel<GWTJahiaNode> selectionModel) {
            super();
            this.selectionModel = selectionModel;
            ctx = new LinkerSelectionContext();

            selectionModel.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNode>() {
                public void selectionChanged(SelectionChangedEvent<GWTJahiaNode> event) {
                    syncSelectionContext(LinkerSelectionContext.BOTH);
                }
View Full Code Here


    private static final long serialVersionUID = 7067456022471038421L;

    @Override
    public void handleNewLinkerSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        setEnabled(lh.getSingleSelection() != null);
    }
View Full Code Here

        setEnabled(lh.getSingleSelection() != null);
    }

    @Override
    public void onComponentSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        new ExportWindow(lh.getSingleSelection()).show();
    }
View Full Code Here

        new EditWindow(selection, linker).show();
    }

    @Override
    public void handleNewLinkerSelection() {
        final LinkerSelectionContext lh = linker.getSelectionContext();
        final GWTJahiaNode singleSelection = lh.getSingleSelection();
        setEnabled(singleSelection != null && PermissionsUtils.isPermitted("jcr:write", lh.getSelectionPermissions()) && lh.isFile());
    }
View Full Code Here


    }

    public void handleNewLinkerSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        GWTJahiaNode singleSelection = lh.getSingleSelection();
        setEnabled(singleSelection!=null && singleSelection.isLockable() &&
                PermissionsUtils.isPermitted("jcr:lockManagement", lh.getSelectionPermissions()) && singleSelection.getLockInfos() != null &&
                !lh.getSingleSelection().getLockInfos().isEmpty() && !lh.isSecondarySelection());
    }
View Full Code Here

        super.init(gwtToolbarItem, linker);
        setEnabled(false);
    }

    public void handleNewLinkerSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        final GWTJahiaNode singleSelection = lh.getSingleSelection();
        setEnabled(false);
        if (singleSelection != null) {

            GWTJahiaWorkflowInfo workflowInfo = singleSelection.getWorkflowInfo();
            Map<GWTJahiaWorkflowType, GWTJahiaWorkflowDefinition> possibleWorkflows = workflowInfo.getPossibleWorkflows();
View Full Code Here

        GWT.runAsync(new RunAsyncCallback() {
            public void onFailure(Throwable reason) {
            }

            public void onSuccess() {
                final LinkerSelectionContext lh = linker.getSelectionContext();
                if (!lh.getMultipleSelection().isEmpty()) {
                    // Usages
                    final List<String> l = new ArrayList<String>();
                    for (GWTJahiaNode node : lh.getMultipleSelection()) {
                        l.add(node.getPath());
                    }

                    final JahiaContentManagementServiceAsync async = JahiaContentManagementService.App.getInstance();

                    if (lh.getSingleSelection() != null && lh.getSingleSelection().isReference()) {
                        async.deletePaths(l, new BaseAsyncCallback<Object>() {
                            public void onApplicationFailure(Throwable throwable) {
                                Log.error(throwable.getMessage(), throwable);
                                MessageBox.alert(Messages.get("label.error", "Error"), throwable.getMessage(), null);
                            }

                            public void onSuccess(Object o) {
                                linker.refresh(EditLinker.REFRESH_ALL);
                                linker.select(null);
                            }
                        });
                    } else {
                        async.getUsages(l, new BaseAsyncCallback<List<GWTJahiaNodeUsage>>() {
                            public void onSuccess(List<GWTJahiaNodeUsage> result) {
                                String icon = MessageBox.WARNING;
                                String message;
                                if (l.size() > 1) {
                                    message = Messages.getWithArgs("message.remove.multiple.confirm",
                                            "Do you really want to remove the {0} selected resources?",
                                            new String[]{String.valueOf(
                                                    l.size())});
                                } else {
                                    if (lh.getMultipleSelection().get(0).getNodeTypes().contains("jnt:page")) {
                                        message = Messages.getWithArgs(
                                                "message.remove.single.page.confirm",
                                                "Do you really want to remove the selected PAGE {0}?",
                                                new String[]{lh.getSingleSelection().getName()});
                                        icon = "ext-mb-delete-page";
                                    } else {
                                        message = Messages.getWithArgs(
                                                "message.remove.single.confirm",
                                                "Do you really want to remove the selected resource {0}?",
                                                new String[]{lh.getSingleSelection().getName()});
                                    }
                                }
                                if (l.size() > 1) {
                                    message += "<br/><br/>";
                                    int i = 0;
                                    for (GWTJahiaNode node : lh.getMultipleSelection()) {
                                        if (i > 4) {
                                            message += "<br/>...";
                                            break;
                                        }
                                        message += "<br/>" + node.getName();
View Full Code Here

            }
        });
    }

    public void handleNewLinkerSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        List<GWTJahiaNode> selection = lh.getMultipleSelection();
        if (selection != null && selection.size() > 0) {
            if (selection.size() == 1) {
                if (selection.get(0).getInheritedNodeTypes().contains("jmix:nodeReference")) {
                    updateTitle(Messages.get(referenceTitleKey,referenceTitleKey));
                } else {
                    updateTitle(getGwtToolbarItem().getTitle() + " : " + selection.get(0).getDisplayName());
                }
            } else {
                updateTitle(getGwtToolbarItem().getTitle() + " : " + selection.get(0).getDisplayName());
            }
        }
        setEnabled(lh.getMultipleSelection() != null
                && lh.getMultipleSelection().size() > 0
                && PermissionsUtils.isPermitted("jcr:removeNode", lh.getSelectionPermissions())
                && !lh.isSecondarySelection()
                && !lh.isLocked());
    }
View Full Code Here

            ContentActions.pasteReference(linker);
        }
    }

    public void handleNewLinkerSelection() {
        LinkerSelectionContext lh = linker.getSelectionContext();
        boolean b = lh.getSingleSelection() != null
                && !lh.isLocked()
                && PermissionsUtils.isPermitted("jcr:addChildNodes", lh.getSelectionPermissions())
                && lh.isPasteAllowed();
        String refTypes = null;
        if (linker instanceof EditLinker && b) {
            final Module module = ((EditLinker) linker).getSelectedModule();
            refTypes = module.getReferenceTypes();
        } else if (lh.getSingleSelection() != null) {
            refTypes = lh.getSingleSelection().get("referenceTypes");
        }
        if (refTypes != null && refTypes.length() > 0) {
            String[] refs = refTypes.split(" ");
            allowedRefs = new ArrayList<String>();
            for (String ref : refs) {
View Full Code Here

        });
    }


    public void handleNewLinkerSelection(){
        LinkerSelectionContext lh = linker.getSelectionContext();
        Boolean isContentType = lh.getSingleSelection() != null && (lh.getSingleSelection().isNodeType("jnt:file") || lh.getSingleSelection().isNodeType("jnt:folder"));
        setEnabled(lh.getMultipleSelection().size() > 0 && lh.isParentWriteable() && !lh.isSecondarySelection() && isContentType );
    }
View Full Code Here

TOP

Related Classes of org.jahia.ajax.gwt.client.widget.LinkerSelectionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.