Search in sources :

Example 16 with TextColumn

use of com.google.gwt.user.cellview.client.TextColumn in project ovirt-engine by oVirt.

the class HostNetworkInterfaceBondedListViewItem method createSlavesContainer.

private Container createSlavesContainer() {
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostInterface> slavesTable = new CellTable<>(MAX_SLAVES, (Resources) GWT.create(CellTablePopupTableResources.class));
    slavesTable.getElement().addClassName(Styles.TABLE);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostInterface> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(slavesTable);
    logicalNetworkDataProvider.setList(getEntity().getInterfaces());
    // Setup columns
    TextColumn<HostInterface> name = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getName();
        }
    };
    slavesTable.addColumn(name, constants.macInterface());
    TextColumn<HostInterface> macAddress = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().getMacAddress() != null ? hostInterface.getInterface().getMacAddress() : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(macAddress, constants.macInterface());
    TextColumn<HostInterface> speed = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().hasSpeed() ? String.valueOf(hostInterface.getInterface().getSpeed()) : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(speed, constants.speedInterface());
    TextColumn<HostInterface> rxRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getRxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(rxRate, templates.sub(constants.rxRate(), constants.mbps()));
    TextColumn<HostInterface> txRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getTxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(txRate, templates.sub(constants.txRate(), constants.mbps()));
    TextColumn<HostInterface> rxTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getRxTotal());
        }
    };
    slavesTable.addColumn(rxTotal, templates.sub(constants.rxTotal(), constants.mbps()));
    TextColumn<HostInterface> txTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getTxTotal());
        }
    };
    slavesTable.addColumn(txTotal, templates.sub(constants.txTotal(), constants.mbps()));
    TextColumn<HostInterface> dropRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return String.valueOf(hostInterface.getRxDrop() + hostInterface.getTxDrop());
        }
    };
    slavesTable.addColumn(dropRate, templates.sub(constants.dropsInterface(), constants.pkts()));
    gridColumn.add(slavesTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) HostInterface(org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface) Row(org.gwtbootstrap3.client.ui.Row) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 17 with TextColumn

use of com.google.gwt.user.cellview.client.TextColumn in project ovirt-engine by oVirt.

the class HostNetworkInterfaceListViewItem method createLogicalNetworkContainer.

private Container createLogicalNetworkContainer() {
    List<HostVLan> logicalNetworks = calculateLogicalNetworks(getEntity());
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostVLan> logicalNetworkTable = new CellTable<>(MAX_LOGICAL_NETWORKS, (Resources) GWT.create(CellTablePopupTableResources.class));
    logicalNetworkTable.getElement().addClassName(Styles.TABLE);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostVLan> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(logicalNetworkTable);
    logicalNetworkDataProvider.setList(logicalNetworks);
    final HostVLanNameRenderer renderer = new HostVLanNameRenderer();
    // Setup columns
    AbstractIconTypeColumn<HostVLan> management = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork.getInterface() != null && logicalNetwork.getInterface().getIsManagement()) {
                return IconType.INSTITUTION;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel());
        }
    };
    IconTypeHeader managementHeader = new IconTypeHeader(IconType.INSTITUTION, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel()));
    management.getCell().setColor(SafeHtmlUtils.fromSafeConstant(ICON_COLOR));
    logicalNetworkTable.addColumn(management, managementHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(management, "40px");
    AbstractIconTypeColumn<HostVLan> sync = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork != null && logicalNetwork.getInterface() != null && isOutOfSync(logicalNetwork.getInterface().getNetworkImplementationDetails())) {
                return IconType.CHAIN_BROKEN;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync());
        }
    };
    IconTypeHeader syncHeader = new IconTypeHeader(IconType.CHAIN_BROKEN, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync()));
    sync.getCell().setColor(SafeHtmlUtils.fromSafeConstant(RED));
    logicalNetworkTable.addColumn(sync, syncHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(sync, "40px");
    TextColumn<HostVLan> vlan = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            if (logicalNetwork == null || logicalNetwork.getName() == null || logicalNetwork.getName().isEmpty()) {
                return "";
            }
            return renderer.render(logicalNetwork);
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(vlan, "175px");
    logicalNetworkTable.addColumn(vlan, constants.vlanInterface());
    TextColumn<HostVLan> networkName = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getNetworkName();
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(networkName, "175px");
    logicalNetworkTable.addColumn(networkName, constants.networkNameInterface());
    TextColumn<HostVLan> ipv4 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv4Address() != null ? logicalNetwork.getIpv4Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv4, "175px");
    logicalNetworkTable.addColumn(ipv4, constants.ipv4AddressInterface());
    TextColumn<HostVLan> ipv6 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv6Address() != null ? logicalNetwork.getIpv6Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv6, "175px");
    logicalNetworkTable.addColumn(ipv6, constants.ipv6AddressInterface());
    TextColumn<HostVLan> emptyTail = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return "";
        }
    };
    logicalNetworkTable.addColumn(emptyTail, "");
    gridColumn.add(logicalNetworkTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) HostVLanNameRenderer(org.ovirt.engine.ui.webadmin.widget.renderer.HostVLanNameRenderer) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) IconTypeHeader(org.ovirt.engine.ui.common.widget.table.header.IconTypeHeader) HostVLan(org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan) Row(org.gwtbootstrap3.client.ui.Row) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 18 with TextColumn

