Example usage for com.vaadin.ui Alignment BOTTOM_CENTER

List of usage examples for com.vaadin.ui Alignment BOTTOM_CENTER

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment BOTTOM_CENTER.

Prototype

Alignment BOTTOM_CENTER

To view the source code for com.vaadin.ui Alignment BOTTOM_CENTER.

Click Source Link

Usage

From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java

License:Open Source License

/**
 * Creates the west area layout including the
 * accordion and tree views.//from   w w w . j  a v a2  s  .  c o m
 * 
 * @return
 */
@SuppressWarnings("serial")
private Layout createWestLayout() {
    m_tree = createTree();

    final TextField filterField = new TextField("Filter");
    filterField.setTextChangeTimeout(200);

    final Button filterBtn = new Button("Filter");
    filterBtn.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            GCFilterableContainer container = m_tree.getContainerDataSource();
            container.removeAllContainerFilters();

            String filterString = (String) filterField.getValue();
            if (!filterString.equals("") && filterBtn.getCaption().toLowerCase().equals("filter")) {
                container.addContainerFilter(LABEL_PROPERTY, (String) filterField.getValue(), true, false);
                filterBtn.setCaption("Clear");
            } else {
                filterField.setValue("");
                filterBtn.setCaption("Filter");
            }

        }
    });

    HorizontalLayout filterArea = new HorizontalLayout();
    filterArea.addComponent(filterField);
    filterArea.addComponent(filterBtn);
    filterArea.setComponentAlignment(filterBtn, Alignment.BOTTOM_CENTER);

    m_treeAccordion = new Accordion();
    m_treeAccordion.addTab(m_tree, m_tree.getTitle());
    m_treeAccordion.setWidth("100%");
    m_treeAccordion.setHeight("100%");

    AbsoluteLayout absLayout = new AbsoluteLayout();
    absLayout.setWidth("100%");
    absLayout.setHeight("100%");
    absLayout.addComponent(filterArea, "top: 25px; left: 15px;");
    absLayout.addComponent(m_treeAccordion, "top: 75px; left: 15px; right: 15px; bottom:25px;");

    return absLayout;
}

From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceEditWindow.java

License:Open Source License

/**
 * Constructor//from  w  w w.ja v  a2s.c o m
 *
 * @param businessService the Business Service DTO instance to be configured
 */
