List of usage examples for com.google.gwt.user.cellview.client Column setFieldUpdater
public void setFieldUpdater(FieldUpdater<T, C> fieldUpdater)
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.KSessionsPanelViewImpl.java
License:Apache License
private void setUpRemoveColumn() { final ButtonCell typeImageCell = new ButtonCell(ButtonType.DANGER, IconType.TRASH); final Column<KSessionModel, String> column = new Column<KSessionModel, String>(typeImageCell) { @Override//w w w.j ava 2 s . co m public String getValue(KSessionModel model) { return ""; } }; column.setFieldUpdater(new FieldUpdater<KSessionModel, String>() { @Override public void update(int index, KSessionModel model, String value) { presenter.onDelete(model); } }); column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dataGrid.addColumn(column, CommonConstants.INSTANCE.Delete()); dataGrid.setColumnWidth(column, 60, Style.Unit.PX); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.ListenersPanelViewImpl.java
License:Apache License
private void addDeleteColumn() { final ButtonCell deleteCell = new ButtonCell(ButtonType.DANGER, IconType.TRASH); final Column<ListenerModel, String> column = new Column<ListenerModel, String>(deleteCell) { @Override/*from ww w. j a v a2 s . c o m*/ public String getValue(ListenerModel object) { return ""; } }; column.setFieldUpdater(new FieldUpdater<ListenerModel, String>() { @Override public void update(int index, ListenerModel model, String value) { presenter.onDelete(model); } }); column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dataGrid.addColumn(column, CommonConstants.INSTANCE.Delete()); dataGrid.setColumnWidth(column, 60, Style.Unit.PX); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.ListenersPanelViewImpl.java
License:Apache License
private void addTypeColumn() { Column<ListenerModel, String> column = new Column<ListenerModel, String>(new EditTextCell()) { @Override/*from ww w. j av a 2 s . c o m*/ public String getValue(ListenerModel listenerModel) { return listenerModel.getType(); } }; column.setFieldUpdater(new FieldUpdater<ListenerModel, String>() { @Override public void update(int index, ListenerModel model, String value) { model.setType(value); } }); dataGrid.addColumn(column, ProjectEditorResources.CONSTANTS.Type()); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.ListenersPanelViewImpl.java
License:Apache License
private void addKindColumn() { ArrayList<String> options = new ArrayList<String>(); options.add(RULE_RUNTIME_EVENT_LISTENER); options.add(AGENDA_EVENT_LISTENER);//w w w . j a va 2s . com options.add(PROCESS_EVENT_LISTENER); Column<ListenerModel, String> column = new Column<ListenerModel, String>(new SelectionCell(options)) { @Override public String getValue(ListenerModel listenerModel) { if (listenerModel.getKind() == null || listenerModel.getKind().equals(ListenerModel.Kind.RULE_RUNTIME_EVENT_LISTENER)) { return RULE_RUNTIME_EVENT_LISTENER; } else if (listenerModel.getKind().equals(ListenerModel.Kind.PROCESS_EVENT_LISTENER)) { return PROCESS_EVENT_LISTENER; } else if (listenerModel.getKind().equals(ListenerModel.Kind.AGENDA_EVENT_LISTENER)) { return AGENDA_EVENT_LISTENER; } else { return listenerModel.getKind().toString(); } } }; column.setFieldUpdater(new FieldUpdater<ListenerModel, String>() { @Override public void update(int index, ListenerModel model, String value) { if (value.equals(RULE_RUNTIME_EVENT_LISTENER)) { model.setKind(ListenerModel.Kind.RULE_RUNTIME_EVENT_LISTENER); } else if (value.equals(PROCESS_EVENT_LISTENER)) { model.setKind(ListenerModel.Kind.PROCESS_EVENT_LISTENER); } else if (value.equals(AGENDA_EVENT_LISTENER)) { model.setKind(ListenerModel.Kind.AGENDA_EVENT_LISTENER); } } }); dataGrid.addColumn(column, ProjectEditorResources.CONSTANTS.Kind()); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.WorkItemHandlersPanelViewImpl.java
License:Apache License
private void addDeleteColumn() { final ButtonCell deleteCell = new ButtonCell(ButtonType.DANGER, IconType.TRASH); final Column<WorkItemHandlerModel, String> column = new Column<WorkItemHandlerModel, String>(deleteCell) { @Override//from w ww. j a va2 s .c o m public String getValue(WorkItemHandlerModel object) { return ""; } }; column.setFieldUpdater(new FieldUpdater<WorkItemHandlerModel, String>() { @Override public void update(int index, WorkItemHandlerModel model, String value) { presenter.onDelete(model); } }); column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dataGrid.addColumn(column, CommonConstants.INSTANCE.Delete()); dataGrid.setColumnWidth(column, 60, Style.Unit.PX); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.WorkItemHandlersPanelViewImpl.java
License:Apache License
private void addTypeColumn() { Column<WorkItemHandlerModel, String> column = new Column<WorkItemHandlerModel, String>(new EditTextCell()) { @Override/*w w w . j a va2 s. c om*/ public String getValue(WorkItemHandlerModel model) { return model.getType(); } }; column.setFieldUpdater(new FieldUpdater<WorkItemHandlerModel, String>() { @Override public void update(int index, WorkItemHandlerModel model, String value) { model.setType(value); } }); dataGrid.addColumn(column, ProjectEditorResources.CONSTANTS.Type()); }
From source file:org.kie.workbench.common.screens.projecteditor.client.forms.WorkItemHandlersPanelViewImpl.java
License:Apache License
private void addNameColumn() { Column<WorkItemHandlerModel, String> column = new Column<WorkItemHandlerModel, String>(new EditTextCell()) { @Override/*from ww w. j av a 2s . c o m*/ public String getValue(WorkItemHandlerModel model) { return model.getName(); } }; column.setFieldUpdater(new FieldUpdater<WorkItemHandlerModel, String>() { @Override public void update(int index, WorkItemHandlerModel model, String value) { model.setName(value); } }); dataGrid.addColumn(column, ProjectEditorResources.CONSTANTS.Name()); }
From source file:org.kie.workbench.common.widgets.client.tables.AbstractPathPagedTable.java
License:Apache License
public AbstractPathPagedTable(final int pageSize) { dataGrid = new PagedTable(pageSize, providesKey); selectionModel = new MultiSelectionModel<T>(providesKey); dataGrid.setSelectionModel(selectionModel); Column<T, Boolean> selectionColumn = new Column<T, Boolean>(new CheckboxCell(true, true)) { @Override//from w w w. jav a2s . com public Boolean getValue(T object) { return dataGrid.getSelectionModel().isSelected(object); } }; selectionColumn.setFieldUpdater(new FieldUpdater<T, Boolean>() { public void update(int index, T object, Boolean value) { dataGrid.getSelectionModel().setSelected(object, value); } }); dataGrid.addColumn(selectionColumn, ""); addAncillaryColumns(); final TextColumn<T> uriColumn = new TextColumn<T>() { public String getValue(T row) { return row.getPath().toURI(); } }; dataGrid.addColumn(uriColumn, CommonConstants.INSTANCE.AbstractTableFileURI(), false); // Add "Open" button column Column<T, String> openColumn = new Column<T, String>(new ButtonCell(ButtonSize.SMALL)) { public String getValue(T row) { return CommonConstants.INSTANCE.AbstractTableOpen(); } }; openColumn.setFieldUpdater(new FieldUpdater<T, String>() { public void update(int index, T row, String value) { getPlaceManager().goTo(row.getPath()); } }); dataGrid.addColumn(openColumn, CommonConstants.INSTANCE.AbstractTableOpen()); final Button refreshButton = new Button(); refreshButton.setIcon(IconType.REFRESH); refreshButton.setTitle(CommonConstants.INSTANCE.Refresh()); refreshButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dataGrid.refresh(); } }); dataGrid.getToolbar().add(refreshButton); final Button openSelectedButton = new Button(CommonConstants.INSTANCE.AbstractTableOpenSelected()); openSelectedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final Set<T> selectedSet = selectionModel.getSelectedSet(); for (T selected : selectedSet) { getPlaceManager().goTo(selected.getPath()); } } }); dataGrid.getToolbar().add(openSelectedButton); initWidget(dataGrid); }
From source file:org.kie.workbench.common.widgets.client.versionhistory.VersionHistoryPresenterViewImpl.java
License:Apache License
public VersionHistoryPresenterViewImpl() { initWidget(table);//w w w . j ava 2 s . c om Column<VersionRecord, String> column = new Column<VersionRecord, String>(new ButtonCell()) { @Override public String getValue(VersionRecord object) { if (version.equals(object.id())) { return "Current"; } else { return "Select"; } } }; table.addColumn(column, ""); column.setFieldUpdater(new FieldUpdater<VersionRecord, String>() { @Override public void update(int index, VersionRecord record, String value) { presenter.onSelect(record); } }); table.addColumn(new Column<VersionRecord, Date>(new DateCell()) { @Override public Date getValue(VersionRecord object) { return object.date(); } }, CommonConstants.INSTANCE.Date()); table.addColumn(new Column<VersionRecord, String>(new TextCell()) { @Override public String getValue(VersionRecord object) { return object.comment(); } }, CommonConstants.INSTANCE.CommitMessage()); table.addColumn(new Column<VersionRecord, String>(new TextCell()) { @Override public String getValue(VersionRecord object) { return object.author(); } }, CommonConstants.INSTANCE.Author()); }
From source file:org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetViewImpl.java
License:Apache License
private void setup() { //Setup table table.setStriped(true);//w ww . j av a2s . c o m table.setCondensed(true); table.setBordered(true); table.setEmptyTableWidget(new Label(ImportConstants.INSTANCE.noImportsDefined())); //Columns final TextColumn<Import> importTypeColumn = new TextColumn<Import>() { @Override public String getValue(final Import importType) { return importType.getType(); } }; final ButtonCell deleteImportButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL) { @Override public void render(final com.google.gwt.cell.client.Cell.Context context, final SafeHtml data, final SafeHtmlBuilder sb) { //Don't render a "Delete" button for "internal" Fact Types if (isExternalImport(context.getIndex())) { super.render(context, data, sb); } } @Override public void onBrowserEvent(final Context context, final Element parent, final String value, final NativeEvent event, final ValueUpdater<String> valueUpdater) { //Don't act on cell interactions for "internal" Fact Types if (isExternalImport(context.getIndex())) { super.onBrowserEvent(context, parent, value, event, valueUpdater); } } @Override protected void onEnterKeyDown(final Context context, final Element parent, final String value, final NativeEvent event, final ValueUpdater<String> valueUpdater) { //Don't act on cell interactions for "internal" Fact Types if (isExternalImport(context.getIndex())) { super.onEnterKeyDown(context, parent, value, event, valueUpdater); } } }; final Column<Import, String> deleteImportColumn = new Column<Import, String>(deleteImportButton) { @Override public String getValue(final Import importType) { return ImportConstants.INSTANCE.remove(); } }; deleteImportColumn.setFieldUpdater((index, importType, value) -> { if (isReadOnly) { return; } final YesNoCancelPopup confirm = YesNoCancelPopup.newYesNoCancelPopup(ImportConstants.INSTANCE.remove(), ImportConstants.INSTANCE.promptForRemovalOfImport0(importType.getType()), () -> getRemoveImportCommand().execute(importType), () -> { /*Nothing*/}, null); confirm.show(); }); table.addColumn(importTypeColumn, new TextHeader(ImportConstants.INSTANCE.importType())); table.addColumn(deleteImportColumn, ImportConstants.INSTANCE.remove()); //Link display getDataProvider().addDataDisplay(table); }