Skip to content

Commit

Permalink
Merge pull request #12 from spacious-team/develop
Browse files Browse the repository at this point in the history
Релиз 2022.4
  • Loading branch information
vananiev authored Mar 20, 2022
2 parents 4b40e99 + c1dcbd1 commit 5cc4eb7
Show file tree
Hide file tree
Showing 9 changed files with 483 additions and 79 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>org.spacious-team</groupId>
<artifactId>table-wrapper-api</artifactId>
<version>2022.2</version>
<version>2022.4</version>
<packaging>jar</packaging>

<name>Table Wrapper API</name>
Expand Down Expand Up @@ -56,14 +56,14 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<version>1.18.22</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<version>1.7.36</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ public TableRow next() {
@Override
public TableRow findRow(Object value) {
TableCellAddress address = reportPage.find(value);
return getMutableTableRow(address);
}

@Override
public TableRow findRowByPrefix(String prefix) {
TableCellAddress address = reportPage.findByPrefix(prefix);
return getMutableTableRow(address);
}

private MutableTableRow<R> getMutableTableRow(TableCellAddress address) {
if (tableRange.contains(address)) {
MutableTableRow<R> tableRow = new MutableTableRow<>(this, getCellDataAccessObject());
tableRow.setRow(reportPage.getRow(address.getRow()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public int getLastCellNum() {
}

@Override
public boolean rowContains(Object value) {
return row.rowContains(value);
public boolean rowContains(Object expected) {
return row.rowContains(expected);
}

@Override
Expand Down
247 changes: 212 additions & 35 deletions src/main/java/org/spacious_team/table_wrapper/api/ReportPage.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Table Wrapper API
* Copyright (C) 2022 Vitalii Ananev <spacious-team@ya.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.spacious_team.table_wrapper.api;

import java.util.function.Predicate;

class ReportPageHelper {

static Predicate<Object> getCellStringValueIgnoreCasePrefixPredicate(String prefix) {
String lowercasePrefix = prefix.trim().toLowerCase();
return (cell) -> (cell instanceof String) &&
((String) cell).trim().toLowerCase().startsWith(lowercasePrefix);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ public interface ReportPageRow extends Iterable<TableCell> {
*/
int getLastCellNum();

boolean rowContains(Object value);
/**
* @param expected searching value
* @return true if any cell of this row has exact value, false otherwise
*/
boolean rowContains(Object expected);
}
7 changes: 6 additions & 1 deletion src/main/java/org/spacious_team/table_wrapper/api/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ <T> List<T> getDataCollection(Object report, Function<TableRow, Collection<T>> r
Stream<TableRow> stream();

/**
* @return row containing given value or null if not found
* @return row containing cell with exact value or null if not found
*/
TableRow findRow(Object value);

/**
* @return row containing cell starting with prefix or null if not found
*/
TableRow findRowByPrefix(String prefix);

Map<TableColumn, Integer> getHeaderDescription();

/**
Expand Down
Loading

0 comments on commit 5cc4eb7

Please sign in to comment.