@SuppressWarnings("unchecked")
public BusinessServiceEditWindow(BusinessService businessService,
        BusinessServiceManager businessServiceManager) {
    /**
     * set window title...
     */
    super("Business Service Edit");

    m_businessService = businessService;

    /**
     * ...and basic properties
     */
    setModal(true);
    setClosable(false);
    setResizable(false);
    setWidth(650, Unit.PIXELS);
    setHeight(550, Unit.PIXELS);

    /**
     * create set for Business Service names
     */
    m_businessServiceNames = businessServiceManager.getAllBusinessServices().stream()
            .map(BusinessService::getName).collect(Collectors.toSet());

    if (m_businessService.getName() != null) {
        m_businessServiceNames.remove(m_businessService.getName());
    }

    /**
     * construct the main layout
     */
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);

    /**
     * add saveBusinessService button
     */
    Button saveButton = new Button("Save");
    saveButton.setId("saveButton");
    saveButton.addClickListener(
            UIHelper.getCurrent(TransactionAwareUI.class).wrapInTransactionProxy(new Button.ClickListener() {
                private static final long serialVersionUID = -5985304347211214365L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    if (!m_thresholdTextField.isValid() || !m_nameTextField.isValid()) {
                        return;
                    }

                    final ReductionFunction reductionFunction = getReduceFunction();
                    businessService.setName(m_nameTextField.getValue().trim());
                    businessService.setReduceFunction(reductionFunction);
                    businessService.save();
                    close();
                }

                private ReductionFunction getReduceFunction() {
                    try {
                        final ReductionFunction reductionFunction = ((Class<? extends ReductionFunction>) m_reduceFunctionNativeSelect
                                .getValue()).newInstance();
                        reductionFunction.accept(new ReduceFunctionVisitor<Void>() {
                            @Override
                            public Void visit(HighestSeverity highestSeverity) {
                                return null;
                            }

                            @Override
                            public Void visit(HighestSeverityAbove highestSeverityAbove) {
                                highestSeverityAbove.setThreshold((Status) m_thresholdStatusSelect.getValue());
                                return null;
                            }

                            @Override
                            public Void visit(Threshold threshold) {
                                threshold.setThreshold(Float.parseFloat(m_thresholdTextField.getValue()));
                                return null;
                            }
                        });
                        return reductionFunction;
                    } catch (final InstantiationException | IllegalAccessException e) {
                        throw Throwables.propagate(e);
                    }
                }
            }));

    /**
     * add the cancel button
     */
    Button cancelButton = new Button("Cancel");
    cancelButton.setId("cancelButton");
    cancelButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 5306168797758047745L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });

    /**
     * add the buttons to a HorizontalLayout
     */
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(saveButton);
    buttonLayout.addComponent(cancelButton);

    /**
     * instantiate the input fields
     */
    m_nameTextField = new TextField("Business Service Name");
    m_nameTextField.setId("nameField");
    m_nameTextField.setNullRepresentation("");
    m_nameTextField.setNullSettingAllowed(true);
    m_nameTextField.setValue(businessService.getName());
    m_nameTextField.setWidth(100, Unit.PERCENTAGE);
    m_nameTextField.setRequired(true);
    m_nameTextField.focus();
    m_nameTextField.addValidator(new AbstractStringValidator("Name must be unique") {
        private static final long serialVersionUID = 1L;

        @Override
        protected boolean isValidValue(String value) {
            return value != null && !m_businessServiceNames.contains(value);
        }
    });
    verticalLayout.addComponent(m_nameTextField);

    /**
     * create the reduce function component
     */

    m_reduceFunctionNativeSelect = new NativeSelect("Reduce Function", ImmutableList.builder()
            .add(HighestSeverity.class).add(Threshold.class).add(HighestSeverityAbove.class).build());
    m_reduceFunctionNativeSelect.setId("reduceFunctionNativeSelect");
    m_reduceFunctionNativeSelect.setWidth(100.0f, Unit.PERCENTAGE);
    m_reduceFunctionNativeSelect.setNullSelectionAllowed(false);
    m_reduceFunctionNativeSelect.setMultiSelect(false);
    m_reduceFunctionNativeSelect.setImmediate(true);
    m_reduceFunctionNativeSelect.setNewItemsAllowed(false);

    /**
     * setting the captions for items
     */
    m_reduceFunctionNativeSelect.getItemIds().forEach(
            itemId -> m_reduceFunctionNativeSelect.setItemCaption(itemId, ((Class<?>) itemId).getSimpleName()));

    verticalLayout.addComponent(m_reduceFunctionNativeSelect);

    m_thresholdTextField = new TextField("Threshold");
    m_thresholdTextField.setId("thresholdTextField");
    m_thresholdTextField.setRequired(false);
    m_thresholdTextField.setEnabled(false);
    m_thresholdTextField.setImmediate(true);
    m_thresholdTextField.setWidth(100.0f, Unit.PERCENTAGE);
    m_thresholdTextField.setValue("0.0");
    m_thresholdTextField.addValidator(v -> {
        if (m_thresholdTextField.isEnabled()) {
            try {
                final float value = Float.parseFloat(m_thresholdTextField.getValue());
                if (0.0f >= value || value > 1.0) {
                    throw new NumberFormatException();
                }
            } catch (final NumberFormatException e) {
                throw new Validator.InvalidValueException("Threshold must be a positive number");
            }
        }
    });

    verticalLayout.addComponent(m_thresholdTextField);

    /**
     * Status selection for "Highest Severity Above"
     */
    m_thresholdStatusSelect = new NativeSelect("Threshold");
    m_thresholdStatusSelect.setId("thresholdStatusSelect");
    m_thresholdStatusSelect.setRequired(false);
    m_thresholdStatusSelect.setEnabled(false);
    m_thresholdStatusSelect.setImmediate(true);
    m_thresholdStatusSelect.setWidth(100.0f, Unit.PERCENTAGE);
    m_thresholdStatusSelect.setMultiSelect(false);
    m_thresholdStatusSelect.setNewItemsAllowed(false);
    m_thresholdStatusSelect.setNullSelectionAllowed(false);
    for (Status eachStatus : Status.values()) {
        m_thresholdStatusSelect.addItem(eachStatus);
    }
    m_thresholdStatusSelect.setValue(Status.INDETERMINATE);
    m_thresholdStatusSelect.getItemIds()
            .forEach(itemId -> m_thresholdStatusSelect.setItemCaption(itemId, ((Status) itemId).getLabel()));
    verticalLayout.addComponent(m_thresholdStatusSelect);

    m_reduceFunctionNativeSelect.addValueChangeListener(ev -> {
        boolean thresholdFunction = m_reduceFunctionNativeSelect.getValue() == Threshold.class;
        boolean highestSeverityAboveFunction = m_reduceFunctionNativeSelect
                .getValue() == HighestSeverityAbove.class;

        setVisible(m_thresholdTextField, thresholdFunction);
        setVisible(m_thresholdStatusSelect, highestSeverityAboveFunction);
    });

    if (Objects.isNull(businessService.getReduceFunction())) {
        m_reduceFunctionNativeSelect.setValue(HighestSeverity.class);
    } else {
        m_reduceFunctionNativeSelect.setValue(businessService.getReduceFunction().getClass());

        businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() {
            @Override
            public Void visit(HighestSeverity highestSeverity) {
                return null;
            }

            @Override
            public Void visit(HighestSeverityAbove highestSeverityAbove) {
                m_thresholdStatusSelect.setValue(highestSeverityAbove.getThreshold());
                return null;
            }

            @Override
            public Void visit(Threshold threshold) {
                m_thresholdTextField.setValue(String.valueOf(threshold.getThreshold()));
                return null;
            }
        });
    }

    /**
     * create the edges list box
     */
    m_edgesListSelect = new ListSelect("Edges");
    m_edgesListSelect.setId("edgeList");
    m_edgesListSelect.setWidth(100.0f, Unit.PERCENTAGE);
    m_edgesListSelect.setRows(10);
    m_edgesListSelect.setNullSelectionAllowed(false);
    m_edgesListSelect.setMultiSelect(false);
    refreshEdges();

    HorizontalLayout edgesListAndButtonLayout = new HorizontalLayout();

    edgesListAndButtonLayout.setWidth(100.0f, Unit.PERCENTAGE);

    VerticalLayout edgesButtonLayout = new VerticalLayout();
    edgesButtonLayout.setWidth(110.0f, Unit.PIXELS);
    edgesButtonLayout.setSpacing(true);

    Button addEdgeButton = new Button("Add Edge");
    addEdgeButton.setId("addEdgeButton");
    addEdgeButton.setWidth(110.0f, Unit.PIXELS);
    addEdgeButton.addStyleName("small");
    edgesButtonLayout.addComponent(addEdgeButton);
    addEdgeButton.addClickListener((Button.ClickListener) event -> {
        final BusinessServiceEdgeEditWindow window = new BusinessServiceEdgeEditWindow(businessService,
                businessServiceManager, null);
        window.addCloseListener(e -> refreshEdges());
        this.getUI().addWindow(window);
    });

    Button editEdgeButton = new Button("Edit Edge");
    editEdgeButton.setId("editEdgeButton");
    editEdgeButton.setEnabled(false);
    editEdgeButton.setWidth(110.0f, Unit.PIXELS);
    editEdgeButton.addStyleName("small");
    edgesButtonLayout.addComponent(editEdgeButton);
    editEdgeButton.addClickListener((Button.ClickListener) event -> {
        final BusinessServiceEdgeEditWindow window = new BusinessServiceEdgeEditWindow(businessService,
                businessServiceManager, (Edge) m_edgesListSelect.getValue());
        window.addCloseListener(e -> refreshEdges());
        this.getUI().addWindow(window);
    });

    final Button removeEdgeButton = new Button("Remove Edge");
    removeEdgeButton.setId("removeEdgeButton");
    removeEdgeButton.setEnabled(false);
    removeEdgeButton.setWidth(110.0f, Unit.PIXELS);
    removeEdgeButton.addStyleName("small");
    edgesButtonLayout.addComponent(removeEdgeButton);

    m_edgesListSelect.addValueChangeListener((Property.ValueChangeListener) event -> {
        removeEdgeButton.setEnabled(event.getProperty().getValue() != null);
        editEdgeButton.setEnabled(event.getProperty().getValue() != null);
    });

    removeEdgeButton.addClickListener((Button.ClickListener) event -> {
        if (m_edgesListSelect.getValue() != null) {
            removeEdgeButton.setEnabled(false);
            ((Edge) m_edgesListSelect.getValue()).delete();
            refreshEdges();
        }
    });

    edgesListAndButtonLayout.setSpacing(true);
    edgesListAndButtonLayout.addComponent(m_edgesListSelect);
    edgesListAndButtonLayout.setExpandRatio(m_edgesListSelect, 1.0f);

    edgesListAndButtonLayout.addComponent(edgesButtonLayout);
    edgesListAndButtonLayout.setComponentAlignment(edgesButtonLayout, Alignment.BOTTOM_CENTER);
    verticalLayout.addComponent(edgesListAndButtonLayout);

    /**
     * create the attributes list box
     */
    m_attributesListSelect = new ListSelect("Attributes");
    m_attributesListSelect.setId("attributeList");
    m_attributesListSelect.setWidth(100.0f, Unit.PERCENTAGE);
    m_attributesListSelect.setRows(10);
    m_attributesListSelect.setNullSelectionAllowed(false);
    m_attributesListSelect.setMultiSelect(false);

    refreshAttributes();

    HorizontalLayout attributesListAndButtonLayout = new HorizontalLayout();

    attributesListAndButtonLayout.setWidth(100.0f, Unit.PERCENTAGE);

    VerticalLayout attributesButtonLayout = new VerticalLayout();
    attributesButtonLayout.setWidth(110.0f, Unit.PIXELS);
    attributesButtonLayout.setSpacing(true);

    Button addAttributeButton = new Button("Add Attribute");
    addAttributeButton.setId("addAttributeButton");
    addAttributeButton.setWidth(110.0f, Unit.PIXELS);
    addAttributeButton.addStyleName("small");
    attributesButtonLayout.addComponent(addAttributeButton);
    addAttributeButton.addClickListener((Button.ClickListener) event -> {
        KeyValueInputDialogWindow keyValueInputDialogWindow = new KeyValueInputDialogWindow()
                .withKeyFieldName("Key").withValueFieldName("Value").withCaption("Attribute").withKey("")
                .withValue("").withOkAction(new KeyValueInputDialogWindow.Action() {
                    @Override
                    public void execute(KeyValueInputDialogWindow window) {
                        m_businessService.getAttributes().put(window.getKey(), window.getValue());
                        refreshAttributes();
                    }
                }).withKeyValidator(new AbstractStringValidator("Key must not be empty") {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected boolean isValidValue(String value) {
                        return !Strings.isNullOrEmpty(value);
                    }
                }).withKeyValidator(new AbstractStringValidator("Key must be unique") {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected boolean isValidValue(String value) {
                        return !m_businessService.getAttributes().containsKey(value);
                    }
                }).focusKey();
        this.getUI().addWindow(keyValueInputDialogWindow);
        keyValueInputDialogWindow.focus();
    });

    Button editAttributeButton = new Button("Edit Attribute");
    editAttributeButton.setId("editAttributeButton");
    editAttributeButton.setEnabled(false);
    editAttributeButton.setWidth(110.0f, Unit.PIXELS);
    editAttributeButton.addStyleName("small");
    attributesButtonLayout.addComponent(editAttributeButton);
    editAttributeButton.addClickListener((Button.ClickListener) event -> {
        Map.Entry<String, String> entry = (Map.Entry<String, String>) m_attributesListSelect.getValue();
        KeyValueInputDialogWindow keyValueInputDialogWindow = new KeyValueInputDialogWindow()
                .withKeyFieldName("Key").withValueFieldName("Value").withCaption("Attribute")
                .withKey(entry.getKey()).disableKey().withValue(entry.getValue())
                .withOkAction(new KeyValueInputDialogWindow.Action() {
                    @Override
                    public void execute(KeyValueInputDialogWindow window) {
                        m_businessService.getAttributes().put(window.getKey(), window.getValue());
                        refreshAttributes();
                    }
                }).focusValue();
        this.getUI().addWindow(keyValueInputDialogWindow);
        keyValueInputDialogWindow.focus();
    });

    final Button removeAttributeButton = new Button("Remove Attribute");
    removeAttributeButton.setId("removeAttributeButton");
    removeAttributeButton.setEnabled(false);
    removeAttributeButton.setWidth(110.0f, Unit.PIXELS);
    removeAttributeButton.addStyleName("small");
    attributesButtonLayout.addComponent(removeAttributeButton);

    m_attributesListSelect.addValueChangeListener((Property.ValueChangeListener) event -> {
        removeAttributeButton.setEnabled(event.getProperty().getValue() != null);
        editAttributeButton.setEnabled(event.getProperty().getValue() != null);
    });

    removeAttributeButton.addClickListener((Button.ClickListener) event -> {
        if (m_attributesListSelect.getValue() != null) {
            removeAttributeButton.setEnabled(false);
            m_businessService.getAttributes()
                    .remove(((Map.Entry<String, String>) m_attributesListSelect.getValue()).getKey());
            refreshAttributes();
        }
    });

    attributesListAndButtonLayout.setSpacing(true);
    attributesListAndButtonLayout.addComponent(m_attributesListSelect);
    attributesListAndButtonLayout.setExpandRatio(m_attributesListSelect, 1.0f);

    attributesListAndButtonLayout.addComponent(attributesButtonLayout);
    attributesListAndButtonLayout.setComponentAlignment(attributesButtonLayout, Alignment.BOTTOM_CENTER);
    verticalLayout.addComponent(attributesListAndButtonLayout);

    /**
     * now add the button layout to the main layout
     */
    verticalLayout.addComponent(buttonLayout);
    verticalLayout.setExpandRatio(buttonLayout, 1.0f);

    verticalLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    /**
     * set the window's content
     */
    setContent(verticalLayout);
}

