Search in sources :

Example 1 with XTemplate

use of com.extjs.gxt.ui.client.core.XTemplate in project geo-platform by geosdi.

the class RecordsContainer method prepareColumnModel.

@Override
public ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
    StringBuilder templateBuilder = new StringBuilder();
    templateBuilder.append("<p><b>");
    templateBuilder.append(CatalogFinderConstants.INSTANCE.RecordsContainer_xTemplateAbstractText());
    templateBuilder.append(":</b> {ABSTRACT_TEXT}</p><br>");
    templateBuilder.append("<p><b>");
    templateBuilder.append(CatalogFinderConstants.INSTANCE.RecordsContainer_xTemplateKeywordsText());
    templateBuilder.append(":</b><br></p>");
    templateBuilder.append("<tpl for=\"SUBJECTS\">");
    templateBuilder.append("<div>{.}</div>");
    templateBuilder.append("</tpl>");
    XTemplate tpl = XTemplate.create(templateBuilder.toString());
    rowExpander = new RowExpander(tpl);
    configs.add(rowExpander);
    ColumnConfig titleColumn = new ColumnConfig();
    titleColumn.setId(RecordKeyValue.TITLE.toString());
    titleColumn.setHeaderHtml(CatalogFinderConstants.INSTANCE.RecordsContainer_titleColumnHeaderText());
    titleColumn.setWidth(490);
    titleColumn.setFixed(true);
    titleColumn.setResizable(false);
    configs.add(titleColumn);
    selectionModel = new CheckBoxSelectionModel<FullRecord>();
    selectionModel.setSelectionMode(SelectionMode.SINGLE);
    configs.add(selectionModel.getColumn());
    return new ColumnModel(configs);
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) FullRecord(org.geosdi.geoplatform.gui.client.model.FullRecord) XTemplate(com.extjs.gxt.ui.client.core.XTemplate) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) RowExpander(com.extjs.gxt.ui.client.widget.grid.RowExpander)

Example 2 with XTemplate

use of com.extjs.gxt.ui.client.core.XTemplate in project geo-platform by geosdi.

the class CatalogGridLayersWidget method prepareColumnModel.

@Override
public ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
    XTemplate tpl = XTemplate.create("<p><b>Abstract:</b> {abstractText}</p>");
    rowExpander = new RowExpander(tpl);
    configs.add(rowExpander);
    ColumnConfig name = new ColumnConfig();
    name.setId(GPLayerGrid.GPLayerBeanKeyValue.GPLAYER_NAME.getValue());
    name.setHeaderHtml(CatalogFinderConstants.INSTANCE.CatalogGridLayersWidget_layerNameHeaderText());
    name.setWidth(200);
    configs.add(name);
    ColumnConfig title = new ColumnConfig();
    title.setId(GPLayerGrid.GPLayerBeanKeyValue.GPLAYER_LABEL.getValue());
    title.setHeaderHtml(CatalogFinderConstants.INSTANCE.CatalogGridLayersWidget_titleHeaderText());
    title.setWidth(150);
    configs.add(title);
    return new ColumnModel(configs);
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) XTemplate(com.extjs.gxt.ui.client.core.XTemplate) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) RowExpander(com.extjs.gxt.ui.client.widget.grid.RowExpander)

Example 3 with XTemplate

use of com.extjs.gxt.ui.client.core.XTemplate in project geo-platform by geosdi.

the class GridLayersWidget method prepareColumnModel.

@Override
public ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
    XTemplate tpl = XTemplate.create("<p><b>Abstract:</b> {abstractText}</p>");
    rowExpander = new RowExpander(tpl);
    configs.add(rowExpander);
    ColumnConfig name = new ColumnConfig();
    name.setId(GPLayerBeanKeyValue.GPLAYER_NAME.getValue());
    name.setHeaderHtml(ServerModuleConstants.INSTANCE.GridLayersWidget_layerNameHeaderText());
    name.setWidth(200);
    configs.add(name);
    ColumnConfig title = new ColumnConfig();
    title.setId(GPLayerBeanKeyValue.GPLAYER_LABEL.getValue());
    title.setHeaderHtml(ServerModuleConstants.INSTANCE.GridLayersWidget_titleHeaderText());
    title.setWidth(150);
    configs.add(title);
    return new ColumnModel(configs);
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) XTemplate(com.extjs.gxt.ui.client.core.XTemplate) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) RowExpander(com.extjs.gxt.ui.client.widget.grid.RowExpander)

