Examples of GWTJahiaNodeProperty


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

            public void componentSelected(IconButtonEvent event) {
                if (linked != null) {
                    if (linked) {
                        List<GWTJahiaNodeProperty> properties = new ArrayList<GWTJahiaNodeProperty>();
//                            final List<GWTJahiaNode> srcNodes = e.getStatus().getData(SOURCE_NODES);
                        final GWTJahiaNodeProperty gwtJahiaNodeProperty = new GWTJahiaNodeProperty(property,
                                new GWTJahiaNodePropertyValue((String) null,
                                        GWTJahiaNodePropertyType.WEAKREFERENCE));
                        properties.add(gwtJahiaNodeProperty);
                        JahiaContentManagementService.App.getInstance()
                                .saveProperties(Arrays.asList(node), properties, null, new BaseAsyncCallback() {
                                    public void onSuccess(Object o) {
                                        getMainModule().getEditLinker().refresh(EditLinker.REFRESH_MAIN);
                                    }

                                    public void onApplicationFailure(Throwable throwable) {
                                        Window.alert("Failed : " + throwable);
                                    }
                                });

                    } else {
                        String s = JahiaGWTParameters.getContextPath();
                        if (s.equals("/")) {
                            s = "";
                        }
                        mainModule.setStyleAttribute("cursor",
                                "url('" + s + "/gwt/resources/images/xtheme-jahia-andromeda/panel/link.cur'), pointer");

                        mainModule.getEditLinker().setSelectionListener(new ModuleSelectionListener() {
                            public void onModuleSelection(Module selection) {
                                mainModule.setStyleAttribute("cursor", "");
                                mainModule.getEditLinker().setSelectionListener(null);
                                if (selection.getNode() != node) {
                                    List<GWTJahiaNodeProperty> properties = new ArrayList<GWTJahiaNodeProperty>();
                                    final GWTJahiaNodeProperty gwtJahiaNodeProperty = new GWTJahiaNodeProperty(property,
                                            new GWTJahiaNodePropertyValue(selection.getNode(),
                                                    GWTJahiaNodePropertyType.WEAKREFERENCE));
                                    properties.add(gwtJahiaNodeProperty);
                                    JahiaContentManagementService.App.getInstance()
                                            .saveProperties(Arrays.asList(node), properties, null, new BaseAsyncCallback() {
View Full Code Here

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

        super.setNode(node);
        final JahiaContentManagementServiceAsync async = JahiaContentManagementService.App.getInstance();
        async.getProperties(node.getPath(), null, new BaseAsyncCallback<GWTJahiaGetPropertiesResult>() {
            public void onSuccess(GWTJahiaGetPropertiesResult gwtJahiaGetPropertiesResult) {
                if (gwtJahiaGetPropertiesResult.getProperties().containsKey(property)) {
                    final GWTJahiaNodeProperty o = gwtJahiaGetPropertiesResult.getProperties().get(property);
                    if (o.getValues().get(0).getNode().getPath().equals(mainModule.getPath())) {
                        setHeaderText(headerText + " - Linked to: main resource");
                        linked = Boolean.FALSE;
                    } else {
                        setHeaderText(headerText + " - Linked to: " + o.getValues().get(0).getNode().getName());
                        linked = Boolean.TRUE;
                    }
                } else {
                    linked = Boolean.FALSE;
                    setHeaderText(head.getText() + " - Linked to: main resource");
View Full Code Here

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

        }

        private void doSchedule(Date date, GWTJahiaNode gwtJahiaNode) {
            List<GWTJahiaNodeProperty> props = new ArrayList<GWTJahiaNodeProperty>();
            String propValueString = String.valueOf(date.getTime());
            props.add(new GWTJahiaNodeProperty("j:scheduled", new GWTJahiaNodePropertyValue(propValueString, GWTJahiaNodePropertyType.DATE)));

            List<GWTJahiaNode> nodes = new ArrayList<GWTJahiaNode>();
            nodes.add(gwtJahiaNode);
            JahiaContentManagementService.App.getInstance().saveProperties(nodes, props, null, new BaseAsyncCallback() {
                public void onSuccess(Object result) {
View Full Code Here

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

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

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

            }

            public void onSuccess(List<GWTJahiaNodeType> result) {
                GWTJahiaNode copiedNode = CopyPasteEngine.getInstance().getCopiedPaths().get(0);
                Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>(2);
                props.put("jcr:title", new GWTJahiaNodeProperty("jcr:title", new GWTJahiaNodePropertyValue(copiedNode.getDisplayName(), GWTJahiaNodePropertyType.STRING)));
                props.put("j:node", new GWTJahiaNodeProperty("j:node", new GWTJahiaNodePropertyValue(copiedNode, GWTJahiaNodePropertyType.WEAKREFERENCE)));
                if (result.size() == 1) {
                    EngineLoader.showCreateEngine(linker, linker.getSelectionContext().getSingleSelection(), result.get(0), props, copiedNode.getName(), false);
                } else {
                    Map<GWTJahiaNodeType, List<GWTJahiaNodeType>> m = new HashMap<GWTJahiaNodeType, List<GWTJahiaNodeType>>();
                    m.put(null, result);
View Full Code Here

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

                    @Override
                    protected void load(Object o, final AsyncCallback<List<GWTJahiaNode>> listAsyncCallback) {
                        if (node != null) {
                            final JahiaContentManagementServiceAsync async = JahiaContentManagementService.App.getInstance();
                            if (newValues.containsKey(TagsTabItem.this.locale)) {
                                final GWTJahiaNodeProperty gwtJahiaNodeProperty = newValues.get(TagsTabItem.this.locale);
                                final List<GWTJahiaNodePropertyValue> propertyValues = gwtJahiaNodeProperty.getValues();
                                List<GWTJahiaNode> nodes = new ArrayList<GWTJahiaNode>(propertyValues.size());
                                for (GWTJahiaNodePropertyValue propertyValue : propertyValues) {
                                    nodes.add(propertyValue.getNode());
                                }
                                listAsyncCallback.onSuccess(nodes);
                            } else {
                                GWTJahiaNodeProperty oldProperty = engine.getProperties().get("j:tags");

                                GWTJahiaNodeProperty newProperty = new GWTJahiaNodeProperty();
                                newProperty.setMultiple(true);
                                newProperty.setValues(new ArrayList<GWTJahiaNodePropertyValue>());
                                newProperty.setName("j:tags");

                                if (oldProperty != null) {
                                    final List<GWTJahiaNodePropertyValue> propertyValues = oldProperty.getValues();
                                    List<GWTJahiaNode> nodes = new ArrayList<GWTJahiaNode>(propertyValues.size());
                                    for (GWTJahiaNodePropertyValue propertyValue : propertyValues) {
                                        nodes.add(propertyValue.getNode());
                                    }
                                    newProperty.getValues().addAll(oldProperty.getValues());
                                    listAsyncCallback.onSuccess(nodes);
                                } else {
                                    listAsyncCallback.onSuccess(new ArrayList<GWTJahiaNode>());
                                }
                                oldValues.put(TagsTabItem.this.locale, oldProperty);
                                newValues.put(TagsTabItem.this.locale, newProperty);
                            }
                        }
                    }
                });

                tagStore = new TreeStore<GWTJahiaNode>(tagLoader);
                tagStore.setStoreSorter(new StoreSorter<GWTJahiaNode>(new Comparator<Object>() {
                    public int compare(Object o1, Object o2) {
                        if (o1 instanceof String && o2 instanceof String) {
                            String s1 = (String) o1;
                            String s2 = (String) o2;
                            return Collator.getInstance().localeCompare(s1, s2);
                        } else if (o1 instanceof Comparable && o2 instanceof Comparable) {
                            return ((Comparable) o1).compareTo(o2);
                        }
                        return 0;
                    }
                }));
                ColumnConfig columnConfig;
                columnConfig = new ColumnConfig("name", Messages.get("label.name"), 500);
                columnConfig.setFixed(true);
                columnConfig.setRenderer(new TreeGridCellRenderer<GWTJahiaNode>());

                ColumnConfig action = new ColumnConfig("action", Messages.get("label.action"), 100);
                action.setAlignment(Style.HorizontalAlignment.RIGHT);
                action.setRenderer(new GridCellRenderer() {
                    public Object render(ModelData modelData, String s, ColumnData columnData, int i, int i1,
                                         ListStore listStore, Grid grid) {
                        Button button = new Button(Messages.get("label.remove"), new SelectionListener<ButtonEvent>() {
                            @Override
                            public void componentSelected(ButtonEvent buttonEvent) {
                                final GWTJahiaNode node1 = (GWTJahiaNode) buttonEvent.getButton().getData("associatedNode");
                                tagStore.remove(node1);
                                newValues.get(TagsTabItem.this.locale).getValues().remove(new GWTJahiaNodePropertyValue(node1,
                                            GWTJahiaNodePropertyType.WEAKREFERENCE));
                            }
                        });
                        button.setData("associatedNode", modelData);
                        button.setIcon(StandardIconsProvider.STANDARD_ICONS.minusRound());
                        return button;
                    }
                });

                // Add a new tag
                final AutoCompleteComboBox autoCompleteComboBox = new AutoCompleteComboBox(JCRClientUtils.TAG_NODETYPES, 15);
                autoCompleteComboBox.setMaxLength(120);
                autoCompleteComboBox.setWidth(200);
                autoCompleteComboBox.setName("tagName");

                //panel.add(name, data);
                Button addTag = new Button(Messages.get("label.add", "Add"), new SelectionListener<ButtonEvent>() {
                    @Override
                    public void componentSelected(ButtonEvent buttonEvent) {
                        final JahiaContentManagementServiceAsync async = JahiaContentManagementService.App.getInstance();
                        async.getTagNode(autoCompleteComboBox.getRawValue(), true, new BaseAsyncCallback<GWTJahiaNode>() {
                            /**
                             * On success
                             * @param result
                             */
                            public void onSuccess(GWTJahiaNode result) {
                                if (tagStore.findModel(result) == null) {
                                    tagStore.add(result, false);
                                    GWTJahiaNodeProperty gwtJahiaNodeProperty = newValues.get(TagsTabItem.this.locale);
                                    if (gwtJahiaNodeProperty == null) {
                                        gwtJahiaNodeProperty = new GWTJahiaNodeProperty();
                                        gwtJahiaNodeProperty.setMultiple(true);
                                        gwtJahiaNodeProperty.setValues(new ArrayList<GWTJahiaNodePropertyValue>());
                                        gwtJahiaNodeProperty.setName("j:tags");
                                        newValues.put(TagsTabItem.this.locale, gwtJahiaNodeProperty);
                                    }
                                    gwtJahiaNodeProperty.getValues().add(new GWTJahiaNodePropertyValue(result,
                                            GWTJahiaNodePropertyType.WEAKREFERENCE));
                                }
                            }


View Full Code Here

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

    public void updateI18NProperties(Map<String,List<GWTJahiaNodeProperty>> list, Set<String> addedTypes, Set<String> removedTypes) {
        boolean noTag = true;
        if (newValues != null) {
            for (Map.Entry<String, GWTJahiaNodeProperty> entry : newValues.entrySet()) {
                GWTJahiaNodeProperty newTag = entry.getValue();
                GWTJahiaNodeProperty oldTag = oldValues.get(entry.getKey());

                if (!newTag.equals(oldTag)) {
                    List<GWTJahiaNodeProperty> props = list.get(entry.getKey());

                    if (props == null) {
                        props = new ArrayList<GWTJahiaNodeProperty>();
                        list.put(entry.getKey(), props);
                    }

                    if (!newTag.getValues().isEmpty()) {
                        noTag = false;
                    }
                    props.add(newTag);
                } else if (oldTag != null) {
                    if (!oldTag.getValues().isEmpty()) {
                        noTag = false;
                    }
                }
            }
        }
View Full Code Here

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

    public void updateProperties(List<GWTJahiaNodeProperty> list, Set<String> addedTypes, Set<String> removedTypes) {
        boolean noTag = true;
        if (newValues != null) {
            for (Map.Entry<String, GWTJahiaNodeProperty> entry : newValues.entrySet()) {
                GWTJahiaNodeProperty newTag = entry.getValue();
                GWTJahiaNodeProperty oldTag = oldValues.get(entry.getKey());

                if (!newTag.equals(oldTag)) {
                    if (!newTag.getValues().isEmpty()) {
                        // Add new tags
                        noTag = false;
                        list.add(newTag);
                    }
                } else if (oldTag != null) {
                    if (!oldTag.getValues().isEmpty()) {
                        noTag = false;
                    }
                }
            }
        }
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.