Example usage for com.vaadin.ui HorizontalLayout setExpandRatio

List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setExpandRatio.

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:com.tapas.evidence.fe.main.MainPresenter.java

License:Apache License

private void componentLocation() {
    final HorizontalLayout buttonBar = this.view.getButtonBar();
    buttonBar.setExpandRatio(this.getView().getExpander(), 0.5f);
    buttonBar.setExpandRatio(this.getView().getTitle(), 0.5f);
    buttonBar.setMargin(true);//w w w.ja va2  s . c o m
}

From source file:com.tapas.evidence.fe.responsible.ResponsiblePersonPresenter.java

License:Apache License

@Override
public void bind() {
    final HorizontalLayout buttonBar = this.view.getButtonBar();
    buttonBar.setExpandRatio(this.getView().getExpander(), 1.0f);
    final Table responsiblePersonList = this.view.getResponsiblePersonList();
    container = new BeanItemContainer<ResponsiblePersonDTO>(ResponsiblePersonDTO.class);
    responsiblePersonList.setContainerDataSource(container);
    responsiblePersonList.setColumnHeader("fullName",
            this.getMessage("responsiblePerson.list.header.fullName", this.getLocale()));
    responsiblePersonList.setColumnHeader("fullAddress",
            this.getMessage("responsiblePerson.list.header.fullAddress", this.getLocale()));
    responsiblePersonList.setVisibleColumns(new String[] { "fullName", "fullAddress" });
    loadResponsiblePersonList();//from ww  w.j a v a2  s . com
}

From source file:com.tapas.evidence.fe.teacher.TeacherPresenter.java

License:Apache License

