List of usage examples for com.google.gwt.user.cellview.client Column setSortable
public void setSortable(boolean sortable)
From source file:org.jboss.as.console.client.teiid.runtime.VDBView.java
License:Open Source License
Widget mainPageAsWidget() { ListHandler<VDB> sortHandler = new ListHandler<VDB>(this.vdbProvider.getList()); final ToolStrip toolStrip = new ToolStrip(); toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_refresh(), new ClickHandler() { @Override/*from w w w.j ava2 s . co m*/ public void onClick(ClickEvent event) { presenter.refresh(false); } })); DefaultCellTable<VDB> table = new DefaultCellTable<VDB>(5, new ProvidesKey<VDB>() { @Override public Object getKey(VDB item) { return item.getName() + "_" + item.getVersion(); } }); table.addColumnSortHandler(sortHandler); TextColumn<VDB> nameColumn = new TextColumn<VDB>() { @Override public String getValue(VDB record) { return record.getName(); } }; nameColumn.setSortable(true); sortHandler.setComparator(nameColumn, new Comparator<VDB>() { @Override public int compare(VDB o1, VDB o2) { return o1.getName().compareTo(o2.getName()); } }); Column<VDB, Number> versionColumn = new Column<VDB, Number>(new NumberCell()) { @Override public Number getValue(VDB vdb) { return vdb.getVersion(); } }; versionColumn.setSortable(true); sortHandler.setComparator(versionColumn, new Comparator<VDB>() { @Override public int compare(VDB o1, VDB o2) { return o1.getVersion().compareTo(o2.getVersion()); } }); TextColumn<VDB> dynamicColumn = new TextColumn<VDB>() { @Override public String getValue(VDB record) { return String.valueOf(record.isDynamic()); } }; dynamicColumn.setSortable(true); sortHandler.setComparator(dynamicColumn, new Comparator<VDB>() { @Override public int compare(VDB o1, VDB o2) { return o1.isDynamic().compareTo(o2.isDynamic()); } }); TextColumn<VDB> statusColumn = new TextColumn<VDB>() { @Override public String getValue(VDB record) { return String.valueOf(record.getStatus()); } }; statusColumn.setSortable(true); sortHandler.setComparator(statusColumn, new Comparator<VDB>() { @Override public int compare(VDB o1, VDB o2) { return o1.getStatus().compareTo(o2.getStatus()); } }); Column<VDB, ImageResource> validColumn = new Column<VDB, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(VDB vdb) { ImageResource res = null; if (vdb.isValid()) { res = Icons.INSTANCE.status_good(); } else { res = TeiidIcons.INSTANCE.status_not_ok(); } return res; } }; validColumn.setSortable(true); sortHandler.setComparator(validColumn, new Comparator<VDB>() { @Override public int compare(VDB o1, VDB o2) { return o1.isValid().compareTo(o2.isValid()); } }); Column<VDB, String> reloadBtn = new Column<VDB, String>(new ButtonCell()) { @Override public String getValue(VDB record) { return "Reload"; } }; reloadBtn.setFieldUpdater(new FieldUpdater<VDB, String>() { @Override public void update(int index, VDB vdb, String value) { reloadVDB(vdb); } }); table.addColumn(nameColumn, "Name"); table.addColumn(versionColumn, "Version"); table.addColumn(dynamicColumn, "Dynamic"); table.addColumn(statusColumn, "Status"); table.addColumn(validColumn, "Valid"); table.addColumn(reloadBtn, "Reload"); // sets initial sorting table.getColumnSortList().push(nameColumn); this.vdbTable = table; this.vdbProvider.addDataDisplay(table); this.vdbRequestsTab = new VDBRequestsTab(presenter); this.vdbModelsTab = new VDBModelsTab(this.presenter); this.vdbModelsTab.setDataModelFactory(factory); this.vdbSessionsTab = new VDBSessionsTab(presenter); this.vdbCachingTab = new VDBCachingTab(presenter); // Page layout MultipleToOneLayout layout = new MultipleToOneLayout().setPlain(true).setTitle("VDB Panel") .setDescription(new SafeHtmlBuilder().appendHtmlConstant("").toSafeHtml()) .setHeadline("Deployed Virtual Databases").setTopLevelTools(toolStrip) .setMaster("Deployed VDBS", table) .addDetail("Summary", new VDBSummaryTab(this.presenter).getPanel(table)) .addDetail("Models", this.vdbModelsTab.getPanel(table)) .addDetail("Overrides", new VDBTranslatorsTab(this.presenter).getPanel(table)) .addDetail("Caching", this.vdbCachingTab.getPanel(table)) .addDetail("Data Roles", new VDBDataRolesTab(this.presenter).getPanel(table)) .addDetail("Requests", this.vdbRequestsTab.getPanel(table)) .addDetail("Sessions", this.vdbSessionsTab.getPanel(table)); return layout.build(); }
From source file:org.jboss.as.console.client.v3.widgets.PropertyEditor.java
License:Open Source License
@SuppressWarnings("unchecked") public Widget asWidget() { VerticalPanel panel = new VerticalPanel(); panel.addStyleName("fill-layout-width"); // table//from w w w .ja va 2 s. c om table = new DefaultCellTable<>(numRows, keyProvider); dataProvider = new ListDataProvider<>(keyProvider); dataProvider.addDataDisplay(table); final SingleSelectionModel<Property> selectionModel = new SingleSelectionModel<>(keyProvider); table.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(event -> { Property selection = selectionModel.getSelectedObject(); if (selection == null) { propertyManager.onDeselect(); } else { propertyManager.onSelect(selection); } }); // columns Column<Property, String> keyColumn = new TextColumn<Property>() { @Override public String getValue(Property property) { return property.getName(); } }; keyColumn.setSortable(true); Column<Property, String> valueColumn; if (inlineEditing) { valueColumn = new Column<Property, String>(new DefaultEditTextCell()) { { setFieldUpdater((index, property, value) -> getPropertyValue(property).set(value)); } @Override public String getValue(Property property) { return property.getValue().get(VALUE).asString(); } }; } else { valueColumn = new TextColumn<Property>() { @Override public String getValue(Property property) { return getPropertyValue(property).asString(); } }; } ColumnSortEvent.ListHandler<Property> sortHandler = new ColumnSortEvent.ListHandler<>( dataProvider.getList()); sortHandler.setComparator(keyColumn, new Comparator<Property>() { @Override public int compare(Property o1, Property o2) { return o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase()); } }); table.addColumn(keyColumn, Console.CONSTANTS.common_label_key()); table.addColumn(valueColumn, Console.CONSTANTS.common_label_value()); table.setColumnWidth(keyColumn, 40, Style.Unit.PCT); table.setColumnWidth(valueColumn, 60, Style.Unit.PCT); table.addColumnSortHandler(sortHandler); table.getColumnSortList().push(keyColumn); // tools if (!hideTools) { ToolStrip tools = new ToolStrip(); addButton = new ToolButton(addLabel, event -> { addDialog.clearValues(); propertyManager.openAddDialog(addDialog); }); removeButton = new ToolButton(removeLabel, event -> { final Property selection = selectionModel.getSelectedObject(); if (selection != null) { Feedback.confirm(Console.MESSAGES.removeProperty(), Console.MESSAGES.removePropertyConfirm(selection.getName()), new Feedback.ConfirmationHandler() { @Override public void onConfirmation(boolean isConfirmed) { if (isConfirmed) { propertyManager.onRemove(selection); } } }); } }); AddressTemplate effectiveAddress = operationAddress != null ? operationAddress : propertyManager.getAddress(); if (effectiveAddress != null) { addButton.setOperationAddress(effectiveAddress.getTemplate(), propertyManager.getAddOperationName()); removeButton.setOperationAddress(effectiveAddress.getTemplate(), propertyManager.getRemoveOperationName()); } 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.bd.client.editors.deployment.list.DeploymentUnitsListViewImpl.java
License:Apache License
private void initTableColumns(final SelectionModel<KModuleDeploymentUnitSummary> selectionModel) { // Unit Id/*w ww .ja v a 2 s .c om*/ Column<KModuleDeploymentUnitSummary, String> unitIdColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getId(); } }; unitIdColumn.setSortable(true); sortHandler.setComparator(unitIdColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getId().compareTo(o2.getId()); } }); deployedUnitsListGrid.addColumn(unitIdColumn, new ResizableHeader(constants.Unit(), deployedUnitsListGrid, unitIdColumn)); // Unit Group Id Column<KModuleDeploymentUnitSummary, String> groupIdColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getGroupId(); } }; groupIdColumn.setSortable(true); sortHandler.setComparator(groupIdColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getGroupId().compareTo(o2.getGroupId()); } }); deployedUnitsListGrid.addColumn(groupIdColumn, new ResizableHeader(constants.GroupID(), deployedUnitsListGrid, groupIdColumn)); // Unit Artifact Id Column<KModuleDeploymentUnitSummary, String> artifactIdColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getArtifactId(); } }; artifactIdColumn.setSortable(true); sortHandler.setComparator(artifactIdColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getArtifactId().compareTo(o2.getArtifactId()); } }); deployedUnitsListGrid.addColumn(artifactIdColumn, new ResizableHeader(constants.Artifact(), deployedUnitsListGrid, artifactIdColumn)); // Unit Version Column<KModuleDeploymentUnitSummary, String> versionColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getVersion(); } }; versionColumn.setSortable(true); sortHandler.setComparator(versionColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getVersion().compareTo(o2.getVersion()); } }); deployedUnitsListGrid.addColumn(versionColumn, new ResizableHeader(constants.Version(), deployedUnitsListGrid, versionColumn)); // Unit KBase Column<KModuleDeploymentUnitSummary, String> kbaseColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getKbaseName(); } }; kbaseColumn.setSortable(true); sortHandler.setComparator(kbaseColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getKbaseName().compareTo(o2.getKbaseName()); } }); deployedUnitsListGrid.addColumn(kbaseColumn, new ResizableHeader(constants.KieBaseName(), deployedUnitsListGrid, kbaseColumn)); // Unit KBase Column<KModuleDeploymentUnitSummary, String> ksessionColumn = new Column<KModuleDeploymentUnitSummary, String>( new TextCell()) { @Override public String getValue(KModuleDeploymentUnitSummary unit) { return unit.getKsessionName(); } }; ksessionColumn.setSortable(true); sortHandler.setComparator(ksessionColumn, new Comparator<KModuleDeploymentUnitSummary>() { @Override public int compare(KModuleDeploymentUnitSummary o1, KModuleDeploymentUnitSummary o2) { return o1.getKsessionName().compareTo(o2.getKsessionName()); } }); deployedUnitsListGrid.addColumn(ksessionColumn, new ResizableHeader(constants.KieSessionName(), deployedUnitsListGrid, ksessionColumn)); // actions (icons) List<HasCell<KModuleDeploymentUnitSummary, ?>> cells = new LinkedList<HasCell<KModuleDeploymentUnitSummary, ?>>(); cells.add(new DeleteActionHasCell("Undeploy", new Delegate<KModuleDeploymentUnitSummary>() { @Override public void execute(KModuleDeploymentUnitSummary unit) { presenter.undeployUnit(unit.getId(), unit.getGroupId(), unit.getArtifactId(), unit.getVersion(), unit.getKbaseName(), unit.getKsessionName()); } })); cells.add(new DetailsActionHasCell("Details", new Delegate<KModuleDeploymentUnitSummary>() { @Override public void execute(KModuleDeploymentUnitSummary unit) { displayNotification("Deployment Unit " + unit.getId() + " go to details here!!"); } })); CompositeCell<KModuleDeploymentUnitSummary> cell = new CompositeCell<KModuleDeploymentUnitSummary>(cells); Column<KModuleDeploymentUnitSummary, KModuleDeploymentUnitSummary> actionsColumn = new Column<KModuleDeploymentUnitSummary, KModuleDeploymentUnitSummary>( cell) { @Override public KModuleDeploymentUnitSummary getValue(KModuleDeploymentUnitSummary object) { return object; } }; deployedUnitsListGrid.addColumn(actionsColumn, constants.Actions()); deployedUnitsListGrid.setColumnWidth(actionsColumn, "70px"); }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private Column initTaskIdColumn() { Column<CaseSummary, Number> caseIdColumn = new Column<CaseSummary, Number>(new NumberCell()) { @Override// w ww . j av a 2s. c om public Number getValue(CaseSummary object) { return object.getCaseId(); } }; caseIdColumn.setSortable(true); caseIdColumn.setDataStoreName("c.id"); return caseIdColumn; }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private Column initTaskNameColumn() { Column<CaseSummary, String> taskNameColumn = new Column<CaseSummary, String>(new TextCell()) { @Override/*from ww w.j av a2 s .c om*/ public String getValue(CaseSummary object) { return object.getCaseName(); } }; taskNameColumn.setSortable(true); taskNameColumn.setDataStoreName("c.name"); return taskNameColumn; }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private Column initTaskDescriptionColumn() { Column<CaseSummary, String> descriptionColumn = new Column<CaseSummary, String>(new TextCell()) { @Override/*w w w . j a v a2 s . co m*/ public String getValue(CaseSummary object) { return object.getDescription(); } }; descriptionColumn.setSortable(true); descriptionColumn.setDataStoreName("c.description"); return descriptionColumn; }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private Column initTaskStatusColumn() { Column<CaseSummary, String> statusColumn = new Column<CaseSummary, String>(new TextCell()) { @Override//w ww.ja v a2 s . c om public String getValue(CaseSummary object) { return object.getStatus(); } }; statusColumn.setSortable(true); statusColumn.setDataStoreName("c.status"); return statusColumn; }
From source file:org.jbpm.console.ng.cm.client.casegrid.CasesListGridViewImpl.java
License:Apache License
private Column initCaseRecipientColumn() { Column<CaseSummary, String> recipientColumn = new Column<CaseSummary, String>(new TextCell()) { @Override// w w w .j ava 2 s . c o m public String getValue(CaseSummary object) { return object.getRecipient(); } }; recipientColumn.setSortable(true); recipientColumn.setDataStoreName("c.recipient"); return recipientColumn; }
From source file:org.jbpm.console.ng.dm.client.document.list.DocumentListViewImpl.java
License:Apache License
private Column<CMSContentSummary, ?> initIdColumn() { Column<CMSContentSummary, String> idColumn = new Column<CMSContentSummary, String>(new TextCell()) { @Override//from ww w. j a va 2 s . co m public String getValue(CMSContentSummary object) { return object.getId(); } }; idColumn.setSortable(true); idColumn.setDataStoreName(COL_ID_ID); return idColumn; }
From source file:org.jbpm.console.ng.dm.client.document.list.DocumentListViewImpl.java
License:Apache License
private Column<CMSContentSummary, ?> initNameColumn() { Column<CMSContentSummary, String> processNameColumn = new Column<CMSContentSummary, String>( new TextCell()) { @Override// ww w. j a v a2 s . c o m public String getValue(CMSContentSummary object) { return object.getName(); } }; processNameColumn.setSortable(true); processNameColumn.setDataStoreName(COL_ID_NAME); return processNameColumn; }