Search in sources :

Example 6 with Form

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);
}
Also used : Form(org.apache.pivot.wtk.Form)

Example 7 with Form

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();
}
Also used : Form(org.apache.pivot.wtk.Form) Label(org.apache.pivot.wtk.Label) Point(org.apache.pivot.wtk.Point)

Example 8 with Form

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());
}
Also used : Form(org.apache.pivot.wtk.Form) Point(org.apache.pivot.wtk.Point) Separator(org.apache.pivot.wtk.Separator)

Example 9 with Form

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();
}
Also used : Form(org.apache.pivot.wtk.Form) Label(org.apache.pivot.wtk.Label) Component(org.apache.pivot.wtk.Component) Point(org.apache.pivot.wtk.Point)

Example 10 with Form

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();
}
Also used : Form(org.apache.pivot.wtk.Form) Point(org.apache.pivot.wtk.Point)

Aggregations

Form (org.apache.pivot.wtk.Form)15 Point (org.apache.pivot.wtk.Point)14 Label (org.apache.pivot.wtk.Label)10 Component (org.apache.pivot.wtk.Component)8 Separator (org.apache.pivot.wtk.Separator)7 Dimensions (org.apache.pivot.wtk.Dimensions)3 BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 ArrayList (org.apache.pivot.collections.ArrayList)1 Bounds (org.apache.pivot.wtk.Bounds)1 MessageType (org.apache.pivot.wtk.MessageType)1 Image (org.apache.pivot.wtk.media.Image)1