Search in sources :

Example 1 with ItemSetChangeEvent

use of com.vaadin.v7.data.Container.ItemSetChangeEvent in project SORMAS-Project by hzi-braunschweig.

the class AbstractTableField method initContent.

@Override
protected Component initContent() {
    this.addStyleName(CssStyles.CAPTION_HIDDEN);
    this.addStyleName(CssStyles.VSPACE_2);
    layout = new VerticalLayout();
    layout.setSpacing(false);
    layout.setMargin(false);
    HorizontalLayout headerLayout = new HorizontalLayout();
    {
        headerLayout.setWidth(100, Unit.PERCENTAGE);
        captionLabel = new Label(getCaption());
        captionLabel.setSizeUndefined();
        headerLayout.addComponent(captionLabel);
        headerLayout.setComponentAlignment(captionLabel, Alignment.BOTTOM_LEFT);
        headerLayout.setExpandRatio(captionLabel, 0);
        addButton = createAddButton();
        headerLayout.addComponent(addButton);
        headerLayout.setComponentAlignment(addButton, Alignment.BOTTOM_RIGHT);
        headerLayout.setExpandRatio(addButton, 1);
    }
    layout.addComponent(headerLayout);
    table = createTable();
    table.addItemSetChangeListener(new ItemSetChangeListener() {

        @Override
        public void containerItemSetChange(ItemSetChangeEvent event) {
            applyTablePageLength();
        }
    });
    layout.addComponent(table);
    return layout;
}
Also used : ItemSetChangeListener(com.vaadin.v7.data.Container.ItemSetChangeListener) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ItemSetChangeEvent(com.vaadin.v7.data.Container.ItemSetChangeEvent) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ItemSetChangeEvent (com.vaadin.v7.data.Container.ItemSetChangeEvent)1 ItemSetChangeListener (com.vaadin.v7.data.Container.ItemSetChangeListener)1