Skip to content

Commit efd09a5

Browse files
committed
Merge branch 'develop'
2 parents 0368355 + a61cd7b commit efd09a5

File tree

7 files changed

+85
-7
lines changed

7 files changed

+85
-7
lines changed

docgen/parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"title" : "Venus (Fugerit Document Generation Framework)",
33
"name": "Venus",
4-
"version" : "0.5.6",
5-
"date" : "05/12/2022",
4+
"version" : "0.5.7",
5+
"date" : "09/12/2022",
66
"organization" : {
77
"name" : "Fugerit Org",
88
"url" : "https://www.fugerit.org"

docgen/release-notes.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
0.5.6 (2022-12-05)
1+
0.5.7 (2022-12-09)
2+
------------------
3+
+ Updated fj-core version to 0.8.4
4+
+ Updated fj-bom version to 0.2.3
5+
+ Added facade for creating new SimpleTable
6+
7+
0.5.6 (2022-12-05)
28
------------------
39
+ Changed base path of freemarker config to avoid conflict
410
+ Changed base path of mod fop config to avoid conflict

fj-doc-lib-simpletable/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This module is already configured, and can be called just creating the model of
2020
DocTypeHandler handler = ...
2121
2222
// the table model
23-
SimpleTable simpleTableModel = new SimpleTable( "30;30;40" );
23+
SimpleTable simpleTableModel = SimpleTableFacade.newTable( 30, 30, 40 );
2424
SimpleRow headerRow = new SimpleRow( BooleanUtils.BOOLEAN_TRUE );
2525
headerRow.addCell( "Name" );
2626
headerRow.addCell( "Surname" );
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package org.fugerit.java.doc.lib.simpletable;
2+
3+
import java.util.Arrays;
4+
import java.util.List;
5+
import java.util.stream.Collectors;
6+
7+
import org.fugerit.java.core.cfg.ConfigRuntimeException;
8+
import org.fugerit.java.core.lang.helpers.StringUtils;
9+
import org.fugerit.java.doc.lib.simpletable.model.SimpleTable;
10+
11+
public class SimpleTableFacade {
12+
13+
/**
14+
* Creates a new {@link SimpleTable}
15+
*
16+
* A minimum of one column must be provided.
17+
* Sum of column widths must be 100
18+
*
19+
* @param colWidths columns width percentage (minimum column width must be 1, sum must be 100)
20+
* @return the new table model initialized
21+
*/
22+
public static SimpleTable newTable( Integer... colWidths ) {
23+
if ( colWidths == null ) {
24+
throw new ConfigRuntimeException( "Minimum one colunm must be provided" );
25+
}
26+
return newTable( Arrays.asList( colWidths ) );
27+
}
28+
29+
/**
30+
* Creates a new {@link SimpleTable}
31+
*
32+
* A minimum of one column must be provided.
33+
* Sum of column widths must be 100
34+
*
35+
* @param colWidths columns width percentage (minimum column width must be 1, sum must be 100)
36+
* @return the new table model initialized
37+
*/
38+
public static SimpleTable newTable( List<Integer> colWidths ) {
39+
if ( colWidths == null ) {
40+
throw new ConfigRuntimeException( "Minimum one colunm must be provided" );
41+
} else {
42+
int sum = 0;
43+
for ( int v : colWidths ) {
44+
sum+=v;
45+
}
46+
if ( sum != 100 ) {
47+
throw new ConfigRuntimeException( "Column width sum must be 100, while is : "+sum );
48+
}
49+
}
50+
return new SimpleTable( StringUtils.concat( ";" , colWidths.stream().map( v -> v.toString() ).collect( Collectors.toList() ) ) );
51+
}
52+
53+
/**
54+
* Creates a new {@link SimpleTable} , made of a single column with width 100.
55+
*
56+
* @return the new table model initialized
57+
*/
58+
public static SimpleTable newTableSingleColumn() {
59+
return newTable( 100 );
60+
}
61+
62+
}

fj-doc-lib-simpletable/src/main/java/org/fugerit/java/doc/lib/simpletable/model/SimpleTable.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6+
import org.fugerit.java.doc.lib.simpletable.SimpleTableFacade;
7+
68
public class SimpleTable {
79

810
public static final String ATT_NAME = "simpleTableModel";
@@ -19,6 +21,13 @@ public List<SimpleRow> getRows() {
1921
return rows;
2022
}
2123

24+
/**
25+
* Creates a new SimpleTable.
26+
*
27+
* NOTE: betteer using the factory method in {@link SimpleTableFacade}
28+
*
29+
* @param colwidths the semicolons separeted columns widh in percentage
30+
*/
2231
public SimpleTable( String colwidths ) {
2332
this.rows = new ArrayList<SimpleRow>();
2433
this.columns = String.valueOf( colwidths.split( ";" ).length );

fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/simpletable/TestSimpleTable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.fugerit.java.core.lang.helpers.BooleanUtils;
1010
import org.fugerit.java.doc.base.config.DocTypeHandler;
1111
import org.fugerit.java.doc.lib.simpletable.SimpleTableDocConfig;
12+
import org.fugerit.java.doc.lib.simpletable.SimpleTableFacade;
1213
import org.fugerit.java.doc.lib.simpletable.model.SimpleRow;
1314
import org.fugerit.java.doc.lib.simpletable.model.SimpleTable;
1415
import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler;
@@ -37,7 +38,7 @@ public void init() throws ConfigException {
3738

3839
@Test
3940
public void testSimpleTable01() {
40-
SimpleTable simpleTableModel = new SimpleTable( "30;30;40" );
41+
SimpleTable simpleTableModel = SimpleTableFacade.newTable( 30, 30, 40 );
4142
SimpleRow headerRow = new SimpleRow( BooleanUtils.BOOLEAN_TRUE );
4243
headerRow.addCell( "Name" );
4344
headerRow.addCell( "Surname" );

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.fugerit.java</groupId>
77
<artifactId>fj-bom</artifactId>
8-
<version>0.2.2</version>
8+
<version>0.2.3</version>
99
<relativePath></relativePath>
1010
</parent>
1111

@@ -24,7 +24,7 @@
2424
<maven.compiler.source>${java-version-compliance}</maven.compiler.source>
2525
<maven.compiler.target>${java-version-compliance}</maven.compiler.target>
2626
<!-- fj java versions -->
27-
<fj-version>0.8.0</fj-version>
27+
<fj-version>0.8.4</fj-version>
2828
<fj-doc-version>${project.version}</fj-doc-version>
2929
</properties>
3030

0 commit comments

Comments
 (0)