Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

From source file:edu.kit.dama.ui.admin.administration.usergroup.UserGroupForm.java

License:Apache License

public UserGroupForm(UserGroupAdministrationTab groupAdministrationTab) {
    this.userGroupAdministrationTab = groupAdministrationTab;

    LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ...");

    setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1));
    setColumns(5);/*from w ww .ja  va 2s  .  c  om*/
    setRows(4);
    setSizeFull();
    setSpacing(true);

    // Add components
    addComponent(getIdField(), 0, 0);
    addComponent(getGroupNameField(), 0, 1);
    addComponent(getDescriptionArea(), 0, 2, 2, 3);
    addComponent(getGroupIdField(), 2, 0);
    addComponent(getNumberOfMembersField(), 2, 1);
    addComponent(getCommitChangesButton(), 4, 0);
    addComponent(getShowMembersButton(), 4, 1);
    addComponent(getCreateUserGroupButton(), 4, 2, 4, 3);

    setColumnExpandRatio(0, 0.39f);
    setColumnExpandRatio(1, 0.01f);
    setColumnExpandRatio(2, 0.39f);
    setColumnExpandRatio(3, 0.01f);
    setColumnExpandRatio(4, 0.2f);

    setComponentAlignment(getCommitChangesButton(), Alignment.BOTTOM_RIGHT);
    setComponentAlignment(getShowMembersButton(), Alignment.MIDDLE_RIGHT);

    setComponentAlignment(getCreateUserGroupButton(), Alignment.MIDDLE_CENTER);
}

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

License:Apache License

private void setupHeader(boolean landingPage, String landingObjectId) {
    if (!landingPage) {
        String repositoryName = DataManagerSettings.getSingleton()
                .getStringProperty(DataManagerSettings.GENERAL_REPOSITORY_NAME, "Repository");
        title = new Label("<h1>" + repositoryName + " Administration</h1><h5>Build " + readVersion() + "</h5>",
                ContentMode.HTML);
        title.setDescription("Click to return to main page.");
        title.setWidth("50%");
        title.addStyleName("title");
        title.addStyleName("myclickablecomponent");

        logo = new Image();
        String logoUrl;//from  w w  w  .j a v a  2s  . c  o  m
        try {
            logoUrl = new URL(DataManagerSettings.getSingleton().getStringProperty(
                    DataManagerSettings.GENERAL_REPOSITORY_LOGO_URL,
                    "http://datamanager.kit.edu/dama/logo_default.png")).toString();
        } catch (MalformedURLException ex) {
            logoUrl = URI.create("http://datamanager.kit.edu/dama/logo_default.png").toString();
        }
        logo.setSource(new ExternalResource(logoUrl));

        header = new HorizontalLayout(logo, title);
        header.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
        header.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
    } else {
        title = new Label(
                "<h1>Landing Page for Object #" + landingObjectId + "</h1><h5>Build " + readVersion() + "</h5>",
                ContentMode.HTML);
        title.setWidth("50%");
        title.addStyleName("title");
        title.addStyleName("myclickablecomponent");

        logo = new Image();
        String logoUrl;
        try {
            logoUrl = new URL(DataManagerSettings.getSingleton().getStringProperty(
                    DataManagerSettings.GENERAL_REPOSITORY_LOGO_URL,
                    "http://datamanager.kit.edu/dama/logo_default.png")).toString();
        } catch (MalformedURLException ex) {
            logoUrl = URI.create("http://datamanager.kit.edu/dama/logo_default.png").toString();
        }
        logo.setSource(new ExternalResource(logoUrl));

        header = new HorizontalLayout(logo, title);
        header.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
        header.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
    }
}

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

License:Apache License

/**
 * Update the view depending on the user selection.
 *
 * @param pView The new view./*from   w  w  w .j av a 2s  .com*/
 */
