Package org.jahia.ajax.gwt.client.data.node

Examples of org.jahia.ajax.gwt.client.data.node.GWTJahiaNode


        @Override
        protected void showFeedback(DNDEvent e) {
            super.showFeedback(e);
            setStatus(e);
            if (activeItem != null) {
                GWTJahiaNode activeNode = (GWTJahiaNode) activeItem.getModel();
                e.getStatus().setData(EditModeDNDListener.TARGET_PATH, activeNode.get("path"));
            } else {
                e.getStatus().setData(EditModeDNDListener.TARGET_PATH, null);
            }
        }
View Full Code Here


        EngineLoader.showEditEngine(linker, linker.getSelectionContext().getSingleSelection().getReferencedNode());
    }

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

                Button button = new Button(ModuleHelper.getNodeType(s) != null ? ModuleHelper.getNodeType(
                        s).getLabel() : s);
                button.setStyleName("button-placeholder");
                button.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        final GWTJahiaNode parentNode = getParentModule().getNode();
                        if (parentNode != null && PermissionsUtils.isPermitted("jcr:addChildNodes", parentNode) && !parentNode.isLocked()) {
                            ContentActions.showContentWizard(mainModule.getEditLinker(), s, parentNode,
                                    true, mainModule.getConfig().getName().equals("studiomode"));
                        }
                    }
                });