From source file:org.vaadin.alump.scaleimage.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setMargin(true);/*from   ww w . j  a  v  a  2  s . c o  m*/
    layout.setSpacing(true);
    setContent(layout);

    // Big image that will scale to match with your page width, will
    // show the center of given picture. See SCSS file.
    ScaleImage bigCenterImage = new ScaleImage();
    bigCenterImage.setWidth("100%");
    bigCenterImage.setHeight("200px");
    bigCenterImage.setStyleName("big-center-image");
    bigCenterImage.setSource(new ThemeResource("images/big-center-image.jpg"));
    bigCenterImage.addClickListener(new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent clickEvent) {
            Notification.show("Big center image clicked!");
        }
    });
    layout.addComponent(bigCenterImage);

    // Tile with image, where images will be scaled to match with tile size.
    // tileimage will cover space of tile and indicator image will be at
    // top left corner.
    // Uses absolute left/right/top/down positioning. See SCSS file.
    final CssLayout tile = new CssLayout();
    tile.setStyleName("tile");
    tile.setWidth(100, Unit.PIXELS);
    tile.setHeight(100, Unit.PIXELS);
    layout.addComponent(tile);
    tile.addLayoutClickListener(new LayoutClickListener() {

        @Override
        public void layoutClick(LayoutClickEvent event) {
            int size = (int) Math.round(100.0 + Math.random() * 100.0);
            tile.setWidth(size, Unit.PIXELS);
            tile.setHeight(size, Unit.PIXELS);
        }

    });

    ScaleImage tileImage = new ScaleImage();
    tileImage.setSource(new ThemeResource("images/tile-image.jpg"));
    tileImage.setStyleName("tile-image");
    tile.addComponent(tileImage);
    ScaleImage indicatorImage = new ScaleImage();
    indicatorImage.setSource(new ThemeResource("images/tile-indicator.png"));
    indicatorImage.setStyleName("tile-indicator");
    tile.addComponent(indicatorImage);
    Label tileLabel = new Label("Click tile to scale it.");
    tile.addComponent(tileLabel);

    extendedImage = new ExtendedScaleImage();
    extendedImage.setSource(new ThemeResource("images/tile-indicator.png"));
    extendedImage.setWidth("200px");
    extendedImage.setHeight("400px");
    extendedImage.setStyleName("extended-image");
    layout.addComponent(extendedImage);

    Button moveButton = new Button("Move background", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Boolean val = extendedImage.getPosition();
            if (val == null) {
                val = true;
            }

            extendedImage.setPosition(!val.booleanValue());

        }
    });
    layout.addComponent(moveButton);

    // Test how well scale image behaves inside alignment layout

    HorizontalLayout alignLayout = new HorizontalLayout();
    alignLayout.setSpacing(true);
    alignLayout.setWidth("200px");
    layout.addComponent(alignLayout);

    Label label = new Label("Alignment test:");
    label.addStyleName("align-label");
    alignLayout.addComponent(label);
    alignLayout.setExpandRatio(label, 1.0f);
    alignLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    ScaleImage alignImage = new ScaleImage();
    alignImage.setSource(new ThemeResource("images/tile-image.jpg"));
    alignImage.setWidth("20px");
    alignImage.setHeight("20px");
    alignLayout.addComponent(alignImage);
    alignLayout.setComponentAlignment(alignImage, Alignment.BOTTOM_CENTER);
}

