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:com.esofthead.mycollab.vaadin.ui.DynamicQueryParamLayout.java

License:Open Source License

private HorizontalLayout createButtonControls() {
    MHorizontalLayout buttonControls = new MHorizontalLayout().withSpacing(true).withMargin(true);

    final Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//from www.  j ava 2 s  . com
                public void buttonClick(final ClickEvent event) {
                    DynamicQueryParamLayout.this.callSearchAction();
                }
            });
    searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    searchBtn.setIcon(FontAwesome.SEARCH);

    buttonControls.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_CENTER);

    final Button clearBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    clearFields();
                }
            });
    clearBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    buttonControls.with(clearBtn).withAlign(clearBtn, Alignment.MIDDLE_CENTER);

    final Button basicSearchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_BASIC_SEARCH),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    ((DefaultGenericSearchPanel<S>) DynamicQueryParamLayout.this.searchPanel)
                            .moveToBasicSearchLayout();
                }
            });
    basicSearchBtn.setStyleName("link");
    buttonControls.with(basicSearchBtn).withAlign(basicSearchBtn, Alignment.MIDDLE_CENTER);
    return buttonControls;
}

From source file:com.esofthead.mycollab.vaadin.ui.EditFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(final boolean isSaveBtnVisible,
        final boolean isSaveAndNewBtnVisible, final boolean isCancelBtnVisible) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from   ww  w  .  j  a  v a 2s .  c  o  m
    layout.setSizeUndefined();
    layout.setStyleName("addNewControl");

    if (isSaveBtnVisible) {
        final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveForm();
                        }
                    }
                });
        saveBtn.setIcon(FontAwesome.SAVE);
        saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveBtn);
        layout.setComponentAlignment(saveBtn, Alignment.MIDDLE_CENTER);
    }

    if (isSaveAndNewBtnVisible) {
        final Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveAndNewForm();
                        }
                    }
                });
        saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT);
        saveAndNewBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveAndNewBtn);
        layout.setComponentAlignment(saveAndNewBtn, Alignment.MIDDLE_CENTER);
    }

    if (isCancelBtnVisible) {
        final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        EditFormControlsGenerator.this.editForm.fireCancelForm();
                    }
                });
        cancelBtn.setIcon(FontAwesome.MINUS);
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        layout.addComponent(cancelBtn);
        layout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER);
    }

    return layout;
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

@SuppressWarnings("serial")
private void initButtonLinkCcBcc() {
    btnLinkCc = new Button("Add Cc");
    btnLinkCc.setStyleName("link");
    inputLayout.addComponent(btnLinkCc, 1, 0);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);

    btnLinkBcc = new Button("Add Bcc");
    btnLinkBcc.setStyleName("link");
    inputLayout.addComponent(btnLinkBcc, 2, 0);
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);

    btnLinkCc.addClickListener(new Button.ClickListener() {

        @Override/*from   w w w .  j  a  v  a 2 s  .  c  o  m*/
        public void buttonClick(ClickEvent event) {
            buttonLinkCcClick(event);
        }
    });

    btnLinkBcc.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            butonLinkBccClick(event);
        }
    });
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);/* ww  w.  ja  v  a 2 s.co m*/
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();
    tokenFieldMailTo.setRequired(true);

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {
                        tokenFieldMailTo.addToken(mail);
                    }
                } else {
                    tokenFieldMailTo.addToken(mail);
                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

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

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn = new Button("Send", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
                NotificationUtil.showErrorNotification(
                        "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                return;
            }
            if (AppContext.getSession().getEmail() != null && AppContext.getSession().getEmail().length() > 0) {
                ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class);

                List<File> listFile = attachments.getListFile();
                List<EmailAttachementSource> emailAttachmentSource = null;
                if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<EmailAttachementSource>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                systemMailService.sendHTMLMail(AppContext.getSession().getEmail(),
                        AppContext.getSession().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                        tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                        subject.getValue().toString(), noteArea.getValue().toString(), emailAttachmentSource);
                MailFormWindow.this.close();
            } else {
                NotificationUtil.showErrorNotification(
                        "Your email is empty value, please fulfil it before sending email!");
            }
        }
    });
    sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

