Search in sources :

Example 21 with TextCell

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

the class ContainerConfigParamsView method addArtifactIdColumn.

private void addArtifactIdColumn() {
    Column<ContainerConfig, String> column = new Column<ContainerConfig, String>(new TextCell()) {

        @Override
        public String getValue(ContainerConfig containerConfig) {
            return containerConfig.getArtifactId();
        }
    };
    dataGrid.addColumn(column, translationService.getTranslation(ContainerConfigParamsView_ArtifactIdColumn));
}
Also used : ContainerConfigParamsView_ArtifactIdColumn(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ArtifactIdColumn) ContainerConfigParamsView_VersionColumn(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_VersionColumn) ContainerConfigParamsView_GroupIdColumn(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_GroupIdColumn) ContainerConfigParamsView_ContainerNameColumn(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ContainerNameColumn) Column(com.google.gwt.user.cellview.client.Column) TextCell(com.google.gwt.cell.client.TextCell)

Example 22 with TextCell

use of com.google.gwt.cell.client.TextCell in project mvp4g2-examples by mvp4g.

the class ListView method createView.

public void createView() {
    panel = new ScrollPanel();
    FlowPanel resultPanel = new FlowPanel();
    resultPanel.addStyleName(style.resultPanel());
    panel.add(resultPanel);
    Label headline = new Label(ApplicationConstants.CONSTANTS.resultHeadline());
    headline.addStyleName(style.headline());
    resultPanel.add(headline);
    resultTable = new CellTable<Person>();
    resultPanel.add(resultTable);
    resultTable.setEmptyTableWidget(new HTML(ApplicationConstants.CONSTANTS.resultText()));
    Column<Person, String> nameColumn = addColumn(new ClickableTextCell(), ApplicationConstants.CONSTANTS.columnName(), new GetValue<String>() {

        @Override
        public String getValue(Person person) {
            return person.getName() + ", " + person.getFirstName();
        }
    }, new FieldUpdater<Person, String>() {

        @Override
        public void update(int index, Person object, String value) {
            getPresenter().doUpdate(object);
        }
    });
    Column<Person, String> streetColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnStreet(), new GetValue<String>() {

        @Override
        public String getValue(Person person) {
            return person.getAddress().getStreet();
        }
    }, null);
    Column<Person, String> plzColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnPlz(), new GetValue<String>() {

        @Override
        public String getValue(Person person) {
            return person.getAddress().getZip();
        }
    }, null);
    plzColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    Column<Person, String> cityColumn = addColumn(new TextCell(), ApplicationConstants.CONSTANTS.columnCity(), new GetValue<String>() {

        @Override
        public String getValue(Person person) {
            return person.getAddress().getCity();
        }
    }, null);
    // Tabellen und Spalten-Breite setzen
    resultTable.setWidth("100%");
    resultTable.setColumnWidth(nameColumn, "40%");
    resultTable.setColumnWidth(streetColumn, "25%");
    resultTable.setColumnWidth(plzColumn, "10%");
    resultTable.setColumnWidth(cityColumn, "25%");
    resetTable();
}
Also used : ClickableTextCell(com.google.gwt.cell.client.ClickableTextCell) TextCell(com.google.gwt.cell.client.TextCell) ClickableTextCell(com.google.gwt.cell.client.ClickableTextCell) Person(de.gishmo.gwt.example.mvp4g2.simpleapplication.shared.dto.Person)

Example 23 with TextCell

use of com.google.gwt.cell.client.TextCell in project perun by CESNET.

the class JsonUtils method addColumn.

/**
 * Returns a column with a header and with automatic cell selection
 *
 * @param <R> the row type
 * @param getter the value getter for the cell
 * @param fieldUpdater Field updater - on click action
 */
public static <R> Column<R, String> addColumn(final GetValue<R, String> getter, final FieldUpdater<R, String> fieldUpdater) {
    Cell<String> cell;
    if (fieldUpdater == null) {
        cell = new TextCell();
    } else {
        cell = new CustomClickableTextCell();
    }
    Column<R, String> column = new Column<R, String>(cell) {

        @Override
        public String getValue(R object) {
            return getter.getValue(object);
        }

        @Override
        public String getCellStyleNames(Cell.Context context, R object) {
            if (fieldUpdater != null) {
                return super.getCellStyleNames(context, object) + " pointer";
            } else {
                return super.getCellStyleNames(context, object);
            }
        }
    };
    if (fieldUpdater != null) {
        column.setFieldUpdater(fieldUpdater);
    }
    return column;
}
Also used : CustomClickableTextCell(cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell) Column(com.google.gwt.user.cellview.client.Column) JsArrayString(com.google.gwt.core.client.JsArrayString) TextCell(com.google.gwt.cell.client.TextCell) CustomClickableTextCell(cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell)

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