diff --git a/.config/pmd/ruleset.xml b/.config/pmd/ruleset.xml
index 667f74e..7a03f17 100644
--- a/.config/pmd/ruleset.xml
+++ b/.config/pmd/ruleset.xml
@@ -151,5 +151,12 @@
+
+
+
+
+
+
+
diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml
index 96af798..8f98f1a 100644
--- a/.github/workflows/broken-links.yml
+++ b/.github/workflows/broken-links.yml
@@ -11,6 +11,7 @@ permissions:
jobs:
link-checker:
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@v4
@@ -18,7 +19,9 @@ jobs:
- name: Link Checker
id: lychee
- uses: lycheeverse/lychee-action@v1
+ uses: lycheeverse/lychee-action@v2
+ with:
+ fail: false # Don't fail on broken links, create an issue instead
- name: Find already existing issue
id: find-issue
diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml
index 93378be..bd726cc 100644
--- a/.github/workflows/check-build.yml
+++ b/.github/workflows/check-build.yml
@@ -26,6 +26,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
+ timeout-minutes: 30
strategy:
matrix:
@@ -73,6 +74,7 @@ jobs:
checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
+ timeout-minutes: 15
strategy:
matrix:
@@ -95,6 +97,7 @@ jobs:
pmd:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
+ timeout-minutes: 15
strategy:
matrix:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9841679..8bd23e5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -14,6 +14,7 @@ permissions:
jobs:
check-code:
runs-on: ubuntu-latest
+ timeout-minutes: 30
steps:
- uses: actions/checkout@v4
@@ -48,6 +49,7 @@ jobs:
prepare-release:
runs-on: ubuntu-latest
needs: [check-code]
+ timeout-minutes: 10
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
@@ -112,6 +114,7 @@ jobs:
publish-maven:
runs-on: ubuntu-latest
needs: [prepare-release]
+ timeout-minutes: 60
steps:
- uses: actions/checkout@v4
@@ -143,6 +146,7 @@ jobs:
publish-pages:
runs-on: ubuntu-latest
needs: [prepare-release]
+ timeout-minutes: 15
steps:
- uses: actions/checkout@v4
@@ -172,6 +176,7 @@ jobs:
after-release:
runs-on: ubuntu-latest
needs: [publish-maven]
+ timeout-minutes: 10
steps:
- uses: actions/checkout@v4
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index b38f0d8..df6dbb7 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -27,6 +27,7 @@ jobs:
token-check:
runs-on: ubuntu-latest
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
+ timeout-minutes: 5
outputs:
hasToken: ${{ steps.check-token.outputs.has }}
steps:
@@ -40,6 +41,7 @@ jobs:
runs-on: ubuntu-latest
needs: token-check
if: ${{ needs.token-check.outputs.hasToken }}
+ timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml
index ff880f0..c9d7ec7 100644
--- a/.github/workflows/sync-labels.yml
+++ b/.github/workflows/sync-labels.yml
@@ -14,6 +14,7 @@ permissions:
jobs:
labels:
runs-on: ubuntu-latest
+ timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml
index e3ed038..03f5339 100644
--- a/.github/workflows/test-deploy.yml
+++ b/.github/workflows/test-deploy.yml
@@ -9,6 +9,7 @@ env:
jobs:
publish-maven:
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@v4
diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml
index 36d059a..905a123 100644
--- a/.github/workflows/update-from-template.yml
+++ b/.github/workflows/update-from-template.yml
@@ -31,6 +31,7 @@ permissions:
jobs:
update:
runs-on: ubuntu-latest
+ timeout-minutes: 60
outputs:
update_branch_merged_commit: ${{ steps.manage-branches.outputs.update_branch_merged_commit }}
create_update_branch_merged_pr: ${{ steps.manage-branches.outputs.create_update_branch_merged_pr }}
@@ -180,6 +181,7 @@ jobs:
needs: [update]
if: needs.update.outputs.create_update_branch_merged_pr == 1
runs-on: ubuntu-latest
+ timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
index eb3fcd8..5f35e01 100644
--- a/.idea/checkstyle-idea.xml
+++ b/.idea/checkstyle-idea.xml
@@ -1,7 +1,7 @@
- 10.15.0
+ 10.20.1
JavaOnlyWithTests
true
true
diff --git a/.idea/saveactions_settings.xml b/.idea/saveactions_settings.xml
index 506f17e..848c311 100644
--- a/.idea/saveactions_settings.xml
+++ b/.idea/saveactions_settings.xml
@@ -9,7 +9,6 @@
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d5441b..01785a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,2 +1,10 @@
+# 1.0.1
+* Added customization degree
+ * Makes it possible that certain filters or parts of them are read-only
+* Correctly set url when handling query parameters
+* Fix faulty reset-button-behaviour
+* Fix error when URL is disabled and fields are edited
+* Updated Vaadin to v24.6.0 and XDEV Date range picker to v4.2.0
+
# 1.0.0
_Initial release_
diff --git a/README.md b/README.md
index e113cb9..187f32c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[](https://vaadin.com/directory/component/grid-filter-for-vaadin)
+[](https://vaadin.com/directory/component/simple-grid-filter-for-vaadin)
[](https://mvnrepository.com/artifact/software.xdev/vaadin-simple-grid-filter)
[](https://github.com/xdev-software/vaadin-simple-grid-filter/actions/workflows/check-build.yml?query=branch%3Adevelop)
[](https://sonarcloud.io/dashboard?id=xdev-software_vaadin-simple-grid-filter)
@@ -10,6 +10,29 @@ A simple Vaadin Flow component for filtering Grids.

+> [!NOTE]
+> If you are looking for a more advanced component you may check out our [grid-filter](https://github.com/xdev-software/vaadin-grid-filter).
+
+## Usage
+
+Here is a very simple example how the FilterComponent can be used:
+```java
+Grid grid = createGrid();
+
+FilterComponent filter = new FilterComponent<>(grid)
+ .withFilter(new SimpleFilterField<>(Person::getLastName, "Lastname"));
+
+this.add(filter, grid);
+```
+
+To get started further it's recommended to have a look at the [demo](./vaadin-simple-grid-filter-demo).
+A description how to get it running can be found [below](#run-the-demo).
+
+> [!IMPORTANT]
+> This component is designed for "in memory" filtering of small to medium sized amounts of data.
+
+> [!NOTE]
+> Filtering multiple thousand items with complex filtering conditions can drastically impact performance and make the UI unresponsive!
In these cases it's recommended to use backend filtering solutions like database queries or search engines like [ElasticSearch](https://en.wikipedia.org/wiki/Elasticsearch) in combination with a customized UI search framework. If you need help in implementing these feel free to [contact us](https://xdev.software/en/services/support).
## Installation
[Installation guide for the latest release](https://github.com/xdev-software/vaadin-simple-grid-filter/releases/latest#Installation)
diff --git a/pom.xml b/pom.xml
index 4bfe4c5..58d9f9c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,12 +40,12 @@
org.apache.maven.plugins
maven-checkstyle-plugin
- 3.5.0
+ 3.6.0
com.puppycrawl.tools
checkstyle
- 10.18.2
+ 10.21.0
@@ -70,7 +70,7 @@
org.apache.maven.plugins
maven-pmd-plugin
- 3.25.0
+ 3.26.0
true
true
@@ -82,12 +82,12 @@
net.sourceforge.pmd
pmd-core
- 7.6.0
+ 7.8.0
net.sourceforge.pmd
pmd-java
- 7.6.0
+ 7.8.0
@@ -99,7 +99,7 @@
org.apache.maven.plugins
maven-jxr-plugin
- 3.5.0
+ 3.6.0
diff --git a/vaadin-simple-grid-filter-demo/pom.xml b/vaadin-simple-grid-filter-demo/pom.xml
index b2f1098..9a74749 100644
--- a/vaadin-simple-grid-filter-demo/pom.xml
+++ b/vaadin-simple-grid-filter-demo/pom.xml
@@ -29,9 +29,9 @@
software.xdev.vaadin.Application
- 24.4.13
+ 24.6.0
- 3.3.4
+ 3.4.0
diff --git a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java
index 3596c42..457daff 100644
--- a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java
+++ b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java
@@ -19,6 +19,7 @@
import software.xdev.vaadin.comparators.NotEqualComparator;
import software.xdev.vaadin.daterange_picker.business.DateRangeModel;
import software.xdev.vaadin.daterange_picker.business.SimpleDateRanges;
+import software.xdev.vaadin.model.CustomizationDegree;
import software.xdev.vaadin.model.Department;
import software.xdev.vaadin.model.Person;
import software.xdev.vaadin.model.SimpleFilterField;
@@ -100,7 +101,8 @@ private void initUI()
EqualComparator.getInstance(),
"true",
false,
- true
+ true,
+ CustomizationDegree.INPUT_VALUE
);
this.add(filterComponent, this.dataGrid);
diff --git a/vaadin-simple-grid-filter/pom.xml b/vaadin-simple-grid-filter/pom.xml
index cdca3ec..75e6ef8 100644
--- a/vaadin-simple-grid-filter/pom.xml
+++ b/vaadin-simple-grid-filter/pom.xml
@@ -49,7 +49,7 @@
UTF-8
- 24.4.13
+ 24.5.8
@@ -107,7 +107,7 @@
software.xdev
vaadin-date-range-picker
- 4.1.1
+ 4.2.0
@@ -122,7 +122,7 @@
org.apache.maven.plugins
maven-project-info-reports-plugin
- 3.7.0
+ 3.8.0
@@ -185,11 +185,11 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.10.1
+ 3.11.2
attach-javadocs
- verify
+ package
jar
@@ -207,7 +207,7 @@
attach-sources
- verify
+ package
jar-no-fork
@@ -308,12 +308,12 @@
org.apache.maven.plugins
maven-checkstyle-plugin
- 3.5.0
+ 3.6.0
com.puppycrawl.tools
checkstyle
- 10.18.2
+ 10.21.0
@@ -338,7 +338,7 @@
org.apache.maven.plugins
maven-pmd-plugin
- 3.25.0
+ 3.26.0
true
true
@@ -350,12 +350,12 @@
net.sourceforge.pmd
pmd-core
- 7.6.0
+ 7.8.0
net.sourceforge.pmd
pmd-java
- 7.6.0
+ 7.8.0
@@ -367,7 +367,7 @@
org.apache.maven.plugins
maven-jxr-plugin
- 3.5.0
+ 3.6.0
diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java
index 0b843b8..04a30b9 100644
--- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java
+++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java
@@ -64,6 +64,7 @@
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
+import com.vaadin.flow.router.Location;
import com.vaadin.flow.router.QueryParameters;
import software.xdev.vaadin.builder.CustomizableFilterBuilder;
@@ -76,10 +77,12 @@
import software.xdev.vaadin.daterange_picker.ui.DateRangePicker;
import software.xdev.vaadin.model.ChipBadge;
import software.xdev.vaadin.model.ChipBadgeExtension;
+import software.xdev.vaadin.model.CustomizationDegree;
import software.xdev.vaadin.model.FilterCondition;
import software.xdev.vaadin.model.FilterField;
import software.xdev.vaadin.model.FilterFieldEnumExtension;
import software.xdev.vaadin.model.SimpleFilterField;
+import software.xdev.vaadin.utl.FilterComponentUtl;
import software.xdev.vaadin.utl.QueryParameterUtil;
@@ -296,9 +299,6 @@ else if(this.selOperations.getValue() != null)
private void onShowFilterInput()
{
- // Needed if the previous condition was an editable initial condition
- // The editable initial condition makes the cancel button invisible
- this.btnCancelFilter.setVisible(true);
if(this.hlFilter.getChildren().findAny().isEmpty())
{
@@ -307,8 +307,10 @@ private void onShowFilterInput()
this.btnCancelFilter.setVisible(true);
this.selFields.setValue(null);
+ this.selFields.setReadOnly(false);
this.selOperations.setItems(Collections.emptyList());
this.selOperations.setEnabled(false);
+ this.selOperations.setReadOnly(false);
this.btnAcceptFilter.setEnabled(false);
this.txtSearchQuery.clear();
this.nmbSearchQuery.clear();
@@ -318,7 +320,6 @@ private void onShowFilterInput()
this.setInputComponentVisibility(String.class);
this.hlFilter.add(
-
this.selFields,
this.selOperations,
this.txtSearchQuery,
@@ -333,6 +334,30 @@ private void onShowFilterInput()
}
}
+ /**
+ * Method used to make the select field and select condition dependent on the customization degree readonly.
+ *
+ * @param usedCustomizationDegree Used to set which input field is readonly.
+ */
+ private void setUsedCustomizationDegreeForComponents(final CustomizationDegree usedCustomizationDegree)
+ {
+ if(usedCustomizationDegree.equals(CustomizationDegree.INPUT_VALUE))
+ {
+ this.selFields.setReadOnly(true);
+ this.selOperations.setReadOnly(true);
+ }
+ else if(usedCustomizationDegree.equals(CustomizationDegree.CONDITION_AND_INPUT_VALUE))
+ {
+ this.selFields.setReadOnly(true);
+ this.selOperations.setReadOnly(false);
+ }
+ else
+ {
+ this.selFields.setReadOnly(false);
+ this.selOperations.setReadOnly(false);
+ }
+ }
+
/**
* Clicking on the accept filter button.
*/
@@ -341,14 +366,28 @@ private void onAcceptFilter()
final String userInput = this.getValueFromVisibleComponent();
final ChipBadgeExtension> badge;
+ CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING;
final boolean deletable;
final boolean editable;
- // Check if it's an initial condition
- if(this.editingBadgeId != null && !this.editingBadgeId.equals(NO_BADGE_ID_STRING))
+ if(this.deletingBadgeEnabled != null && this.editingBadgeEnabled != null)
{
deletable = this.deletingBadgeEnabled;
editable = this.editingBadgeEnabled;
+
+ this.deletingBadgeEnabled = null;
+ this.editingBadgeEnabled = null;
+
+ if(this.editingBadgeId != null)
+ {
+ // Get customization rating from initial condition
+ customizationDegree = this.initialChipBadges
+ .stream()
+ .filter(e -> e.getBadgeId().equals(this.editingBadgeId))
+ .toList()
+ .get(0)
+ .getCustomizationRating();
+ }
}
else
{
@@ -361,7 +400,8 @@ private void onAcceptFilter()
this.selOperations.getValue(),
userInput,
deletable,
- editable);
+ editable,
+ customizationDegree);
if(!this.identifier.isBlank())
{
@@ -390,7 +430,8 @@ private void onAcceptFilter()
final FilterComparator selOperation,
final String userInput,
final boolean deletableCondition,
- final boolean editableCondition)
+ final boolean editableCondition,
+ final CustomizationDegree customizationDegree)
{
final ChipBadgeExtension> badge = new ChipBadgeExtension<>(
new FilterCondition<>(
@@ -426,14 +467,15 @@ private void onAcceptFilter()
// Make the cancel button invisible
this.btnCancelFilter.setVisible(false);
- // Just activated when the url parameters are activated
- if(!this.identifier.isBlank())
- {
- this.editingBadgeId = badge.getBadgeId();
- // Needed for the acceptFilterBtn
- this.editingBadgeEnabled = badge.isBtnEditEnabled();
- this.deletingBadgeEnabled = badge.isBtnDeleteEnabled();
- }
+ // Needed to save state of the condition if it was editable/deletable before editing
+ this.editingBadgeEnabled = badge.isBtnEditEnabled();
+ this.deletingBadgeEnabled = badge.isBtnDeleteEnabled();
+
+ // Just activated when the url parameters are enabled
+ // Set the customization rating for the filter select and condition select
+ this.setUsedCustomizationDegreeForComponents(customizationDegree);
+
+ this.editingBadgeId = badge.getBadgeId();
// Remove filter, update grid
this.removeChipBadgeCondition(badge);
@@ -478,8 +520,23 @@ private void deactivateDeleteButtonFromChipComponents(
this.addQueryParameter(badge);
}
- // Activate the reset button
- this.btnResetFilter.setEnabled(true);
+ // When no initial filter is existing
+ if(this.initialChipBadges.isEmpty() && this.chipBadges.isEmpty())
+ {
+ this.btnResetFilter.setEnabled(false);
+ }
+ else
+ {
+ final List>> initialChipBadgesCopy
+ = new ArrayList<>(this.initialChipBadges);
+ final List>> chipBadgesCopy
+ = new ArrayList<>(this.chipBadges);
+
+ // Check if just the initial filter are currently applied. Then enable/disable the reset button as
+ // appropriate.
+ this.btnResetFilter.setEnabled(
+ !new FilterComponentUtl().equalLists(initialChipBadgesCopy, chipBadgesCopy));
+ }
});
}
}
@@ -841,15 +898,30 @@ private void createConditionsFromQueryParameters()
{
if(!this.queryBadgeIdList.get(i).equals(DELETED_INITIAL_CONDITION_STRING))
{
+ final String badgeId = this.queryBadgeIdList.get(i);
+ CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING;
+
+ // Check if it's an initial condition
+ final List>> cD = this.initialChipBadges
+ .stream()
+ .filter(e -> e.getBadgeId().equals(badgeId))
+ .toList();
+
+ if(!cD.isEmpty())
+ {
+ customizationDegree = cD.get(0).getCustomizationRating();
+ }
+
final ChipBadgeExtension> chipBadgeExtension =
this.createBadgeConditionAndApplyFilter(
filterField,
comparatorOptional.get(),
this.queryInputFieldList.get(i),
Boolean.parseBoolean(this.queryBadgeDeletableList.get(i)),
- Boolean.parseBoolean(this.queryBadgeEditableList.get(i)));
+ Boolean.parseBoolean(this.queryBadgeEditableList.get(i)),
+ customizationDegree);
- chipBadgeExtension.setBadgeId(this.queryBadgeIdList.get(i));
+ chipBadgeExtension.setBadgeId(badgeId);
}
else
{
@@ -1237,7 +1309,7 @@ private String createMultipleQueryParameterString()
/**
* Method for adding a specific filter condition as query parameter.
*
- * @param filterCondition The condition which should be converted to query parameter.
+ * @param chipBadge The condition which should be converted to query parameter.
*/
private void addQueryParameter(final ChipBadgeExtension> chipBadge)
{
@@ -1251,11 +1323,17 @@ private void addQueryParameter(final ChipBadgeExtension> c
this.ui.getPage().fetchCurrentURL(currentUrl ->
{
- String separator = "?";
+ final String questionMarkCharacter = "?";
+ String querySeperator = "";
+ String currentQuery = currentUrl.getQuery();
- if(currentUrl.getQuery() != null)
+ if(currentQuery != null)
+ {
+ querySeperator = "&";
+ }
+ else
{
- separator = "&";
+ currentQuery = "";
}
this.ui
@@ -1263,14 +1341,17 @@ private void addQueryParameter(final ChipBadgeExtension> c
.getHistory()
.replaceState(
null,
- currentUrl
- + separator
- + QueryParameterUtil.createQueryParameterString(
- this.identifier,
- filterCondition,
- chipBadge.getBadgeId(),
- chipBadge.isBtnDeleteEnabled(),
- chipBadge.isBtnEditEnabled()));
+ new Location(
+ currentUrl.getPath()
+ + questionMarkCharacter
+ + currentQuery
+ + querySeperator
+ + QueryParameterUtil.createQueryParameterString(
+ this.identifier,
+ filterCondition,
+ chipBadge.getBadgeId(),
+ chipBadge.isBtnDeleteEnabled(),
+ chipBadge.isBtnEditEnabled())));
});
}
@@ -1349,6 +1430,7 @@ public FilterComponent withInitialFilter(
final String searchQuery,
final boolean conditionDeletable,
final boolean conditionEditable,
+ final CustomizationDegree customizationDegree,
final String badgeId)
{
FilterField finalFilterField = filterField;
@@ -1381,11 +1463,14 @@ public FilterComponent withInitialFilter(
selectedCondition,
searchQuery,
conditionDeletable,
- conditionEditable);
+ conditionEditable,
+ customizationDegree);
// Just needed if the url parameters are activated
chipBadge.setBadgeId(badgeId);
+ chipBadge.setCustomizationRating(customizationDegree);
+
// Needed for resetting the conditions
this.initialChipBadges.add(chipBadge);
@@ -1414,6 +1499,30 @@ public FilterComponent withInitialFilter(
searchQuery,
conditionDeletable,
conditionEditable,
+ CustomizationDegree.EVERYTHING,
+ String.valueOf(this.initialConditionIdCounter));
+
+ this.initialConditionIdCounter++;
+
+ return filterComponent;
+ }
+
+ public FilterComponent withInitialFilter(
+ final FilterField filterField,
+ final FilterComparator selectedCondition,
+ final String searchQuery,
+ final boolean conditionDeletable,
+ final boolean conditionEditable,
+ final CustomizationDegree customizationDegree)
+ {
+ final FilterComponent filterComponent =
+ this.withInitialFilter(
+ filterField,
+ selectedCondition,
+ searchQuery,
+ conditionDeletable,
+ conditionEditable,
+ customizationDegree,
String.valueOf(this.initialConditionIdCounter));
this.initialConditionIdCounter++;
diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java
index de5049a..80a2a7f 100644
--- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java
+++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java
@@ -30,6 +30,8 @@ public class ChipBadgeExtension extends ChipBadge
protected final Button btnEdit = new Button(VaadinIcon.PENCIL.create());
+ private CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING;
+
public ChipBadgeExtension(final T item)
{
super(item);
@@ -76,6 +78,16 @@ public boolean isBtnDeleteEnabled()
return this.btnDelete.isEnabled();
}
+ public CustomizationDegree getCustomizationRating()
+ {
+ return this.customizationDegree;
+ }
+
+ public void setCustomizationRating(final CustomizationDegree customizationDegree)
+ {
+ this.customizationDegree = customizationDegree;
+ }
+
public Registration addBtnEditClickListener(final ComponentEventListener> listener)
{
return this.btnEdit.addClickListener(listener);
diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java
new file mode 100644
index 0000000..8e5f23f
--- /dev/null
+++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2024 XDEV Software (https://xdev.software)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package software.xdev.vaadin.model;
+
+/**
+ * When editing a condition, the developer can specify how much of the condition can be edited.
+ */
+public enum CustomizationDegree
+{
+ EVERYTHING,
+ CONDITION_AND_INPUT_VALUE,
+ INPUT_VALUE
+}
diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java
new file mode 100644
index 0000000..40e3341
--- /dev/null
+++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright © 2024 XDEV Software (https://xdev.software)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package software.xdev.vaadin.utl;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import software.xdev.vaadin.model.ChipBadge;
+import software.xdev.vaadin.model.ChipBadgeExtension;
+import software.xdev.vaadin.model.FilterCondition;
+
+
+public final class FilterComponentUtl
+{
+ public FilterComponentUtl()
+ {
+ }
+
+ /**
+ * Check if the lists contains the same chip badges objects
+ *
+ * @param one List one
+ * @param two List two
+ * @return True if the lists contains the same objects
+ */
+ public boolean equalLists(
+ final List>> one,
+ final List>> two)
+ {
+ return one.stream()
+ .map(ChipBadge::getBadgeId)
+ .collect(Collectors.toSet())
+ .equals(two.stream()
+ .map(ChipBadge::getBadgeId)
+ .collect(Collectors.toSet()));
+ }
+}