private void buttonLinkCcClick(ClickEvent event) {
    removeAllInputField();/*from  ww w  . j  a v  a 2 s  .co  m*/
    if (!isAddCc) {
        btnLinkCc.setCaption("Remove Cc");
        if (!isAddBcc) {
            inputLayout.addComponent(ccField, 0, 1);
            inputLayout.addComponent(btnLinkCc, 1, 1);
            inputLayout.addComponent(btnLinkBcc, 2, 1);
            inputLayout.addComponent(subjectField, 0, 2);
        } else {
            addFullInputFieldByOrder();
        }
    } else {
        tokenFieldMailCc.removeAllRecipients();
        btnLinkCc.setCaption("Add Cc");

        if (isAddBcc) {
            inputLayout.addComponent(bccField, 0, 1);
            inputLayout.addComponent(btnLinkBcc, 1, 1);
            inputLayout.addComponent(btnLinkCc, 2, 1);
            inputLayout.addComponent(subjectField, 0, 2);
        } else {
            inputLayout.addComponent(btnLinkBcc, 1, 0);
            inputLayout.addComponent(btnLinkCc, 2, 0);
            inputLayout.addComponent(subjectField, 0, 1);
        }
    }

    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);

    isAddCc = !isAddCc;

    checkToReInitCcBcc();
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

private void butonLinkBccClick(ClickEvent event) {

    removeAllInputField();/*from  w ww .ja  v  a 2s. c  o  m*/

    if (!isAddBcc) {
        btnLinkBcc.setCaption("Remove Bcc");
        if (!isAddCc) {
            inputLayout.addComponent(bccField, 0, 1);
            inputLayout.addComponent(btnLinkCc, 1, 1);
            inputLayout.addComponent(btnLinkBcc, 2, 1);
            inputLayout.addComponent(subjectField, 0, 2);
        } else {
            addFullInputFieldByOrder();
        }
    } else {
        btnLinkBcc.setCaption("Add Bcc");
        tokenFieldMailBcc.removeAllRecipients();
        if (isAddCc) {
            inputLayout.addComponent(ccField, 0, 1);
            inputLayout.addComponent(btnLinkCc, 1, 1);
            inputLayout.addComponent(btnLinkBcc, 2, 1);
            inputLayout.addComponent(subjectField, 0, 2);
        } else {
            inputLayout.addComponent(btnLinkBcc, 1, 0);
            inputLayout.addComponent(btnLinkCc, 2, 0);
            inputLayout.addComponent(subjectField, 0, 1);
        }
    }
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);
    isAddBcc = !isAddBcc;
    checkToReInitCcBcc();
}

From source file:com.esofthead.mycollab.vaadin.ui.NotificationButton.java

License:Open Source License

@Override
public void popupVisibilityChange(PopupVisibilityEvent event) {
    notificationContainer.removeAllComponents();

    if (notificationItems.size() > 0) {
        for (AbstractNotification item : notificationItems) {
            Component comp = item.renderContent();
            comp.setStyleName("notification-type");
            comp.addStyleName("notification-type-" + item.getType());
            notificationContainer.addComponent(comp);
        }/*  ww w .j a va2s  .co  m*/
    } else {
        Label noItemLbl = new Label("There is no notification right now");
        notificationContainer.addComponent(noItemLbl);
        notificationContainer.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER);
    }
}

From source file:com.esofthead.mycollab.vaadin.ui.NotPresentedView.java

License:Open Source License