public void updateView(VIEW pView) {
    currentView = pView;
    mainLayout.removeAllComponents();
    switch (pView) {
    case SIMON:
        loginInformationBar.setVisible(true);
        if (simonPanel == null) {
            simonPanel = new SimonMainPanel();
        }
        viewComponent = simonPanel;
        break;
    case INFORMATION:
        loginInformationBar.setVisible(true);
        if (informationView == null) {
            informationView = new InformationView();
        }
        viewComponent = informationView;
        break;
    case LOGIN:
        loginInformationBar.setVisible(false);
        viewComponent = loginForm;
        break;
    case PROFILE:
        loginInformationBar.setVisible(true);
        if (profileView == null) {
            profileView = new ProfileView();
        }
        profileView.reload();
        viewComponent = profileView;
        break;
    case SETTINGS:
        loginInformationBar.setVisible(true);
        if (datamanagerSettings == null) {
            datamanagerSettings = new DataManagerSettingsPanel();
        }
        /* if (!datamanagerSettings.getUserAdministrationTab().equals(datamanagerSettings.getMainComponentContainer().getSelectedTab())) {
            datamanagerSettings.getMainComponentContainer().setSelectedTab(datamanagerSettings.getUserAdministrationTab());
        }
        datamanagerSettings.getUserAdministrationTab().reload();*/
        viewComponent = datamanagerSettings;
        break;
    case LANDING:
        loginInformationBar.setVisible(false);
        if (landingPage == null) {
            landingPage = new LandingPageComponent();
        }
        viewComponent = landingPage;
        break;
    }

    mainLayout.addComponent(header);
    mainLayout.addComponent(loginInformationBar);
    mainLayout.addComponent(viewComponent);
    mainLayout.setExpandRatio(header, .09f);
    mainLayout.setExpandRatio(loginInformationBar, .11f);
    mainLayout.setExpandRatio(viewComponent, .8f);
    mainLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(viewComponent, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(loginInformationBar, Alignment.TOP_RIGHT);

    mainLayout.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> {
        if (header.equals(event.getClickedComponent()) || title.equals(event.getClickedComponent())
                || logo.equals(event.getClickedComponent())) {
            refreshMainLayout();
        }
    });
}

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

License:Apache License

/**
 * Reset all fields and show the 'no properties available' label.
 *///from   w ww.j  a  v  a  2 s  . c om
public void reset() {
    removeAllComponents();
    addComponent(noPropertiesAvailableLabel);
    setComponentAlignment(noPropertiesAvailableLabel, Alignment.MIDDLE_CENTER);
}

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

License:Apache License

/**
 * Build the main layout./*from   w ww  . j  a va2 s .  c  o  m*/
 */
private void buildMainLayout() {
    table = new Table();
    table.setSelectable(false);
    table.setMultiSelect(false);
    table.setImmediate(true);
    table.setWidth("600px");
    table.setHeight("400px");
    table.setColumnExpandRatio("Identifier", 1);
    table.setColumnWidth("Value", 100);

    table.setColumnAlignment("Value", Align.CENTER);

    table.setColumnHeader("Identifier", "");
    table.setColumnHeader("Value", "Amount");

    Button reloadButton = new Button("Reload");
    reloadButton.addClickListener(new Button.ClickListener() {

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

    mainLayout = new VerticalLayout(table, reloadButton);
    mainLayout.setComponentAlignment(table, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(reloadButton, Alignment.MIDDLE_CENTER);
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    reload();
}

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

License:Apache License

public final void update(DigitalObject object, boolean privileged) {
    if (object == null) {
        UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(1, 1);
        builder.fill(new Label("Access to digital object not permitted."), 0, 0);
        mainLayout = builder.getLayout();
        mainLayout.setMargin(true);/*from w ww.ja  va  2 s . com*/
        mainLayout.setSpacing(true);
        mainLayout.setStyleName("landing");
        HorizontalLayout hLayout = new HorizontalLayout(mainLayout);
        hLayout.setSizeFull();
        hLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);
        setCompositionRoot(hLayout);
    } else {
        final TextField oidField = new TextField();
        Button searchButton = new Button("Search");
        Button metsButton = new Button("METS");
        final Button dcButton = new Button("DublinCore");
        Button dataButton = new Button("Download");
        VerticalLayout metadataDownloadButtons = new VerticalLayout(dcButton, metsButton);
        UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(3, 6);

        StreamResource metsResource = new StreamResource(() -> {
            try {
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                MetsBuilder.init(object).createMinimalMetsDocument(UserData.WORLD_USER).write(bout);
                return new ByteArrayInputStream(bout.toByteArray());
            } catch (Exception ex) {
                LOGGER.error("Failed to provide METS document.", ex);
                UIComponentTools.showError(
                        "Failed to initialize METS document for download. Cause: " + ex.getMessage());
                return null;
            }
        }, object.getDigitalObjectIdentifier() + ".mets.xml");

        StreamResource dcResource = new StreamResource(() -> {
            try {
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                DublinCoreHelper.writeDublinCoreDocument(object, UserData.WORLD_USER, bout);
                return new ByteArrayInputStream(bout.toByteArray());
            } catch (ParserConfigurationException ex) {
                LOGGER.error("Failed to provide DC document.", ex);
                UIComponentTools
                        .showError("Failed to initialize DC document for download. Cause: " + ex.getMessage());
                return null;
            }
        }, object.getDigitalObjectIdentifier() + ".dc.xml");

        StreamResource dataResource = new StreamResource(() -> {
            IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager();
            mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext());
            try {
                IAuthorizationContext ctx = new AuthorizationContext(new UserId(Constants.WORLD_USER_ID),
                        new GroupId(Constants.WORLD_USER_ID), Role.GUEST);
                if (accessGranted(object, ctx) || accessGranted(object, UIHelper.getSessionContext())) {
                    Response response = new PublicDownloadHandler().prepareStream(object);
                    if (response.getStatus() == Response.Status.OK.getStatusCode()) {
                        return (InputStream) response.getEntity();
                    } else {
                        LOGGER.error("Preparation of the public download for object "
                                + object.getDigitalObjectIdentifier() + " returned status "
                                + response.getStatus() + ". Aborting.");
                    }
                }
                throw new IOException("Public access not available.");
            } catch (IOException ex) {
                LOGGER.error(
                        "Failed to provide data stream for object " + object.getDigitalObjectIdentifier() + ".",
                        ex);
                UIComponentTools.showError(
                        "Failed to initialize data stream for public download. Probably, the digital object is not publicly available.");
                return null;
            }
        }, object.getDigitalObjectIdentifier() + ".zip");

        Map<String, String> dcElementMap = new HashMap<>();
        try {
            dcElementMap = DublinCoreHelper.createDublinCoreElementMap(object, UserData.WORLD_USER);
        } catch (ParserConfigurationException ex) {
            LOGGER.error(
                    "Failed to create DC metadata for object with id " + object.getDigitalObjectIdentifier(),
                    ex);
        }
        oidField.setValue(object.getDigitalObjectIdentifier());

        FileDownloader metsDownloader = new FileDownloader(metsResource);
        metsDownloader.extend(metsButton);

        FileDownloader dcDownloader = new FileDownloader(dcResource);
        dcDownloader.extend(dcButton);

        FileDownloader dataDownloader = new FileDownloader(dataResource);
        dataDownloader.extend(dataButton);

        oidField.setSizeFull();
        searchButton.setWidth("128px");

        searchButton.addClickListener((Button.ClickEvent event) -> {
            String oid = oidField.getValue();
            Page.getCurrent().setLocation(
                    URI.create(UIHelper.getWebAppUrl().toString() + "?landing&oid=" + oid).toString());
        });

        dcButton.setWidth("128px");
        metsButton.setWidth("128px");
        dataButton.setWidth("128px");

        metadataDownloadButtons.setComponentAlignment(dcButton, Alignment.TOP_LEFT);
        metadataDownloadButtons.setComponentAlignment(metsButton, Alignment.TOP_LEFT);

        //build layout
        Label oidLabel = new Label("<u>Object Id</u>", ContentMode.HTML);
        builder.fillRow(oidLabel, 0, 0, 1);
        oidLabel.addStyleName("myboldcaption");
        builder.addComponent(oidField, 0, 1, 2, 1).addComponent(searchButton, 2, 1);
        Label dcMetadataLabel = new Label("<u>DC Metadata</u>", ContentMode.HTML);
        builder.fillRow(dcMetadataLabel, 0, 2, 1);
        dcMetadataLabel.addStyleName("myboldcaption");

        Set<Map.Entry<String, String>> entries = dcElementMap.entrySet();

        Table dcTable = new Table();
        dcTable.setPageLength(entries.size() + 1);
        dcTable.addContainerProperty("dc:key", String.class, "-");
        dcTable.addContainerProperty("dc:value", String.class, "-");
        entries.forEach((entry) -> {
            Object newItemId = dcTable.addItem();
            Item row1 = dcTable.getItem(newItemId);
            row1.getItemProperty("dc:key").setValue(entry.getKey());
            row1.getItemProperty("dc:value").setValue(entry.getValue());
        });

        dcTable.setWidth("640px");
        dcTable.addStyleName("myboldcaption");
        builder.addComponent(dcTable, 0, 3, 2, 1);
        builder.addComponent(metadataDownloadButtons, 2, 3, 1, 1);

        builder.fillRow(new Label("<u>Data Access</u>", ContentMode.HTML), 0, 4, 1);
        long bytes = DataOrganizationUtils.getAssociatedDataSize(object.getDigitalObjectId());
        String formatted = AbstractFile.formatSize(bytes);
        Label oidDownloadLabel = new Label(
                object.getDigitalObjectIdentifier() + ".zip (approx. " + formatted + ")");
        oidDownloadLabel.addStyleName("myboldcaption");
        builder.addComponent(oidDownloadLabel, 0, 5, 2, 1);
        builder.addComponent(dataButton, 2, 5, 1, 1);

        mainLayout = builder.getLayout();
        mainLayout.setRowExpandRatio(0, .1f);
        mainLayout.setRowExpandRatio(1, .1f);
        mainLayout.setRowExpandRatio(2, .6f);
        mainLayout.setRowExpandRatio(3, .1f);
        mainLayout.setRowExpandRatio(4, .1f);

        mainLayout.setColumnExpandRatio(0, .1f);
        mainLayout.setColumnExpandRatio(1, .8f);
        mainLayout.setColumnExpandRatio(2, .1f);
    }
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("landing");
    HorizontalLayout hLayout = new HorizontalLayout(mainLayout);
    hLayout.setSizeFull();
    hLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);
    setCompositionRoot(hLayout);
}

From source file:edu.kit.dama.ui.admin.login.AbstractLoginComponent.java

License:Apache License

/**
 * Basic initialization of components.//from w  w  w . j  a v a2  s.  c  om
 */
private void initializeLayout() {
    registrationFormView.setWidth("400px");
    loginButton = new Button("Login");
    loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    loginButton.setWidth("100px");
    loginButton.addClickListener(this);

    registerButton = new Button("Register");
    registerButton.setWidth("100px");
    registerButton.addClickListener(this);
    mainLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getLoginForm(), 0, 0, 2, 1)
            .addComponent(registerButton, 0, 1, 1, 1).addComponent(loginButton, 1, 1, 1, 1).getLayout();

    mainLayout.setComponentAlignment(getLoginForm(), Alignment.TOP_CENTER);
    mainLayout.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT);
    mainLayout.setSpacing(true);
    mainLayout.setMargin(false);
    mainLayout.setComponentAlignment(registerButton, Alignment.BOTTOM_LEFT);
    VerticalLayout vLayout = new VerticalLayout(mainLayout);
    vLayout.setImmediate(true);
    vLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);
    setCompositionRoot(vLayout);
}

From source file:edu.kit.dama.ui.admin.login.RegistrationFormView.java

License:Apache License

/**
 * Initialize the user interface components.
 *///from  w  w  w. j  a va  2 s .c  o  m
