Search in sources :

Example 1 with TextCell

use of com.google.gwt.cell.client.TextCell in project che by eclipse.

the class SshKeyManagerViewImpl method initSshKeyTable.

/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
    keys = new CellTable<>(20, res);
    Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return object.getName();
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-title-" + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    hostColumn.setSortable(true);
    Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return "View";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
            if (object != null && object.getPublicKey() != null) {
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {

        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onViewClicked(object);
        }
    });
    Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return "Delete";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    // Creates handler on button clicked
    deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {

        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onDeleteClicked(object);
        }
    });
    keys.addColumn(hostColumn, "Title");
    keys.addColumn(publicKeyColumn, "Public Key");
    keys.addColumn(deleteKeyColumn, "Delete");
    keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
    keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
    keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
    // don't show loading indicator
    keys.setLoadingIndicator(null);
}
Also used : Context(com.google.gwt.cell.client.Cell.Context) SshPairDto(org.eclipse.che.api.ssh.shared.dto.SshPairDto) Column(com.google.gwt.user.cellview.client.Column) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ButtonCell(com.google.gwt.cell.client.ButtonCell) TextCell(com.google.gwt.cell.client.TextCell)

Example 2 with TextCell

use of com.google.gwt.cell.client.TextCell in project che by eclipse.

the class SshKeyManagerViewImpl method initSshKeyTable.

/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
    keys = new CellTable<>(15, res);
    Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return object.getName();
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-host-" + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    hostColumn.setSortable(true);
    Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return "View";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
            if (object != null && object.getPublicKey() != null) {
                super.render(context, object, sb);
            }
        }
    };
    // Creates handler on button clicked
    publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {

        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onViewClicked(object);
        }
    });
    Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {

        @Override
        public String getValue(SshPairDto object) {
            return "Delete";
        }

        @Override
        public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
            super.render(context, object, sb);
        }
    };
    // Creates handler on button clicked
    deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {

        @Override
        public void update(int index, SshPairDto object, String value) {
            delegate.onDeleteClicked(object);
        }
    });
    keys.addColumn(hostColumn, "Host");
    keys.addColumn(publicKeyColumn, "Public Key");
    keys.addColumn(deleteKeyColumn, "Delete");
    keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
    keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
    keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
    // don't show loading indicator
    keys.setLoadingIndicator(null);
}
Also used : Context(com.google.gwt.cell.client.Cell.Context) SshPairDto(org.eclipse.che.api.ssh.shared.dto.SshPairDto) Column(com.google.gwt.user.cellview.client.Column) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ButtonCell(com.google.gwt.cell.client.ButtonCell) TextCell(com.google.gwt.cell.client.TextCell)

Example 3 with TextCell

use of com.google.gwt.cell.client.TextCell in project che by eclipse.

the class ResetFilesViewImpl method initColumns.

/** Initialize the columns of the grid. */
private void initColumns() {
    indexFiles = new CellTable<IndexFile>();
    // Create files column:
    Column<IndexFile, String> filesColumn = new Column<IndexFile, String>(new TextCell()) {

        @Override
        public String getValue(IndexFile file) {
            return file.getPath();
        }
    };
    // Create column with checkboxes:
    Column<IndexFile, Boolean> checkColumn = new Column<IndexFile, Boolean>(new CheckboxCell(false, true)) {

        @Override
        public Boolean getValue(IndexFile file) {
            return !file.isIndexed();
        }
    };
    // Create bean value updater:
    FieldUpdater<IndexFile, Boolean> checkFieldUpdater = new FieldUpdater<IndexFile, Boolean>() {

        @Override
        public void update(int index, IndexFile file, Boolean value) {
            file.setIndexed(!value);
        }
    };
    checkColumn.setFieldUpdater(checkFieldUpdater);
    filesColumn.setHorizontalAlignment(ALIGN_LEFT);
    indexFiles.addColumn(checkColumn, new SafeHtml() {

        @Override
        public String asString() {
            return "&nbsp;";
        }
    });
    indexFiles.setColumnWidth(checkColumn, 1, Style.Unit.PCT);
    indexFiles.addColumn(filesColumn, FILES);
    indexFiles.setColumnWidth(filesColumn, 35, Style.Unit.PCT);
    indexFiles.addStyleName(resources.gitCSS().cells());
}
Also used : FieldUpdater(com.google.gwt.cell.client.FieldUpdater) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) IndexFile(org.eclipse.che.api.git.shared.IndexFile) TextCell(com.google.gwt.cell.client.TextCell) Column(com.google.gwt.user.cellview.client.Column) CheckboxCell(com.google.gwt.cell.client.CheckboxCell)