use of com.google.gwt.user.cellview.client.TextColumn in project perun by CESNET.

the class VoResourcesPropagationsTabItem method draw.

public Widget draw() {
    mainrow = 0;
    okCounter = 0;
    errorCounter = 0;
    notDeterminedCounter = 0;
    procesingCounter = 0;
    titleWidget.setText(Utils.getStrippedStringWithEllipsis(vo.getName()) + ": resources state");
    final TabItem tab = this;
    VerticalPanel mainTab = new VerticalPanel();
    mainTab.setWidth("100%");
    // MAIN PANEL
    final ScrollPanel firstTabPanel = new ScrollPanel();
    firstTabPanel.setSize("100%", "100%");
    firstTabPanel.setStyleName("perun-tableScrollPanel");
    final FlexTable help = new FlexTable();
    help.setCellPadding(4);
    help.setWidth("100%");
    final CustomButton cb = UiElements.getRefreshButton(this);
    help.setWidget(0, 0, cb);
    help.getFlexCellFormatter().setWidth(0, 0, "80px");
    help.setHTML(0, 1, "<strong>Color&nbsp;notation:</strong>");
    help.getFlexCellFormatter().setWidth(0, 1, "100px");
    help.setHTML(0, 2, "<strong>OK</strong>");
    help.getFlexCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);
    help.getFlexCellFormatter().setWidth(0, 2, "50px");
    help.getFlexCellFormatter().setStyleName(0, 2, "green");
    help.setHTML(0, 3, "<strong>Error</strong>");
    help.getFlexCellFormatter().setWidth(0, 3, "50px");
    help.getFlexCellFormatter().setStyleName(0, 3, "red");
    help.getFlexCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER);
    help.setHTML(0, 4, "<strong>Not&nbsp;determined</strong>");
    help.getFlexCellFormatter().setWidth(0, 4, "50px");
    help.getFlexCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_CENTER);
    help.getFlexCellFormatter().setStyleName(0, 4, "notdetermined");
    /*
			 help.setHTML(0, 5, "<strong>Processing</strong>");
			 help.getFlexCellFormatter().setWidth(0, 5, "50px");
			 help.getFlexCellFormatter().setStyleName(0, 5, "yellow");
			 help.getFlexCellFormatter().setHorizontalAlignment(0, 5, HasHorizontalAlignment.ALIGN_CENTER);
			 */
    help.setHTML(0, 5, "&nbsp;");
    help.getFlexCellFormatter().setWidth(0, 6, "50%");
    mainTab.add(help);
    mainTab.add(new HTML("<hr size=\"2\" />"));
    mainTab.add(firstTabPanel);
    final FlexTable content = new FlexTable();
    content.setWidth("100%");
    content.setBorderWidth(0);
    firstTabPanel.add(content);
    content.setStyleName("propagationTable", true);
    final AjaxLoaderImage im = new AjaxLoaderImage();
    content.setWidget(0, 0, im);
    content.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    final GetAllResourcesState callback = new GetAllResourcesState(voId, new JsonCallbackEvents() {

        public void onLoadingStart() {
            im.loadingStart();
            cb.setProcessing(true);
        }

        public void onError(PerunError error) {
            im.loadingError(error);
            cb.setProcessing(false);
        }

        public void onFinished(JavaScriptObject jso) {
            im.loadingFinished();
            cb.setProcessing(false);
            content.clear();
            content.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
            ArrayList<ResourceState> list = JsonUtils.jsoAsList(jso);
            if (list != null && !list.isEmpty()) {
                list = new TableSorter<ResourceState>().sortByResourceName(list);
                for (final ResourceState state : list) {
                    content.setHTML(mainrow, 0, new Image(LargeIcons.INSTANCE.serverGroupIcon()) + "<span class=\"now-managing\" style=\"display: inline-block; position: relative; top: -8px;\">" + state.getResource().getName() + "</span>");
                    ArrayList<Task> tasks = new TableSorter<Task>().sortByService(JsonUtils.<Task>jsoAsList(state.getTasks()));
                    if (tasks == null || tasks.isEmpty())
                        notDeterminedCounter++;
                    boolean allOk = true;
                    for (Task tsk : tasks) {
                        if (tsk.getStatus().equalsIgnoreCase("ERROR") || tsk.getStatus().equalsIgnoreCase("SENDERROR") || tsk.getStatus().equalsIgnoreCase("GENERROR")) {
                            errorCounter++;
                            allOk = false;
                            break;
                        }
                    }
                    if (allOk && tasks != null && !tasks.isEmpty())
                        okCounter++;
                    ListDataProvider<Task> dataProvider = new ListDataProvider<Task>();
                    PerunTable<Task> table;
                    // Table data provider.
                    dataProvider = new ListDataProvider<Task>(tasks);
                    // Cell table
                    table = new PerunTable<Task>(tasks);
                    table.removeRowCountChangeHandler();
                    // Connect the table to the data provider.
                    dataProvider.addDataDisplay(table);
                    // Sorting
                    ColumnSortEvent.ListHandler<Task> columnSortHandler = new ColumnSortEvent.ListHandler<Task>(dataProvider.getList());
                    table.addColumnSortHandler(columnSortHandler);
                    // set empty content & loader
                    AjaxLoaderImage loaderImage = new AjaxLoaderImage();
                    loaderImage.setEmptyResultMessage("No service configuration was propagated to this resource.");
                    table.setEmptyTableWidget(loaderImage);
                    loaderImage.loadingFinished();
                    table.addIdColumn("Task Id");
                    // Service column
                    Column<Task, String> serviceColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Task, String>() {

                        public String getValue(Task task) {
                            return String.valueOf(task.getService().getName());
                        }
                    }, null);
                    // status column
                    Column<Task, String> statusColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Task, String>() {

                        public String getValue(Task task) {
                            return String.valueOf(task.getStatus());
                        }
                    }, null);
                    // start COLUMN
                    TextColumn<Task> startTimeColumn = new TextColumn<Task>() {

                        public String getValue(Task result) {
                            return result.getStartTime();
                        }
                    };
                    // end COLUMN
                    TextColumn<Task> endTimeColumn = new TextColumn<Task>() {

                        public String getValue(Task result) {
                            return result.getEndTime();
                        }
                    };
                    // schedule COLUMN
                    TextColumn<Task> scheduleColumn = new TextColumn<Task>() {

                        public String getValue(Task result) {
                            return result.getSchedule();
                        }
                    };
                    // Add the columns.
                    table.addColumn(serviceColumn, "Service");
                    table.addColumn(statusColumn, "Status");
                    table.addColumn(scheduleColumn, "Scheduled");
                    table.addColumn(startTimeColumn, "Started");
                    table.addColumn(endTimeColumn, "Ended");
                    // set row styles based on task state
                    table.setRowStyles(new RowStyles<Task>() {

                        public String getStyleNames(Task row, int rowIndex) {
                            if (row.getStatus().equalsIgnoreCase("NONE")) {
                                return "rowdarkgreen";
                            } else if (row.getStatus().equalsIgnoreCase("DONE")) {
                                return "rowgreen";
                            } else if (row.getStatus().equalsIgnoreCase("PROCESSING")) {
                                return "rowyellow";
                            } else if (Arrays.asList("GENERROR", "SENDERROR", "ERROR").contains(row.getStatus())) {
                                return "rowred";
                            } else if (row.getStatus().equalsIgnoreCase("WARNING")) {
                                return "roworange";
                            }
                            return "";
                        }
                    });
                    table.setWidth("100%");
                    content.setWidget(mainrow + 1, 0, table);
                    content.getFlexCellFormatter().setStyleName(mainrow + 1, 0, "propagationTablePadding");
                    mainrow++;
                    mainrow++;
                }
            }
            // set counters
            help.setHTML(0, 2, "<strong>Ok&nbsp;(" + okCounter + ")</strong>");
            help.setHTML(0, 3, "<strong>Error&nbsp;(" + errorCounter + ")</strong>");
            help.setHTML(0, 4, "<strong>Not&nbsp;determined&nbsp;(" + notDeterminedCounter + ")</strong>");
        // help.setHTML(0, 5, "<strong>Processing&nbsp;(" + procesingCounter + ")</strong>");
        }
    });
    // get for all facilities for VO
    callback.retrieveData();
    // resize perun table to correct size on screen
    session.getUiElements().resizePerunTable(firstTabPanel, 400, this);
    this.contentWidget.setWidget(mainTab);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ListDataProvider(com.google.gwt.view.client.ListDataProvider) AjaxLoaderImage(cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage) ArrayList(java.util.ArrayList) GetAllResourcesState(cz.metacentrum.perun.webgui.json.tasksManager.GetAllResourcesState) AjaxLoaderImage(cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage) ColumnSortEvent(com.google.gwt.user.cellview.client.ColumnSortEvent) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) TextColumn(com.google.gwt.user.cellview.client.TextColumn) PerunTable(cz.metacentrum.perun.webgui.widgets.PerunTable) RowStyles(com.google.gwt.user.cellview.client.RowStyles) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 19 with TextColumn

