Search in sources :

Example 6 with ButtonCell

use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project kie-wb-common by kiegroup.

the class CrudComponentViewImpl method showEditButtons.

@Override
public void showEditButtons() {
    final Column<MODEL, String> column = new Column<MODEL, String>(new ButtonCell(IconType.EDIT, ButtonType.PRIMARY, ButtonSize.SMALL)) {

        @Override
        public String getValue(final Object model) {
            return translationService.getTranslation(CrudComponentConstants.CrudComponentViewImplEditInstanceButton);
        }
    };
    column.setFieldUpdater(new FieldUpdater<MODEL, String>() {

        @Override
        public void update(final int index, final Object model, final String s) {
            presenter.editInstance(index);
        }
    });
    table.addColumn(column, "");
}
Also used : Column(com.google.gwt.user.cellview.client.Column) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell)

Example 7 with ButtonCell

use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project kie-wb-common by kiegroup.

the class NotificationWidgetViewImpl method initDelete.

private void initDelete() {
    AbstractCell<NotificationRow> buttonCell = new AbstractCell<NotificationRow>(ClickEvent.getType().getName()) {

        @Override
        public void render(Context context, NotificationRow value, SafeHtmlBuilder sb) {
            Button button = new Button();
            button.setSize(ButtonSize.SMALL);
            button.add(new Icon(IconType.TRASH));
            sb.append(SafeHtmlUtils.fromTrustedString(button.toString()));
        }

        @Override
        public void onBrowserEvent(Context context, Element parent, NotificationRow value, NativeEvent event, ValueUpdater<NotificationRow> valueUpdater) {
            if (!readOnly) {
                delete(value);
            }
        }
    };
    Column<NotificationRow, NotificationRow> deleteColumn = new Column<NotificationRow, NotificationRow>(buttonCell) {

        @Override
        public NotificationRow getValue(NotificationRow object) {
            return object;
        }
    };
    deleteColumn.setSortable(false);
    table.addColumn(deleteColumn, presenter.getDeleteLabel());
    table.setColumnWidth(deleteColumn, 60, Style.Unit.PX);
}
Also used : Button(org.gwtbootstrap3.client.ui.Button) ValueUpdater(com.google.gwt.cell.client.ValueUpdater) Column(com.google.gwt.user.cellview.client.Column) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Element(com.google.gwt.dom.client.Element) NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) AbstractCell(com.google.gwt.cell.client.AbstractCell) Icon(org.gwtbootstrap3.client.ui.Icon) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 8 with ButtonCell

use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project kie-wb-common by kiegroup.

the class DataObjectBrowserViewImpl method addRemoveRowColumn.

private void addRemoveRowColumn() {
    ButtonCell buttonCell = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL);
    Column<ObjectProperty, String> column = new Column<ObjectProperty, String>(buttonCell) {

        @Override
        public String getValue(ObjectProperty objectProperty) {
            return Constants.INSTANCE.objectBrowser_action_delete();
        }
    };
    column.setFieldUpdater(new FieldUpdater<ObjectProperty, String>() {

        @Override
        public void update(int index, ObjectProperty objectProperty, String value) {
            if (!readonly) {
                presenter.onDeleteProperty(objectProperty, index);
            }
        }
    });
    propertiesTable.addColumn(column, "");
    propertiesTable.setColumnWidth(column, calculateButtonSize(Constants.INSTANCE.objectBrowser_action_delete()), Style.Unit.PX);
}
Also used : ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Column(com.google.gwt.user.cellview.client.Column) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell)

Example 9 with ButtonCell

use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project kie-wb-common by kiegroup.

the class DependencyListWidget method init.

@PostConstruct
public void init() {
    dependencyPagedJarTable = IOC.getBeanManager().lookupBean(ArtifactListPresenter.class).getInstance();
    dependencyPagedJarTable.setup(ColumnType.NAME, ColumnType.GAV, ColumnType.LAST_MODIFIED);
    // Column to view KJAR's pom
    final Column<JarListPageRow, String> openColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {

        @Override
        public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Open();
        }
    };
    openColumn.setFieldUpdater(new FieldUpdater<JarListPageRow, String>() {

        @Override
        public void update(int index, JarListPageRow row, String value) {
            dependencyPagedJarTable.onOpenPom(row.getPath());
        }
    });
    // Column to allow selection of dependency
    final Column<JarListPageRow, String> selectColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {

        @Override
        public String getValue(JarListPageRow row) {
            return ProjectEditorResources.CONSTANTS.Select();
        }
    };
    selectColumn.setFieldUpdater(new FieldUpdater<JarListPageRow, String>() {

        @Override
        public void update(final int index, final JarListPageRow row, final String value) {
            onPathSelect.execute(row.getPath());
        }
    });
    final ArtifactListView artifactListView = dependencyPagedJarTable.getView();
    artifactListView.addColumn(openColumn, M2RepoEditorConstants.INSTANCE.Open(), false, 100.0, Style.Unit.PX);
    artifactListView.addColumn(selectColumn, ProjectEditorResources.CONSTANTS.Select(), 100.0, Style.Unit.PX);
    artifactListView.setContentHeight("200px");
    artifactListView.asWidget().getElement().getStyle().setMarginLeft(0, Style.Unit.PX);
    artifactListView.asWidget().getElement().getStyle().setMarginRight(0, Style.Unit.PX);
    panel.add(artifactListView);
}
Also used : ArtifactListView(org.guvnor.m2repo.client.widgets.ArtifactListView) Column(com.google.gwt.user.cellview.client.Column) JarListPageRow(org.guvnor.m2repo.model.JarListPageRow) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) PostConstruct(javax.annotation.PostConstruct)

Example 10 with ButtonCell

use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project kie-wb-common by kiegroup.

the class ProjectClassListViewImpl method addRemoveRowColumn.

private void addRemoveRowColumn() {
    Column<ClassRow, String> column = new Column<ClassRow, String>(new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL)) {

        @Override
        public String getValue(ClassRow classRow) {
            return Constants.INSTANCE.project_class_list_action_delete();
        }
    };
    column.setFieldUpdater(new FieldUpdater<ClassRow, String>() {

        @Override
        public void update(int index, ClassRow classRow, String value) {
            if (!readOnly) {
                onRemoveClass(classRow);
            }
        }
    });
    dataGrid.addColumn(column, Constants.INSTANCE.project_class_list_action_column());
    dataGrid.setColumnWidth(column, 10, Style.Unit.PCT);
}
Also used : Column(com.google.gwt.user.cellview.client.Column) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell)

Aggregations

Column (com.google.gwt.user.cellview.client.Column)16 ButtonCell (org.gwtbootstrap3.client.ui.gwt.ButtonCell)12 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)4 Element (com.google.gwt.dom.client.Element)4 NativeEvent (com.google.gwt.dom.client.NativeEvent)4 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)4 HTMLButtonElement (elemental2.dom.HTMLButtonElement)4 Button (org.gwtbootstrap3.client.ui.Button)4 Icon (org.gwtbootstrap3.client.ui.Icon)4 PostConstruct (javax.annotation.PostConstruct)3 Label (org.gwtbootstrap3.client.ui.Label)2 NotificationRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow)2 ReassignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)2 TextCell (com.google.gwt.cell.client.TextCell)1 TextColumn (com.google.gwt.user.cellview.client.TextColumn)1 TextHeader (com.google.gwt.user.cellview.client.TextHeader)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 Global (org.drools.workbench.screens.globals.model.Global)1 ContainerConfigParamsView_ArtifactIdColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ArtifactIdColumn)1