public NotPresentedView() {
    this.setHeight("370px");
    this.setWidth("100%");
    VerticalLayout layoutWapper = new VerticalLayout();
    layoutWapper.setWidth("100%");

    VerticalLayout layout = new VerticalLayout();
    final Label titleIcon = new Label(FontAwesome.EXCLAMATION_CIRCLE.getHtml(), ContentMode.HTML);
    titleIcon.setStyleName("warning-icon");
    titleIcon.setSizeUndefined();/*www .j a  v  a  2s  . co  m*/
    layout.addComponent(titleIcon);
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER);

    Label label = new Label("The feature is not presented for this edition");
    label.setStyleName("h2_community");
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    layoutWapper.addComponent(layout);
    layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
    this.addComponent(layoutWapper);
    this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.vaadin.ui.PreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(String permissionItem) {
    layout = new MHorizontalLayout().withStyleName("control-buttons");
    layout.setSizeUndefined();//from   ww  w  .  j  a v a2 s  . c o m

    optionParentBtn = new Button("Option", new Button.ClickListener() {
        private static final long serialVersionUID = 695008443208333680L;

        @Override
        public void buttonClick(ClickEvent event) {
            optionBtn.setPopupVisible(true);
        }
    });

    optionBtn = new SplitButton(optionParentBtn);
    optionBtn.setWidthUndefined();
    optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    popupButtonsControl = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withWidth("100px");

    editButtons = new MHorizontalLayout();

    editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            optionBtn.setPopupVisible(false);
            B item = previewForm.getBean();
            previewForm.fireEditForm(item);
        }
    });
    editBtn.setIcon(FontAwesome.EDIT);
    editBtn.setStyleName("link");
    popupButtonsControl.addComponent(editBtn);

    deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            B item = previewForm.getBean();
            previewForm.fireDeleteForm(item);
        }
    });
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
    editButtons.addComponent(deleteBtn);
    editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER);

    cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            optionBtn.setPopupVisible(false);
            B item = previewForm.getBean();
            previewForm.fireCloneForm(item);
        }
    });
    cloneBtn.setIcon(FontAwesome.ROAD);
    cloneBtn.setStyleName("link");
    popupButtonsControl.addComponent(cloneBtn);

    optionBtn.setContent(popupButtonsControl);
    editButtons.addComponent(optionBtn);
    editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER);

    layout.addComponent(editButtons);
    layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(editButtons, 1.0f);

    if (permissionItem != null) {
        boolean canWrite = AppContext.canWrite(permissionItem);
        boolean canAccess = AppContext.canAccess(permissionItem);

        editBtn.setEnabled(canWrite);
        cloneBtn.setEnabled(canWrite);
        deleteBtn.setEnabled(canAccess);
    }
    return layout;
}

From source file:com.esofthead.mycollab.vaadin.ui.ProjectPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {

    Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override/*from w ww  .  jav a  2  s .c  o m*/
                public void buttonClick(ClickEvent event) {
                    optionBtn.setPopupVisible(true);
                }
            });

    optionBtn = new SplitButton(optionParentBtn);
    optionBtn.setWidthUndefined();
    optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }
        });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(addBtn);
        editButtons.setComponentAlignment(addBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }
        });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(editBtn);
        editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireDeleteForm(item);
            }
        });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        editButtons.addComponent(deleteBtn);
        editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER);
    }

    if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
        assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireAssignForm(item);
            }
        });
        assignBtn.setIcon(FontAwesome.SHARE_SQUARE_O);
        assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(assignBtn, 0);

    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                optionBtn.setPopupVisible(false);
                final T item = previewForm.getBean();
                previewForm.fireCloneForm(item);
            }
        });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        popupButtonsControl.addComponent(cloneBtn);
    }

    if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        editButtons.addComponent(optionBtn);
        editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER);
    }

    layout.addComponent(editButtons);
    layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(editButtons, 1.0f);

    if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        ButtonGroup navigationBtns = new ButtonGroup();
        navigationBtns.setStyleName("navigation-btns");
        Button previousItem = new Button("<", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }
        });

        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        navigationBtns.addButton(previousItem);

        Button nextItemBtn = new Button(">", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }
        });

        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));

        navigationBtns.addButton(nextItemBtn);
        layout.addComponent(navigationBtns);
        layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT);
    }

    if (permissionItem != null) {
        final boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        final boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);

        if (assignBtn != null) {
            assignBtn.setEnabled(canWrite);
        }

        if (addBtn != null) {
            addBtn.setEnabled(canWrite);
        }

        if (editBtn != null) {
            editBtn.setEnabled(canWrite);
        }

        if (cloneBtn != null) {
            cloneBtn.setEnabled(canWrite);
        }

        if (deleteBtn != null) {
            deleteBtn.setEnabled(canAccess);
        }
    }
    return layout;
}