Example usage for com.google.gwt.user.cellview.client Column setFieldUpdater

List of usage examples for com.google.gwt.user.cellview.client Column setFieldUpdater

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client Column setFieldUpdater.

Prototype

public void setFieldUpdater(FieldUpdater<T, C> fieldUpdater) 

Source Link

Document

Set the FieldUpdater used for updating values in the column.

Usage

From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DDParametersPopup.java

License:Apache License

private void configureParametersTable() {
    //Setup table
    parametersTable.setStriped(true);/*  w  w  w .  j av  a2s  . c  o m*/
    parametersTable.setCondensed(true);
    parametersTable.setBordered(true);
    parametersTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined()));

    //Columns
    final Column<Parameter, String> typeColumn = new Column<Parameter, String>(new EditTextCell()) {

        @Override
        public String getValue(final Parameter item) {
            return item.getType();
        }
    };
    typeColumn.setFieldUpdater(new FieldUpdater<Parameter, String>() {
        @Override
        public void update(int index, Parameter object, String value) {
            if (value.equals("")) {
                return;
            }
            object.setType(value);
        }
    });

    final Column<Parameter, String> valueColumn = new Column<Parameter, String>(new EditTextCell()) {

        @Override
        public String getValue(final Parameter item) {
            return item.getValue();
        }
    };
    valueColumn.setFieldUpdater(new FieldUpdater<Parameter, String>() {
        @Override
        public void update(int index, Parameter object, String value) {
            if (value.equals("")) {
                return;
            }
            object.setValue(value);
        }
    });

    final ButtonCell deleteMSButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL);
    final Column<Parameter, String> deleteGlobalColumn = new Column<Parameter, String>(deleteMSButton) {
        @Override
        public String getValue(final Parameter item) {
            return Constants.INSTANCE.Remove();
        }
    };
    deleteGlobalColumn.setFieldUpdater(new FieldUpdater<Parameter, String>() {
        public void update(final int index, final Parameter item, final String value) {

            if (Window.confirm(Constants.INSTANCE.PromptForRemoval())) {
                parametersDataProvider.getList().remove(index);
            }
        }
    });

    parametersTable.addColumn(typeColumn, new TextHeader(Constants.INSTANCE.Type()));
    parametersTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    parametersTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove());

    //Link data
    parametersDataProvider.addDataDisplay(parametersTable);
}

From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java

License:Apache License

private Column<ItemObjectModel, String> setUpResolverColumn() {
    ArrayList<String> options = new ArrayList<String>();
    options.add("----");
    options.add(ItemObjectModel.REFLECTION_RESOLVER);
    options.add(ItemObjectModel.MVEL_RESOLVER);

    Column<ItemObjectModel, String> column = new Column<ItemObjectModel, String>(new SelectionCell(options)) {
        @Override//from   w  w w.j av  a  2 s . c om
        public String getValue(ItemObjectModel input) {
            if (input.getResolver() == null) {
                return "----";
            } else {
                return input.getResolver();
            }
        }
    };

    column.setFieldUpdater(new FieldUpdater<ItemObjectModel, String>() {
        @Override
        public void update(int index, ItemObjectModel model, String value) {
            model.setResolver(value);
        }
    });

    return column;
}

From source file:org.jbpm.console.ng.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   w w  w. j  a  v  a2s.  co  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());
                        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.Value()));
    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.console.ng.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 .  j  a  v a 2 s .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());
                        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.Value()));
    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.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java

License:Apache License

private void configureGlobalsTable() {
    //Setup table
    globalsTable.setStriped(true);//  ww w .  ja v a2  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.Value()));
    globalsTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    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.console.ng.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  ww w  . j a  v  a 2 s.co  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.Value()));
    workItemHandlersTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    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.console.ng.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   w  ww . ja  va 2 s. 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.Value()));
    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);

}

From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java

License:Apache License

private void configureEnvironmentEntriesTable() {
    //Setup table
    environmentEntriesTable.setStriped(true);
    environmentEntriesTable.setCondensed(true);
    environmentEntriesTable.setBordered(true);
    environmentEntriesTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined()));

    //Columns/*from w  ww. j  ava 2s  .  co  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());
                        environmentEntriesDataProvider.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())) {
                environmentEntriesDataProvider.getList().remove(index);
            }
        }
    });

    environmentEntriesTable.addColumn(nameColumn, new TextHeader(Constants.INSTANCE.Value()));
    environmentEntriesTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    environmentEntriesTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver()));
    environmentEntriesTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters());
    environmentEntriesTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove());

    //Link data
    environmentEntriesDataProvider.addDataDisplay(environmentEntriesTable);
}

From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java

License:Apache License

private void configureConfigurationTable() {
    //Setup table
    configurationTable.setStriped(true);
    configurationTable.setCondensed(true);
    configurationTable.setBordered(true);
    configurationTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined()));

    //Columns//from  w  w  w. j  a  v  a  2 s.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());
                        configurationDataProvider.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())) {
                configurationDataProvider.getList().remove(index);
            }
        }
    });

    configurationTable.addColumn(nameColumn, new TextHeader(Constants.INSTANCE.Value()));
    configurationTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    configurationTable.addColumn(resolverColumn, new TextHeader(Constants.INSTANCE.Resolver()));
    configurationTable.addColumn(parametersColumn, Constants.INSTANCE.DeploymentDescriptorParameters());
    configurationTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove());

    //Link data
    configurationDataProvider.addDataDisplay(configurationTable);
}

From source file:org.jbpm.console.ng.wi.client.editors.deployment.descriptor.DeploymentDescriptorViewImpl.java

License:Apache License

private void configureRequiredRolesTable() {
    //Setup table
    requiredRolesTable.setStriped(true);
    requiredRolesTable.setCondensed(true);
    requiredRolesTable.setBordered(true);
    requiredRolesTable.setEmptyTableWidget(new Label(Constants.INSTANCE.NoDataDefined()));

    //Columns/*  w ww  .  j a v  a  2  s.  c  o  m*/
    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) {
            requiredRolesDataProvider.getList().remove(index);
            requiredRolesDataProvider.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())) {
                requiredRolesDataProvider.getList().remove(index);
            }
        }
    });

    requiredRolesTable.addColumn(valueColumn, new TextHeader(Constants.INSTANCE.Value()));
    requiredRolesTable.addColumn(deleteGlobalColumn, Constants.INSTANCE.Remove());

    //Link data
    requiredRolesDataProvider.addDataDisplay(requiredRolesTable);

}