@Override
public void bind() {
    final HorizontalLayout buttonBar = this.view.getButtonBar();
    buttonBar.setExpandRatio(this.getView().getExpander(), 1.0f);
    final Table teacherList = this.view.getTeacherList();
    container = new BeanItemContainer<TeacherDTO>(TeacherDTO.class);
    teacherList.setContainerDataSource(container);
    teacherList.setColumnHeader("fullName", this.getMessage("teacher.list.header.fullName", this.getLocale()));
    teacherList.setColumnHeader("fullAddress",
            this.getMessage("teacher.list.header.fullAddress", this.getLocale()));
    teacherList.setVisibleColumns(new String[] { "fullName", "fullAddress" });
    loadTeacherList();//from   w  ww  .j  av  a  2 s .c  o m
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildContactInfo() {
    contactInfo = new ComboBox();
    contactInfo.setContainerDataSource(containerContacts);
    contactInfo.setTextInputAllowed(false);
    contactInfo.setInputPrompt("Seleccione un contacto...");
    contactInfo.setWidth("100%");
    rootLayout.addComponent(contactInfo);

    contactInfoDetails = new Button(FontAwesome.PHONE);
    contactInfoDetails.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    contactInfoDetails.addClickListener(new Button.ClickListener() {
        @Override/*from  ww  w  . j  ava2s . co m*/
        public void buttonClick(Button.ClickEvent event) {
            if (appointment.getContactInfo() != null) {
                Notification.show("Funcionalidad en desarrollo.", Notification.Type.ASSISTIVE_NOTIFICATION);
                //customerView.open(appointment.getCustomer());
            }
        }
    });

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setCaption("Contacto");
    wrapper.addComponent(contactInfo);
    wrapper.addComponent(contactInfoDetails);
    wrapper.setWidth("100%");
    wrapper.setExpandRatio(contactInfo, 1);
    rootLayout.addComponent(wrapper);
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildAddress() {
    address = new ComboBox();
    address.setContainerDataSource(containerAddresses);
    address.setTextInputAllowed(false);//from  www.  ja  v  a 2s.  com
    address.setInputPrompt("Seleccione una direccin...");
    address.setWidth("100%");
    rootLayout.addComponent(address);

    addressDetails = new Button(FontAwesome.MAP_MARKER);
    addressDetails.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    addressDetails.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (appointment.getAddress() != null) {
                Notification.show("Funcionalidad en desarrollo.", Notification.Type.ASSISTIVE_NOTIFICATION);
                //customerView.open(appointment.getCustomer());
            }
        }
    });

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setCaption("Direccin");
    wrapper.addComponent(address);
    wrapper.addComponent(addressDetails);
    wrapper.setWidth("100%");
    wrapper.setExpandRatio(address, 1);
    rootLayout.addComponent(wrapper);
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildCustomer() {
    customer = new ComboBox();
    customer.setContainerDataSource(containerCustomers);
    customer.setFilteringMode(FilteringMode.CONTAINS);
    customer.setInputPrompt("Seleccione un cliente...");
    customer.setWidth("100%");
    //<editor-fold defaultstate="collapsed" desc="Adjust ContactInfo and Addresses according to the selected Customer">
    customer.addValueChangeListener(new ValueChangeListener() {

        @Override//from w w w.j a  v a2s  .c om
        public void valueChange(Property.ValueChangeEvent event) {
            updateCustomerCombos((CustomerCRM) event.getProperty().getValue());
        }

        private void updateCustomerCombos(CustomerCRM customerCRM) {
            if (customerCRM != null) {
                containerAddresses.removeAllItems();
                address.setValue(null);
                containerAddresses.addAll(customerCRMService.find(customerCRM.getId()).getAddressList());
                if (containerAddresses.size() > 0) {
                    address.select(containerAddresses.getIdByIndex(0));
                }

                containerContacts.removeAllItems();
                contactInfo.setValue(null);
                containerContacts.addAll(customerCRMService.find(customerCRM.getId()).getContactInfoList());
                if (containerContacts.size() > 0) {
                    contactInfo.select(containerContacts.getIdByIndex(0));
                }
            } else {
                containerAddresses.removeAllItems();
                address.setValue(null);

                containerContacts.removeAllItems();
                contactInfo.setValue(null);
            }
        }
    });
    //</editor-fold>

    customerDetails = new Button(FontAwesome.EYE);
    customerDetails.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    customerDetails.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (appointment.getCustomer() != null) {
                customerView.open(appointment.getCustomer());
            }
        }
    });

    HorizontalLayout customerWrapper = new HorizontalLayout();
    customerWrapper.setCaption("Cliente");
    customerWrapper.addComponent(customer);
    customerWrapper.addComponent(customerDetails);
    customerWrapper.setWidth("100%");
    customerWrapper.setExpandRatio(customer, 1);
    rootLayout.addComponent(customerWrapper);

    //<editor-fold defaultstate="collapsed" desc="Antiguo buscador de clientes">
    //        Button searchCustomerBtn = new Button("Busca!");
    //        searchCustomerBtn.addClickListener(new Button.ClickListener() {
    //
    //            @Override
    //            public void buttonClick(Button.ClickEvent event) {
    //                CustomerFinderDialogWindow dlgWin = new CustomerFinderDialogWindow(appointment.getCustomer(), customerCRMService){
    //
    //                    @Override
    //                    protected void onButtonCancelClicked() {
    //                        this.close();
    //                    }
    //
    //                    @Override
    //                    protected void onButtonOKClicked() {
    //                        //appointment.setCustomer(this.getSelectedCustomer());
    //                        customer.setValue(this.getSelectedCustomer());
    //                        //updateCustomerCombos(appointment.getCustomer());
    //                        this.close();
    //                    }
    //
    //
    //
    //                };
    //                UI.getCurrent().addWindow(dlgWin);
    //                dlgWin.focus();
    //            }
    //        });
    //        rootLayout.addComponent(searchCustomerBtn);
    //</editor-fold>    
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildAppointmentStatus() {
    Label section = new Label("Estado");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    rootLayout.addComponent(section);/*from   w ww  .  j  a  v a 2s.  co  m*/

    status = new ComboBox();
    status.setContainerDataSource(containerStatuses);
    status.setWidth("100%");
    status.setTextInputAllowed(false);
    status.setNullSelectionAllowed(false);

    notifyChanges = new CheckBox();
    notifyChanges.setIcon(FontAwesome.BELL);
    notifyChanges.setImmediate(true);

    HorizontalLayout statusWrapper = new HorizontalLayout();
    statusWrapper.setCaption("Estado");
    statusWrapper.addComponent(status);
    statusWrapper.addComponent(notifyChanges);
    statusWrapper.setWidth("100%");
    statusWrapper.setExpandRatio(status, 1);
    rootLayout.addComponent(statusWrapper);

    statusNotes = new TextArea("Notas de estado");
    statusNotes.setWidth("100%");
    statusNotes.setInputPrompt("Anotaciones del estado...");
    rootLayout.addComponent(statusNotes);
}

From source file:com.terralcode.gestion.frontend.view.widgets.incomingAppointments.IncomingAppointments.java

