Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIRadioButtons.java |
---|
13,6 → 13,9 |
package org.openconcerto.ui.light; |
import java.io.IOException; |
import java.io.ObjectInput; |
import java.io.ObjectOutput; |
import java.util.ArrayList; |
import java.util.List; |
22,6 → 25,10 |
public class LightUIRadioButtons extends LightUserControl { |
private final List<String> choices = new ArrayList<>(); |
public LightUIRadioButtons() { |
// Serialization |
} |
// Init from json constructor |
public LightUIRadioButtons(final JSONObject json) { |
super(json); |
86,13 → 93,22 |
} |
@Override |
public JSONToLightUIConvertor getConvertor() { |
return new JSONToLightUIConvertor() { |
public void writeExternal(ObjectOutput out) throws IOException { |
super.writeExternal(out); |
out.writeInt(this.choices.size()); |
for (String c : this.choices) { |
out.writeUTF(c); |
} |
} |
@Override |
public LightUIElement convert(final JSONObject json) { |
return new LightUIRadioButtons(json); |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { |
super.readExternal(in); |
int size = in.readInt(); |
this.choices.clear(); |
for (int i = 0; i < size; i++) { |
this.choices.add(in.readUTF()); |
} |
}; |
} |
@Override |