Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:com.jain.common.authenticate.LoginAction.java

License:Apache License

private void createActions(VerticalLayout layout) {
    ButtonSegment hLayout = new ButtonSegment(ApplicationTheme.FIRST, ApplicationTheme.LAST);
    hLayout.setStyleName(ApplicationTheme.HEADER_SEGMENT_SMALL);
    hLayout.createSegment(this, JAction.LOGIN, JAction.CANCEL);

    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setSizeUndefined();//from   w  w  w  . jav  a 2 s .c  o  m
    vLayout.setStyleName(ApplicationTheme.VIEW);
    vLayout.addComponent(hLayout);

    layout.addComponent(vLayout);
    layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(vLayout, 1);
}

From source file:com.jain.i18N.definition.PersonDefinitionForm.java

License:Apache License

private void createActions(VerticalLayout layout) {
    if (!viewOnly) {
        JainEditClickListener clickListner = new JainEditClickListener(this);
        HorizontalLayout hLayout = VaadinHelper.createButtonSegment(clickListner, JAction.SAVE, JAction.CANCEL);

        VerticalLayout vLayout = new VerticalLayout();
        vLayout.setSizeUndefined();//from w w w .  j a  va  2 s .c o m
        vLayout.setStyleName(ApplicationTheme.VIEW);
        vLayout.addComponent(hLayout);

        layout.addComponent(vLayout);
        layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
        layout.setExpandRatio(vLayout, 1);
    }
}

From source file:com.jiangyifen.ec2.ui.LoginLayout.java

/**
 * ?// ww  w.j  a  v a2  s . co m
 * 
 * @param panelContent ????
 * @param roleType      ?
 */
private void createLoginMainComponents(VerticalLayout panelContent, RoleType roleType) {
    GridLayout gridLayout = new GridLayout(2, 5);
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);
    panelContent.addComponent(gridLayout);
    panelContent.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER);

    // ??
    Label username_lb = new Label("    ??", Label.CONTENT_XHTML);
    gridLayout.addComponent(username_lb, 0, 0);
    usernameTextField = new TextField();
    usernameTextField.setWidth("170px");
    usernameTextField.setValue(username);
    gridLayout.addComponent(usernameTextField, 1, 0);

    // ?
    Label password = new Label("       ?", Label.CONTENT_XHTML);
    gridLayout.addComponent(password, 0, 1);
    passwordTextField = new PasswordField();
    passwordTextField.setWidth("170px");
    gridLayout.addComponent(passwordTextField, 1, 1);

    //  ?Csr ?
    if (roleType.equals(RoleType.csr)) {
        Label extenNoLabel = new Label("       ",
                Label.CONTENT_XHTML);
        gridLayout.addComponent(extenNoLabel, 0, 2);
        extenNoField = new TextField();
        extenNoField.setWidth("170px");
        extenNoField.setValue(exten);
        gridLayout.addComponent(extenNoField, 1, 2);
    }

    // ?????
    String warningMsg = "<font color='red'>?????</font>";
    warningLabel = new Label(warningMsg, Label.CONTENT_XHTML);
    warningLabel.setVisible(false);

    gridLayout.addComponent(warningLabel, 1, 3);
    gridLayout.setComponentAlignment(warningLabel, Alignment.MIDDLE_CENTER);

    // ?
    login = new Button("  ", this);
    forget = new NativeButton("?", this);

    //???
    Map<String, String> licenseMap = LicenseManager.licenseValidate();
    String validateResult = licenseMap.get(LicenseManager.LICENSE_VALIDATE_RESULT);
    if (LicenseManager.LICENSE_VALID.equals(validateResult)) {
        SpringContextHolder.getHttpSession().removeAttribute("businessModels");
        String licensedDate = licenseMap.get(LicenseManager.LICENSE_DATE);
        try {
            Date stopDate = LicenseManager.simpleDateFormat.parse(licensedDate);
            Long times = stopDate.getTime() - new Date().getTime();
            int outdateWarnDay = (int) (times / (24 * 3600 * 1000));

            if (outdateWarnDay < 7) {
                isValid = true;
                warningLabel.setValue("<font color='red'>" + outdateWarnDay
                        + ",???</font>");
                if (outdateWarnDay < 0) {
                    warningLabel.setValue("<font color='red'>?,???</font>");
                    isValid = false;
                } else if (outdateWarnDay == 0) {
                    warningLabel.setValue(
                            "<font color='red'>?,???</font>");
                }
                warningLabel.setVisible(true);
            }
            //            //??
            //            if(roleType==RoleType.manager){
            //               login.setEnabled(true);
            //            }
            //            
        } catch (Exception e) {
            e.printStackTrace();
            login.setEnabled(false);
            forget.setEnabled(false);
        }

    } else {
        warningLabel.setVisible(true);
        warningLabel.setValue("<font color='red'>??,???</font>");
        login.setEnabled(false);
        forget.setEnabled(false);
        isValid = false;

        //chb ???
        if (roleType == RoleType.manager) {
            if (isValid == false) {
                login.setEnabled(true);
            } else {
                //normal login
            }
        }

    }

    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    operatorHLayout.addComponent(login);
    operatorHLayout.addComponent(forget);
    gridLayout.addComponent(operatorHLayout, 1, 4);
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.DynQueueMemberManagement.java

/**
 * ??("?")/*from  ww  w  .j a v  a2 s .c  om*/
 * return 
 */