From source file:org.vaadin.overlay.sample.OverlaySampleApplication.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();

    final Label label = new Label("Alignment.TOP_LEFT");
    layout.addComponent(label);/*from   w w  w .java2  s  .  c  om*/

    for (int i = 0; i < 20; i++) {

        Button button = new Button("Sample Button");
        layout.addComponent(button);

        final ImageOverlay io = new ImageOverlay(button);

        Resource res = new ClassResource(this.getClass(), "../icon-new.png");
        io.setImage(res);
        io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button
        io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        io.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("ImageOverlay Clicked!");
            }
        });
        layout.addComponent(io);
        io.setEnabled(true);

        final TextOverlay to = new TextOverlay(button, "New!");
        to.setComponentAnchor(Alignment.MIDDLE_RIGHT); // Top right of the button
        to.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        to.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("TextOverlay Clicked!");
            }
        });
        layout.addComponent(to);

        button.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                Alignment a = io.getComponentAnchor();
                String s = "";
                if (Alignment.TOP_LEFT.equals(a)) {
                    a = Alignment.TOP_CENTER;
                    s = "TOP_CENTER";
                } else if (Alignment.TOP_CENTER.equals(a)) {
                    a = Alignment.TOP_RIGHT;
                    s = "TOP_RIGHT";
                } else if (Alignment.TOP_RIGHT.equals(a)) {
                    a = Alignment.MIDDLE_RIGHT;
                    s = "MIDDLE_RIGHT";
                } else if (Alignment.MIDDLE_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_RIGHT;
                    s = "BOTTOM_RIGHT";
                } else if (Alignment.BOTTOM_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_CENTER;
                    s = "BOTTOM_CENTER";
                } else if (Alignment.BOTTOM_CENTER.equals(a)) {
                    a = Alignment.BOTTOM_LEFT;
                    s = "BOTTOM_LEFT";
                } else if (Alignment.BOTTOM_LEFT.equals(a)) {
                    a = Alignment.MIDDLE_LEFT;
                    s = "MIDDLE_LEFT";
                } else if (Alignment.MIDDLE_LEFT.equals(a)) {
                    a = Alignment.TOP_LEFT;
                    s = "TOP_LEFT";
                }
                io.setComponentAnchor(a);
                label.setValue("Alignment." + s);
            }
        });
    }

    setContent(layout);
}

