use of org.apache.pivot.wtk.Form in project pivot by apache.
the class TerraFormSkin method fieldsRemoved.
@Override
public void fieldsRemoved(Form.Section section, int index, Sequence<Component> fields) {
Form form = (Form) getComponent();
removeFields(form.getSections().indexOf(section), index, fields);
}
use of org.apache.pivot.wtk.Form in project pivot by apache.
the class TerraFormSkin method insertField.
private void insertField(Form.Section section, Component field, int index) {
Form form = (Form) getComponent();
int sectionIndex = form.getSections().indexOf(section);
// Create the label
Label label = new Label();
labels.get(sectionIndex).insert(label, index);
form.add(label);
// Add mouse listener
field.getComponentMouseListeners().add(fieldMouseListener);
// Update the field label
updateFieldLabel(section, index);
invalidateComponent();
}
use of org.apache.pivot.wtk.Form in project pivot by apache.
the class TerraFormSkin method updateSectionHeading.
private void updateSectionHeading(Form.Section section) {
Form form = (Form) getComponent();
int sectionIndex = form.getSections().indexOf(section);
Separator separator = separators.get(sectionIndex);
separator.setHeading(section.getHeading());
}
use of org.apache.pivot.wtk.Form in project pivot by apache.
the class TerraFormSkin method removeFields.
private void removeFields(int sectionIndex, int index, Sequence<Component> removed) {
Form form = (Form) getComponent();
int count = removed.getLength();
// Remove the labels
Sequence<Label> removedLabels = labels.get(sectionIndex).remove(index, count);
for (int i = 0; i < count; i++) {
form.remove(removedLabels.get(i));
// Remove mouse listener
Component field = removed.get(i);
field.getComponentMouseListeners().remove(fieldMouseListener);
}
invalidateComponent();
}
use of org.apache.pivot.wtk.Form in project pivot by apache.
the class TerraFormSkin method setDelimiter.
public void setDelimiter(String delimiter) {
Utils.checkNull(delimiter, "delimiter");
this.delimiter = delimiter;
Form form = (Form) getComponent();
Form.SectionSequence sections = form.getSections();
for (int i = 0, n = sections.getLength(); i < n; i++) {
Form.Section section = sections.get(i);
for (int j = 0, m = section.getLength(); j < m; j++) {
updateFieldLabel(section, j);
}
}
invalidateComponent();
}
Aggregations