List of usage examples for com.google.gwt.user.cellview.client Column setFieldUpdater
public void setFieldUpdater(FieldUpdater<T, C> fieldUpdater)
From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureRemoteableClassesTable() { //Setup table remoteableClassesTable.setStriped(true); remoteableClassesTable.setCondensed(true); remoteableClassesTable.setBordered(true); remoteableClassesTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns//ww w .j ava 2s. c om final Column<String, String> valueColumn = new Column<String, String>(new EditTextCell()) { @Override public String getValue(final String item) { return item; } }; valueColumn.setFieldUpdater(new FieldUpdater<String, String>() { @Override public void update(int index, String object, String value) { remoteableClassesDataProvider.getList().remove(index); remoteableClassesDataProvider.getList().add(index, value); } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<String, String> deleteGlobalColumn = new Column<String, String>(deleteMSButton) { @Override public String getValue(final String item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<String, String>() { public void update(final int index, final String item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { remoteableClassesDataProvider.getList().remove(index); } } }); remoteableClassesTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value())); remoteableClassesTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data remoteableClassesDataProvider.addDataDisplay(remoteableClassesTable); }
From source file:org.jbpm.datamodeler.editor.client.editors.DataModelBrowser.java
License:Apache License
public DataModelBrowser() { initWidget(uiBinder.createAndBindUi(this)); modelName.setText(Constants.INSTANCE.modelBrowser_modelUnknown()); dataObjectsProvider.setList(dataObjects); dataObjectsTable.setEmptyTableWidget( new com.github.gwtbootstrap.client.ui.Label(Constants.INSTANCE.modelBrowser_emptyTable())); // Init delete column ClickableImageResourceCell clickableImageResourceCell = new ClickableImageResourceCell(true); final TooltipCellDecorator<ImageResource> decorator = new TooltipCellDecorator<ImageResource>( clickableImageResourceCell); decorator.setText(Constants.INSTANCE.modelBrowser_action_deleteDataObject()); final Column<DataObjectTO, ImageResource> deleteDataObjectColumnImg = new Column<DataObjectTO, ImageResource>( decorator) {//from w w w .ja va2 s . c o m @Override public ImageResource getValue(final DataObjectTO global) { return ImagesResources.INSTANCE.Delete(); } }; deleteDataObjectColumnImg.setFieldUpdater(new FieldUpdater<DataObjectTO, ImageResource>() { public void update(final int index, final DataObjectTO object, final ImageResource value) { deleteDataObject(object, index); } }); dataObjectsTable.addColumn(deleteDataObjectColumnImg); dataObjectsTable.setColumnWidth(deleteDataObjectColumnImg, 20, Style.Unit.PX); // Init data object column final TextColumn<DataObjectTO> dataObjectColumn = new TextColumn<DataObjectTO>() { @Override public void render(Cell.Context context, DataObjectTO object, SafeHtmlBuilder sb) { SafeHtml startDiv = new SafeHtml() { @Override public String asString() { return "<div style=\"cursor: pointer;\">"; } }; SafeHtml endDiv = new SafeHtml() { @Override public String asString() { return "</div>"; } }; sb.append(startDiv); super.render(context, object, sb); sb.append(endDiv); } @Override public String getValue(final DataObjectTO dataObject) { return dataObject.getName(); } }; dataObjectColumn.setSortable(true); dataObjectsTable.addColumn(dataObjectColumn, Constants.INSTANCE.modelBrowser_columnName()); ColumnSortEvent.ListHandler<DataObjectTO> dataObjectNameColHandler = new ColumnSortEvent.ListHandler<DataObjectTO>( dataObjectsProvider.getList()); dataObjectNameColHandler.setComparator(dataObjectColumn, new DataObjectComparator()); dataObjectsTable.addColumnSortHandler(dataObjectNameColHandler); dataObjectsTable.getColumnSortList().push(dataObjectColumn); //Init the selection model SingleSelectionModel<DataObjectTO> selectionModel = new SingleSelectionModel<DataObjectTO>(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { if (!skipNextOnChange) { DataObjectTO selectedObjectTO = ((SingleSelectionModel<DataObjectTO>) dataObjectsTable .getSelectionModel()).getSelectedObject(); notifyObjectSelected(selectedObjectTO); } skipNextOnChange = false; } }); dataObjectsTable .setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.BOUND_TO_SELECTION); dataObjectsTable.setSelectionModel(selectionModel); dataObjectsProvider.addDataDisplay(dataObjectsTable); dataObjectsProvider.refresh(); newEntityButton.setIcon(IconType.PLUS_SIGN); }
From source file:org.jbpm.datamodeler.editor.client.editors.DataObjectBrowser.java
License:Apache License
public DataObjectBrowser() { initWidget(uiBinder.createAndBindUi(this)); objectName.setText(Constants.INSTANCE.objectEditor_objectUnknown()); dataObjectPropertiesProvider.setList(dataObjectProperties); //Init data objects table dataObjectPropertiesTable.setEmptyTableWidget( new com.github.gwtbootstrap.client.ui.Label(Constants.INSTANCE.objectEditor_emptyTable())); //Init delete column ClickableImageResourceCell clickableImageResourceCell = new ClickableImageResourceCell(true); final TooltipCellDecorator<ImageResource> decorator = new TooltipCellDecorator<ImageResource>( clickableImageResourceCell); decorator.setText(Constants.INSTANCE.objectEditor_action_deleteProperty()); final Column<ObjectPropertyTO, ImageResource> deletePropertyColumnImg = new Column<ObjectPropertyTO, ImageResource>( decorator) {//from www . java 2 s . com @Override public ImageResource getValue(final ObjectPropertyTO global) { return ImagesResources.INSTANCE.Delete(); } }; deletePropertyColumnImg.setFieldUpdater(new FieldUpdater<ObjectPropertyTO, ImageResource>() { public void update(final int index, final ObjectPropertyTO property, final ImageResource value) { deleteDataObjectProperty(property, index); } }); dataObjectPropertiesTable.addColumn(deletePropertyColumnImg); dataObjectPropertiesTable.setColumnWidth(deletePropertyColumnImg, 20, Style.Unit.PX); //Init property name column final TextColumn<ObjectPropertyTO> propertyNameColumn = new TextColumn<ObjectPropertyTO>() { @Override public void render(Cell.Context context, ObjectPropertyTO object, SafeHtmlBuilder sb) { SafeHtml startDiv = new SafeHtml() { @Override public String asString() { return "<div style=\"cursor: pointer;\">"; } }; SafeHtml endDiv = new SafeHtml() { @Override public String asString() { return "</div>"; } }; sb.append(startDiv); super.render(context, object, sb); sb.append(endDiv); } @Override public String getValue(final ObjectPropertyTO objectProperty) { return objectProperty.getName(); } }; propertyNameColumn.setSortable(true); dataObjectPropertiesTable.addColumn(propertyNameColumn, Constants.INSTANCE.objectEditor_columnName()); //dataObjectPropertiesTable.setColumnWidth(propertyNameColumn, 100, Style.Unit.PX); ColumnSortEvent.ListHandler<ObjectPropertyTO> propertyNameColHandler = new ColumnSortEvent.ListHandler<ObjectPropertyTO>( dataObjectPropertiesProvider.getList()); propertyNameColHandler.setComparator(propertyNameColumn, new ObjectPropertyComparator("name")); dataObjectPropertiesTable.addColumnSortHandler(propertyNameColHandler); //Init property type column final Column<ObjectPropertyTO, String> propertyTypeColumn = new Column<ObjectPropertyTO, String>(typeCell) { @Override public String getValue(final ObjectPropertyTO objectProperty) { return propertyTypeDisplay(objectProperty); } }; propertyTypeColumn.setSortable(true); dataObjectPropertiesTable.addColumn(propertyTypeColumn, Constants.INSTANCE.objectEditor_columnType()); //dataObjectPropertiesTable.setColumnWidth(propertyTypeColumn, 100, Style.Unit.PX); ColumnSortEvent.ListHandler<ObjectPropertyTO> propertyTypeColHandler = new ColumnSortEvent.ListHandler<ObjectPropertyTO>( dataObjectPropertiesProvider.getList()); propertyTypeColHandler.setComparator(propertyTypeColumn, new ObjectPropertyComparator("className")); dataObjectPropertiesTable.addColumnSortHandler(propertyTypeColHandler); dataObjectPropertiesTable.getColumnSortList().push(propertyTypeColumn); dataObjectPropertiesTable.getColumnSortList().push(propertyNameColumn); //Init the selection model SingleSelectionModel<ObjectPropertyTO> selectionModel = new SingleSelectionModel<ObjectPropertyTO>(); dataObjectPropertiesTable.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { ObjectPropertyTO selectedPropertyTO = ((SingleSelectionModel<ObjectPropertyTO>) dataObjectPropertiesTable .getSelectionModel()).getSelectedObject(); notifyFieldSelected(selectedPropertyTO); } }); dataObjectPropertiesTable .setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.BOUND_TO_SELECTION); dataObjectPropertiesProvider.addDataDisplay(dataObjectPropertiesTable); dataObjectPropertiesProvider.refresh(); newPropertyIsMultiple.setVisible(false); newPropertyIsMultiple.setValue(false); newPropertyBasicType.setValue(true); newPropertyButton.setIcon(IconType.PLUS_SIGN); }
From source file:org.jbpm.workbench.es.client.editors.quicknewjob.NewJobViewImpl.java
License:Apache License
private void initGridColumns() { Column<RequestParameterSummary, String> paramKeyColumn = new Column<RequestParameterSummary, String>( new EditTextCell()) { @Override/*from w w w .jav a 2 s .c om*/ public String getValue(RequestParameterSummary rowObject) { return rowObject.getKey(); } }; paramKeyColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { object.setKey(value); dataProvider.getList().set(index, object); } }); myParametersGrid.addColumn(paramKeyColumn, new ResizableHeader<RequestParameterSummary>(constants.Key(), myParametersGrid, paramKeyColumn)); Column<RequestParameterSummary, String> paramValueColumn = new Column<RequestParameterSummary, String>( new EditTextCell()) { @Override public String getValue(RequestParameterSummary rowObject) { return rowObject.getValue(); } }; paramValueColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { object.setValue(value); dataProvider.getList().set(index, object); } }); myParametersGrid.addColumn(paramValueColumn, new ResizableHeader<RequestParameterSummary>(constants.Value(), myParametersGrid, paramValueColumn)); // actions (icons) final ButtonCell buttonCell = new ButtonCell(ButtonType.DANGER, IconType.TRASH); final Column<RequestParameterSummary, String> actionsColumn = new Column<RequestParameterSummary, String>( buttonCell) { @Override public String getValue(final RequestParameterSummary object) { return Constants.INSTANCE.Remove(); } }; actionsColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { removeRow(index); } }); actionsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); myParametersGrid.addColumn(actionsColumn, constants.Actions()); myParametersGrid.setColumnWidth(actionsColumn, 105, Style.Unit.PX); dataProvider.addDataDisplay(myParametersGrid); }
From source file:org.jbpm.workbench.es.client.editors.quicknewjob.QuickNewJobPopup.java
License:Apache License
private void initGridColumns() { Column<RequestParameterSummary, String> paramKeyColumn = new Column<RequestParameterSummary, String>( new EditTextCell()) { @Override// ww w .j ava 2 s . co m public String getValue(RequestParameterSummary rowObject) { return rowObject.getKey(); } }; paramKeyColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { object.setKey(value); dataProvider.getList().set(index, object); } }); myParametersGrid.addColumn(paramKeyColumn, new ResizableHeader<RequestParameterSummary>(constants.Key(), myParametersGrid, paramKeyColumn)); Column<RequestParameterSummary, String> paramValueColumn = new Column<RequestParameterSummary, String>( new EditTextCell()) { @Override public String getValue(RequestParameterSummary rowObject) { return rowObject.getValue(); } }; paramValueColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { object.setValue(value); dataProvider.getList().set(index, object); } }); myParametersGrid.addColumn(paramValueColumn, new ResizableHeader<RequestParameterSummary>(constants.Value(), myParametersGrid, paramValueColumn)); // actions (icons) final ButtonCell buttonCell = new ButtonCell(ButtonType.DANGER, IconType.TRASH); final Column<RequestParameterSummary, String> actionsColumn = new Column<RequestParameterSummary, String>( buttonCell) { @Override public String getValue(final RequestParameterSummary object) { return Constants.INSTANCE.Remove(); } }; actionsColumn.setFieldUpdater(new FieldUpdater<RequestParameterSummary, String>() { @Override public void update(int index, RequestParameterSummary object, String value) { removeParameter(object); } }); actionsColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); myParametersGrid.addColumn(actionsColumn, constants.Actions()); myParametersGrid.setColumnWidth(actionsColumn, 90, Style.Unit.PX); dataProvider.addDataDisplay(myParametersGrid); }
From source file:org.jbpm.workbench.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureMarshalingTable() { //Setup table marshalStrategyTable.setStriped(true); marshalStrategyTable.setCondensed(true); marshalStrategyTable.setBordered(true); marshalStrategyTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns/*from ww w . j av a2s.c om*/ final Column<ItemObjectModel, String> valueColumn = new Column<ItemObjectModel, String>( new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setValue(value); } }); final Column<ItemObjectModel, String> resolverColumn = setUpResolverColumn(); final ButtonCell parametersMSButton = new ButtonCell(IconType.ADJUST, ButtonType.PRIMARY, ButtonSize.SMALL); final Column<ItemObjectModel, String> parametersColumn = new Column<ItemObjectModel, String>( parametersMSButton) { @Override public String getValue(final ItemObjectModel item) { if (item.getParameters() != null) { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (" + item.getParameters().size() + ")"; } else { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (0)"; } } }; parametersColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (ItemObjectModel.REFLECTION_RESOLVER.equals(item.getResolver())) { ddParametersPopup.setContent(new Command() { @Override public void execute() { item.setParameters(ddParametersPopup.getContent()); marshalStrategyDataProvider.refresh(); } }, item); ddParametersPopup.show(); } else { Window.alert(Constants.INSTANCE.NoParamResolver()); } } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<ItemObjectModel, String> deleteGlobalColumn = new Column<ItemObjectModel, String>( deleteMSButton) { @Override public String getValue(final ItemObjectModel item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { marshalStrategyDataProvider.getList().remove(index); } } }); marshalStrategyTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Identifier())); marshalStrategyTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver())); marshalStrategyTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters()); marshalStrategyTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data marshalStrategyDataProvider.addDataDisplay(marshalStrategyTable); }
From source file:org.jbpm.workbench.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureEventListenersTable() { //Setup table eventListenersTable.setStriped(true); eventListenersTable.setCondensed(true); eventListenersTable.setBordered(true); eventListenersTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns/* w w w . ja va 2 s . c om*/ final Column<ItemObjectModel, String> valueColumn = new Column<ItemObjectModel, String>( new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setValue(value); } }); final Column<ItemObjectModel, String> resolverColumn = setUpResolverColumn(); final ButtonCell parametersMSButton = new ButtonCell(IconType.ADJUST, ButtonType.PRIMARY, ButtonSize.SMALL); final Column<ItemObjectModel, String> parametersColumn = new Column<ItemObjectModel, String>( parametersMSButton) { @Override public String getValue(final ItemObjectModel item) { if (item.getParameters() != null) { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (" + item.getParameters().size() + ")"; } else { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (0)"; } } }; parametersColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (ItemObjectModel.REFLECTION_RESOLVER.equals(item.getResolver())) { ddParametersPopup.setContent(new Command() { @Override public void execute() { item.setParameters(ddParametersPopup.getContent()); eventListenersDataProvider.refresh(); } }, item); ddParametersPopup.show(); } else { Window.alert(Constants.INSTANCE.NoParamResolver()); } } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<ItemObjectModel, String> deleteGlobalColumn = new Column<ItemObjectModel, String>( deleteMSButton) { @Override public String getValue(final ItemObjectModel item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { eventListenersDataProvider.getList().remove(index); } } }); eventListenersTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Identifier())); eventListenersTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver())); eventListenersTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters()); eventListenersTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data eventListenersDataProvider.addDataDisplay(eventListenersTable); }
From source file:org.jbpm.workbench.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureGlobalsTable() { //Setup table globalsTable.setStriped(true);/*from www . j av a 2 s. c o m*/ globalsTable.setCondensed(true); globalsTable.setBordered(true); globalsTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns final Column<ItemObjectModel, String> nameColumn = new Column<ItemObjectModel, String>(new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getName(); } }; nameColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setName(value); } }); final Column<ItemObjectModel, String> valueColumn = new Column<ItemObjectModel, String>( new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setValue(value); } }); final Column<ItemObjectModel, String> resolverColumn = setUpResolverColumn(); final ButtonCell parametersMSButton = new ButtonCell(IconType.ADJUST, ButtonType.PRIMARY, ButtonSize.SMALL); final Column<ItemObjectModel, String> parametersColumn = new Column<ItemObjectModel, String>( parametersMSButton) { @Override public String getValue(final ItemObjectModel item) { if (item.getParameters() != null) { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (" + item.getParameters().size() + ")"; } else { return Constants.INSTANCE.DeploymentDescriptorParameters() + " (0)"; } } }; parametersColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (ItemObjectModel.REFLECTION_RESOLVER.equals(item.getResolver())) { ddParametersPopup.setContent(new Command() { @Override public void execute() { item.setParameters(ddParametersPopup.getContent()); globalsDataProvider.refresh(); } }, item); ddParametersPopup.show(); } else { Window.alert(Constants.INSTANCE.NoParamResolver()); } } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<ItemObjectModel, String> deleteGlobalColumn = new Column<ItemObjectModel, String>( deleteMSButton) { @Override public String getValue(final ItemObjectModel item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { globalsDataProvider.getList().remove(index); } } }); globalsTable.addColumn(nameColumn, new TextHeader(Constants.INSTANCE.Name())); globalsTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Identifier())); globalsTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver())); globalsTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters()); globalsTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data globalsDataProvider.addDataDisplay(globalsTable); }
From source file:org.jbpm.workbench.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureWorkItemHandlersTable() { //Setup table workItemHandlersTable.setStriped(true); workItemHandlersTable.setCondensed(true); workItemHandlersTable.setBordered(true); workItemHandlersTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns//from w ww. j av a 2s . c o m final Column<ItemObjectModel, String> nameColumn = new Column<ItemObjectModel, String>(new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getName(); } }; nameColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setName(value); } }); final Column<ItemObjectModel, String> valueColumn = new Column<ItemObjectModel, String>( new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setValue(value); } }); final Column<ItemObjectModel, String> resolverColumn = setUpResolverColumn(); final ButtonCell parametersMSButton = new ButtonCell(IconType.ADJUST, ButtonType.PRIMARY, ButtonSize.SMALL); final Column<ItemObjectModel, String> parametersColumn = new Column<ItemObjectModel, String>( parametersMSButton) { @Override public String getValue(final ItemObjectModel item) { if (item.getParameters() != null) { return Constants.INSTANCE.DeploymentDescriptorParameters() + "(" + item.getParameters().size() + ")"; } else { return Constants.INSTANCE.DeploymentDescriptorParameters() + "(0)"; } } }; parametersColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (ItemObjectModel.REFLECTION_RESOLVER.equals(item.getResolver())) { ddParametersPopup.setContent(new Command() { @Override public void execute() { item.setParameters(ddParametersPopup.getContent()); workItemHandlersDataProvider.refresh(); } }, item); ddParametersPopup.show(); } else { Window.alert(Constants.INSTANCE.NoParamResolver()); } } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<ItemObjectModel, String> deleteGlobalColumn = new Column<ItemObjectModel, String>( deleteMSButton) { @Override public String getValue(final ItemObjectModel item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { workItemHandlersDataProvider.getList().remove(index); } } }); workItemHandlersTable.addColumn(nameColumn, new TextHeader(Constants.INSTANCE.Name())); workItemHandlersTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Identifier())); workItemHandlersTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver())); workItemHandlersTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters()); workItemHandlersTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data workItemHandlersDataProvider.addDataDisplay(workItemHandlersTable); }
From source file:org.jbpm.workbench.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java
License:Apache License
private void configureTaskEventListenersTable() { //Setup table taskEventListenersTable.setStriped(true); taskEventListenersTable.setCondensed(true); taskEventListenersTable.setBordered(true); taskEventListenersTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined())); //Columns/*from ww w .ja va 2s .c o m*/ final Column<ItemObjectModel, String> valueColumn = new Column<ItemObjectModel, String>( new EditTextCell()) { @Override public String getValue(final ItemObjectModel item) { return item.getValue(); } }; valueColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { @Override public void update(int index, ItemObjectModel object, String value) { object.setValue(value); } }); final Column<ItemObjectModel, String> resolverColumn = setUpResolverColumn(); final ButtonCell parametersMSButton = new ButtonCell(IconType.ADJUST, ButtonType.PRIMARY, ButtonSize.SMALL); final Column<ItemObjectModel, String> parametersColumn = new Column<ItemObjectModel, String>( parametersMSButton) { @Override public String getValue(final ItemObjectModel item) { if (item.getParameters() != null) { return Constants.INSTANCE.DeploymentDescriptorParameters() + "(" + item.getParameters().size() + ")"; } else { return Constants.INSTANCE.DeploymentDescriptorParameters() + "(0)"; } } }; parametersColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (ItemObjectModel.REFLECTION_RESOLVER.equals(item.getResolver())) { ddParametersPopup.setContent(new Command() { @Override public void execute() { item.setParameters(ddParametersPopup.getContent()); taskEventListenersDataProvider.refresh(); } }, item); ddParametersPopup.show(); } else { Window.alert(Constants.INSTANCE.NoParamResolver()); } } }); final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL); final Column<ItemObjectModel, String> deleteGlobalColumn = new Column<ItemObjectModel, String>( deleteMSButton) { @Override public String getValue(final ItemObjectModel item) { return Constants.INSTANCE.Remove(); } }; deleteGlobalColumn.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() { public void update(final int index, final ItemObjectModel item, final String value) { if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) { taskEventListenersDataProvider.getList().remove(index); } } }); taskEventListenersTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Identifier())); taskEventListenersTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver())); taskEventListenersTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters()); taskEventListenersTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove()); //Link data taskEventListenersDataProvider.addDataDisplay(taskEventListenersTable); }