Examples of GWTJahiaNodeType


Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

                final List<GWTJahiaNodeType> theseTypes =
                        contentDefinition.getNodeTypes(nodeWrapper.getNodeTypes(), getUILocale());
                if (nodeTypes == null) {
                    nodeTypes = theseTypes;
                } else {
                    GWTJahiaNodeType p = nodeTypes.get(0);
                    nodeTypes.retainAll(theseTypes);

                    if (!nodeWrapper.isNodeType(p.getName())) {
                        nodeTypes.remove(0);
                        List<String> superTypes = p.getSuperTypes();
                        for (String s : superTypes) {
                            if (nodeWrapper.isNodeType(s)) {
                                nodeTypes.add(0, contentDefinition.getNodeType(s, getUILocale()));
                                break;
                            }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

            }
        });


        // update form components
        boolean isManual = !propertiesEditor.getNodeTypes().contains(new GWTJahiaNodeType(JMIX_ORDERED_LIST));
        for (FieldSet component : propertiesEditor.getOrderingListFieldSet()) {
            component.setEnabled(!isManual);
            if (isManual) {
                component.collapse();
            }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

        name.setRenderer(new WidgetTreeGridCellRenderer() {
            @Override
            public Widget getWidget(ModelData modelData, String s, ColumnData columnData, int i, int i1,
                                    ListStore listStore, Grid grid) {
                Label label = new Label((String) modelData.get(s));
                GWTJahiaNodeType gwtJahiaNodeType = (GWTJahiaNodeType) modelData;
                HorizontalPanel panel = new HorizontalPanel();
//                panel.setWidth(width - 40);
                panel.setTableWidth("100%");
                TableData tableData;
                if (gwtJahiaNodeType != null) {
                    tableData = new TableData(Style.HorizontalAlignment.RIGHT, Style.VerticalAlignment.MIDDLE);
                    tableData.setWidth("5%");
                    panel.add(ContentModelIconProvider.getInstance().getIcon(gwtJahiaNodeType).createImage());
                    tableData = new TableData(Style.HorizontalAlignment.LEFT, Style.VerticalAlignment.MIDDLE);
                    tableData.setWidth("95%");
                } else {
                    tableData = new TableData(Style.HorizontalAlignment.LEFT, Style.VerticalAlignment.MIDDLE);
                    tableData.setWidth("100%");
                }
                panel.add(label, tableData);
                if (!"".equals(gwtJahiaNodeType.getDescription())) { panel.setToolTip(gwtJahiaNodeType.getDescription()); }
                panel.layout();
                return panel;
            }
        });
        treeGrid = new TreeGrid<GWTJahiaNodeType>(store, new ColumnModel(Arrays.asList(name)));
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

                        }
                    }
                    allowed &= nodeAllowed;
                }
            }
            GWTJahiaNodeType type = e.getStatus().getData(EditModeDNDListener.SOURCE_NODETYPE);
            if (type != null) {
                String[] allowedTypes = nodetypes.split(" ");
                boolean typeAllowed = false;
                for (String t : allowedTypes) {
                    if (!type.isMixin() && (t.equals(type.getName()) || type.getSuperTypes().contains(t))) {
                        typeAllowed = true;
                        break;
                    }
                }
                allowed &= typeAllowed;
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

            return;
        }
        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);
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType

        contentTypeTree = new ContentTypeTree(types);
        TreeGrid treeGrid = contentTypeTree.getTreeGrid();
        treeGrid.sinkEvents(Event.ONDBLCLICK + Event.ONCLICK);
        treeGrid.addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent baseEvent) {
                GWTJahiaNodeType gwtJahiaNodeType = (GWTJahiaNodeType) (((TreeGridEvent) baseEvent).getModel());
                if (gwtJahiaNodeType != null && linker != null && !gwtJahiaNodeType.isMixin()) {
                    EngineLoader.showCreateEngine(linker, parentNode, gwtJahiaNodeType, props, nodeName, createInParentAndMoveBefore);
                    hide();
                }
            }
        });

        add(contentTypeTree);
        setFocusWidget(contentTypeTree.getFilter());
        contentTypeTree.layout(true);
        layout();

        LayoutContainer buttonsPanel = new LayoutContainer();
        buttonsPanel.setBorders(false);
        final Window window = this;
        buttonBar = new ButtonBar();
        buttonBar.setAlignment(Style.HorizontalAlignment.CENTER);

        ok = new Button(Messages.get("label.ok"));
        ok.setHeight(EditContentEngine.BUTTON_HEIGHT);
        ok.setEnabled(false);
        ok.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonOK());
        ok.addSelectionListener(new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent buttonEvent) {
                final GWTJahiaNodeType contentTypeModelData = contentTypeTree.getTreeGrid().getSelectionModel().getSelectedItem();
                if (contentTypeModelData != null && !contentTypeModelData.isMixin()) {
                    final GWTJahiaNodeType gwtJahiaNodeType = contentTypeModelData;
                    if (gwtJahiaNodeType != null) {
                        EngineLoader.showCreateEngine(ContentTypeWindow.this.linker, parentNode, gwtJahiaNodeType, props, nodeName, createInParentAndMoveBefore);
                        window.hide();
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.