List of usage examples for com.google.gwt.user.cellview.client Column setHorizontalAlignment
@Override public void setHorizontalAlignment(HorizontalAlignmentConstant align)
The new horizontal alignment will apply the next time the table is rendered.
From source file:org.jboss.as.console.client.shared.subsys.elytron.ui.mapper.ConstantPermissionMappingEditor.java
License:Open Source License
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns/* w w w.j a v a 2 s. c o m*/ Column<ModelNode, String> classNameColumn = createColumn("class-name"); Column<ModelNode, String> moduleColumn = createColumn("module"); Column<ModelNode, String> targetNameColumn = createColumn("target-name"); Column<ModelNode, String> actionColumn = createColumn("action"); classNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); moduleColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); targetNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); actionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(classNameColumn, "Class name"); table.addColumn(moduleColumn, "Module"); table.addColumn(targetNameColumn, "Target name"); table.addColumn(actionColumn, "Action"); table.setColumnWidth(classNameColumn, 40, Style.Unit.PCT); table.setColumnWidth(moduleColumn, 20, Style.Unit.PCT); table.setColumnWidth(targetNameColumn, 25, Style.Unit.PCT); table.setColumnWidth(actionColumn, 15, Style.Unit.PCT); }
From source file:org.jboss.as.console.client.shared.subsys.elytron.ui.mapper.SimplePermissionMappingEditor.java
License:Open Source License
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns// w ww . j ava 2 s .co m Column<ModelNode, String> principals = createColumn("principals"); Column<ModelNode, String> roles = createColumn("roles"); principals.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); roles.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(principals, "Principals"); table.addColumn(roles, "Roles"); table.setColumnWidth(principals, 30, Style.Unit.PCT); table.setColumnWidth(roles, 30, Style.Unit.PCT); }
From source file:org.jboss.as.console.client.shared.subsys.elytron.ui.NewIdentityAttributesView.java
License:Open Source License
@SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel panel = new VerticalPanel(); panel.addStyleName("fill-layout-width"); // table/*from ww w.j a va2 s . c o m*/ table = new DefaultCellTable<>(5, nameProvider); dataProvider = new ListDataProvider<>(nameProvider); dataProvider.addDataDisplay(table); table.setSelectionModel(selectionModel); // columns Column<ModelNode, String> nameColumn = new TextColumn<ModelNode>() { @Override public String getValue(ModelNode node) { return node.get("name").asString(); } }; nameColumn.setSortable(true); Column<ModelNode, String> valueColumn = new TextColumn<ModelNode>() { @Override public String getValue(ModelNode node) { return node.get("value").asString(); } }; valueColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); ColumnSortEvent.ListHandler<ModelNode> sortHandler = new ColumnSortEvent.ListHandler<>( dataProvider.getList()); sortHandler.setComparator(nameColumn, (o1, o2) -> o1.get("name").asString().toLowerCase() .compareTo(o2.get("name").asString().toLowerCase())); table.addColumn(nameColumn, "From"); table.addColumn(valueColumn, "To"); table.setColumnWidth(nameColumn, 30, Style.Unit.PCT); table.setColumnWidth(valueColumn, 70, Style.Unit.PCT); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(nameColumn); panel.add(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); panel.add(pager); return panel; }
From source file:org.jboss.as.console.client.shared.subsys.elytron.ui.ProviderLoaderEditor.java
License:Apache License
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns/*from w w w.j ava 2 s . c o m*/ Column<ModelNode, String> indexCol = createColumn("index"); Column<ModelNode, String> moduleCol = createColumn("module"); Column<ModelNode, String> loadServicesCol = createColumn("load-services"); Column<ModelNode, String> classnamesCol = createColumn("class-names"); Column<ModelNode, String> pathCol = createColumn("path"); Column<ModelNode, String> relativeToCol = createColumn("relative-to"); indexCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); moduleCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loadServicesCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); classnamesCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); pathCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); relativeToCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(indexCol, "Index"); table.addColumn(moduleCol, "Module"); table.addColumn(loadServicesCol, "Load Services"); table.addColumn(classnamesCol, "Class names"); table.addColumn(pathCol, "Path"); table.addColumn(relativeToCol, "Relative To"); table.setColumnWidth(indexCol, 7, Style.Unit.PCT); table.setColumnWidth(moduleCol, 20, Style.Unit.PCT); table.setColumnWidth(loadServicesCol, 13, Style.Unit.PCT); table.setColumnWidth(classnamesCol, 30, Style.Unit.PCT); table.setColumnWidth(pathCol, 20, Style.Unit.PCT); table.setColumnWidth(relativeToCol, 10, Style.Unit.PCT); }
From source file:org.jboss.as.console.client.shared.subsys.elytron.ui.SecurityDomainRealmEditor.java
License:Open Source License
private void setupTable() { table = new DefaultCellTable<>(5); table.setSelectionModel(selectionModel); // columns//from w ww .j a va 2 s. co m Column<ModelNode, String> realmColumn = createColumn("realm"); Column<ModelNode, String> principalTransformColumn = createColumn("principal-transformer"); Column<ModelNode, String> roleDecoderColumn = createColumn("role-decoder"); Column<ModelNode, String> roleMapperColumn = createColumn("role-mapper"); realmColumn.setSortable(true); realmColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); principalTransformColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); roleDecoderColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); roleMapperColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); table.addColumn(realmColumn, "Realm"); table.addColumn(principalTransformColumn, "Principal Transform"); table.addColumn(roleDecoderColumn, "Role Decoder"); table.addColumn(roleMapperColumn, "Role Mapper"); table.setColumnWidth(realmColumn, 30, Style.Unit.PCT); table.setColumnWidth(principalTransformColumn, 30, Style.Unit.PCT); table.setColumnWidth(roleDecoderColumn, 20, Style.Unit.PCT); table.setColumnWidth(roleMapperColumn, 20, Style.Unit.PCT); }
From source file:org.jboss.as.console.client.shared.subsys.undertow.FilterRefEditor.java
License:Open Source License
@SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel panel = new VerticalPanel(); panel.addStyleName("fill-layout-width"); // table// w w w .j a v a 2 s. c om table = new DefaultCellTable<>(5, nameProvider); dataProvider = new ListDataProvider<>(nameProvider); dataProvider.addDataDisplay(table); table.setSelectionModel(selectionModel); // columns Column<Property, String> nameColumn = new TextColumn<Property>() { @Override public String getValue(Property property) { return property.getName(); } }; nameColumn.setSortable(true); Column<Property, String> predicateColumn = new TextColumn<Property>() { @Override public String getValue(Property property) { return getClassValue(property, "predicate"); } }; Column<Property, String> priorityColumn = new TextColumn<Property>() { @Override public String getValue(Property property) { return getClassValue(property, "priority"); } }; priorityColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); predicateColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); ColumnSortEvent.ListHandler<Property> sortHandler = new ColumnSortEvent.ListHandler<>( dataProvider.getList()); sortHandler.setComparator(nameColumn, (o1, o2) -> o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase())); table.addColumn(nameColumn, Console.CONSTANTS.common_label_name()); table.addColumn(predicateColumn, "Predicate"); table.addColumn(priorityColumn, "Priority"); table.setColumnWidth(nameColumn, 30, Style.Unit.PCT); table.setColumnWidth(predicateColumn, 40, Style.Unit.PCT); table.setColumnWidth(priorityColumn, 20, Style.Unit.PCT); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(nameColumn); // tools ToolStrip tools = new ToolStrip(); ToolButton addButton = new ToolButton(Console.CONSTANTS.common_label_add(), event -> { presenter.setSelectedHost(hostname); presenter.onLaunchAddFilterReferenceDialog(operationAddress, hostname); }); ToolButton removeButton = new ToolButton(Console.CONSTANTS.common_label_delete(), event -> { final Property selection = selectionModel.getSelectedObject(); if (selection != null) { Feedback.confirm("Filter reference", Console.MESSAGES.deleteConfirm("Filter reference " + selection.getName()), isConfirmed -> { if (isConfirmed) { presenter.setSelectedHost(hostname); presenter.onRemoveResource(resolvedOperationAddress, selection.getName()); } }); } }); tools.addToolButtonRight(addButton); tools.addToolButtonRight(removeButton); panel.add(tools); panel.add(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); panel.add(pager); return panel; }
From source file:org.jbpm.console.ng.es.client.editors.quicknewjob.QuickNewJobPopup.java
License:Apache License
private void initGridColumns() { Column<RequestParameterSummary, String> paramKeyColumn = new Column<RequestParameterSummary, String>( new EditTextCell()) { @Override//from w ww.ja va 2s . 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>("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>("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, "Actions"); myParametersGrid.setColumnWidth(actionsColumn, 90, Style.Unit.PX); dataProvider.addDataDisplay(myParametersGrid); }
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 . j a va2s .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) { 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// w w w. j a va 2s . c o 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.kie.dockerui.client.widgets.container.KieContainerDetails.java
License:Apache License
private void configurePortsGrid(final KieContainer container, final org.kie.dockerui.shared.model.KieContainerDetails details, final Settings settings) { // NOTE: If not removing and re-adding columns, grid tow data refresh is not well done. if (portsGrid.getColumnCount() > 0) { portsGrid.removeColumn(0);/*from w w w.ja v a 2 s . c om*/ portsGrid.removeColumn(0); } // Set emtpy message. portsGrid.setEmptyTableWidget(new Label(Constants.INSTANCE.noPorts())); // Create Private port column. final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> privatePortColumn = new com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String>( new EditTextCell()) { @Override public String getValue(Map.Entry<String, String> object) { return object.getKey().toString(); } }; privatePortColumn.setSortable(false); privatePortColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); portsGrid.addColumn(privatePortColumn, Constants.INSTANCE.privatePort()); portsGrid.setColumnWidth(privatePortColumn, 40, Style.Unit.PCT); // Create Public port column. final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> publicPortColumn = new com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String>( new EditTextCell()) { @Override public String getValue(Map.Entry<String, String> object) { return object.getValue().toString(); } }; publicPortColumn.setSortable(false); publicPortColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); portsGrid.addColumn(publicPortColumn, Constants.INSTANCE.publicPort()); portsGrid.setColumnWidth(publicPortColumn, 40, Style.Unit.PCT); final List<Map.Entry<String, String>> list = ClientUtils.toMapEntries(container.getPorts()); if (list != null) { portsGrid.setRowCount(list.size()); portsGrid.setRowData(0, list); } }