Search in sources :

Example 1 with ComboBox

use of com.extjs.gxt.ui.client.widget.form.ComboBox in project geo-platform by geosdi.

the class GPScaleWidget method onShowInfo.

protected void onShowInfo() {
    Draggable d = new Draggable(this, this.getHeader());
    d.setContainer(LayoutManager.getInstance().getCenter());
    d.setUseProxy(false);
    RootPanel.get().add(this);
    el().makePositionable(true);
    setTitle();
    setText();
    List<GPScaleBean> scales = Lists.<GPScaleBean>newArrayList();
    scales.add(new GPScaleBean("1:1000"));
    scales.add(new GPScaleBean("1:10000"));
    scales.add(new GPScaleBean("1:100000"));
    scales.add(new GPScaleBean("1:1000000"));
    scales.add(new GPScaleBean("1:10000000"));
    scales.add(new GPScaleBean("1:100000000"));
    scales.add(new GPScaleBean("1:1000000000"));
    ListStore<GPScaleBean> scaleStore = new ListStore<GPScaleBean>();
    scaleStore.add(scales);
    ComboBox<GPScaleBean> comboScale = new ComboBox<GPScaleBean>();
    comboScale.setEmptyText(MapModuleConstants.INSTANCE.GPScaleWidget_comboScaleEmptyText());
    comboScale.setDisplayField("scale");
    comboScale.setWidth(150);
    comboScale.setStore(scaleStore);
    comboScale.setTypeAhead(true);
    comboScale.setTriggerAction(TriggerAction.ALL);
    comboScale.setEditable(true);
    comboScale.setForceSelection(false);
    comboScale.setValidator(new Validator() {

        @Override
        public String validate(Field<?> field, String value) {
            String result = null;
            try {
                Long.parseLong(value.substring(2));
            } catch (NumberFormatException nfe) {
                result = "The scale value: " + value.substring(2) + " is not a number";
            }
            if (!value.startsWith("1:")) {
                String error = "The scale value must start with string 1:";
                result = (result == null) ? error : (result += '\n' + error);
            }
            return result;
        }
    });
    add(comboScale);
    Point p = position(XDOM.getViewportSize());
    el().setLeftTop(p.x, p.y);
    setSize(config.width, config.height);
    comboScale.addListener(Events.Select, new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            ComboBox cb = (ComboBox) fe.getComponent();
            GPScaleBean s = (GPScaleBean) cb.getValue();
            scaleSelectedElement(s);
        }
    });
    comboScale.addListener(Events.OnKeyPress, new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            ComboBox cb = (ComboBox) fe.getComponent();
            if (fe.getKeyCode() == KeyCodes.KEY_ENTER && cb.validate()) {
                GPScaleBean scaleBean = new GPScaleBean(cb.getRawValue());
                scaleSelectedElement(scaleBean);
            }
        }
    });
    el().slideIn(Direction.DOWN, FxConfig.NONE);
}
Also used : Draggable(com.extjs.gxt.ui.client.fx.Draggable) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) GPScaleBean(org.geosdi.geoplatform.gui.model.scale.GPScaleBean) Point(com.extjs.gxt.ui.client.util.Point) ListStore(com.extjs.gxt.ui.client.store.ListStore) Validator(com.extjs.gxt.ui.client.widget.form.Validator)

Example 2 with ComboBox

use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.

the class LayoutTabItem method attachPropertiesEditor.