use of com.google.gwt.user.cellview.client.TextColumn in project blogwt by billy1380.

the class DownloadsPage method createColumns.

/**
 */
private void createColumns() {
    Column<GeneratedDownload, SafeHtml> name = new Column<GeneratedDownload, SafeHtml>(UiHelper.SAFE_HTML_PROTOTYPE) {

        @Override
        public SafeHtml getValue(GeneratedDownload object) {
            String parameters = object.parameters.replace("/send", "");
            String label = parameters.replace(Filter.QUERY + "/", "").replace("/", " > ");
            label = URL.decodeQueryString(label);
            return parameters.startsWith("proforma") || parameters.startsWith("invoice") ? Templates.INSTANCE.label(label) : Templates.INSTANCE.label(label, PageTypeHelper.slugToHref(parameters));
        }
    };
    TextColumn<GeneratedDownload> date = new TextColumn<GeneratedDownload>() {

        @Override
        public String getValue(GeneratedDownload object) {
            Date date;
            if (object.created == null) {
                date = DateTimeHelper.now();
            } else {
                date = object.created;
            }
            return DateTimeHelper.ago(date);
        }
    };
    TextColumn<GeneratedDownload> status = new TextColumn<GeneratedDownload>() {

        @Override
        public String getValue(GeneratedDownload object) {
            return object.status.toString();
        }
    };
    Column<GeneratedDownload, SafeHtml> download = new Column<GeneratedDownload, SafeHtml>(UiHelper.SAFE_HTML_PROTOTYPE) {

        @Override
        public SafeHtml getValue(GeneratedDownload object) {
            return object.status == GeneratedDownloadStatusType.GeneratedDownloadStatusTypeReady ? Templates.INSTANCE.download(UriUtils.fromString(object.url)) : SafeHtmlUtils.EMPTY_SAFE_HTML;
        }
    };
    tblDownloads.setColumnWidth(download, 1.0, Unit.PX);
    Column<GeneratedDownload, String> delete = new Column<GeneratedDownload, String>(ACTION_BUTTON_PROTOTYPE) {

        @Override
        public String getValue(GeneratedDownload object) {
            return "delete";
        }
    };
    delete.setFieldUpdater(new FieldUpdater<GeneratedDownload, String>() {

        @Override
        public void update(int index, GeneratedDownload object, String value) {
            if (Window.confirm("Are you sure you want to delete export with parameters " + URL.decodeQueryString(object.parameters) + "?")) {
                GeneratedDownloadController.get().deleteGeneratedDownload(object);
            }
        }
    });
    tblDownloads.setColumnWidth(delete, 1.0, Unit.PX);
    tblDownloads.addColumn(name, "Type");
    tblDownloads.addColumn(date, "Date");
    tblDownloads.addColumn(status, "Completion");
    // actions
    tblDownloads.addColumn(download);
    tblDownloads.addColumn(delete);
}
Also used : GeneratedDownload(com.willshex.blogwt.shared.api.datatype.GeneratedDownload) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Date(java.util.Date) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 20 with TextColumn

