-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c0584a
commit 9f7a92f
Showing
14 changed files
with
43 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.manydesigns.elements; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Angelo Lupo - [email protected] | ||
* @author Giampiero Granatella - [email protected] | ||
|
@@ -14,5 +16,6 @@ public interface KeyValueAccessor { | |
void set(String name, Object value); | ||
boolean has(String name); | ||
|
||
KeyValueAccessor inner(Object value); | ||
KeyValueAccessor object(String name); | ||
List<KeyValueAccessor> list(String name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,4 @@ public SearchField findSearchFieldByPropertyName(String propertyName) { | |
} | ||
return null; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
import java.lang.reflect.Array; | ||
import java.util.*; | ||
|
||
/* | ||
/** A form with multiple rows, where a row is a collection of fields. Every row has the same fields. | ||
* @author Paolo Predonzani - [email protected] | ||
* @author Angelo Lupo - [email protected] | ||
* @author Giampiero Granatella - [email protected] | ||
|
@@ -52,7 +52,7 @@ public class TableForm implements Element { | |
protected String selectInputName = "select"; | ||
|
||
protected final Column[] columns; | ||
protected final List<Row> rows = new ArrayList<>(); | ||
protected List<Row> rows = new ArrayList<>(); | ||
|
||
protected String prefix; | ||
|
||
|
@@ -187,34 +187,26 @@ public boolean isValid() { | |
|
||
public void readFromObject(Object obj) { | ||
Class clazz = obj.getClass(); | ||
if (clazz.isArray()) { // Tratta obj come un array | ||
// Scorre tutti gli ellementi dell'array obj, | ||
// indipendentemente da quante righe ci sono nell table form. | ||
// Eventualmente lancia Eccezione. | ||
if (clazz.isArray()) { | ||
final int arrayLength = Array.getLength(obj); | ||
rows = new ArrayList<>(arrayLength); | ||
for (int i = 0; i < arrayLength; i++) { | ||
Object currentObj = Array.get(obj, i); | ||
rows[i].readFromObject(currentObj); | ||
} | ||
|
||
// Scorre le rimanenti righe del table form, | ||
// passano null come ottetto di bind. | ||
for (int i = arrayLength; i < rows.length; i++) { | ||
rows[i].readFromObject(null); | ||
Row row = new Row(i); | ||
rows.add(row); | ||
row.readFromObject(currentObj); | ||
} | ||
} else if (Collection.class.isAssignableFrom(clazz)) { | ||
// Tratta obj come collection | ||
Collection collection = (Collection)obj; | ||
|
||
Collection collection = (Collection) obj; | ||
rows = new ArrayList<>(collection.size()); | ||
int i = 0; | ||
for (Object currentObj : collection) { | ||
rows[i].readFromObject(currentObj); | ||
Row row = new Row(i); | ||
rows.add(row); | ||
row.readFromObject(currentObj); | ||
i++; | ||
} | ||
|
||
for (; i < rows.length; i++) { | ||
rows[i].readFromObject(null); | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters