Example usage for com.vaadin.ui Image getId

List of usage examples for com.vaadin.ui Image getId

Introduction

In this page you can find the example usage for com.vaadin.ui Image getId.

Prototype

@Override
    public String getId() 

Source Link

Usage

From source file:edu.kit.dama.ui.admin.HelpExtension.java

License:Apache License

public void extend(Image image) {
    getState().setHelpId(image.getId());
    super.extend(image);
}

From source file:edu.kit.dama.ui.admin.MainControlPanel.java

License:Apache License

/**
 * Build the main layout.//from  w ww  .  ja v a 2s  .c o  m
 */
private void buildMainLayout() {
    infoCell = createCell("img/128x128/information2.png", Alignment.TOP_RIGHT, 0,
            "<p>Show/edit your profile and personel settings.</p>", "help-right");
    profileCell = createCell("img/128x128/preferences.png", Alignment.TOP_LEFT, 1,
            "<p>Get information on how you use this KIT Data Manager instance.</p>", "help-left");
    administrationCell = createCell("img/128x128/gears_preferences.png", Alignment.BOTTOM_RIGHT, 2,
            "<p>Logout.</p>", "help-right");
    logoutCell = createCell("img/128x128/exit.png", Alignment.BOTTOM_LEFT, 3,
            "<p>Show KIT Data Manager settings.<br/>This view is only available for administrators and group manager</p>.",
            "help-left");

    GridLayout actionCellLayout = new UIUtils7.GridLayoutBuilder(2, 2)
            .addComponent(infoCell, Alignment.BOTTOM_RIGHT, 0, 0, 1, 1)
            .addComponent(profileCell, Alignment.BOTTOM_LEFT, 1, 0, 1, 1)
            .addComponent(administrationCell, Alignment.TOP_RIGHT, 0, 1, 1, 1)
            .addComponent(logoutCell, Alignment.TOP_LEFT, 1, 1, 1, 1).getLayout();
    actionCellLayout.setSpacing(true);
    actionCellLayout.setMargin(true);
    actionCellLayout.setSizeFull();

    actionCellLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (event.getClickedComponent() instanceof Image) {
                // Check if childComponent is disabled
                if (!event.getChildComponent().isEnabled()) {
                    return;
                }
                Image img = (Image) event.getClickedComponent();
                if ("image0".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.INFORMATION);
                } else if ("image1".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.PROFILE);
                } else if ("image2".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.SETTINGS);
                } else if ("image3".equals(img.getId())) {
                    parent.logout();
                }
            }
        }
    });

    mainLayout = new VerticalLayout(actionCellLayout);
    mainLayout.setSizeFull();
}