Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;

import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
import org.eclipse.set.core.services.enumtranslation.EnumTranslationService;
Expand Down Expand Up @@ -62,6 +63,10 @@ public class SskpTransformationService
@Reference
private EventAdmin eventAdmin;

private static final List<String> FREQUENCY_ODER = List.of("2000", //$NON-NLS-1$
"1000/2000", "1000", //$NON-NLS-1$ //$NON-NLS-2$
"500"); //$NON-NLS-1$

/**
* constructor.
*/
Expand Down Expand Up @@ -113,8 +118,6 @@ private static String getCellContent(final TableCell cell) {

@Override
public Comparator<RowGroup> getRowGroupComparator() {
final List<String> gmOrder = List.of("2000", "1000/2000", "1000", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"500"); //$NON-NLS-1$
return TableRowGroupComparator.builder().sortByRouteAndKm(obj -> {
if (obj instanceof final PZB_Element pzb) {
final List<Basis_Objekt> bezugPunkts = PZBElementExtensions
Expand All @@ -129,14 +132,25 @@ public Comparator<RowGroup> getRowGroupComparator() {
})
.sort(Bezugselement, CellComparatorType.LEXICOGRAPHICAL,
SortDirectionEnum.ASC)
.sort(Wirkfrequenz, Comparator.comparing(
SskpTransformationService::getCellContent,
Comparator.nullsLast(Comparator.comparing(
gmOrder::indexOf, Integer::compareUnsigned))))
.sort(Wirkfrequenz,
Comparator.comparing(
SskpTransformationService::getCellContent,
Comparator.nullsLast(frequencyComparator())))
.build();

}

@SuppressWarnings("boxing")
private static Comparator<String> frequencyComparator() {
return (first, second) -> {
final Function<String, Integer> getPiority = value -> {
return FREQUENCY_ODER.indexOf(value.replace("GÜ", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$
};
return Integer.compareUnsigned(getPiority.apply(first),
getPiority.apply(second));
};
}

@Override
public ColumnDescriptor fillHeaderDescriptions(
final ColumnDescriptorModelBuilder builder) {
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TruongQuangSB The ordering of the rows is broken now. See table diffs in #2146

Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class SskpTransformator extends AbstractPlanPro2TableModelTransformator {

private def fillRowGroupContent(TableRow instance, PZB_Element pzb,
Fstr_DWeg dweg) {

val pzbGUEs = (pzb.container.PZBElement.map[PZBElementGUE].filterNull.
filter[IDPZBElementMitnutzung?.value === pzb] +
#[pzb.PZBElementGUE]).filterNull

// A: Sskp.Bezug.BezugsElement
fillIterable(
instance,
Expand All @@ -119,7 +124,7 @@ class SskpTransformator extends AbstractPlanPro2TableModelTransformator {
instance,
cols.getColumn(Wirkfrequenz),
pzb,
[PZBArt?.translate]
['''«PZBArt?.translate»«IF !pzbGUEs.nullOrEmpty» GÜ«ENDIF»''']
)

val isPZB2000 = pzb.PZBArt?.wert === ENUMPZBArt.ENUMPZB_ART_2000_HZ ||
Expand Down Expand Up @@ -517,10 +522,6 @@ class SskpTransformator extends AbstractPlanPro2TableModelTransformator {
}
}

val pzbGUEs = (pzb.container.PZBElement.map[PZBElementGUE].filterNull.
filter[IDPZBElementMitnutzung?.value === pzb] +
#[pzb.PZBElementGUE]).filterNull

if (!pzbGUEs.empty) {
// R: Sskp.Gue.Pruefgeschwindigkeit
fillIterable(
Expand Down
Loading
Loading