code cleanup
This commit is contained in:
parent
c110d7aec4
commit
2611f4f464
2 changed files with 13 additions and 38 deletions
|
@ -22,17 +22,7 @@ import java.nio.CharBuffer;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -887,25 +877,11 @@ public final class Utils {
|
|||
}
|
||||
|
||||
public static int compareDateTime(final DateTime dt1, final DateTime dt2, final boolean descending) {
|
||||
return ((dt1 == dt2)
|
||||
? 0
|
||||
: (dt1 == null || dt1 == null)
|
||||
? 1
|
||||
: (dt2 == null || dt2 == null)
|
||||
? -1
|
||||
: dt1.compareTo(dt2))
|
||||
* ((descending) ? -1 : 1);
|
||||
return Objects.compare(dt1, dt1, DateTime::compareTo ) * ((descending) ? -1 : 1);
|
||||
}
|
||||
|
||||
public static int compareIds(final Long id1, final Long id2, final boolean descending) {
|
||||
return ((id1 == id2)
|
||||
? 0
|
||||
: (id1 == null || id1 == null)
|
||||
? 1
|
||||
: (id2 == null || id2 == null)
|
||||
? -1
|
||||
: id1.compareTo(id2))
|
||||
* ((descending) ? -1 : 1);
|
||||
return Objects.compare(id1, id2, Long::compareTo ) * ((descending) ? -1 : 1);
|
||||
}
|
||||
|
||||
public static String toFileName(final String name) {
|
||||
|
|
|
@ -544,13 +544,15 @@ public class EntityTable<ROW extends ModelIdAware> {
|
|||
.onError(this.pageContext::notifyUnexpectedError)
|
||||
.getOr(null);
|
||||
|
||||
this.isComplete = page.complete;
|
||||
this.composite.getParent().layout(true, true);
|
||||
PageService.updateScrolledComposite(this.composite);
|
||||
this.notifyContentChange();
|
||||
this.notifySelectionChange();
|
||||
|
||||
if (page != null && this.pageReloadListener != null) {
|
||||
if (page != null) {
|
||||
this.isComplete = page.complete;
|
||||
}
|
||||
if (this.pageReloadListener != null) {
|
||||
this.pageReloadListener.accept(this);
|
||||
}
|
||||
}
|
||||
|
@ -633,8 +635,7 @@ public class EntityTable<ROW extends ModelIdAware> {
|
|||
|
||||
private void adaptColumnWidthChange(final Event event) {
|
||||
final Widget widget = event.widget;
|
||||
if (widget instanceof TableColumn) {
|
||||
final TableColumn tableColumn = ((TableColumn) widget);
|
||||
if (widget instanceof final TableColumn tableColumn) {
|
||||
if (this.filter != null) {
|
||||
this.filter.adaptColumnWidth(
|
||||
this.table.indexOf(tableColumn),
|
||||
|
@ -676,10 +677,10 @@ public class EntityTable<ROW extends ModelIdAware> {
|
|||
for (int i = 0; i < columns.length; i++) {
|
||||
final ColumnDefinition<ROW> columnDefinition = table.columns.get(i);
|
||||
if (columnDefinition.isLocalized()) {
|
||||
for (int j = 0; j < items.length; j++) {
|
||||
for (final TableItem item : items) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final ROW rowData = (ROW) items[j].getData(TABLE_ROW_DATA);
|
||||
setValueToCell(items[j], i, columnDefinition, columnDefinition.valueSupplier.apply(rowData));
|
||||
final ROW rowData = (ROW) item.getData(TABLE_ROW_DATA);
|
||||
setValueToCell(item, i, columnDefinition, columnDefinition.valueSupplier.apply(rowData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -852,8 +853,7 @@ public class EntityTable<ROW extends ModelIdAware> {
|
|||
this.multiselection.remove(modelId);
|
||||
} else {
|
||||
this.multiselection.add(modelId);
|
||||
Arrays.asList(this.table.getSelection())
|
||||
.stream()
|
||||
Arrays.stream(this.table.getSelection())
|
||||
.forEach(i -> this.multiselection.add(getModelId(i)));
|
||||
}
|
||||
multiselectFromPage();
|
||||
|
@ -862,8 +862,7 @@ public class EntityTable<ROW extends ModelIdAware> {
|
|||
|
||||
private void multiselectFromPage() {
|
||||
if (this.multiselection != null) {
|
||||
Arrays.asList(this.table.getItems())
|
||||
.stream()
|
||||
Arrays.stream(this.table.getItems())
|
||||
.forEach(item -> {
|
||||
final int index = this.table.indexOf(item);
|
||||
if (this.multiselection.contains(getModelId(item))) {
|
||||
|
|
Loading…
Reference in a new issue