From source file:org.vaadin.spring.samples.security.shared.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo Login");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();//from www . j a  v a2s.co m

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(rememberMe);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.DiseaseGroupsListFilter.java

/**
 *
 * @param Quant_Central_Manager/*from ww  w .ja v a 2 s.c  o  m*/
 */
public DiseaseGroupsListFilter(final QuantCentralManager Quant_Central_Manager) {
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.setWidth("450px");
    //        this.Quant_Central_Manager.registerFilterListener(DiseaseGroupsListFilter.this);

    //        this.updatePatientGroups(Quant_Central_Manager.getFilteredDatasetsList());
    //        String[] pgArr = merge(patGr1, patGr2);
    this.patientGroupIFilter = new ListSelectDatasetExplorerFilter(1, "Disease Group I",
            Quant_Central_Manager.getSelectedHeatMapRows());
    initGroupsIFilter();

    this.patientGroupIIFilter = new ListSelectDatasetExplorerFilter(2, "Disease Group II",
            Quant_Central_Manager.getSelectedHeatMapColumns());
    initGroupsIIFilter();
    diseaseGroupsSet = new LinkedHashSet<String>();
    diseaseGroupsSet.addAll(Quant_Central_Manager.getSelectedHeatMapRows());

    this.addComponent(patientGroupIIFilter);

    diseaseGroupsFilterBtn = new Button("Disease Groups");
    diseaseGroupsFilterBtn.setStyleName(Reindeer.BUTTON_LINK);
    diseaseGroupsFilterBtn.addClickListener(DiseaseGroupsListFilter.this);

    VerticalLayout popupBody = new VerticalLayout();

    VerticalLayout filtersConatinerLayout = new VerticalLayout();
    filtersConatinerLayout.setSpacing(true);
    filtersConatinerLayout.setWidth("500px");
    filtersConatinerLayout.setHeightUndefined();

    popupBody.addComponent(filtersConatinerLayout);

    HorizontalLayout btnLayout = new HorizontalLayout();
    popupBody.addComponent(btnLayout);
    btnLayout.setSpacing(true);
    btnLayout.setMargin(new MarginInfo(false, false, true, true));

    Button applyFilters = new Button("Apply");
    applyFilters.setDescription("Apply the selected filters");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            popupWindow.close();
        }
    });

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");

    resetFiltersBtn.setDescription("Reset all applied filters");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Quant_Central_Manager.resetFiltersListener();
        }
    });

    popupWindow = new Window() {
        @Override
        public void close() {
            if (updateManager) {
                updateSelectionManager(studiesIndexes);
            }

            popupWindow.setVisible(false);

        }
    };
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidth((540) + "px");
    popupWindow.setHeight((500) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.center();
    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Disease Groups Comparisons</font>");

    UI.getCurrent().addWindow(popupWindow);
    popupWindow.center();

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    this.setHeightUndefined();
    filtersConatinerLayout.addComponent(DiseaseGroupsListFilter.this);
    filtersConatinerLayout.setComponentAlignment(DiseaseGroupsListFilter.this, Alignment.BOTTOM_CENTER);
    //        Quant_Central_Manager.setSelectedHeatMapRows(selectedRows);
    //        Quant_Central_Manager.setSelectedHeatMapColumns(selectedColumns);

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.GroupSwichBtn.java

public GroupSwichBtn(final QuantCentralManager Quant_Central_Manager,
        List<QuantProtein> searchQuantificationProtList) {
    this.Quant_Central_Manager = Quant_Central_Manager;
    this.searchQuantificationProtList = searchQuantificationProtList;
    updatedComparisonList = new ArrayList<QuantDiseaseGroupsComparison>();
    this.setWidth("24px");
    this.setHeight("24px");
    this.setDescription("Switch protein groups");
    this.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override/*  ww  w  .j  ava  2 s .  c om*/
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            updateSelectionList();
            popupWindow.setVisible(true);
        }
    });
    this.setStyleName("switchicon");

    popupBody = new VerticalLayout();

    popupBody.setHeightUndefined();
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);

    popupWindow = new Window() {

        @Override
        public void close() {

            popupWindow.setVisible(false);
            Quant_Central_Manager.setDiseaseGroupsComparisonSelection(
                    new LinkedHashSet<QuantDiseaseGroupsComparison>(updatedComparisonList));
        }

    };
    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Switch  disease groups</font>");
    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);

    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(true);

    UI.getCurrent().addWindow(popupWindow);
    //        popupWindow.center();
    //        popupWindow.setPositionX(popupWindow.getPositionX());
    popupWindow.setPositionY(100);

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);

    popupBody.setMargin(true);
    popupBody.setSpacing(true);

    //init table
    table = new GridLayout();
    table.setStyleName("switchtable");
    table.setWidth("100%");
    table.setSpacing(true);
    table.setColumns(3);
    table.setRows(1000);
    table.setHeightUndefined();
    table.setHideEmptyRowsAndColumns(true);
    table.setMargin(new MarginInfo(false, false, true, false));

    headerI = new Label("<center><b>Numerator</b></center>");
    headerI.setWidth("100%");
    headerI.setContentMode(ContentMode.HTML);
    headerII = new Label("<center><b>Denominator</b></center>");
    headerII.setContentMode(ContentMode.HTML);
    headerII.setWidth("100%");

    //        comparisonList = new OptionGroup(null);
    //
    //        comparisonList.setMultiSelect(true);
    //        comparisonList.setNullSelectionAllowed(true);
    //        comparisonList.setHtmlContentAllowed(true);
    //        comparisonList.setImmediate(true);
    //        comparisonList.setWidth("80%");
    //        comparisonList.setHeight("80%");
    popupBody.addComponent(table);

    Button applyFilters = new Button("Apply");
    applyFilters.setDescription("Apply the selected filters");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("76px");
    applyFilters.setHeight("24px");

    //        popupBody.addComponent(applyFilters);
    //        popupBody.setComponentAlignment(applyFilters, Alignment.TOP_RIGHT);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            popupWindow.close();
        }
    });
    btnWrapper = new HorizontalLayout();
    btnWrapper.setWidth("100%");
    btnWrapper.setHeight("50px");
    btnWrapper.addComponent(applyFilters);
    btnWrapper.setComponentAlignment(applyFilters, Alignment.BOTTOM_CENTER);

    table.addLayoutClickListener(GroupSwichBtn.this);

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.heatmap.HeaderCell.java