@Override
public void attachPropertiesEditor(final NodeHolder engine, final AsyncTabItem tab) {
    if (engine.getNode() != null && engine.getLinker() instanceof EditLinker) {
        final PropertiesEditor.PropertyAdapterField templateField = propertiesEditor.getFieldsMap().get("j:view");
        final PropertiesEditor.PropertyAdapterField skinField = propertiesEditor.getFieldsMap().get("j:skin");
        final PropertiesEditor.PropertyAdapterField subNodesViewField = propertiesEditor.getFieldsMap().get("j:subNodesView");
        listener = new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

            public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
                Map<String, List<String>> contextParams = new HashMap<String, List<String>>();
                if (skinField != null && skinField.getValue() != null) {
                    contextParams.put("forcedSkin", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).getValue().getValue()));
                }
                if (subNodesViewField != null && subNodesViewField.getValue() != null) {
                    contextParams.put("forcedSubNodesTemplate", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).getValue().getValue()));
                }
                String template = (templateField != null && templateField.getValue() != null) ? ((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).getValue().getValue() : null;
                if (engine.getNode() != null) {
                    JahiaContentManagementService.App.getInstance().getRenderedContent(engine.getNode().getPath(), null, LayoutTabItem.this.language, template, "preview", contextParams, false, null, null, null, new BaseAsyncCallback<GWTRenderResult>() {

                        public void onSuccess(GWTRenderResult result) {
                            HTML html = new HTML(result.getResult());
                            setHTML(html);
                            tab.layout();
                        }
                    });
                } else {
                    setHTML(null);
                }
            }
        };
        if (templateField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).addSelectionChangedListener(listener);
        }
        if (skinField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).addSelectionChangedListener(listener);
        }
        if (subNodesViewField != null) {
            ((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).addSelectionChangedListener(listener);
        }
        tab.setLayout(new FillLayout());
        if (ctn == null) {
            ctn = new LayoutContainer(new FitLayout());
            tab.add(ctn);
            htmlPreview = new LayoutContainer();
            htmlPreview.addStyleName(cssWrapper);
            htmlPreview.setStyleAttribute("background-color", "white");
            FieldSet f = new FieldSet();
            f.addStyleName("x-panel");
            f.setHeadingHtml(Messages.get("label.preview", "Preview"));
            f.setScrollMode(Style.Scroll.AUTO);
            f.add(htmlPreview);
            tab.add(f);
        }
        ctn.add(propertiesEditor);
    } else {
        super.attachPropertiesEditor(engine, tab);
    }
}
Also used : PropertiesEditor(org.jahia.ajax.gwt.client.widget.definition.PropertiesEditor) GWTRenderResult(org.jahia.ajax.gwt.client.data.GWTRenderResult) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) HTML(com.google.gwt.user.client.ui.HTML) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) BaseAsyncCallback(org.jahia.ajax.gwt.client.core.BaseAsyncCallback) List(java.util.List) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean) HashMap(java.util.HashMap) Map(java.util.Map) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 3 with ComboBox

use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.

the class AbstractContentEngine method refillDependantListWidgetOn.

