List of usage examples for com.google.gwt.user.cellview.client CellTable setEmptyTableWidget
@Override public void setEmptyTableWidget(Widget widget)
From source file:org.roda.wui.client.common.lists.AIPList.java
@Override protected void configureDisplay(CellTable<IndexedAIP> display) { levelColumn = new Column<IndexedAIP, SafeHtml>(new SafeHtmlCell()) { @Override//from ww w .ja v a2s . c o m public SafeHtml getValue(IndexedAIP aip) { SafeHtml ret; if (aip == null) { logger.error("Trying to display a NULL item"); ret = null; } else { ret = DescriptionLevelUtils.getElementLevelIconSafeHtml(aip.getLevel(), true); } return ret; } }; titleColumn = new TextColumn<IndexedAIP>() { @Override public String getValue(IndexedAIP aip) { return aip != null ? aip.getTitle() : null; } }; datesColumn = new TextColumn<IndexedAIP>() { @Override public String getValue(IndexedAIP aip) { return Humanize.getDatesText(aip.getDateInitial(), aip.getDateFinal(), false); } }; hasRepresentationsColumn = new Column<IndexedAIP, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(IndexedAIP aip) { SafeHtml ret; if (aip == null) { logger.error("Trying to display a NULL item"); ret = null; } else if (aip.getHasRepresentations()) { // TODO set title and aria ret = HAS_REPRESENTATIONS_ICON; } else { ret = null; } return ret; } }; levelColumn.setSortable(true); titleColumn.setSortable(true); datesColumn.setSortable(true); hasRepresentationsColumn.setSortable(true); display.addColumn(levelColumn, SafeHtmlUtils.fromSafeConstant("<i class='fa fa-tag'></i> " + messages.aipLevel())); display.addColumn(titleColumn, messages.aipGenericTitle()); display.addColumn(datesColumn, messages.aipDates()); display.addColumn(hasRepresentationsColumn, HAS_REPRESENTATIONS_ICON); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); // define default sorting display.getColumnSortList().push(new ColumnSortInfo(datesColumn, true)); display.setColumnWidth(levelColumn, 7.0, Unit.EM); display.setColumnWidth(datesColumn, 13.0, Unit.EM); display.setColumnWidth(hasRepresentationsColumn, 3.0, Unit.EM); levelColumn.setCellStyleNames("nowrap"); datesColumn.setCellStyleNames("nowrap"); addStyleName("my-collections-table"); emptyInfo.addStyleName("my-collections-empty-info"); }
From source file:org.roda.wui.client.common.lists.DIPFileList.java
@Override protected void configureDisplay(CellTable<DIPFile> display) { iconColumn = new Column<DIPFile, SafeHtml>(new SafeHtmlCell()) { @Override/*from w w w .ja v a2 s .c om*/ public SafeHtml getValue(DIPFile file) { if (file != null) { if (file.isDirectory()) { return SafeHtmlUtils.fromSafeConstant("<i class='fa fa-folder-o'></i>"); } else { return SafeHtmlUtils.fromSafeConstant("<i class='fa fa-file-o'></i>"); } } else { logger.error("Trying to display a NULL item"); } return null; } }; idColumn = new TextColumn<DIPFile>() { @Override public String getValue(DIPFile file) { return file != null ? file.getId() : null; } }; iconColumn.setSortable(true); idColumn.setSortable(true); addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<i class='fa fa-files-o'></i>"), false, false, 2); display.addColumn(idColumn, messages.fileName()); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); // define default sorting display.getColumnSortList().push(new ColumnSortInfo(idColumn, true)); display.setColumnWidth(iconColumn, 2.5, Unit.EM); addStyleName("my-collections-table"); emptyInfo.addStyleName("my-collections-empty-info"); }
From source file:org.roda.wui.client.common.lists.DIPList.java
@Override protected void configureDisplay(CellTable<IndexedDIP> display) { dateCreated = new Column<IndexedDIP, Date>( new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) { @Override//from w w w . ja v a 2s. co m public Date getValue(IndexedDIP dip) { return dip != null ? dip.getDateCreated() : null; } }; lastModified = new Column<IndexedDIP, Date>( new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) { @Override public Date getValue(IndexedDIP dip) { return dip != null ? dip.getLastModified() : null; } }; titleColumn = new TextColumn<IndexedDIP>() { @Override public String getValue(IndexedDIP dip) { return dip != null ? dip.getTitle() : null; } }; titleColumn.setSortable(true); dateCreated.setSortable(true); lastModified.setSortable(true); display.addColumn(titleColumn, messages.aipGenericTitle()); display.addColumn(dateCreated, messages.dipCreatedDate()); display.addColumn(lastModified, messages.dipLastModified()); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); // define default sorting display.getColumnSortList().push(new ColumnSortInfo(titleColumn, true)); display.setColumnWidth(dateCreated, 13.0, Unit.EM); display.setColumnWidth(lastModified, 13.0, Unit.EM); dateCreated.setCellStyleNames("nowrap"); lastModified.setCellStyleNames("nowrap"); addStyleName("my-collections-table"); emptyInfo.addStyleName("my-collections-empty-info"); }
From source file:org.roda.wui.client.common.lists.IngestJobReportList.java
@Override protected void configureDisplay(CellTable<IndexedReport> display) { sourceObjectColumn = new TooltipTextColumn<IndexedReport>() { @Override//from www . jav a 2 s . c o m public String getValue(IndexedReport report) { String value = ""; if (report != null) { if (report.getSourceObjectOriginalIds().isEmpty()) { value = report.getSourceObjectId(); } else { value = StringUtils.prettyPrint(report.getSourceObjectOriginalIds()); } value = report.getSourceObjectOriginalName() + " (" + value + ")"; } return value; } }; outcomeObjectColumn = new TooltipTextColumn<IndexedReport>() { @Override public String getValue(IndexedReport report) { String value = ""; if (report != null) { if (StringUtils.isNotBlank(report.getOutcomeObjectLabel())) { value = report.getOutcomeObjectLabel() + " (" + report.getOutcomeObjectId() + ")"; } else { value = report.getOutcomeObjectId(); } } return value; } }; updatedDateColumn = new Column<IndexedReport, Date>( new DateCell(DateTimeFormat.getFormat(RodaConstants.DEFAULT_DATETIME_FORMAT))) { @Override public Date getValue(IndexedReport job) { return job != null ? job.getDateUpdated() : null; } }; lastPluginRunColumn = new TextColumn<IndexedReport>() { @Override public String getValue(IndexedReport job) { String value = null; if (job != null && job.getPlugin() != null) { PluginInfo pluginInfo = pluginsInfo.get(job.getPlugin()); String pluginName; if (pluginInfo != null) { pluginName = pluginInfo.getName(); } else { pluginName = job.getPlugin(); } if (StringUtils.isNotBlank(job.getPluginVersion())) { value = messages.pluginLabelWithVersion(pluginName, job.getPluginVersion()); } else { value = messages.pluginLabel(pluginName); } } return value; } }; lastPluginRunStateColumn = new Column<IndexedReport, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(IndexedReport report) { SafeHtml ret = null; if (report != null) { switch (report.getPluginState()) { case SUCCESS: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-success'>" + messages.pluginStateMessage(PluginState.SUCCESS) + "</span>"); break; case RUNNING: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-default'>" + messages.pluginStateMessage(PluginState.RUNNING) + "</span>"); break; case FAILURE: default: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-danger'>" + messages.pluginStateMessage(PluginState.FAILURE) + "</span>"); break; } } return ret; } }; completionStatusColumn = new TextColumn<IndexedReport>() { @Override public String getValue(IndexedReport report) { String value = ""; if (report != null) { value = report.getStepsCompleted() + " " + messages.of() + " " + report.getTotalSteps() + " (" + report.getCompletionPercentage() + "%)"; } return value; } }; sourceObjectColumn.setSortable(true); outcomeObjectColumn.setSortable(true); updatedDateColumn.setSortable(true); lastPluginRunColumn.setSortable(true); lastPluginRunStateColumn.setSortable(true); completionStatusColumn.setSortable(false); addColumn(sourceObjectColumn, messages.showSIPExtended(), true, false); addColumn(outcomeObjectColumn, messages.showAIPExtended(), true, false); addColumn(updatedDateColumn, messages.reportLastUpdatedAt(), true, false, 11); addColumn(lastPluginRunColumn, messages.reportLastRunTask(), true, false); addColumn(lastPluginRunStateColumn, messages.reportStatus(), true, false, 8); addColumn(completionStatusColumn, messages.reportProgress(), true, false, 8); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); // default sorting display.getColumnSortList().push(new ColumnSortInfo(updatedDateColumn, false)); }
From source file:org.roda.wui.client.common.lists.RepresentationList.java
@Override protected void configureDisplay(CellTable<IndexedRepresentation> display) { originalColumn = new TextColumn<IndexedRepresentation>() { @Override/*from ww w.j a v a 2 s . co m*/ public String getValue(IndexedRepresentation rep) { return rep != null ? rep.isOriginal() ? messages.originalRepresentation() : messages.alternativeRepresentation() : null; } }; typeColumn = new Column<IndexedRepresentation, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(IndexedRepresentation rep) { SafeHtml ret; if (rep == null) { LOGGER.error("Trying to display a NULL item"); ret = null; } else { ret = DescriptionLevelUtils.getRepresentationTypeIcon(rep.getType(), true); } return ret; } }; sizeInBytesColumn = new TextColumn<IndexedRepresentation>() { @Override public String getValue(IndexedRepresentation rep) { return rep != null ? Humanize.readableFileSize(rep.getSizeInBytes()) : null; } }; numberOfDataFilesColumn = new TextColumn<IndexedRepresentation>() { @Override public String getValue(IndexedRepresentation rep) { return rep != null ? messages.numberOfFiles(rep.getNumberOfDataFiles()) : null; } }; /* add sortable */ originalColumn.setSortable(true); typeColumn.setSortable(true); sizeInBytesColumn.setSortable(true); numberOfDataFilesColumn.setSortable(true); display.addColumn(typeColumn, messages.representationType()); display.addColumn(numberOfDataFilesColumn, messages.representationFiles()); display.addColumn(sizeInBytesColumn, messages.representationSize()); display.addColumn(originalColumn, messages.representationOriginal()); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); originalColumn.setCellStyleNames("nowrap"); typeColumn.setCellStyleNames("nowrap"); sizeInBytesColumn.setCellStyleNames("nowrap"); numberOfDataFilesColumn.setCellStyleNames("nowrap"); // define default sorting display.getColumnSortList().push(new ColumnSortInfo(typeColumn, true)); addStyleName("my-representation-table"); emptyInfo.addStyleName("my-representation-empty-info"); }
From source file:org.roda.wui.client.common.lists.SimpleJobReportList.java
@Override protected void configureDisplay(CellTable<IndexedReport> display) { sourceColumn = new TooltipTextColumn<IndexedReport>() { @Override/*from ww w . jav a 2 s . co m*/ public String getValue(IndexedReport report) { String value = ""; if (report != null) { value = report.getSourceObjectOriginalIds().isEmpty() ? report.getSourceObjectId() : StringUtils.prettyPrint(report.getSourceObjectOriginalIds()); sourceClass = report.getSourceObjectClass(); } return value; } }; outcomeColumn = new TooltipTextColumn<IndexedReport>() { @Override public String getValue(IndexedReport report) { String value = ""; if (report != null) { if (StringUtils.isNotBlank(report.getOutcomeObjectLabel())) { value = report.getOutcomeObjectLabel() + " (" + report.getOutcomeObjectId() + ")"; } else { value = report.getOutcomeObjectId(); } } return value; } }; updatedDateColumn = new Column<IndexedReport, Date>( new DateCell(DateTimeFormat.getFormat(RodaConstants.DEFAULT_DATETIME_FORMAT))) { @Override public Date getValue(IndexedReport job) { return job != null ? job.getDateUpdated() : null; } }; lastPluginRunColumn = new TextColumn<IndexedReport>() { @Override public String getValue(IndexedReport job) { String value = null; if (job != null) { String jobPlugin = job.getPlugin(); if (jobPlugin != null) { PluginInfo pluginInfo = pluginsInfo.get(jobPlugin); String pluginName; if (pluginInfo != null) { pluginName = pluginInfo.getName(); } else { pluginName = jobPlugin; } if (StringUtils.isNotBlank(job.getPluginVersion())) { value = messages.pluginLabelWithVersion(pluginName, job.getPluginVersion()); } else { value = messages.pluginLabel(pluginName); } } } return value; } }; lastPluginRunStateColumn = new Column<IndexedReport, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(IndexedReport report) { SafeHtml ret = null; if (report != null) { switch (report.getPluginState()) { case SUCCESS: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-success'>" + messages.pluginStateMessage(PluginState.SUCCESS) + "</span>"); break; case RUNNING: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-default'>" + messages.pluginStateMessage(PluginState.RUNNING) + "</span>"); break; case FAILURE: default: ret = SafeHtmlUtils.fromSafeConstant("<span class='label-danger'>" + messages.pluginStateMessage(PluginState.FAILURE) + "</span>"); break; } } return ret; } }; completionStatusColumn = new TextColumn<IndexedReport>() { @Override public String getValue(IndexedReport report) { String value = ""; if (report != null) { value = report.getStepsCompleted() + " " + messages.of() + " " + report.getTotalSteps() + " (" + report.getCompletionPercentage() + "%)"; } return value; } }; sourceColumn.setSortable(true); outcomeColumn.setSortable(true); updatedDateColumn.setSortable(true); lastPluginRunColumn.setSortable(true); lastPluginRunStateColumn.setSortable(true); completionStatusColumn.setSortable(false); addColumn(sourceColumn, messages.reportSource(), true, false); addColumn(outcomeColumn, messages.reportOutcome(), true, false); addColumn(updatedDateColumn, messages.reportLastUpdatedAt(), true, false, 11); addColumn(lastPluginRunColumn, messages.reportLastRunTask(), true, false); addColumn(lastPluginRunStateColumn, messages.reportStatus(), true, false, 8); addColumn(completionStatusColumn, messages.reportProgress(), true, false, 8); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); // default sorting display.getColumnSortList().push(new ColumnSortInfo(updatedDateColumn, false)); }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.MultiSelectListDialog.java
License:Apache License
private CellTable<String> createCellTable(Map<String, Boolean> items) { CellTable<String> cellTable = new CellTable<String>(); cellTable.setWidth("100%", true); cellTable.setEmptyTableWidget(new Label("empty list")); cellTable.setVisibleRange(0, items.size()); selectionModel = new MultiSelectionModel<String>(); cellTable.setSelectionModel(selectionModel, DefaultSelectionEventManager.<String>createCheckboxManager()); Column<String, Boolean> checkboxColumn = new Column<String, Boolean>(new CheckboxCell(true, false)) { @Override//from ww w .jav a2 s . c om public Boolean getValue(String object) { return selectionModel.isSelected(object); } }; cellTable.addColumn(checkboxColumn); cellTable.setColumnWidth(checkboxColumn, 40, Style.Unit.PX); Column<String, String> valueColumn = new Column<String, String>(new TextCell()) { @Override public String getValue(String object) { return object; } }; cellTable.addColumn(valueColumn); dataProvider = new ListDataProvider<String>(); dataProvider.addDataDisplay(cellTable); dataProvider.setList(new ArrayList<String>(items.keySet())); for (String item : items.keySet()) { selectionModel.setSelected(item, items.get(item)); } return cellTable; }