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 @@ -74,6 +74,7 @@ Import-Package: jakarta.annotation,
org.eclipse.set.utils.widgets,
org.eclipse.swt,
org.eclipse.swt.events,
org.eclipse.swt.layout,
org.eclipse.swt.widgets,
org.locationtech.jts.geom;version="1.19.0",
org.osgi.service.component.annotations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ PlazModellPart_ExportTitleMsg=Export als CSV
PlazModellPart_ExportCsvFileName=PlaZ-Modell
PlazModellPart_ExpandAllGroup= Alle ausklappen
PlazModellPart_CollapseAllGroup= Alle einklappen

PlazModellPart_ActiveDefaultFilterCheckbox=technische Meldungen ausblenden
PlazReportColumns_Severity = Schweregrad
PlazReportColumns_ProblemType = Problemart
PlazReportColumns_LineNumber = Zeilennummer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,9 @@ public class Messages {
*/
public String PlazExport_ExportProcess_ErrorDialog_Message;

/**
* technische Meldungen ausblenden
*/
public String PlazModellPart_ActiveDefaultFilterCheckbox;

}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public String getText() {
}
});

tableView.createActiveDefaultFilterCheckBox(
(Composite) getBanderole().getControl());
tableView.createExpandCollapseAllButton(
(Composite) getBanderole().getControl(),
messages.PlazModellPart_ExpandAllGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.eclipse.set.feature.plazmodel.table;

import java.nio.file.Path;
import java.util.Map;

import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.set.basis.ToolboxPaths.ExportPathExtension;
Expand All @@ -22,6 +23,11 @@
import org.eclipse.set.utils.table.menu.TableMenuService;
import org.eclipse.set.utils.table.tree.AbstractTreeLayerTable;
import org.eclipse.set.utils.xml.XMLNodeFinder;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

Expand Down Expand Up @@ -142,4 +148,41 @@ public void exportCsv() {
exportCsv(part.getToolboxShell(), part.getDialogService(),
messages.PlazModellPart_ExportTitleMsg, exportFileName);
}

@Override
protected Map<Integer, Object> getDefaultFilterValue() {
return Map.of(Integer.valueOf(2), "-GUID-Sortierung"); //$NON-NLS-1$
}

/**
* IMPROVE: when reimplementation the filter to like excel then the check
* box here can be removed
*
* @param parent
* the parent composite
*/
public void createActiveDefaultFilterCheckBox(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
// Empty
final Composite space = new Composite(parent, SWT.NONE);
space.setLayout(new GridLayout());
composite.setLayout(new GridLayout(2, false));
final Button checkDefaultFilterButton = new Button(composite,
SWT.CHECK);
checkDefaultFilterButton.setSelection(true);
checkDefaultFilterButton
.setText(messages.PlazModellPart_ActiveDefaultFilterCheckbox);
checkDefaultFilterButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(final SelectionEvent e) {
widgetDefaultSelected(e);
}

@Override
public void widgetDefaultSelected(final SelectionEvent e) {
setDefaultFilterState(checkDefaultFilterButton.getSelection());
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
package org.eclipse.set.feature.validation.table;

import java.nio.file.Path;
import java.util.Collections;
import java.util.Map;

import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.set.basis.ToolboxPaths.ExportPathExtension;
Expand Down Expand Up @@ -136,4 +138,9 @@ public void exportCsv() {
exportCsv(shell, part.getDialogService(),
messages.ExportValidationTitleMsg, exportFileName);
}

@Override
protected Map<Integer, Object> getDefaultFilterValue() {
return Collections.emptyMap();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.set.swtbot.table.AbstractTableTest;
import org.eclipse.set.swtbot.table.TestFailHandle;
import org.eclipse.set.swtbot.utils.SWTBotUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand All @@ -36,6 +37,8 @@ public String getTestTableReferenceName() {

private void whenOpeningPlaZModelNatTable() {
givenNattableBot("PlaZ Modell");
SWTBotUtils.checkBoxWithText(bot, "technische Meldungen ausblenden")
.click();
bot.button("Alle ausklappen").click();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,21 @@
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.set.utils.table.BodyLayerStack;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swtbot.nebula.nattable.finder.SWTNatTableBot;
import org.eclipse.swtbot.nebula.nattable.finder.widgets.SWTBotNatTable;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotExpandItem;
import org.hamcrest.Matcher;

/**
* Utilities for working with Nattable in SWTBot
*/
public class SWTBotUtils {
/**
* Waits for any nattable to be visible
*
* @param bot
* The SWT Bot
* @param timeout
* Timeout for waiting
* @return The SWTBotNatTable instance for accessing the nattable
*/
public static SWTBotNatTable waitForNattable(SWTBot bot, int timeout) {
var condition = new DefaultCondition() {
SWTBotNatTable nattableBot = null;

@Override
public String getFailureMessage() {
return "Failed to find any nattable";
}

@Override
public boolean test() throws Exception {
nattableBot = new SWTNatTableBot().nattable();
return nattableBot != null;
}
};

bot.waitUntil(condition, timeout);
return condition.nattableBot;
}

/**
* @param gridLayer
* The gridLayer
Expand Down Expand Up @@ -79,52 +54,42 @@ public FreezeLayer freezeLayer() {

}

/**
* @param nattableBot
* the nattable bot for the nattable
* @return a record of commonly used layers
*/
public static NattableLayers getNattableLayers(SWTBotNatTable nattableBot) {
final NatTable natTable = nattableBot.widget;
final ILayer layer = natTable.getLayer();
assertInstanceOf(GridLayer.class, layer);
final GridLayer gridLayer = (GridLayer) layer;
assertInstanceOf(BodyLayerStack.class, gridLayer.getBodyLayer());
final BodyLayerStack bodyLayerStack = (BodyLayerStack) gridLayer
.getBodyLayer();

return new NattableLayers(gridLayer, bodyLayerStack,
gridLayer.getColumnHeaderLayer());
}

/**
* @param bot
* the {@link SWTBot}
* @param condition
* the wait condition
* @return the {@link DefaultCondition}
*/
public static DefaultCondition botWaitUntil(SWTBot bot,
Supplier<Boolean> condition) {
public static DefaultCondition botWaitUntil(final SWTBot bot,
final Supplier<Boolean> condition) {
return new DefaultCondition() {

@Override
public boolean test() throws Exception {
return condition.get().booleanValue();
public String getFailureMessage() {
return "Failed to wait for Application";
}

@Override
public String getFailureMessage() {
return "Failed to wait for Application";
public boolean test() throws Exception {
return condition.get().booleanValue();
}
};
}

@SuppressWarnings("unchecked")
public static SWTBotCheckBox checkBoxWithText(final SWTBot bot,
final String text) {
final Matcher<Button> matcher = allOf(widgetOfType(Button.class),
withStyle(SWT.CHECK, "SWT.CHECK"), withText(text));
return new SWTBotCheckBox((Button) bot.widget(matcher));
}

/**
* @param bot
* the {@link SWTBot}
*/
public static void expandTableMenu(SWTBot bot) {
public static void expandTableMenu(final SWTBot bot) {
@SuppressWarnings("unchecked")
final List<? extends ExpandItem> expandItems = bot
.widgets(allOf(widgetOfType(ExpandItem.class), withRegex(
Expand All @@ -136,4 +101,53 @@ public static void expandTableMenu(SWTBot bot) {
swtBotExpandItem.expand();
});
}

/**
* @param nattableBot
* the nattable bot for the nattable
* @return a record of commonly used layers
*/
public static NattableLayers getNattableLayers(
final SWTBotNatTable nattableBot) {
final NatTable natTable = nattableBot.widget;
final ILayer layer = natTable.getLayer();
assertInstanceOf(GridLayer.class, layer);
final GridLayer gridLayer = (GridLayer) layer;
assertInstanceOf(BodyLayerStack.class, gridLayer.getBodyLayer());
final BodyLayerStack bodyLayerStack = (BodyLayerStack) gridLayer
.getBodyLayer();

return new NattableLayers(gridLayer, bodyLayerStack,
gridLayer.getColumnHeaderLayer());
}

/**
* Waits for any nattable to be visible
*
* @param bot
* The SWT Bot
* @param timeout
* Timeout for waiting
* @return The SWTBotNatTable instance for accessing the nattable
*/
public static SWTBotNatTable waitForNattable(final SWTBot bot,
final int timeout) {
final var condition = new DefaultCondition() {
SWTBotNatTable nattableBot = null;

@Override
public String getFailureMessage() {
return "Failed to find any nattable";
}

@Override
public boolean test() throws Exception {
nattableBot = new SWTNatTableBot().nattable();
return nattableBot != null;
}
};

bot.waitUntil(condition, timeout);
return condition.nattableBot;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class TableDataProvider implements IDataProvider {
].filter[filterMatch].toList
}

def Map<Integer, Object> getCurrentFilters() {
return filters
}

/**
* Checks whether a row fulfils the applied filters
*
Expand All @@ -75,15 +79,19 @@ class TableDataProvider implements IDataProvider {
for (var i = 0; i < columnCount; i++) {
if (filters.containsKey(i)) {
val content = row.contents.get(i).plainStringValue.toLowerCase
var filterValue = filters.get(i).toString.toLowerCase
val isExcludeFilter = filterValue.substring(0, 1).equals(
EXCULDE_FILTER_SIGN)
filterValue = isExcludeFilter ? filterValue.
substring(1) : filterValue

// Equivalence logic
if (isExcludeFilter === content.contains(filterValue)) {
return false
var filterValues = filters.get(i).toString.split(",")
for (v : filterValues) {
if (!v.nullOrEmpty) {
val isExcludeFilter = v.substring(0, 1).equals(
EXCULDE_FILTER_SIGN)
var value = isExcludeFilter ? v.substring(1) : v

// Equivalence logic
if (isExcludeFilter ===
content.contains(value.toLowerCase)) {
return false
}
}
}
}
}
Expand Down
Loading
Loading