OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 143 → Rev 144

/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUITable.java
45,7 → 45,7
private Boolean autoSelectFirstLine = true;
private TableSpec tableSpec = null;
 
private List<ActionListener> selectionListeners = new ArrayList<ActionListener>();
private transient List<ActionListener> selectionListeners = new ArrayList<ActionListener>();
 
// Nombre de ligne à afficher par Row
private int linePerRow = 1;
246,6 → 246,7
return selectedRows;
}
 
@Override
public final boolean replaceChild(final LightUIElement pChild) {
pChild.setReadOnly(this.isReadOnly());
 
280,11 → 281,7
return false;
}
 
public final LightUIElement findElement(final String searchParam, final boolean byUUID) {
return this.findElement(searchParam, byUUID, LightUIElement.class);
}
 
public final <T extends LightUIElement> T findElement(final String searchParam, final boolean byUUID, final Class<T> objectClass) {
public final <T extends LightUIElement> T findElementByID(final String searchParam, final Class<T> objectClass) {
if (this.hasRow()) {
 
for (int i = 0; i < this.getRowsCount(); i++) {
293,14 → 290,14
for (final Object value : rowValues) {
if (value instanceof LightUIContainer) {
final LightUIContainer panel = (LightUIContainer) value;
final T element = panel.findChild(searchParam, byUUID, objectClass);
final T element = panel.findChildByID(searchParam, objectClass);
if (element != null) {
return element;
}
} else if (value instanceof LightUIElement) {
final LightUIElement element = (LightUIElement) value;
if (byUUID) {
if (element.getUUID().equals(searchParam)) {
 
if (element.getId().equals(searchParam)) {
if (objectClass.isAssignableFrom(element.getClass())) {
return objectClass.cast(element);
} else {
308,8 → 305,39
"Element found at is not an instance of " + objectClass.getName() + ", element class: " + element.getClass().getName() + " element ID: " + element.getId());
}
}
 
if (element instanceof LightUITable) {
final T resultElement = ((LightUITable) element).findElementByID(searchParam, objectClass);
if (resultElement != null) {
return resultElement;
}
}
}
}
}
} else {
if (element.getId().equals(searchParam)) {
System.out.println("LightUITable.findElementByID() - No rows for table: " + this.getId());
}
return null;
}
 
public final <T extends LightUIElement> T findElementByUUID(final String searchParam, final Class<T> objectClass) {
if (this.hasRow()) {
 
for (int i = 0; i < this.getRowsCount(); i++) {
final Row row = this.getRow(i);
final List<Object> rowValues = row.getValues();
for (final Object value : rowValues) {
if (value instanceof LightUIContainer) {
final LightUIContainer panel = (LightUIContainer) value;
final T element = panel.findChildByUUID(searchParam, objectClass);
if (element != null) {
return element;
}
} else if (value instanceof LightUIElement) {
final LightUIElement element = (LightUIElement) value;
 
if (element.getUUID().equals(searchParam)) {
if (objectClass.isAssignableFrom(element.getClass())) {
return objectClass.cast(element);
} else {
317,10 → 345,9
"Element found at is not an instance of " + objectClass.getName() + ", element class: " + element.getClass().getName() + " element ID: " + element.getId());
}
}
}
 
if (element instanceof LightUITable) {
final T resultElement = ((LightUITable) element).findElement(searchParam, byUUID, objectClass);
final T resultElement = ((LightUITable) element).findElementByUUID(searchParam, objectClass);
if (resultElement != null) {
return resultElement;
}
329,7 → 356,7
}
}
} else {
System.out.println("LightUITable.getElementById() - No rows for table: " + this.getId());
System.out.println("LightUITable.findElementByUUID() - No rows for table: " + this.getId());
}
return null;
}
530,17 → 557,16
}
}
} else {
throw new IllegalArgumentException("Impossible to find row: " + rowId.toString());
final List<Number> ids = new ArrayList<Number>(size);
for (int j = 0; j < size; j++) {
ids.add(this.getRow(j).getId());
}
throw new IllegalArgumentException("Impossible to find row: " + rowId.toString() + " known table row ids :" + ids);
}
}
}
}
}
 
@Override
public LightUIElement clone() {
return new LightUITable(this);
}
 
@Override
575,7 → 601,7
this.autoSelectFirstLine = JSONConverter.getParameterFromJSON(json, AUTO_SELECT_FIRST_LINE, Boolean.class, true);
this.linePerRow = JSONConverter.getParameterFromJSON(json, LINE_PER_ROW, Integer.class);
 
final JSONObject jsonRawContent = (JSONObject) JSONConverter.getParameterFromJSON(json, TABLE_SPEC, JSONObject.class);
final JSONObject jsonRawContent = JSONConverter.getParameterFromJSON(json, TABLE_SPEC, JSONObject.class);
 
if (jsonRawContent != null) {
this.tableSpec = new TableSpec(jsonRawContent);