Example 4 with XTemplate

use of com.extjs.gxt.ui.client.core.XTemplate in project jahia by Jahia.

the class VisibilityTabItem method init.

@Override
public void init(NodeHolder engine, AsyncTabItem tab, String language) {
    if (engine.getNode() == null) {
        return;
    }
    final GWTJahiaNode node = engine.getNode();
    tab.setLayout(new RowLayout());
    tab.setProcessed(true);
    final boolean editable = (!engine.isExistingNode() || (PermissionsUtils.isPermitted("jcr:modifyProperties", engine.getNode()) && !engine.getNode().isLocked()));
    LayoutContainer header = new LayoutContainer(new FillLayout(Style.Orientation.VERTICAL));
    tab.add(header, new RowData(1, 25, new Margins(5)));
    final HorizontalPanel timeZonePanel = new HorizontalPanel();
    timeZonePanel.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    timeZonePanel.add(new HTML(Messages.get("label.visibility.timeZone", "All the visibility conditions are using the server timezone") + ":&nbsp;" + JahiaGWTParameters.getServerDisplayableTimeZone()));
    header.add(timeZonePanel);
    LayoutContainer top = new LayoutContainer(new FillLayout(Style.Orientation.VERTICAL));
    tab.add(top, new RowData(1, 60, new Margins(5)));
    final HorizontalPanel statusPanel = new HorizontalPanel();
    statusPanel.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    top.add(statusPanel);
    statusBar = new StatusBar(node, statusPanel, editable);
    HorizontalPanel addPanel = new HorizontalPanel();
    addPanel.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    if (editable) {
        top.add(addPanel);
    }
    addPanel.add(new HTML(Messages.get("label.visibility.allConditionsMatch", "All conditions should match") + ":&nbsp;"));
    allConditionsMatch = new CheckBox();
    allConditionsMatch.setEnabled(editable);
    allConditionsMatch.addListener(Events.Change, new Listener<ComponentEvent>() {

        public void handleEvent(ComponentEvent event) {
            changed = true;
            refreshConditionsList();
            statusBar.update();
        }
    });
    addPanel.add(allConditionsMatch);
    addPanel.add(new HTML("&nbsp;&nbsp;&nbsp;" + Messages.get("label.visibility.addCondition", "Add new condition") + ":&nbsp;"));
    final ListStore<GWTJahiaNodeType> typesStore = new ListStore<GWTJahiaNodeType>();
    final ComboBox<GWTJahiaNodeType> types = new ComboBox<GWTJahiaNodeType>();
    types.setDisplayField("label");
    types.setStore(typesStore);
    types.setTypeAhead(true);
    types.setTriggerAction(ComboBox.TriggerAction.ALL);
    types.setForceSelection(true);
    types.setEditable(false);
    types.setWidth(250);
    types.setEnabled(editable);
    addPanel.add(types);
    final Map<String, GWTJahiaNodeType> typesMap = new HashMap<String, GWTJahiaNodeType>();
    final Button add = new Button();
    add.setIcon(StandardIconsProvider.STANDARD_ICONS.plusRound());
    add.setEnabled(false);
    addPanel.add(add);
    conditionsStore = new ListStore<GWTJahiaNode>();
    deleted = new ArrayList<GWTJahiaNode>();
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    ColumnConfig name = new ColumnConfig("name", Messages.get("label.title"), 500);
    name.setRenderer(new GridCellRenderer<GWTJahiaNode>() {

        public Object render(GWTJahiaNode condition, String property, com.extjs.gxt.ui.client.widget.grid.ColumnData config, int rowIndex, int colIndex, ListStore<GWTJahiaNode> store, Grid<GWTJahiaNode> grid) {
            String typeName = condition.getNodeTypes().get(0);
            XTemplate tpl = typesMap.get(typeName).get("compiledTemplate");
            convertStringToDate(condition);
            return tpl.applyTemplate(com.extjs.gxt.ui.client.util.Util.getJsObject(condition));
        }
    });
    name.setFixed(true);
    configs.add(name);
    ColumnConfig conditionStatus = new ColumnConfig("status", Messages.get("label.status"), 100);
    conditionStatus.setRenderer(new GridCellRenderer<GWTJahiaNode>() {

        public Object render(GWTJahiaNode model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<GWTJahiaNode> gwtJahiaNodeListStore, Grid<GWTJahiaNode> gwtJahiaNodeGrid) {
            Boolean match = model.get("conditionMatch");
            if (match != null) {
                if (match.equals(Boolean.TRUE)) {
                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("visibilityStatusGreen");
                    return icon.getHTML();
                } else {
                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("visibilityStatusRed");
                    return icon.getHTML();
                }
            }
            AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("visibilityStatusUnknown");
            return icon.getHTML();
        }
    });
    configs.add(conditionStatus);
    if (editable) {
        ColumnConfig remove = new ColumnConfig("remove", Messages.get("label.remove"), 100);
        remove.setRenderer(new GridCellRenderer<GWTJahiaNode>() {

            public Object render(final GWTJahiaNode condition, String property, com.extjs.gxt.ui.client.widget.grid.ColumnData config, final int rowIndex, final int colIndex, ListStore<GWTJahiaNode> listStore, final Grid<GWTJahiaNode> grid) {
                final Button button;
                if (condition.get("node-removed") == null || condition.isMarkedForDeletion()) {
                    button = new Button(Messages.get("label.remove"));
                    button.addStyleName("button-remove");
                    button.setIcon(StandardIconsProvider.STANDARD_ICONS.minusRound());
                } else {
                    button = new Button(Messages.get("label.undelete"));
                    button.addStyleName("button-undelete");
                    button.setIcon(StandardIconsProvider.STANDARD_ICONS.restore());
                }
                button.addSelectionListener(new SelectionListener<ButtonEvent>() {

                    @Override
                    public void componentSelected(ButtonEvent buttonEvent) {
                        conditionsStore.remove(condition);
                        propertiesEditorMap.remove(condition.getPath());
                        if (condition.get("new-node") == null) {
                            deleted.add(condition);
                            condition.set("node-removed", Boolean.TRUE);
                        }
                        changed = true;
                        refreshConditionsList();
                        statusBar.update();
                    }
                });
                return button;
            }
        });
        configs.add(remove);
    }
    // ColumnConfig publicationInfo = new ColumnConfig("publish", Messages.get("label.publish"), 100);
    // publicationInfo.setRenderer(new GridCellRenderer<GWTJahiaNode>() {
    // public Object render(final GWTJahiaNode conditionNode, String property, ColumnData config, int rowIndex, int colIndex,
    // ListStore<GWTJahiaNode> store, Grid<GWTJahiaNode> grid) {
    // final GWTJahiaPublicationInfo info = conditionNode.getAggregatedPublicationInfo();
    // HorizontalPanel p = new HorizontalPanel();
    // p.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
    // Integer infoStatus;
    // if (info != null) {
    // if (conditionNode.get("node-modified") != null) {
    // infoStatus = GWTJahiaPublicationInfo.MODIFIED;
    // } else {
    // infoStatus = info.getStatus();
    // }
    // } else {
    // infoStatus = GWTJahiaPublicationInfo.NOT_PUBLISHED;
    // }
    // PropertiesEditor pe = propertiesEditorMap.get(conditionNode.getPath());
    // if (pe != null) {
    // if (pe.getProperties(false, true, true).isEmpty()) {
    // infoStatus = GWTJahiaPublicationInfo.MODIFIED;
    // }
    // }
    // 
    // Image res = GWTJahiaPublicationInfo.renderPublicationStatusImage(infoStatus);
    // p.add(res);
    // final CheckBox checkbox = new CheckBox();
    // if (infoStatus == GWTJahiaPublicationInfo.PUBLISHED) {
    // checkbox.setEnabled(false);
    // }
    // checkbox.addListener(Events.Change, new Listener<ComponentEvent>() {
    // public void handleEvent(ComponentEvent event) {
    // conditionNode.set("node-published", checkbox.getValue());
    // }
    // });
    // p.add(checkbox);
    // return p;
    // }
    // });
    // configs.add(publicationInfo);
    ColumnModel cm = new ColumnModel(configs);
    final Grid<GWTJahiaNode> conditions = new Grid<GWTJahiaNode>(conditionsStore, cm);
    conditions.setAutoExpandColumn("name");
    tab.add(conditions, new RowData(1, 0.5));
    final LayoutContainer form = new LayoutContainer(new FitLayout());
    form.setEnabled(editable);
    tab.add(form, new RowData(1, 0.5));
    final GridSelectionModel<GWTJahiaNode> selectionModel = conditions.getSelectionModel();
    selectionModel.setSelectionMode(Style.SelectionMode.SINGLE);
    selectionModel.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNode>() {

        public void selectionChanged(SelectionChangedEvent<GWTJahiaNode> event) {
            form.removeAll();
            final GWTJahiaNode conditionNode = selectionModel.getSelectedItem();
            if (conditionNode != null) {
                PropertiesEditor pe = propertiesEditorMap.get(conditionNode.getPath());
                if (pe != null) {
                    form.add(pe);
                    form.layout();
                } else {
                    if (conditionNode.get("new-node") != null) {
                        final GWTJahiaNodeType type = types.getSelection().get(0);
                        JahiaContentManagementService.App.getInstance().initializeCreateEngine(type.getName(), node.getPath(), null, new BaseAsyncCallback<GWTJahiaCreateEngineInitBean>() {

                            public void onSuccess(GWTJahiaCreateEngineInitBean result) {
                                PropertiesEditor pe = new PropertiesEditor(Arrays.asList(type), new HashMap<String, GWTJahiaNodeProperty>(), Arrays.asList("content"));
                                pe.setChoiceListInitializersValues(result.getChoiceListInitializersValues());
                                pe.renderNewFormPanel();
                                propertiesEditorMap.put(conditionNode.getPath(), pe);
                                form.add(pe);
                                form.layout();
                                addFieldListener(pe, conditions, conditionNode);
                            }
                        });
                    } else {
                        JahiaContentManagementService.App.getInstance().initializeEditEngine(conditionNode.getPath(), false, new BaseAsyncCallback<GWTJahiaEditEngineInitBean>() {

                            public void onSuccess(GWTJahiaEditEngineInitBean result) {
                                if (result == null) {
                                    return;
                                }
                                PropertiesEditor pe = new PropertiesEditor(result.getNodeTypes(), result.getProperties(), Arrays.asList("content"));
                                pe.setChoiceListInitializersValues(result.getInitializersValues());
                                pe.renderNewFormPanel();
                                propertiesEditorMap.put(conditionNode.getPath(), pe);
                                form.add(pe);
                                form.layout();
                                addFieldListener(pe, conditions, conditionNode);
                            }
                        });
                    }
                }
            }
        }
    });
    add.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            GWTJahiaNode newCondition = new GWTJahiaNode();
            List<GWTJahiaNodeType> nodeTypes = types.getSelection();
            String nodeTypeName = nodeTypes.get(0).getName();
            newCondition.setNodeTypes(Arrays.asList(nodeTypeName));
            String nodeName = nodeTypeName + new Date().getTime();
            newCondition.setName(nodeName);
            newCondition.setPath(node.getPath() + "/j:conditionalVisibility/" + nodeName);
            newCondition.set("new-node", Boolean.TRUE);
            conditionsStore.add(newCondition);
            selectionModel.select(Arrays.asList(newCondition), false);
            changed = true;
            refreshConditionsList();
            statusBar.update();
        }
    });
    if (editable) {
        types.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNodeType>() {

            @Override
            public void selectionChanged(SelectionChangedEvent<GWTJahiaNodeType> se) {
                add.enable();
            }
        });
    }
    JahiaContentManagementService.App.getInstance().getVisibilityInformation(node.getPath(), new BaseAsyncCallback<ModelData>() {

        public void onSuccess(ModelData result) {
            List<GWTJahiaNodeType> l = (List<GWTJahiaNodeType>) result.get("types");
            typesStore.add(l);
            types.setSelection(Arrays.asList(l.get(0)));
            for (GWTJahiaNodeType type : l) {
                typesMap.put(type.getName(), type);
                XTemplate tpl = XTemplate.create((String) type.get("xtemplate"));
                tpl.compile();
                type.set("compiledTemplate", tpl);
            }
            conditionsStore.add((List<GWTJahiaNode>) result.get("conditions"));
            refreshConditionsList();
            allConditionsMatch.setOriginalValue(result.<Boolean>get("j:forceMatchAllConditions"));
            allConditionsMatch.setValue(result.<Boolean>get("j:forceMatchAllConditions"));
            statusBar.initStatusBar((GWTJahiaPublicationInfo) result.get("publicationInfo"), (Boolean) result.get("liveStatus"));
        }
    });
    tab.layout();
}
Also used : GWTJahiaCreateEngineInitBean(org.jahia.ajax.gwt.client.data.GWTJahiaCreateEngineInitBean) HTML(com.google.gwt.user.client.ui.HTML) ListStore(com.extjs.gxt.ui.client.store.ListStore) Button(com.extjs.gxt.ui.client.widget.button.Button) GWTJahiaNodeProperty(org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeProperty) BaseAsyncCallback(org.jahia.ajax.gwt.client.core.BaseAsyncCallback) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) FillLayout(com.extjs.gxt.ui.client.widget.layout.FillLayout) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) CheckBox(com.extjs.gxt.ui.client.widget.form.CheckBox) AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) GWTJahiaEditEngineInitBean(org.jahia.ajax.gwt.client.data.GWTJahiaEditEngineInitBean) ModelData(com.extjs.gxt.ui.client.data.ModelData) RowData(com.extjs.gxt.ui.client.widget.layout.RowData) RowLayout(com.extjs.gxt.ui.client.widget.layout.RowLayout) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel) Margins(com.extjs.gxt.ui.client.util.Margins) GWTJahiaNodeType(org.jahia.ajax.gwt.client.data.definition.GWTJahiaNodeType) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout) PropertiesEditor(org.jahia.ajax.gwt.client.widget.definition.PropertiesEditor) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) XTemplate(com.extjs.gxt.ui.client.core.XTemplate) com.extjs.gxt.ui.client.widget.grid(com.extjs.gxt.ui.client.widget.grid) GWTJahiaPublicationInfo(org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo)

Example 5 with XTemplate

use of com.extjs.gxt.ui.client.core.XTemplate in project jahia by Jahia.

the class MainModule method refreshInfoLayer.

public void refreshInfoLayer() {
    infoLayers.removeAll();
    handleTranslateStatus();
    if (!activeLayers.isEmpty()) {
        infoLayers.setMainModule(this);
        List<Module> modules = ModuleHelper.getModules();
        String lastUnpublished = null;
        if (modules != null) {
            for (Module m : modules) {
                if (m instanceof AreaModule || !m.getPath().endsWith("*")) {
                    GWTJahiaNode currentNode = m.getNode();
                    if (currentNode != null) {
                        List<LayoutContainer> images = new ArrayList<LayoutContainer>();
                        if (activeLayers.containsKey("acl") && currentNode.isHasAcl()) {
                            AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("viewACLStatus");
                            LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                            layoutContainer.add(icon.createImage());
                            images.add(layoutContainer);
                        }
                        if (activeLayers.containsKey("publication")) {
                            GWTJahiaPublicationInfo info = currentNode.getAggregatedPublicationInfo();
                            if (lastUnpublished == null || !currentNode.getPath().startsWith(lastUnpublished)) {
                                if (info.isLocked()) {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/locked");
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(icon.createImage());
                                    images.add(layoutContainer);
                                }
                                if (info.getStatus() == GWTJahiaPublicationInfo.NOT_PUBLISHED || info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                                    lastUnpublished = currentNode.getPath();
                                    if (info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                                        AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/unpublished");
                                        LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                        layoutContainer.add(icon.createImage());
                                        images.add(layoutContainer);
                                    } else {
                                        AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/notpublished");
                                        LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                        layoutContainer.add(icon.createImage());
                                        images.add(layoutContainer);
                                    }
                                } else if (info.getStatus() == GWTJahiaPublicationInfo.MODIFIED) {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/modified");
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(icon.createImage());
                                    images.add(layoutContainer);
                                } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_UNPUBLISHABLE) {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/mandatorylanguageunpublishable");
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(icon.createImage());
                                    images.add(layoutContainer);
                                } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_VALID) {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("publication/mandatorylanguagevalid");
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(icon.createImage());
                                    images.add(layoutContainer);
                                }
                            }
                        }
                        if (activeLayers.containsKey("visibility")) {
                            Map<GWTJahiaNode, ModelData> visibility = currentNode.getVisibilityInfo();
                            if (!visibility.isEmpty()) {
                                if (currentNode.isVisible()) {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("visibilityStatusGreen");
                                    Image image = icon.createImage();
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(image);
                                    Set<Map.Entry<GWTJahiaNode, ModelData>> entries = visibility.entrySet();
                                    StringBuilder toolTip = new StringBuilder();
                                    for (Map.Entry<GWTJahiaNode, ModelData> entry : entries) {
                                        if (toolTip.length() > 0) {
                                            toolTip.append("<br/>");
                                        }
                                        XTemplate tpl = XTemplate.create((String) entry.getValue().get("xtemplate"));
                                        toolTip.append(tpl.applyTemplate(com.extjs.gxt.ui.client.util.Util.getJsObject(entry.getKey())));
                                    }
                                    layoutContainer.setToolTip(toolTip.toString());
                                    images.add(layoutContainer);
                                } else {
                                    AbstractImagePrototype icon = ToolbarIconProvider.getInstance().getIcon("visibilityStatusRed");
                                    LayoutContainer layoutContainer = new LayoutContainer(new CenterLayout());
                                    layoutContainer.add(icon.createImage());
                                    Set<Map.Entry<GWTJahiaNode, ModelData>> entries = visibility.entrySet();
                                    StringBuilder toolTip = new StringBuilder();
                                    for (Map.Entry<GWTJahiaNode, ModelData> entry : entries) {
                                        if (toolTip.length() > 0) {
                                            toolTip.append("<br/>");
                                        }
                                        XTemplate tpl = XTemplate.create((String) entry.getValue().get("xtemplate"));
                                        toolTip.append(tpl.applyTemplate(com.extjs.gxt.ui.client.util.Util.getJsObject(entry.getKey())));
                                    }
                                    layoutContainer.setToolTip(toolTip.toString());
                                    images.add(layoutContainer);
                                }
                            }
                        }
                        if (!images.isEmpty()) {
                            infoLayers.addInfoLayer(m, images, null, true, "1");
                        }
                    }
                }
            }
        }
    }
}
Also used : AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) ModelData(com.extjs.gxt.ui.client.data.ModelData) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) XTemplate(com.extjs.gxt.ui.client.core.XTemplate) JSONString(com.google.gwt.json.client.JSONString) Image(com.google.gwt.user.client.ui.Image) GWTJahiaPublicationInfo(org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo)

Aggregations

XTemplate (com.extjs.gxt.ui.client.core.XTemplate)5 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)3 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)3 RowExpander (com.extjs.gxt.ui.client.widget.grid.RowExpander)3 ModelData (com.extjs.gxt.ui.client.data.ModelData)2 AbstractImagePrototype (com.google.gwt.user.client.ui.AbstractImagePrototype)2 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)2 GWTJahiaPublicationInfo (org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo)2 ListStore (com.extjs.gxt.ui.client.store.ListStore)1 Margins (com.extjs.gxt.ui.client.util.Margins)1 HorizontalPanel (com.extjs.gxt.ui.client.widget.HorizontalPanel)1 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 Button (com.extjs.gxt.ui.client.widget.button.Button)1 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)1 ComboBox (com.extjs.gxt.ui.client.widget.form.ComboBox)1 com.extjs.gxt.ui.client.widget.grid (com.extjs.gxt.ui.client.widget.grid)1 FillLayout (com.extjs.gxt.ui.client.widget.layout.FillLayout)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 RowData (com.extjs.gxt.ui.client.widget.layout.RowData)1 RowLayout (com.extjs.gxt.ui.client.widget.layout.RowLayout)1