View Full Code Here

        tab.add(contentContainer, contentVBoxData);

        listView.addListener(Events.DoubleClick, new Listener<ListViewEvent<GWTJahiaNode>>() {
            public void handleEvent(ListViewEvent<GWTJahiaNode> be) {
                Window w = new Window();
                GWTJahiaNode node = listView.getSelectionModel().getSelectedItem();

                final String text = "Preview of " + node.getDisplayName();
                w.setHeading(text);
                w.setScrollMode(Style.Scroll.AUTO);
                w.setModal(true);
                w.setClosable(true);
                w.setMaximizable(true);
                w.setSize(Math.max(Integer.parseInt((String)node.get("j:width")) + 60, 400), Math.max(Integer.parseInt((String)node.get("j:height")) + 80, 50));
                w.setBlinkModal(true);
                w.setPlain(true);
                w.setToolTip(text);
                w.setLayout(new CenterLayout());
                w.add(new Image(listView.getSelectionModel().getSelectedItem().getUrl()));
View Full Code Here

        }
        final String sourceType = status.getData(SOURCE_TYPE);
        final String targetType = status.getData(TARGET_TYPE);
        final String targetPath = status.getData(TARGET_PATH);
        final GWTJahiaNodeType sourceNodeType = status.getData(SOURCE_NODETYPE);
        final GWTJahiaNode targetNode = status.getData(TARGET_NODE);
        final List<String> referenceType = status.getData(TARGET_REFERENCE_TYPE);
        final List<GWTJahiaNode> sourceNodes = status.getData(SOURCE_NODES);
        final GWTJahiaSearchQuery searchQuery = status.getData(SOURCE_QUERY);

        AsyncCallback callback = new DropAsyncCallback();
        final JahiaContentManagementServiceAsync service = JahiaContentManagementService.App.getInstance();
        if (EMPTYAREA_TYPE.equals(targetType)) {
            status.setData(OPERATION_CALLED, "true");
            GWTJahiaNode parent = (GWTJahiaNode) targetNode;
            ((AreaModule) ((ModuleDropTarget)e.getDropTarget()).getModule()).createNode(new BaseAsyncCallback<GWTJahiaNode>() {
                public void onSuccess(GWTJahiaNode result) {
                    e.getStatus().setData(SOURCE_TYPE, sourceType);
                    e.getStatus().setData(TARGET_TYPE, PLACEHOLDER_TYPE);
                    e.getStatus().setData(TARGET_PATH, "*");
                    e.getStatus().setData(SOURCE_NODETYPE, sourceNodeType);
                    e.getStatus().setData(TARGET_NODE, result);
                    e.getStatus().setData(TARGET_REFERENCE_TYPE, referenceType);
                    e.getStatus().setData(SOURCE_NODES, sourceNodes);
                    e.getStatus().setData(SOURCE_QUERY, searchQuery);
                    e.getStatus().setData(OPERATION_CALLED, "false");
                    dragDrop(e);
                }
            });
        } else if (PLACEHOLDER_TYPE.equals(targetType)) {
            int i = targetPath.lastIndexOf('/');
            String name = targetPath.substring(i + 1);
            String parentPath = targetNode.getPath();

            if (referenceType != null) {
                status.setData(OPERATION_CALLED, "true");
                final GWTJahiaNode selectedNode = sourceNodes.get(0);
                JahiaContentManagementService.App.getInstance()
                        .getNodeTypes(referenceType, new BaseAsyncCallback<List<GWTJahiaNodeType>>() {
                            public void onApplicationFailure(Throwable caught) {
                                Window.alert("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage());
                                Log.error("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage(), caught);
                            }

                            public void onSuccess(List<GWTJahiaNodeType> result) {
                                Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>(2);
                                props.put("jcr:title", new GWTJahiaNodeProperty("jcr:title",
                                        new GWTJahiaNodePropertyValue(selectedNode.getDisplayName(),
                                                GWTJahiaNodePropertyType.STRING)));
                                props.put("j:node", new GWTJahiaNodeProperty("j:node",
                                        new GWTJahiaNodePropertyValue(selectedNode,
                                                GWTJahiaNodePropertyType.WEAKREFERENCE)));
                                if (result.size() == 1) {
                                    EngineLoader.showCreateEngine(editLinker, targetNode, result.get(0), props,
                                            selectedNode.getName(), false);
                                } else {
                                    Map<GWTJahiaNodeType, List<GWTJahiaNodeType>> m =
                                            new HashMap<GWTJahiaNodeType, List<GWTJahiaNodeType>>();
                                    m.put(null, result);
                                    new ContentTypeWindow(editLinker, targetNode, m, props, selectedNode.getName(), false)
                                            .show();
                                }
                            }
                        });
            } else if (SIMPLEMODULE_TYPE.equals(sourceType)) {
                // Item move
                GWTJahiaNode selectedNode = sourceNodes.get(0);

                status.setData(OPERATION_CALLED, "true");
                if ("*".equals(name)) {
                    service.moveAtEnd(selectedNode.getPath(), parentPath, callback);
                } else {
                    service.move(selectedNode.getPath(), targetPath, callback);
                }
            } else if (CREATE_CONTENT_SOURCE_TYPE.equals(sourceType)) {
                // Item creation
                status.setData(OPERATION_CALLED, "true");
                if ((sourceNodeType.getItems() == null || sourceNodeType.getItems().size() == 0) &&
                        (sourceNodeType.getInheritedItems() == null ||
                                sourceNodeType.getInheritedItems().size() == 0)) {
                    service.createNode(parentPath, null, sourceNodeType.getName(), null, null,
                            new ArrayList<GWTJahiaNodeProperty>(), null, new BaseAsyncCallback<GWTJahiaNode>() {
                                public void onApplicationFailure(Throwable throwable) {
                                    Window.alert("Properties save failed\n\n" + throwable.getLocalizedMessage());
                                    Log.error("failed", throwable);
                                }

                                public void onSuccess(GWTJahiaNode o) {
                                    Info.display(Messages.get("label.information", "Information"), Messages.get("message.success", "Node created"));
                                    editLinker.refresh(Linker.REFRESH_MAIN);
                                }
                            });
                } else {
                    EngineLoader.showCreateEngine(editLinker, targetNode, sourceNodeType,
                            new HashMap<String, GWTJahiaNodeProperty>(),
                            targetPath.substring(targetPath.lastIndexOf("/") + 1), false);
                }
            } else if (QUERY_SOURCE_TYPE.equals(sourceType)) {
                // Item creation
                status.setData(OPERATION_CALLED, "true");
                if ("*".equals(name)) {
                    service.saveSearch(searchQuery, parentPath, "jnt_query", false, callback);
                } else {
                    service.saveSearch(searchQuery, parentPath, name, false, callback);
                }
            }
        } else if (SIMPLEMODULE_TYPE.equals(targetType)) {
            if (referenceType != null) {
                status.setData(OPERATION_CALLED, "true");
                final GWTJahiaNode selectedNode = sourceNodes.get(0);
                JahiaContentManagementService.App.getInstance()
                        .getNodeTypes(referenceType, new BaseAsyncCallback<List<GWTJahiaNodeType>>() {
                            public void onApplicationFailure(Throwable caught) {
                                Window.alert("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage());
                                Log.error("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage(), caught);
                            }

                            public void onSuccess(List<GWTJahiaNodeType> result) {
                                Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>(2);
                                props.put("jcr:title", new GWTJahiaNodeProperty("jcr:title",
                                        new GWTJahiaNodePropertyValue(selectedNode.getDisplayName(),
                                                GWTJahiaNodePropertyType.STRING)));
                                props.put("j:node", new GWTJahiaNodeProperty("j:node",
                                        new GWTJahiaNodePropertyValue(selectedNode,
                                                GWTJahiaNodePropertyType.WEAKREFERENCE)));
                                if (result.size() == 1) {
                                    EngineLoader.showCreateEngine(editLinker, targetNode, result.get(0), props,
                                            selectedNode.getName(), true);
                                } else {
                                    Map<GWTJahiaNodeType, List<GWTJahiaNodeType>> m =
                                            new HashMap<GWTJahiaNodeType, List<GWTJahiaNodeType>>();
                                    m.put(null, result);
                                    new ContentTypeWindow(editLinker, targetNode, m, props, selectedNode.getName(), true)
                                            .show();
                                }
                            }
                        });
                //            } else if (CONTENT_SOURCE_TYPE.equals(sourceType)) {
                //                // Drop into an existing module
                //                List<GWTJahiaNode> nodes = e.getStatus().getData(SOURCE_NODES);
                //
                //                e.getStatus().setData(OPERATION_CALLED, "true");
                //                async.pasteReferencesOnTopOf(JCRClientUtils.getPathesList(nodes), targetPath, null, callback);
            } else if (SIMPLEMODULE_TYPE.equals(sourceType)) {
                // Item move

                status.setData(OPERATION_CALLED, "true");
                service.moveOnTopOf(sourceNodes.get(0).getPath(), targetPath, callback);
            } else if (CREATE_CONTENT_SOURCE_TYPE.equals(sourceType)) {
                // Item creation
                status.setData(OPERATION_CALLED, "true");
                if ((sourceNodeType.getItems() == null || sourceNodeType.getItems().size() == 0) &&
                        (sourceNodeType.getInheritedItems() == null ||
                                sourceNodeType.getInheritedItems().size() == 0)) {
                    service.createNodeAndMoveBefore(targetNode.getPath(), null, sourceNodeType.getName(), null, null,
                            new ArrayList<GWTJahiaNodeProperty>(), new HashMap<String, List<GWTJahiaNodeProperty>>(),
                            new BaseAsyncCallback<GWTJahiaNode>() {
                                public void onApplicationFailure(Throwable throwable) {
                                    Window.alert("Properties save failed\n\n" + throwable.getLocalizedMessage());
                                    Log.error("failed", throwable);
                                }

                                public void onSuccess(GWTJahiaNode o) {
                                    Info.display("", "Node created");
                                    editLinker.refresh(Linker.REFRESH_MAIN);
                                }
                            });
                } else {
                    EngineLoader.showCreateEngine(editLinker, targetNode, sourceNodeType,
                            new HashMap<String, GWTJahiaNodeProperty>(), "*", true);
                }
            } else if (QUERY_SOURCE_TYPE.equals(sourceType)) {
                // Item creation
                status.setData(OPERATION_CALLED, "true");

                service.saveSearch(searchQuery, targetPath, "jnt_query", true, callback);
            }
        } else if (PAGETREE_TYPE.equals(targetType)) {
            if (PAGETREE_TYPE.equals(sourceType)) {
                status.setData(OPERATION_CALLED, "true");
                final GWTJahiaNode source = ((List<GWTJahiaNode>) sourceNodes).get(0);
                final GWTJahiaNode parent = status.getData(TARGET_PARENT);
                final int type = (Integer) status.getData(TYPE);
                callback = new BaseAsyncCallback() {
                    public void onSuccess(Object result) {
                        String selectedPath = editLinker.getSelectionContext().getMainNode().getPath();
                        String replacedPath;
                        if (type < 0) {
                            replacedPath = targetPath + "/" + source.getName();
                        } else {
                            replacedPath = selectedPath.replace(source.getPath(), parent.getPath() + "/" + source.getName());
                        }
                        if (!replacedPath.equals(selectedPath)) {
                            editLinker.onMainSelection(replacedPath, null, null);
                            editLinker.refresh(Linker.REFRESH_PAGES);
                        } else if (e.getDropTarget() instanceof PagesTabItem.PageTreeGridDropTarget) {
                            ((PagesTabItem.PageTreeGridDropTarget) e.getDropTarget()).getCallback().onSuccess(result);
                        }
                    }
                };

                if (status.<Object>getData("type").equals(-1)) {
                    service.moveAtEnd(source.getPath(), targetPath, callback);
                } else if (status.<Object>getData("type").equals(0)) {
                    service.moveOnTopOf(source.getPath(), targetPath, callback);
                } else if (status.<Object>getData("type").equals(1)) {
                    GWTJahiaNode node = status.getData(TARGET_NEXT_NODE);
                    if (node == null) {
                        service.moveAtEnd(source.getPath(), parent.getPath(), callback);
                    } else {
                        service.moveOnTopOf(source.getPath(), node.getPath(), callback);
                    }
                }
            }
        } else if (BROWSETREE_TYPE.equals(targetType)) {
            if (SIMPLEMODULE_TYPE.equals(sourceType)) {
View Full Code Here

public class SubscriptionManagerActionItem extends BaseActionItem {

    private static final long serialVersionUID = -2710441859293558523L;

  @Override public void handleNewLinkerSelection() {
        final GWTJahiaNode n = linker.getSelectionContext().getSingleSelection();
        setEnabled(n != null && n.getNodeTypes().contains("jnt:newsletter") &&
                (n.getAggregatedPublicationInfo().getStatus() != GWTJahiaPublicationInfo.NOT_PUBLISHED));
    }
View Full Code Here

        setEnabled(false);
    }

    public void handleNewLinkerSelection() {
        setEnabled(false);
        GWTJahiaNode gwtJahiaNode = linker.getSelectionContext().getSingleSelection();
        if (gwtJahiaNode != null && gwtJahiaNode.getSiteUUID()!=null) {
            setEnabled(true);
            updateTitle(getGwtToolbarItem().getTitle() + " " + gwtJahiaNode.getSiteKey());
        }
    }
View Full Code Here

            }
        });

        grid.addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent baseEvent) {
                GWTJahiaNode gwtJahiaNode = (GWTJahiaNode) (((GridEvent) baseEvent).getModel());
                if (gwtJahiaNode != null && editLinker != null) {
                    EngineLoader.showEditEngine(editLinker, gwtJahiaNode);
                }
            }
        });
View Full Code Here

    }

    @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

TOP

Related Classes of org.jahia.ajax.gwt.client.data.node.GWTJahiaNode

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.