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
79 changes: 15 additions & 64 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>twincolgrid</artifactId>
<version>3.2.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<name>TwinColGrid add-on</name>
<description>Dual list component based on Vaadin Grids</description>
<url>https://www.flowingcode.com/en/open-source/</url>

<properties>
<vaadin.version>14.11.13</vaadin.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<vaadin.version>24.9.8</vaadin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jetty.version>9.4.36.v20210114</jetty.version>
<jetty.version>11.0.26</jetty.version>
</properties>
<organization>
<name>Flowing Code</name>
Expand Down Expand Up @@ -128,11 +128,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -142,7 +142,7 @@
<dependency>
<groupId>com.flowingcode.vaadin.addons.demo</groupId>
<artifactId>commons-demo</artifactId>
<version>3.8.0</version>
<version>5.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -156,6 +156,10 @@
<configuration>
<licenseName>apache_v2</licenseName>
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
<excludes>
<exclude>main/bundles/**</exclude>
<exclude>main/frontend/**</exclude>
</excludes>
</configuration>
</plugin>

Expand Down Expand Up @@ -351,47 +355,6 @@
</plugins>
</build>
</profile>

<profile>
<id>v23</id>
<properties>
<vaadin.version>23.3.5</vaadin.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</profile>

<profile>
<id>v24</id>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<vaadin.version>24.2.6</vaadin.version>
<jetty.version>11.0.12</jetty.version>
</properties>
<repositories>
<repository>
<id>vaadin-prerelease</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prerelease</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>


<profile>
<id>release</id>
Expand All @@ -416,23 +379,11 @@
<jetty.version>11.0.26</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>com.flowingcode.vaadin.addons.demo</groupId>
<artifactId>commons-demo</artifactId>
<version>5.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-dev</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*-
* #%L
* TwinColGrid add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code
* %%
* 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.
* #L%
*/
package com.flowingcode.vaadin.addons.twincolgrid;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* https://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.
*/

import lombok.experimental.UtilityClass;

@UtilityClass
class CharSequenceUtils {

/**
* Green implementation of regionMatches.
*
* @param cs the {@link CharSequence} to be processed
* @param ignoreCase whether or not to be case-insensitive
* @param thisStart the index to start on the {@code cs} CharSequence
* @param substring the {@link CharSequence} to be looked for
* @param start the index to start on the {@code substring} CharSequence
* @param length character length of the region
* @return whether the region matched
* @see String#regionMatches(boolean, int, String, int, int)
*/
static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
final CharSequence substring, final int start, final int length) {
if (cs instanceof String && substring instanceof String) {
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
}
int index1 = thisStart;
int index2 = start;
int tmpLen = length;

// Extract these first so we detect NPEs the same as the java.lang.String version
final int srcLen = cs.length() - thisStart;
final int otherLen = substring.length() - start;

// Check for invalid parameters
if (thisStart < 0 || start < 0 || length < 0) {
return false;
}

// Check that the regions are long enough
if (srcLen < length || otherLen < length) {
return false;
}

while (tmpLen-- > 0) {
final char c1 = cs.charAt(index1++);
final char c2 = substring.charAt(index2++);

if (c1 == c2) {
continue;
}

if (!ignoreCase) {
return false;
}

// The real same check as in String#regionMatches(boolean, int, String, int, int):
final char u1 = Character.toUpperCase(c1);
final char u2 = Character.toUpperCase(c2);
if (u1 != u2 && Character.toLowerCase(u1) != Character.toLowerCase(u2)) {
return false;
}
}

return true;
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*-
* #%L
* TwinColGrid add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code
* %%
* 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.
* #L%
*/
package com.flowingcode.vaadin.addons.twincolgrid;

import com.vaadin.flow.component.Component;
Expand Down Expand Up @@ -118,9 +137,9 @@ public FilterableTwinColumn<T> setFooter(Supplier<Component> footerComponentSupp
}

@Override
public FilterableTwinColumn<T> setClassNameGenerator(
SerializableFunction<T, String> classNameGenerator) {
super.setClassNameGenerator(classNameGenerator);
public FilterableTwinColumn<T> setPartNameGenerator(
SerializableFunction<T, String> partNameGenerator) {
super.setPartNameGenerator(partNameGenerator);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*-
* #%L
* TwinColGrid add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code
* %%
* 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.
* #L%
*/
package com.flowingcode.vaadin.addons.twincolgrid;

import com.vaadin.flow.component.ItemLabelGenerator;
Expand All @@ -11,7 +30,18 @@
import java.util.function.Supplier;
import lombok.NonNull;

/** Implementation of {@code TwinColGrid} with deprecated methods from version 2.9.0. */
/**
* Implementation of {@code TwinColGrid} with deprecated methods from version 2.9.0.
* <p>
* This class was introduced in version 3.0.0 to maintain backward compatibility with the API from
* the previous major version. It facilitates migration by hosting methods that were removed or
* changed in the primary implementation.
* </p>
*
* @deprecated As of 3.0.0, this class exists only for migration purposes. New projects should use
* {@code TwinColGrid} directly.
* @param <T> the type of items in the grid
*/
@SuppressWarnings("serial")
@Deprecated
public class LegacyTwinColGrid<T> extends TwinColGrid<T> {
Expand Down Expand Up @@ -71,7 +101,7 @@ public LegacyTwinColGrid(@NonNull Grid<T> availableGrid, @NonNull Grid<T> select
* Constructs a new empty TwinColGrid with caption
*
* @param caption the component caption
* @deprecated Use {@link TwinColGrid#TwinColGrid()} and {{@link #setCaption(String)}
* @deprecated Use {@link TwinColGrid#TwinColGrid()} and {@link #setCaption(String)}
*/
@Deprecated
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -148,7 +178,7 @@ public LegacyTwinColGrid(
* @param caption the caption to set, can be {@code null}
* @param options the options, cannot be {@code null}
* @deprecated Use {@link TwinColGrid#TwinColGrid(Collection)} and
* {{@link TwinColGrid#setCaption(String)}
* {@link TwinColGrid#setCaption(String)}
*/
@Deprecated
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*-
* #%L
* TwinColGrid add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code
* %%
* 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.
* #L%
*/
package com.flowingcode.vaadin.addons.twincolgrid;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* https://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.
*/

import lombok.experimental.UtilityClass;

@UtilityClass
class StringUtils {

public static boolean containsIgnoreCase(String str, String searchStr) {
if (str == null || searchStr == null) {
return false;
}
final int len = searchStr.length();
final int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (CharSequenceUtils.regionMatches(str, true, i, searchStr, 0, len)) {
return true;
}
}
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;

@SuppressWarnings("serial")
@JsModule(value = "./src/fc-twin-col-grid-auto-resize.js")
Expand Down
Loading
Loading