Example usage for com.vaadin.ui GridLayout removeAllComponents

List of usage examples for com.vaadin.ui GridLayout removeAllComponents

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout removeAllComponents.

Prototype

@Override
    public void removeAllComponents() 

Source Link

Usage

From source file:com.scipionyx.butterflyeffect.frontend.configuration.ui.view.AboutView.java

License:Apache License

/**
 * /*  ww  w. j a  va 2 s.  c  o m*/
 * @param instancesBackend
 * @param justclean
 */
private void loadClusterInformation(List<ServiceInstance> instancesBackend, GridLayout layout,
        boolean justclean) {

    layout.removeAllComponents();

    int i = 0;
    for (ServiceInstance instance : instancesBackend) {

        Grid<GridProperty<?>> tableCluster = new Grid<>("Node [" + i + "]");
        tableCluster.addStyleName(ValoTheme.TABLE_COMPACT);
        tableCluster.setSizeFull();

        tableCluster.addColumn(GridProperty::getName).setCaption("Property");
        tableCluster.addColumn(GridProperty::getValue).setCaption("Value");

        List<GridProperty<?>> list = new ArrayList<>();
        list.add(new GridProperty<>("Host", instance.getHost()));
        list.add(new GridProperty<>("Service Id", instance.getServiceId()));
        list.add(new GridProperty<>("Port", instance.getPort()));
        list.add(new GridProperty<>("Uri", instance.getUri()));

        for (String key : instance.getMetadata().keySet()) {
            list.add(new GridProperty<>("Metadata[" + key + "]", instance.getMetadata().get(key)));
        }

        tableCluster.setItems(list);

        layout.addComponent(tableCluster);

        i++;

    }

}