/**
 *
 * @param rowHeader//from  w  w w  . j a  v  a 2 s .c om
 * @param title
 * @param index
 * @param parentcom
 * @param heatmapCellWidth
 * @param heatmapHeaderCellWidth
 * @param fullName
 */
public HeaderCell(boolean rowHeader, String title, int index, HeatMapComponent parentcom, int heatmapCellWidth,
        int heatmapHeaderCellWidth, String fullName) {
    this.parentcom = parentcom;
    valueLabel = new Label();
    this.title = title;
    allStyle = title.split("\n")[1].toLowerCase().replace("-s", "").replace("_disease", "").replace("_", "");
    valueLabel.setValue("<center><font>" + title.split("\n")[0] + "</font></center>");
    if (allStyle.equalsIgnoreCase("multiplesclerosis")) {
        color = "#A52A2A";
    } else if (allStyle.equalsIgnoreCase("alzheimer")) {
        color = "#4b7865";
    } else {
        color = "#74716E";
    }

    if (rowHeader) {
        this.cellStyleName = "hmrowlabel";
    } else {
        this.cellStyleName = "hmcolumnlabel";
    }
    valueLabel.setStyleName(allStyle + cellStyleName);
    valueLabel.setWidth((heatmapHeaderCellWidth - 4) + "px");
    valueLabel.setHeight((heatmapCellWidth - 4) + "px");
    this.setStyleName(cellStyleName);
    this.setWidth(heatmapHeaderCellWidth + "px");
    this.setHeight(heatmapCellWidth + "px");
    this.valueLabel.setContentMode(ContentMode.HTML);
    this.index = index;

    this.addComponent(valueLabel);
    this.setComponentAlignment(valueLabel, Alignment.BOTTOM_CENTER);
    this.addLayoutClickListener(HeaderCell.this);
    if (fullName == null) {
        this.fullName = title.split("\n")[0].replace("_", "").replace("-", ",");
    } else {
        this.fullName = fullName;
    }
    String combinedGroup = "";
    if (this.fullName.contains("*")) {
        combinedGroup = " - Combined disease groups";
    }
    this.setDescription(this.fullName + combinedGroup);

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.heatmap.HeatMapComponent.java

/**
 * @param heatmapCellWidth//from   www . j a  v  a2  s .c  o m
 * @param heatmapHeaderCellWidth
 * @param diseaseStyleMap
 */
public HeatMapComponent(int heatmapCellWidth, int heatmapHeaderCellWidth, Map<String, String> diseaseStyleMap) {

    this.diseaseStyleMap = diseaseStyleMap;

    this.setMargin(false);
    this.setSpacing(true);
    this.setWidth("100%");
    this.heatmapCellWidth = heatmapCellWidth;
    this.heatmapHeaderCellWidth = heatmapHeaderCellWidth;

    columnContainer = new VerticalLayout();
    columnContainer.setWidth("100%");
    columnContainer.setSpacing(true);

    diseaseGroupsColumnsLabels = new HorizontalLayout();
    diseaseGroupsColumnsLabels.setWidth("10px");
    diseaseGroupsColumnsLabels.setHeight("20px");
    diseaseGroupsColumnsLabels.setStyleName(Reindeer.LAYOUT_BLUE);
    columnContainer.addComponent(diseaseGroupsColumnsLabels);

    this.columnHeader = new GridLayout();
    columnContainer.addComponent(columnHeader);
    columnContainer.setComponentAlignment(columnHeader, Alignment.TOP_LEFT);
    this.rowHeader = new GridLayout();
    this.heatmapBody = new GridLayout();
    heatmapBody.setStyleName("hmbackground");

    topLayout = new HorizontalLayout();
    topLayout.setHeight((heatmapHeaderCellWidth + 24) + "px");
    topLayout.setSpacing(false);
    spacer = new VerticalLayout();
    spacer.setWidth((heatmapHeaderCellWidth + 25) + "px");
    spacer.setHeight((heatmapHeaderCellWidth + 24) + "px");
    spacer.setStyleName(Reindeer.LAYOUT_WHITE);

    hideCompBtn = new VerticalLayout();
    hideCompBtn.setSpacing(true);
    hideCompBtn.setWidth((heatmapHeaderCellWidth + 25) + "px");
    //        hideCompBtn.setHeight((heatmapHeaderCellWidth) + "px");
    hideCompBtn.setStyleName("matrixbtn");

    icon = new Image();
    defaultResource = new ThemeResource("img/logo.png");

    icon.setSource(defaultResource);
    hideCompBtn.setDescription("Expand chart and hide comparisons table");
    hideCompBtn.addComponent(icon);
    hideCompBtn.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    icon.setHeight((heatmapHeaderCellWidth - 20 + 10) + "px");
    hideShowBtnLabel = new Label("Expand Chart");
    hideShowBtnLabel.setHeight((20) + "px");
    hideCompBtn.addComponent(hideShowBtnLabel);
    hideCompBtn.setComponentAlignment(hideShowBtnLabel, Alignment.BOTTOM_CENTER);

    spacer.addComponent(hideCompBtn);
    spacer.setComponentAlignment(hideCompBtn, Alignment.MIDDLE_CENTER);
    hideCompBtn.setEnabled(false);

    topLayout.addComponent(spacer);
    topLayout.setComponentAlignment(spacer, Alignment.BOTTOM_LEFT);
    topLayout.setSpacing(true);
    topLayout.addComponent(columnContainer);
    topLayout.setComponentAlignment(columnContainer, Alignment.TOP_LEFT);
    this.addComponent(topLayout);

    bottomLayout = new HorizontalLayout();
    diseaseGroupsRowsLabels = new VerticalLayout();
    diseaseGroupsRowsLabels.setHeight("10px");
    diseaseGroupsRowsLabels.setWidth("20px");
    diseaseGroupsRowsLabels.setStyleName(Reindeer.LAYOUT_BLUE);
    bottomLayout.addComponent(diseaseGroupsRowsLabels);

    rowHeader.setWidth(heatmapHeaderCellWidth + "px");
    rowHeader.setHeight("100%");
    bottomLayout.addComponent(rowHeader);
    bottomLayout.addComponent(heatmapBody);
    bottomLayout.setSpacing(true);
    bottomLayout.setComponentAlignment(heatmapBody, Alignment.MIDDLE_LEFT);
    this.addComponent(bottomLayout);

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.PopupRecombineDiseaseGroups.java

private void initPopupLayout() {

    int h = 0;//(default_DiseaseCat_DiseaseGroupMap.size() * 33) + 300;
    for (Map<String, String> m : default_DiseaseCat_DiseaseGroupMap.values()) {
        if (h < m.size()) {
            h = m.size();//w ww  .j ava  2s.co m
        }
    }
    h = (h * 26) + 200;
    int w = 700;
    if (Page.getCurrent().getBrowserWindowHeight() - 280 < h) {
        h = Page.getCurrent().getBrowserWindowHeight() - 280;
    }
    if (Page.getCurrent().getBrowserWindowWidth() < w) {
        w = Page.getCurrent().getBrowserWindowWidth();
    }

    popupWindow.setWidth(w + "px");
    popupWindow.setHeight(h + "px");

    popupBodyLayout.setWidth((w - 50) + "px");

    Set<String> diseaseSet = Quant_Central_Manager.getDiseaseCategorySet();

    diseaseTypeSelectionList.setDescription("Select disease category");

    for (String disease : diseaseSet) {
        diseaseTypeSelectionList.addItem(disease);
        diseaseTypeSelectionList.setItemCaption(disease, (disease));

    }

    HorizontalLayout diseaseCategorySelectLayout = new HorizontalLayout();
    diseaseCategorySelectLayout.setWidthUndefined();
    diseaseCategorySelectLayout.setHeight("50px");
    diseaseCategorySelectLayout.setSpacing(true);
    diseaseCategorySelectLayout.setMargin(true);

    popupBodyLayout.addComponent(diseaseCategorySelectLayout);
    popupBodyLayout.setComponentAlignment(diseaseCategorySelectLayout, Alignment.TOP_LEFT);

    Label title = new Label("Disease Category");
    title.setStyleName(Reindeer.LABEL_SMALL);
    diseaseCategorySelectLayout.addComponent(title);

    diseaseCategorySelectLayout.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    diseaseTypeSelectionList.setWidth("200px");
    diseaseTypeSelectionList.setNullSelectionAllowed(false);
    diseaseTypeSelectionList.setValue("All");
    diseaseTypeSelectionList.setImmediate(true);
    diseaseCategorySelectLayout.addComponent(diseaseTypeSelectionList);
    diseaseCategorySelectLayout.setComponentAlignment(diseaseTypeSelectionList, Alignment.TOP_LEFT);
    diseaseTypeSelectionList.setStyleName("diseaseselectionlist");
    diseaseTypeSelectionList.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            boolean showAll = false;
            String value = event.getProperty().getValue().toString();
            if (value.equalsIgnoreCase("All")) {
                showAll = true;
            }
            for (String dName : diseaseGroupsGridLayoutMap.keySet()) {
                if (dName.equalsIgnoreCase(value) || showAll) {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(true);
                } else {
                    diseaseGroupsGridLayoutMap.get(dName).setVisible(false);
                }
            }

        }
    });

    VerticalLayout diseaseGroupsNamesContainer = new VerticalLayout();
    diseaseGroupsNamesContainer.setWidth("100%");
    diseaseGroupsNamesContainer.setHeightUndefined();
    popupBodyLayout.addComponent(diseaseGroupsNamesContainer);
    diseaseGroupsNamesContainer.setStyleName(Reindeer.LAYOUT_WHITE);
    GridLayout diseaseNamesHeader = new GridLayout(2, 1);
    diseaseNamesHeader.setWidth("100%");
    diseaseNamesHeader.setHeightUndefined();
    diseaseNamesHeader.setSpacing(true);
    diseaseNamesHeader.setMargin(new MarginInfo(true, false, true, false));
    diseaseGroupsNamesContainer.addComponent(diseaseNamesHeader);
    Label col1Label = new Label("Group Name");
    diseaseNamesHeader.addComponent(col1Label, 0, 0);
    col1Label.setStyleName(Reindeer.LABEL_SMALL);

    Label col2Label = new Label("Suggested Name");
    diseaseNamesHeader.addComponent(col2Label, 1, 0);
    col2Label.setStyleName(Reindeer.LABEL_SMALL);

    Panel diseaseGroupsNamesFrame = new Panel();
    diseaseGroupsNamesFrame.setWidth("100%");
    diseaseGroupsNamesFrame.setHeight((h - 200) + "px");
    diseaseGroupsNamesContainer.addComponent(diseaseGroupsNamesFrame);
    diseaseGroupsNamesFrame.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout diseaseNamesUpdateContainerLayout = new VerticalLayout();
    for (String diseaseCategory : diseaseSet) {
        if (diseaseCategory.equalsIgnoreCase("All")) {
            continue;
        }

        HorizontalLayout diseaseNamesUpdateContainer = initDiseaseNamesUpdateContainer(diseaseCategory);
        diseaseNamesUpdateContainerLayout.addComponent(diseaseNamesUpdateContainer);
        diseaseGroupsGridLayoutMap.put(diseaseCategory, diseaseNamesUpdateContainer);
    }
    diseaseGroupsNamesFrame.setContent(diseaseNamesUpdateContainerLayout);

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setMargin(true);
    btnLayout.setSpacing(true);

    Button resetFiltersBtn = new Button("Reset");
    resetFiltersBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetFiltersBtn);
    resetFiltersBtn.setWidth("50px");
    resetFiltersBtn.setHeight("24px");

    resetFiltersBtn.setDescription("Reset group names to default");
    resetFiltersBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToDefault();
        }
    });
    Button resetToOriginalBtn = new Button("Publications Names");
    resetToOriginalBtn.setPrimaryStyleName("resetbtn");
    btnLayout.addComponent(resetToOriginalBtn);
    resetToOriginalBtn.setWidth("150px");
    resetToOriginalBtn.setHeight("24px");

    resetToOriginalBtn.setDescription("Reset group names to original publication names");
    resetToOriginalBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            resetToPublicationsNames();
        }
    });

    Button applyFilters = new Button("Update");
    applyFilters.setDescription("Update disease groups with the selected names");
    applyFilters.setPrimaryStyleName("resetbtn");
    applyFilters.setWidth("50px");
    applyFilters.setHeight("24px");

    btnLayout.addComponent(applyFilters);
    applyFilters.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateGroups();

        }
    });

    popupBodyLayout.addComponent(btnLayout);
    popupBodyLayout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT);
    resetToDefault();

}