protected void refillDependantListWidgetOn(final String propertyId, final List<String> dependentProperties) {
    final String nodeTypeName = propertyId.substring(0, propertyId.indexOf('.'));
    final String propertyName = propertyId.substring(propertyId.indexOf('.') + 1);
    Map<String, List<GWTJahiaNodePropertyValue>> dependentValues = new HashMap<String, List<GWTJahiaNodePropertyValue>>();
    for (TabItem tab : tabs.getItems()) {
        EditEngineTabItem item = tab.getData("item");
        if (item instanceof PropertiesTabItem) {
            for (PropertiesEditor pe : ((PropertiesTabItem) item).getLangPropertiesEditorMap().values()) {
                if (pe != null) {
                    for (Field<?> field : pe.getFields()) {
                        if (field instanceof PropertiesEditor.PropertyAdapterField) {
                            String name = ((PropertiesEditor.PropertyAdapterField) field).getDefinition().getName();
                            if (dependentProperties.contains(name)) {
                                dependentValues.put(name, PropertiesEditor.getPropertyValues(field, pe.getGWTJahiaItemDefinition(name)));
                            }
                        }
                    }
                }
            }
        }
    }
    JahiaContentManagementService.App.getInstance().getFieldInitializerValues(nodeTypeName, propertyName, parentPath, dependentValues, new BaseAsyncCallback<GWTChoiceListInitializer>() {

        @Override
        public void onSuccess(GWTChoiceListInitializer result) {
            choiceListInitializersValues.put(propertyId, result);
            if (result.getDisplayValues() != null) {
                String nameForDualFields = "from-" + propertyName;
                for (TabItem tab : tabs.getItems()) {
                    EditEngineTabItem item = tab.getData("item");
                    if (item instanceof PropertiesTabItem) {
                        PropertiesEditor pe = ((PropertiesTabItem) item).getPropertiesEditor();
                        if (pe != null) {
                            for (Field<?> field : pe.getFields()) {
                                if (field instanceof PropertiesEditor.PropertyAdapterField) {
                                    field = ((PropertiesEditor.PropertyAdapterField) field).getField();
                                }
                                if (propertyName.equals(field.getName()) || (field instanceof DualListField<?> && nameForDualFields.equals(field.getName()))) {
                                    if (field instanceof DualListField<?>) {
                                        @SuppressWarnings("unchecked") DualListField<GWTJahiaValueDisplayBean> dualListField = (DualListField<GWTJahiaValueDisplayBean>) field;
                                        ListStore<GWTJahiaValueDisplayBean> store = dualListField.getToField().getStore();
                                        for (GWTJahiaValueDisplayBean toValue : store.getModels()) {
                                            if (!result.getDisplayValues().contains(toValue)) {
                                                store.remove(toValue);
                                            }
                                        }
                                        dualListField.getToField().getListView().refresh();
                                        store = dualListField.getFromField().getStore();
                                        store.removeAll();
                                        store.add(result.getDisplayValues());
                                        dualListField.getFromField().getListView().refresh();
                                    } else if (field instanceof ComboBox<?>) {
                                        @SuppressWarnings("unchecked") ComboBox<GWTJahiaValueDisplayBean> comboBox = (ComboBox<GWTJahiaValueDisplayBean>) field;
                                        if (comboBox.getValue() != null && !result.getDisplayValues().contains(comboBox.getValue())) {
                                            try {
                                                comboBox.clear();
                                            } catch (Exception ex) {
                                            /*
                                                             * it could happen that the combobox is empty and so exception is thrown
                                                             * and combobox isn't reinitialized
                                                             */
                                            }
                                        }
                                        ListStore<GWTJahiaValueDisplayBean> store = new ListStore<GWTJahiaValueDisplayBean>();
                                        store.add(result.getDisplayValues());
                                        comboBox.setStore(store);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        @Override
        public void onApplicationFailure(Throwable caught) {
            Log.error("Unable to load avalibale mixin", caught);
        }
    });
}
Also used : ListStore(com.extjs.gxt.ui.client.store.ListStore) GWTJahiaNodePropertyValue(org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodePropertyValue) DualListField(com.extjs.gxt.ui.client.widget.form.DualListField) Field(com.extjs.gxt.ui.client.widget.form.Field) PropertiesEditor(org.jahia.ajax.gwt.client.widget.definition.PropertiesEditor) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) GWTChoiceListInitializer(org.jahia.ajax.gwt.client.data.GWTChoiceListInitializer) TabItem(com.extjs.gxt.ui.client.widget.TabItem) AsyncTabItem(org.jahia.ajax.gwt.client.widget.AsyncTabItem) DualListField(com.extjs.gxt.ui.client.widget.form.DualListField) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean)

Example 4 with ComboBox

use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.

the class CodeEditorTabItem method getModeCombo.

private ComboBox<GWTJahiaValueDisplayBean> getModeCombo() {
    ComboBox<GWTJahiaValueDisplayBean> modes = new ComboBox<GWTJahiaValueDisplayBean>();
    modes.setTypeAhead(true);
    modes.getListView().setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
    modes.setTriggerAction(ComboBox.TriggerAction.ALL);
    modes.setForceSelection(true);
    modes.setStore(new ListStore<GWTJahiaValueDisplayBean>());
    modes.setDisplayField("display");
    for (Map.Entry<String, String> m : availableCodeMirrorModes.entrySet()) {
        String label = m.getValue();
        if (label == null || label.length() == 0) {
            label = Messages.get("label.none", "none");
        }
        GWTJahiaValueDisplayBean option = new GWTJahiaValueDisplayBean(m.getKey(), label);
        modes.getStore().add(option);
        if (codeMirrorMode != null && codeMirrorMode.equals(m.getKey())) {
            ArrayList<GWTJahiaValueDisplayBean> selection = new ArrayList<GWTJahiaValueDisplayBean>();
            selection.add(option);
            modes.setSelection(selection);
        }
    }
    modes.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
            codeField.setMode(se.getSelectedItem().getValue());
        }
    });
    return modes;
}
Also used : ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) ArrayList(java.util.ArrayList) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean) Map(java.util.Map) RpcMap(com.extjs.gxt.ui.client.data.RpcMap)

Example 5 with ComboBox

use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.

the class CodeEditorTabItem method init.

@Override
public void init(final NodeHolder engine, final AsyncTabItem tab, String locale) {
    gwtJahiaNode = engine.getNode();
    tab.setLayout(new BorderLayout());
    tab.setScrollMode(Style.Scroll.AUTO);
    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(10);
    horizontalPanel.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    tab.add(horizontalPanel, new BorderLayoutData(Style.LayoutRegion.NORTH, 40));
    final HorizontalPanel actions = new HorizontalPanel();
    actions.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    horizontalPanel.add(actions);
    if (!tab.isProcessed()) {
        // Add list of properties
        GWTJahiaNodeProperty typeName = engine.getProperties().get("nodeTypeName");
        if (typeName == null) {
            typeName = engine.getPresetProperties().get("nodeTypeName");
        }
        if (engine.getProperties().containsKey(codePropertyName)) {
            codeProperty = engine.getProperties().get(codePropertyName);
        } else {
            codeProperty = new GWTJahiaNodeProperty(codePropertyName, "", GWTJahiaNodePropertyType.STRING);
        }
        Button indentButton = new Button(Messages.get("label.indentAll"));
        indentButton.addStyleName("button-indent");
        indentButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent buttonEvent) {
                if (codeField != null) {
                    codeField.indent();
                }
            }
        });
        if (stubType != null) {
            // stub type is defined -> create combos for code snippets
            final Button addAllButton = new Button(Messages.get("label.addAll"));
            addAllButton.addStyleName("button-addAll");
            final Button addButton = new Button(Messages.get("label.add"));
            addButton.addStyleName("button-add");
            snippetType = new ComboBox<GWTJahiaValueDisplayBean>();
            snippetType.setTypeAhead(true);
            snippetType.getListView().setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
            snippetType.setTriggerAction(ComboBox.TriggerAction.ALL);
            snippetType.setForceSelection(true);
            snippetType.setWidth(200);
            snippetType.removeAllListeners();
            snippetType.setStore(new ListStore<GWTJahiaValueDisplayBean>());
            snippetType.setAllowBlank(false);
            snippetType.setDisplayField("display");
            snippetType.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

                @Override
                public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
                    // snippet type has changed -> populate code snippets
                    mirrorTemplates.clear();
                    mirrorTemplates.getStore().removeAll();
                    mirrorTemplates.getStore().add(snippets.get(se.getSelectedItem().getValue()));
                    if (mirrorTemplates.getStore().getModels().size() > 0) {
                        addAllButton.enable();
                        mirrorTemplates.setEmptyText(Messages.get("label.stub.choose.codeTemplate"));
                    } else {
                        addAllButton.disable();
                    }
                    addButton.disable();
                }
            });
            // code templates combo
            mirrorTemplates = new ComboBox<GWTJahiaValueDisplayBean>() {

                public void doQuery(String q, boolean forceAll) {
                    final String query = q;
                    StoreFilter<GWTJahiaValueDisplayBean> filter = new StoreFilter<GWTJahiaValueDisplayBean>() {

                        @Override
                        public boolean select(Store<GWTJahiaValueDisplayBean> store, GWTJahiaValueDisplayBean parent, GWTJahiaValueDisplayBean item, String property) {
                            return item.getDisplay().contains(query);
                        }
                    };
                    if (q == null) {
                        q = "";
                    }
                    FieldEvent fe = new FieldEvent(this);
                    fe.setValue(q);
                    if (!fireEvent(Events.BeforeQuery, fe)) {
                        return;
                    }
                    if (q.length() >= 1) {
                        if (!q.equals(lastQuery)) {
                            lastQuery = q;
                            store.clearFilters();
                            if (store.getFilters() != null) {
                                store.getFilters().clear();
                            }
                            store.addFilter(filter);
                            store.applyFilters(getDisplayField());
                            expand();
                        }
                    } else {
                        lastQuery = "";
                        store.clearFilters();
                        if (store.getFilters() != null) {
                            store.getFilters().clear();
                        }
                        expand();
                    }
                }
            };
            mirrorTemplates.setTypeAhead(true);
            mirrorTemplates.getListView().setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
            mirrorTemplates.setTriggerAction(ComboBox.TriggerAction.ALL);
            mirrorTemplates.setForceSelection(true);
            mirrorTemplates.setWidth(300);
            mirrorTemplates.removeAllListeners();
            mirrorTemplates.setStore(new ListStore<GWTJahiaValueDisplayBean>());
            mirrorTemplates.getStore().sort("display", Style.SortDir.ASC);
            mirrorTemplates.setAllowBlank(true);
            mirrorTemplates.setDisplayField("display");
            String path = engine.isExistingNode() ? engine.getNode().getPath() : engine.getTargetNode().getPath();
            String nodeType = typeName != null ? typeName.getValues().get(0).getString() : null;
            // get code editor data from the server
            JahiaContentManagementService.App.getInstance().initializeCodeEditor(path, !engine.isExistingNode(), nodeType, stubType, new BaseAsyncCallback<RpcMap>() {

                public void onSuccess(RpcMap result) {
                    if (!result.isEmpty() && result.get("snippets") != null) {
                        // we have got snippets -> populate snippet type combo
                        snippets = (Map<String, List<GWTJahiaValueDisplayBean>>) result.get("snippets");
                        for (String type : snippets.keySet()) {
                            snippetType.getStore().add(new GWTJahiaValueDisplayBean(type, Messages.get("label.snippetType." + type, type)));
                        }
                        snippetType.setValue(snippetType.getStore().getAt(0));
                        addButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

                            @Override
                            public void componentSelected(ButtonEvent buttonEvent) {
                                if (mirrorTemplates.getValue() != null) {
                                    codeField.insertProperty(mirrorTemplates.getValue().getValue());
                                }
                            }
                        });
                        Label label = new Label(Messages.get("label.snippetType", "Snippet Type"));
                        label.setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
                        actions.add(label);
                        actions.add(snippetType);
                        label = new Label(Messages.get("label.codeMirrorTemplates", "Code Template"));
                        label.setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
                        actions.add(label);
                        actions.add(mirrorTemplates);
                        addButton.disable();
                        mirrorTemplates.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

                            @Override
                            public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
                                addButton.enable();
                            }
                        });
                        actions.add(addButton);
                        // create add all snippets addButton
                        addAllButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

                            @Override
                            public void componentSelected(ButtonEvent ce) {
                                StringBuilder s = new StringBuilder();
                                for (GWTJahiaValueDisplayBean value : mirrorTemplates.getStore().getModels()) {
                                    s.append(value.getValue()).append("\n");
                                }
                                codeField.insertProperty(s.toString());
                            }
                        });
                        actions.add(addAllButton);
                    }
                    if (!engine.getProperties().containsKey(codePropertyName)) {
                        Map<String, String> stubs = (Map<String, String>) result.get("stubs");
                        if (stubs.size() == 1) {
                            codeProperty = new GWTJahiaNodeProperty(codePropertyName, stubs.values().iterator().next(), GWTJahiaNodePropertyType.STRING);
                            initEditor(tab);
                        } else if (stubs.size() > 1) {
                            actions.hide();
                            final LayoutContainer w = new LayoutContainer(new CenterLayout());
                            final ComboBox<GWTJahiaValueDisplayBean> stubsCombo = new ComboBox<GWTJahiaValueDisplayBean>();
                            stubsCombo.setWidth(300);
                            stubsCombo.setTypeAhead(true);
                            stubsCombo.getListView().setStyleAttribute(FONT_SIZE, FONT_SIZE_VALUE);
                            stubsCombo.setTriggerAction(ComboBox.TriggerAction.ALL);
                            stubsCombo.setForceSelection(true);
                            stubsCombo.setStore(new ListStore<GWTJahiaValueDisplayBean>());
                            stubsCombo.setDisplayField("display");
                            stubsCombo.setEmptyText(Messages.get("label.stub.select"));
                            for (String stub : stubs.keySet()) {
                                String display;
                                String viewName;
                                if (stub.indexOf('/') != -1) {
                                    viewName = stub.substring(stub.indexOf("."), stub.lastIndexOf("."));
                                    display = Messages.get("label.stub" + viewName);
                                } else {
                                    display = Messages.get("label.stub.default");
                                    viewName = "";
                                }
                                GWTJahiaValueDisplayBean value = new GWTJahiaValueDisplayBean(stubs.get(stub), display);
                                value.set("viewName", viewName);
                                stubsCombo.getStore().add(value);
                            }
                            stubsCombo.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaValueDisplayBean>() {

                                @Override
                                public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
                                    w.removeFromParent();
                                    initEditor(tab);
                                    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

                                        public void execute() {
                                            codeField.insertProperty(stubsCombo.getValue().getValue());
                                        }
                                    });
                                    if (engine instanceof CreateContentEngine) {
                                        final CreateContentEngine createContentEngine = (CreateContentEngine) engine;
                                        createContentEngine.setTargetName(createContentEngine.getTargetName() + stubsCombo.getValue().get("viewName"));
                                    }
                                    actions.show();
                                    codeField.show();
                                }
                            });
                            w.add(stubsCombo);
                            tab.add(w, new BorderLayoutData(Style.LayoutRegion.CENTER));
                            tab.layout();
                        } else {
                            initEditor(tab);
                        }
                    } else {
                        initEditor(tab);
                    }
                }
            });
        } else {
            if (availableCodeMirrorModes != null && availableCodeMirrorModes.size() > 0) {
                actions.add(new Label(Messages.get("label.selectSyntaxHighlighting", "Select syntax highlighting") + ": "));
                actions.add(getModeCombo());
            }
            initEditor(tab);
        }
        if (isEditable(gwtJahiaNode)) {
            actions.add(indentButton);
        }
        actions.show();
        tab.setProcessed(true);
        readOnly = engine.getNode() != null && engine.getNode().isLocked();
        if (codeField != null) {
            codeField.setReadOnly(readOnly);
        }
    }
}
Also used : Label(com.extjs.gxt.ui.client.widget.Label) RpcMap(com.extjs.gxt.ui.client.data.RpcMap) BorderLayout(com.extjs.gxt.ui.client.widget.layout.BorderLayout) GWTJahiaNodeProperty(org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeProperty) Button(com.extjs.gxt.ui.client.widget.button.Button) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel) CenterLayout(com.extjs.gxt.ui.client.widget.layout.CenterLayout) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) StoreFilter(com.extjs.gxt.ui.client.store.StoreFilter) GWTJahiaValueDisplayBean(org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean) Map(java.util.Map) RpcMap(com.extjs.gxt.ui.client.data.RpcMap)

Aggregations

ComboBox (com.extjs.gxt.ui.client.widget.form.ComboBox)15 ListStore (com.extjs.gxt.ui.client.store.ListStore)7 HorizontalPanel (com.extjs.gxt.ui.client.widget.HorizontalPanel)6 Button (com.extjs.gxt.ui.client.widget.button.Button)6 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)5 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)4 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)4 GWTJahiaValueDisplayBean (org.jahia.ajax.gwt.client.data.GWTJahiaValueDisplayBean)4 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)3 HTML (com.google.gwt.user.client.ui.HTML)3 List (java.util.List)3 Map (java.util.Map)3 BaseAsyncCallback (org.jahia.ajax.gwt.client.core.BaseAsyncCallback)3 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)3 RpcMap (com.extjs.gxt.ui.client.data.RpcMap)2 Label (com.extjs.gxt.ui.client.widget.Label)2 Window (com.extjs.gxt.ui.client.widget.Window)2 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)2 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)2 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)2