Search in sources :

Example 11 with TextCell

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

the class DataObjectBrowserViewImpl method addPropertyLabelColumn.

private void addPropertyLabelColumn() {
    Column<ObjectProperty, String> column = new Column<ObjectProperty, String>(new TextCell()) {

        @Override
        public String getValue(ObjectProperty objectProperty) {
            if (objectProperty.getName() != null) {
                return AnnotationValueHandler.getStringValue(objectProperty, MainDomainAnnotations.LABEL_ANNOTATION, MainDomainAnnotations.VALUE_PARAM);
            } else {
                return "";
            }
        }
    };
    column.setSortable(true);
    propertiesTable.addColumn(column, Constants.INSTANCE.objectBrowser_columnLabel());
    propertiesTable.setColumnWidth(column, 25, Style.Unit.PCT);
    columnIds.put(column, ColumnId.LABEL_COLUMN);
}
Also used : ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Column(com.google.gwt.user.cellview.client.Column) TextCell(com.google.gwt.cell.client.TextCell)

Example 12 with TextCell

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

the class DataObjectBrowserViewImpl method addPropertyNameColumn.

private void addPropertyNameColumn() {
    Column<ObjectProperty, String> column = new Column<ObjectProperty, String>(new TextCell()) {

        @Override
        public String getValue(ObjectProperty objectProperty) {
            if (objectProperty.getName() != null) {
                return objectProperty.getName();
            } else {
                return "";
            }
        }
    };
    column.setSortable(true);
    propertiesTable.addColumn(column, Constants.INSTANCE.objectBrowser_columnName());
    propertiesTable.setColumnWidth(column, 25, Style.Unit.PCT);
    columnIds.put(column, ColumnId.NAME_COLUMN);
}
Also used : ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Column(com.google.gwt.user.cellview.client.Column) TextCell(com.google.gwt.cell.client.TextCell)

Example 13 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 14 with TextCell

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

the class RemoteViewImpl method initRepositoriesTable.

/**
     * Initialize the columns of the grid.
     *
     * @param ideResources
     */
private void initRepositoriesTable(org.eclipse.che.ide.Resources ideResources) {
    repositories = new CellTable<>(15, ideResources);
    Column<Remote, String> nameColumn = new Column<Remote, String>(new TextCell()) {

        @Override
        public String getValue(Remote remote) {
            return remote.getName();
        }

        @Override
        public void render(Cell.Context context, Remote remote, SafeHtmlBuilder sb) {
            sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-remotes-remotes-cellTable-" + context.getIndex() + "\">");
            super.render(context, remote, sb);
        }
    };
    Column<Remote, String> urlColumn = new Column<Remote, String>(new TextCell()) {

        @Override
        public String getValue(Remote remote) {
            return remote.getUrl();
        }
    };
    repositories.addColumn(nameColumn, locale.remoteGridNameField());
    repositories.setColumnWidth(nameColumn, "20%");
    repositories.addColumn(urlColumn, locale.remoteGridLocationField());
    repositories.setColumnWidth(urlColumn, "80%");
    final SingleSelectionModel<Remote> selectionModel = new SingleSelectionModel<Remote>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            selectedObject = selectionModel.getSelectedObject();
            delegate.onRemoteSelected(selectedObject);
        }
    });
    repositories.setSelectionModel(selectionModel);
}
Also used : SingleSelectionModel(com.google.gwt.view.client.SingleSelectionModel) Remote(org.eclipse.che.api.git.shared.Remote) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) TextCell(com.google.gwt.cell.client.TextCell) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent) Column(com.google.gwt.user.cellview.client.Column)

Example 15 with TextCell

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

the class RevisionListViewImpl method createRevisionsTable.

private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
    Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getId().substring(0, 8) + "...";
        }
    };
    Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
        }
    };
    Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getCommitter().getName();
        }
    };
    Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getMessage().substring(0, 50);
        }
    };
    revisions = new CellTable<>(15, coreRes);
    revisions.setWidth("100%");
    revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
    revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
    revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
    revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
    selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            description.setText(selectionModel.getSelectedObject().getMessage());
            delegate.onRevisionSelected(selectionModel.getSelectedObject());
        }
    });
    revisions.setSelectionModel(selectionModel);
    revisions.addDomHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            delegate.onRevisionDoubleClicked();
        }
    }, DoubleClickEvent.getType());
    this.revisionsPanel.add(revisions);
}
Also used : Revision(org.eclipse.che.api.git.shared.Revision) Column(com.google.gwt.user.cellview.client.Column) DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) TextCell(com.google.gwt.cell.client.TextCell) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Aggregations

TextCell (com.google.gwt.cell.client.TextCell)23 Column (com.google.gwt.user.cellview.client.Column)21 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 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 TemplateParamsTableView_ParamValueColumn (org.guvnor.ala.ui.openshift.client.resources.i18n.GuvnorAlaOpenShiftUIConstants.TemplateParamsTableView_ParamValueColumn)2 TemplateParam (org.guvnor.ala.ui.openshift.model.TemplateParam)2