use of com.google.gwt.user.cellview.client.TextColumn in project drools-wb by kiegroup.

the class GlobalsEditorViewImpl method setup.

private void setup() {
    // Setup table
    table.setStriped(true);
    table.setCondensed(true);
    table.setBordered(true);
    table.setEmptyTableWidget(new Label(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplNoGlobalsDefined)));
    // Columns
    final TextColumn<Global> aliasColumn = new TextColumn<Global>() {

        @Override
        public String getValue(final Global global) {
            return global.getAlias();
        }
    };
    final TextColumn<Global> classNameColumn = new TextColumn<Global>() {

        @Override
        public String getValue(final Global global) {
            return global.getClassName();
        }
    };
    deleteGlobalButton = new ButtonCell(IconType.MINUS, ButtonType.DANGER, ButtonSize.SMALL);
    final Column<Global, String> deleteGlobalColumn = new Column<Global, String>(deleteGlobalButton) {

        @Override
        public String getValue(final Global global) {
            return translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove);
        }
    };
    deleteGlobalColumn.setFieldUpdater((index, global, value) -> {
        if (Window.confirm(translationService.format(GlobalsEditorConstants.GlobalsEditorViewImplPromptForRemovalOfGlobal, global.getAlias()))) {
            dataProvider.getList().remove(index);
        }
    });
    table.addColumn(aliasColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAlias)));
    table.addColumn(classNameColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplClassName)));
    table.addColumn(deleteGlobalColumn, translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove));
    // Link data
    dataProvider.addDataDisplay(table);
    dataProvider.setList(globals);
    generatedLabel.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAutoGeneratedFile));
    addGlobalButton.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAdd));
    addGlobalButton.setIcon(IconType.PLUS);
}
Also used : TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) Label(org.gwtbootstrap3.client.ui.Label) TextHeader(com.google.gwt.user.cellview.client.TextHeader) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) Global(org.drools.workbench.screens.globals.model.Global) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Aggregations

TextColumn (com.google.gwt.user.cellview.client.TextColumn)20 Column (com.google.gwt.user.cellview.client.Column)8 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)7 TextHeader (com.google.gwt.user.cellview.client.TextHeader)4 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 ListDataProvider (com.google.gwt.view.client.ListDataProvider)3 CheckboxCell (com.google.gwt.cell.client.CheckboxCell)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 CellTable (com.google.gwt.user.cellview.client.CellTable)2 ColumnSortEvent (com.google.gwt.user.cellview.client.ColumnSortEvent)2 Header (com.google.gwt.user.cellview.client.Header)2 GeneralObject (cz.metacentrum.perun.webgui.model.GeneralObject)2 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)2 Column (org.gwtbootstrap3.client.ui.Column)2 Container (org.gwtbootstrap3.client.ui.Container)2 Row (org.gwtbootstrap3.client.ui.Row)2 ImageButtonColumn (org.rstudio.core.client.cellview.ImageButtonColumn)2 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)2 TableCellElement (com.google.gwt.dom.client.TableCellElement)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1