private void initComponent() {
    screenName.setRequired(true);
    email.setRequired(true);
    email.setNullRepresentation("");
    registerForm = new UIUtils7.GridLayoutBuilder(2, 5).addComponent(screenName, 0, 0, 2, 1)
            .addComponent(lastName, 0, 1, 1, 1).addComponent(firstName, 1, 1, 1, 1)
            .addComponent(email, 0, 2, 2, 1).addComponent(password, 0, 3, 2, 1)
            .addComponent(passwordVerify, 0, 4, 2, 1).getLayout();
    registerForm.setSpacing(true);
    registerForm.setMargin(false);
    registerForm.setSizeFull();
    mainLayout = new VerticalLayout(registerForm);
    mainLayout.setComponentAlignment(registerForm, Alignment.MIDDLE_CENTER);
    mainLayout.setSizeFull();
}

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

License:Apache License

private void buildMainLayout() {
    loggedInAsLabel = new Label("Login Username");
    loggedInAsLabel.addStyleName("myboldcaption");
    loggedInUserLabel = new Label();
    activeGroupLabel = new Label("Active Group");
    activeGroupLabel.addStyleName("myboldcaption");
    groupSelection = new ComboBox();
    groupSelection.addValueChangeListener(this);
    activeRoleLabel = new Label("Current Role");
    activeRoleLabel.addStyleName("myboldcaption");
    roleLabel = new Label();

    Label spacer1 = new Label("");
    home = buildMenuItem("home", new ThemeResource("img/70x48/logo_default.png"));
    profile = buildMenuItem("profile", new ThemeResource("img/70x48/preferences.png"));
    simon = buildMenuItem("simon", new ThemeResource("img/70x48/simon.png"));
    settings = buildMenuItem("settings", new ThemeResource("img/70x48/gears_preferences.png"));
    exit = buildMenuItem("exit", new ThemeResource("img/70x48/exit.png"));

    final AbsoluteLayout helps = new AbsoluteLayout();
    helps.setHeight("48px");
    helps.setWidth("100%");
    addHelpItem("home", "Return to the main page.", helps);
    addHelpItem("profile", "Open your profile, e.g. to change your password.", helps);
    addHelpItem("simon",
            "Open the <b>SI</b>mple<b>MON</b>itoring Tool, e.g. to check the availability of single services.",
            helps);//from   www .  j a v  a2  s . com
    addHelpItem("settings", "Open the system settings. (Only available for Group Managers and Administrators)",
            helps);
    addHelpItem("exit", "Logout.", helps);

    HorizontalLayout navigation = new HorizontalLayout(home, profile, simon, settings, exit, helps, spacer1);
    navigation.setExpandRatio(helps, .9f);
    navigation.setExpandRatio(spacer1, .1f);
    navigation.setSizeFull();
    navigation.addStyleName("mynavigationmargin");

    navigation.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> {
        if (home.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.INFORMATION);
        } else if (profile.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.PROFILE);
        } else if (simon.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.SIMON);
        } else if (settings.equals(event.getClickedComponent())) {
            parent.updateView(VIEW.SETTINGS);
        } else if (exit.equals(event.getClickedComponent())) {
            parent.logout();
        }
    });

    GridLayout loginInformationLayout = new UIUtils7.GridLayoutBuilder(3, 2)
            .addComponent(loggedInAsLabel, Alignment.MIDDLE_CENTER, 0, 0, 1, 1)
            .addComponent(activeGroupLabel, Alignment.MIDDLE_CENTER, 1, 0, 1, 1)
            .addComponent(activeRoleLabel, Alignment.MIDDLE_CENTER, 2, 0, 1, 1)
            .addComponent(loggedInUserLabel, Alignment.MIDDLE_CENTER, 0, 1, 1, 1)
            .addComponent(groupSelection, Alignment.MIDDLE_CENTER, 1, 1, 1, 1)
            .addComponent(roleLabel, Alignment.MIDDLE_CENTER, 2, 1, 1, 1).getLayout();

    loginInformationLayout.setSpacing(true);

    mainLayout = new UIUtils7.GridLayoutBuilder(5, 2)
            .addComponent(navigation, Alignment.MIDDLE_LEFT, 0, 0, 3, 2)
            .addComponent(loginInformationLayout, Alignment.MIDDLE_RIGHT, 3, 0, 2, 2).getLayout();
    mainLayout.setColumnExpandRatio(0, 1.0f);
    mainLayout.setColumnExpandRatio(1, .01f);
    mainLayout.setColumnExpandRatio(2, .01f);
    mainLayout.setColumnExpandRatio(3, .01f);
    mainLayout.setColumnExpandRatio(4, .01f);

    mainLayout.setSpacing(true);
    mainLayout.setMargin(new MarginInfo(false, true, false, true));
    mainLayout.setSizeFull();
}

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