Example 4 with TextCell

use of com.google.gwt.cell.client.TextCell in project gwt-test-utils by gwt-test-utils.

the class CellListTest method beforeCellListTest.

@Before
public void beforeCellListTest() {
    sb.delete(0, sb.length());
    setBrowserErrorHandler(new BrowserErrorHandler() {

        public void onError(String errorMessage) {
            sb.append(errorMessage);
        }
    });
    // Create a cell to render each value.
    TextCell textCell = new TextCell();
    // Create the CellList that uses the cell.
    cellList = new CellList<String>(textCell);
    // Set the total row count. This isn't strictly necessary, but it affects
    // paging calculations, so its good habit to keep the row count up to
    // date.
    cellList.setRowCount(DAYS.size(), true);
    // Push the data into the widget.
    cellList.setRowData(0, DAYS);
    cellList.setVisibleRange(0, 5);
    // Add it to the root panel.
    RootPanel.get().add(cellList);
    // Preconditions
    assertThat(cellList.getRowCount()).isEqualTo(DAYS.size());
    assertThat(cellList.getVisibleItemCount()).isEqualTo(5);
    assertThat(cellList.getVisibleItem(cellList.getVisibleItemCount() - 1)).isEqualTo("Thursday");
}
Also used : BrowserErrorHandler(com.googlecode.gwt.test.utils.events.Browser.BrowserErrorHandler) TextCell(com.google.gwt.cell.client.TextCell) Before(org.junit.Before)

Example 5 with TextCell

use of com.google.gwt.cell.client.TextCell in project kie-wb-common by kiegroup.

the class TemplateParamsTableView method addParamRequiredColumn.

private void addParamRequiredColumn() {
    Column<TemplateParam, String> column = new Column<TemplateParam, String>(new TextCell()) {

        @Override
        public String getValue(TemplateParam templateParam) {
            return templateParam.isRequired() ? "*" : "";
        }
    };
    dataGrid.addColumn(column, " ");
    dataGrid.setColumnWidth(column, 30, Style.Unit.PX);
}
Also used : TemplateParamsTableView_ParamNameColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamNameColumn) TemplateParamsTableView_ParamValueColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamValueColumn) TemplateParamsTableView_ParamRequiredColumn(org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamRequiredColumn) Column(com.google.gwt.user.cellview.client.Column) TemplateParam(org.guvnor.ala.ui.openshift.model.TemplateParam) TextCell(com.google.gwt.cell.client.TextCell) EditTextCell(com.google.gwt.cell.client.EditTextCell)

Aggregations

TextCell (com.google.gwt.cell.client.TextCell)28 Column (com.google.gwt.user.cellview.client.Column)26 PopoverTextCell (org.uberfire.ext.widgets.common.client.tables.PopoverTextCell)5 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)4 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)4 ContainerConfigParamsView_ArtifactIdColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ArtifactIdColumn)4 ContainerConfigParamsView_ContainerNameColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ContainerNameColumn)4 ContainerConfigParamsView_GroupIdColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_GroupIdColumn)4 ContainerConfigParamsView_VersionColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_VersionColumn)4 Revision (org.eclipse.che.api.git.shared.Revision)3 NotificationRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow)3 ButtonCell (com.google.gwt.cell.client.ButtonCell)2 Context (com.google.gwt.cell.client.Cell.Context)2 EditTextCell (com.google.gwt.cell.client.EditTextCell)2 DoubleClickEvent (com.google.gwt.event.dom.client.DoubleClickEvent)2 DoubleClickHandler (com.google.gwt.event.dom.client.DoubleClickHandler)2 SingleSelectionModel (com.google.gwt.view.client.SingleSelectionModel)2 SshPairDto (org.eclipse.che.api.ssh.shared.dto.SshPairDto)2 TemplateParamsTableView_ParamNameColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamNameColumn)2 TemplateParamsTableView_ParamRequiredColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamRequiredColumn)2