public AppointmentPreview(Appointment app) {
    this.appointment = app;
    this.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(false);/*w  w w.ja v a2s . c  o  m*/

    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    String scheduleText = sdf.format(app.getProgramDateStart().getTime());
    if (app.getTimeLapse() != null) {
        scheduleText += " (" + app.getTimeLapse().toString() + ")";
    }
    schedule = new Button(scheduleText);
    schedule.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            onAppointmentClicked(appointment);
        }
    });
    schedule.addStyleName(ValoTheme.BUTTON_LINK);
    schedule.setWidth("100%");
    hl.addComponent(schedule);
    //type = new Label();
    if (app.getAppointmentType().getCode().equals("VIS")) {
        schedule.setIcon(FontAwesome.HOME);
    }
    if (app.getAppointmentType().getCode().equals("COM")) {
        schedule.setIcon(FontAwesome.PHONE);
    }
    if (app.getAppointmentType().getCode().equals("CON")) {
        schedule.setIcon(FontAwesome.USER);
    }
    //hl.addComponent(type);
    //hl.setComponentAlignment(type, Alignment.MIDDLE_RIGHT);
    hl.setExpandRatio(schedule, 1);
    this.addComponent(hl);

    if (app.getAppointmentType().getCode().equals("VIS") || app.getAppointmentType().getCode().equals("COM")) {
        customer = new Label(app.getCustomer().toString());
        //customer.addStyleName(ValoTheme.LABEL_H3);
        customer.setWidth("100%");
        this.addComponent(customer);
    }

    if ("VIS".equals(app.getAppointmentType().getCode())) {
        address = new Label(Objects.toString(app.getAddress(), "Direccin no disponible"));
        //address.addStyleName(ValoTheme.LABEL_H3);
        address.setWidth("100%");
        this.addComponent(address);
    }
    if ("CON".equals(app.getAppointmentType().getCode())) {
        contact = new Label(app.getContactNotes());
        //address.addStyleName(ValoTheme.LABEL_H3);
        contact.setWidth("100%");
        this.addComponent(contact);
    }

}

From source file:com.wft.ui.welcome.WFTWelcomeWindow.java

License:Apache License

public void afterPropertiesSet() throws Exception {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();/*from w ww .jav  a2s.co m*/
    setContent(layout);

    VerticalLayout leftLayout = new VerticalLayout();
    leftLayout.setSizeFull();
    layout.addComponent(leftLayout);
    layout.setExpandRatio(leftLayout, 1);

    VerticalLayout middleLayout = new VerticalLayout();
    middleLayout.setSizeFull();
    layout.addComponent(middleLayout);
    layout.setExpandRatio(middleLayout, 3);

    VerticalLayout rightLayout = new VerticalLayout();
    rightLayout.setSizeFull();
    layout.addComponent(rightLayout);
    layout.setExpandRatio(rightLayout, 1);

    leftLayout.addComponent(wftWelcomeProfilePanel);
    leftLayout.setExpandRatio(wftWelcomeProfilePanel, 1);

    leftLayout.addComponent(wftWelcomeTournamentsPanel);
    leftLayout.setExpandRatio(wftWelcomeTournamentsPanel, 1);

    leftLayout.addComponent(wftWelcomeCalendarPanel);
    leftLayout.setExpandRatio(wftWelcomeCalendarPanel, 1);

    middleLayout.addComponent(wftWelcomeMainPanel);

    rightLayout.addComponent(wftWelcomeMessagesPanel);
    rightLayout.setExpandRatio(wftWelcomeMessagesPanel, 1);

    rightLayout.addComponent(wftWelcomeChatPanel);
    rightLayout.setExpandRatio(wftWelcomeChatPanel, 1);

    setImmediate(true);
}

From source file:cz.zcu.pia.social.network.frontend.views.ViewHome.java

/**
 * PostConstruct/*from w  ww. ja  v  a2s . co  m*/
 */
@PostConstruct
@Override
public void postConstruct() {
    super.postConstruct();
    postPaginator = applicationContext.getBean(ComponentPostPaginator.class);

    postsFilter = applicationContext.getBean(ComponentPostsFilter.class, postWrapper, postPaginator);
    //postsFilter.setPostPaginator(postPaginator);
    postPaginator.setFilter(postsFilter);

    addPost = new Button("+");
    if (!securityHelper.isAuthenticated()) {
        addPost.setVisible(false);
    }
    addPost.addClickListener(new Button.ClickListener() {

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

        }
    });
    addPost.setDescription(msgs.getMessage(BUTTON_DESCRIPTION));
    addPost.setWidth(25, Unit.PIXELS);
    HorizontalLayout addButtonWrapper = new HorizontalLayout();

    addButtonWrapper.setWidth(ComponentPost.POST_WIDTH, Unit.PIXELS);

    addButtonWrapper.addComponent(postsFilter);
    addButtonWrapper.addComponent(addPost);
    addButtonWrapper.setComponentAlignment(addPost, Alignment.TOP_RIGHT);

    addButtonWrapper.setExpandRatio(postsFilter, 10);
    addButtonWrapper.setExpandRatio(addPost, 1);
    this.getContentWrapper().addComponent(addButtonWrapper);
    this.getContentWrapper().addComponent(postWrapper);
    this.getContentWrapper().addComponent(postPaginator);
}