License:Apache License

/**
 * Create a new cell for the UI. Each cell contains an image located in the
 * provided resource and a help label for the cell adverse to it.
 * Furthermore, a style is provided which can be 'help-left' or 'help-right'
 * depending on which side the help text should be aligned (help in left col
 * -> align right).//w ww .j a  v  a 2s .co m
 *
 * @param pResourceString The image resource string.
 * @param The alignment of the image (TOP_LEFT or TOP_RIGHT, depending on
 * the column)
 * @param cellNumber The cell number (0-3) counting from top left to bottom
 * right
 * @param pHelp The help string which may contain HTML tags.
 * @param pStyle The help label style ('help-left' or 'help-right').
 *
 * @return The cell layout.
 */
private VerticalLayout createCell(String pResourceString, Alignment pAlignment, int cellNumber, String pHelp,
        String pStyle) {
    final String cellHeight = "132px";
    //create the cell image
    Image cellImage = new Image(null, new ThemeResource(pResourceString));
    cellImage.addStyleName("border");

    //create the cell image wrapper, which provides the shadow and this show/hide functionality
    VerticalLayout imageWrapper = new VerticalLayout(cellImage);
    imageWrapper.addComponent(cellImage);
    imageWrapper.setComponentAlignment(cellImage, Alignment.MIDDLE_CENTER);
    imageWrapper.setWidth(cellHeight);
    imageWrapper.setHeight(cellHeight);
    imageWrapper.addStyleName("shadow");
    imageWrapper.addStyleName("visible");

    //help label for the cell adverse to the current cell
    Label oppositeCellHelp = new Label(pHelp, ContentMode.HTML);
    oppositeCellHelp.addStyleName(pStyle);
    oppositeCellHelp.setSizeFull();
    oppositeCellHelp.addStyleName("invisible");
    oppositeCellHelp.setHeight(cellHeight);

    //the cell layout containing image and help label
    VerticalLayout cell = new VerticalLayout();
    cell.addComponent(imageWrapper);
    cell.setComponentAlignment(imageWrapper, pAlignment);
    cell.setMargin(true);
    cell.addComponent(oppositeCellHelp);
    cell.setComponentAlignment(oppositeCellHelp, Alignment.MIDDLE_CENTER);

    //define component ids depending on the provided cell number
    //---------
    //| 0 | 1 |
    //| 2 | 3 |
    //---------
    //Each cell gets the id 'image<cellNumber>'
    //The currently created wrapper and help label are getting the cellId of the adverse cell (0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2).
    //These ids are used then by edu.kit.dama.ui.admin.client.HelpConnector to show/hide elements on mouse over.
    switch (cellNumber) {
    case 0:
        cellImage.setId("image0");
        //this cell contains the help for cell 1
        imageWrapper.setId("image1_wrapper");
        oppositeCellHelp.setId("image1_help");
        break;
    case 1:
        cellImage.setId("image1");
        //this cell contains the help for cell 0
        imageWrapper.setId("image0_wrapper");
        oppositeCellHelp.setId("image0_help");
        break;
    case 2:
        cellImage.setId("image2");
        //this cell contains the help for cell 3
        imageWrapper.setId("image3_wrapper");
        oppositeCellHelp.setId("image3_help");
        break;
    case 3:
        cellImage.setId("image3");
        //this cell contains the help for cell 2
        imageWrapper.setId("image2_wrapper");
        oppositeCellHelp.setId("image2_help");
        break;
    }
    //link the HelpExtension to the image
    new HelpExtension().extend(cellImage);
    return cell;
}