private VerticalLayout createMiddleComponents() {
    VerticalLayout operatorVLayout = new VerticalLayout();
    operatorVLayout.setSpacing(true);
    operatorVLayout.setSizeFull();

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    // 
    addAll = new Button(">>>", this);
    operatorVLayout.addComponent(addAll);
    operatorVLayout.setComponentAlignment(addAll, Alignment.MIDDLE_CENTER);

    add = new Button(">>", this);
    operatorVLayout.addComponent(add);
    operatorVLayout.setComponentAlignment(add, Alignment.MIDDLE_CENTER);

    remove = new Button("<<", this);
    operatorVLayout.addComponent(remove);
    operatorVLayout.setComponentAlignment(remove, Alignment.MIDDLE_CENTER);

    removeAll = new Button("<<<", this);
    operatorVLayout.addComponent(removeAll);
    operatorVLayout.setComponentAlignment(removeAll, Alignment.MIDDLE_CENTER);

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    return operatorVLayout;
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 * ??("?")//  www.  ja v  a  2s. c om
 * return 
 */
private VerticalLayout createMiddleComponents() {
    VerticalLayout operatorVLayout = new VerticalLayout();
    operatorVLayout.setSpacing(true);
    operatorVLayout.setSizeFull();

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    // 
    addAll = new Button(">>>", this);
    addAll.setEnabled(false);
    operatorVLayout.addComponent(addAll);
    operatorVLayout.setComponentAlignment(addAll, Alignment.MIDDLE_CENTER);

    add = new Button(">>", this);
    add.setEnabled(false);
    operatorVLayout.addComponent(add);
    operatorVLayout.setComponentAlignment(add, Alignment.MIDDLE_CENTER);

    remove = new Button("<<", this);
    remove.setEnabled(false);
    operatorVLayout.addComponent(remove);
    operatorVLayout.setComponentAlignment(remove, Alignment.MIDDLE_CENTER);

    removeAll = new Button("<<<", this);
    removeAll.setEnabled(false);
    operatorVLayout.addComponent(removeAll);
    operatorVLayout.setComponentAlignment(removeAll, Alignment.MIDDLE_CENTER);

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    return operatorVLayout;
}

From source file:com.jorambarrez.PropertyPanel.java

License:Apache License

protected void initTrashIcon() {
    Embedded trashIcon = new Embedded(null, Images.MODELER_TRASH);
    trashIcon.setWidth(63, UNITS_PIXELS);
    trashIcon.setHeight(61, UNITS_PIXELS);
    trashIcon.setType(Embedded.TYPE_IMAGE);

    VerticalLayout trashLayout = new VerticalLayout();
    trashLayout.setWidth(120, UNITS_PIXELS);
    trashLayout.setHeight(120, UNITS_PIXELS);
    trashLayout.addComponent(trashIcon);
    trashLayout.setComponentAlignment(trashIcon, Alignment.MIDDLE_CENTER);

    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(trashLayout);
    dragAndDropWrapper.setDragStartMode(DragStartMode.NONE);
    dragAndDropWrapper.setSizeUndefined();
    addComponent(dragAndDropWrapper);/*from ww w .  j  a  v  a 2  s .  com*/
    setComponentAlignment(dragAndDropWrapper, Alignment.BOTTOM_CENTER);

    dragAndDropWrapper.setDropHandler(new DropHandler() {
        private static final long serialVersionUID = 1L;

        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }

        public void drop(DragAndDropEvent event) {
            WrapperTransferable wrapperTransferable = (WrapperTransferable) event.getTransferable();
            Node srcNode = (Node) wrapperTransferable.getSourceComponent();

            // TODO: use eventrouter!
            ModelerApp.get().getFlowEditor().removeNode(srcNode);
        }
    });
}

From source file:com.karus.EnglishCheckerUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VaadinServiceSession.getCurrent().setErrorHandler(this);
    setSizeFull();/*w w w  . ja v  a 2 s. c  o  m*/

    try {
        DiscoveryNavigator navigator = new DiscoveryNavigator(this, getContent());
        navigator.navigateTo(UI.getCurrent().getPage().getFragment());
    }
    /**
     * Exception on page load
     */
    catch (AccessDeniedException e) {
        Label label = new Label(e.getMessage());
        label.setWidth(-1, Unit.PERCENTAGE);

        Link goToMain = new Link("Go to login page", new ExternalResource("/login/"));

        VerticalLayout layout = new VerticalLayout();
        layout.addComponent(label);
        layout.addComponent(goToMain);
        layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
        layout.setComponentAlignment(goToMain, Alignment.MIDDLE_CENTER);

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setSizeFull();
        mainLayout.addComponent(layout);
        mainLayout.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

        setContent(mainLayout);
        Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from   w w  w.j a v  a 2s  . c  o m*/
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.klwork.explorer.ui.base.AbstractMainGridPage.java

License:Apache License

protected void addSelectComponent() {
    VerticalLayout vLayout = new VerticalLayout();
    vLayout.addStyleName("sidebar");
    vLayout.addStyleName("menu");
    vLayout.addStyleName("tasks");
    vLayout.setMargin(new MarginInfo(true, false, false, false));
    vLayout.setSizeFull();//from  w  w w  .  j  av  a2s  . c o m

    HorizontalLayout tableHeadLayout = createSelectHead();
    vLayout.addComponent(tableHeadLayout);
    vLayout.setComponentAlignment(tableHeadLayout, Alignment.MIDDLE_LEFT);

    AbstractSelect select = createSelectComponent();
    vLayout.addComponent(select);
    vLayout.setExpandRatio(select, 1.0f);
    if (select != null) {
        grid.addComponent(vLayout, 1, 0);
    }
}

From source file:com.klwork.explorer.ui.business.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/* w w w . jav  a2 s  . com*/
    layout.setSpacing(true);
    layout.addStyleName("social");

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}