OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 155 → Rev 156

/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUITable.java
18,6 → 18,10
 
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
 
29,7 → 33,7
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
 
public class LightUITable extends LightUserControlContainer {
public class LightUITable extends LightUserControlContainer implements Externalizable {
 
public static final int DEFAULT_LINE_HEIGHT = 40;
 
52,6 → 56,10
 
private int lineHeight = DEFAULT_LINE_HEIGHT;
 
public LightUITable() {
// Serialization
}
 
// Init from json constructor
public LightUITable(final JSONObject json) {
super(json);
186,6 → 194,10
return this.getTableSpec().getContent().setRow(index, row);
}
 
public final void insertRow(final int index, final Row row) {
this.getTableSpec().getContent().insertRow(index, row);
}
 
public final boolean addRow(final Row row) {
return this.getTableSpec().getContent().addRow(row);
}
224,7 → 236,7
}
 
public final void clearSelection(final boolean fire) {
this.getTableSpec().getSelection().getIds().clear();
this.getTableSpec().getSelection().clear();
if (fire) {
this.fireSelectionChange();
}
491,23 → 503,13
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(final JSONObject json) {
return new LightUITable(json);
}
};
}
 
@Override
public void _setValueFromContext(final Object value) {
if (value != null) {
final JSONArray jsonContext = (JSONArray) JSONConverter.getObjectFromJSON(value, JSONArray.class);
final JSONArray jsonContext = JSONConverter.getObjectFromJSON(value, JSONArray.class);
final ColumnsSpec columnsSpec = this.getTableSpec().getColumns();
final int columnsCount = columnsSpec.getColumnCount();
 
final List<Integer> editorsIndex = new ArrayList<Integer>();
final List<Integer> editorsIndex = new ArrayList<>();
 
for (int i = 0; i < columnsCount; i++) {
final ColumnSpec columnSpec = columnsSpec.getColumn(i);
609,6 → 611,29
}
 
@Override
public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
 
out.writeBoolean(dynamicLoad);
out.writeBoolean(allowSelection);
out.writeBoolean(allowMultiSelection);
out.writeBoolean(autoSelectFirstLine);
tableSpec.writeExternal(out);
 
}
 
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
this.dynamicLoad = in.readBoolean();
this.allowSelection = in.readBoolean();
this.allowMultiSelection = in.readBoolean();
this.autoSelectFirstLine = in.readBoolean();
tableSpec = new TableSpec();
tableSpec.readExternal(in);
}
 
@Override
public void destroy() {
super.destroy();
this.selectionListeners.clear();