Example usage for com.vaadin.ui HorizontalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.squadd.UI.GroupMainInfoLayout.java

private void buildLayout() {
    HorizontalLayout knopki = new HorizontalLayout(edit);
    knopki.setSizeUndefined();//from w w  w.  j  a  v a2  s .  c  o m
    knopki.setSpacing(true);
    HorizontalLayout hor = new HorizontalLayout(knopki);
    hor.setWidth(0.4 * Display.width + "px");
    hor.setComponentAlignment(knopki, Alignment.TOP_RIGHT);
    description.setWidth(0.2 * Display.width + "px");
    FormLayout data = new FormLayout(groupName, placeName, date, description);
    HorizontalLayout first = new HorizontalLayout();
    groupPhoto.setWidth(0.2 * Display.width + "px");
    groupPhoto.setHeight(0.2 * Display.width + "px");
    first.addComponent(groupPhoto);
    HorizontalLayout seventh = new HorizontalLayout();
    seventh.setWidth(0.2 * Display.width + "px");
    seventh.addComponents(uploadPhoto);
    uploadPhoto.setSizeUndefined();
    seventh.setComponentAlignment(uploadPhoto, Alignment.TOP_CENTER);
    VerticalLayout lst = new VerticalLayout();
    lst.setSpacing(true);
    lst.addComponents(hor, data);

    VerticalLayout photoAndUpload = new VerticalLayout(first, seventh);
    HorizontalLayout photoAndInfo = new HorizontalLayout(photoAndUpload, lst);

    VerticalLayout content = new VerticalLayout(photoAndInfo);

    addComponent(content);
}

From source file:com.squadd.UI.GroupParticipantsLayout.java

private void buildLayout(Group group) {
    Label label = new Label("Participants");
    label.setSizeUndefined();//from  w w  w  .ja v  a2s  .  co  m
    HorizontalLayout hor = new HorizontalLayout();
    hor.setWidth(0.67 * Display.width + "px");
    hor.addComponent(label);
    hor.setComponentAlignment(label, Alignment.TOP_CENTER);
    name.setWidth(0.68 * Display.width + "px");
    name.setContent(hor);
    name.setStyleName("backColorGrey");
    DBManager db = new DBManager();
    List<UserInfoBean> users = (ArrayList) db.getUsersForGroup(group);
    participants.setVisible(false);

    fillGrid(users);
    VerticalLayout vert = new VerticalLayout(name, participants);

    addComponents(vert);
}

From source file:com.squadd.UI.MenuLayout.java

private void configureLayout() {
    //AWT toolkit doesn't want to work so there are hardcoded screen variables
    HorizontalLayout zLa = new HorizontalLayout();
    VerticalLayout panels = new VerticalLayout(mainPagePanel, groupsPanel, messagesPanel);
    panels.setWidth(0.1 * Display.width + "px");
    zLa.setWidth(0.1 * Display.width + "px");
    zLa.setHeight(0.2 * Display.height + "px");

    this.setMargin(false);
    this.setSpacing(false);
    addComponents(zLa, panels);/*from w  w w.  j ava2  s. c o  m*/
}

From source file:com.squadd.views.GroupInfo.java

@PostConstruct
private Layout configureMainPageLayout() {
    DBManager db = new DBManager();
    group = db.getGroupById(group.getGroupId());

    HorizontalLayout horIn = new HorizontalLayout();
    groupInfoLayout = new MainInformationAboutGroup(group);
    groupInfoLayout.setWidth(0.69 * Display.width + "px");
    horIn.addComponent(groupInfoLayout);

    groupParticipants = new GroupParticipantsLayout(group);
    groupParticipants.setWidth(0.69 * Display.width + "px");

    HorizontalLayout hor = new HorizontalLayout();
    groupChat = new GroupChatLayout(group);
    groupChat.setSizeUndefined();//from   w  w  w .j ava2 s . c  o  m
    hor.setWidth(0.69 * Display.width + "px");
    hor.addComponent(groupChat);

    HorizontalLayout whiteSp = new HorizontalLayout();
    HorizontalLayout whiteSp1 = new HorizontalLayout();
    VerticalLayout whole = new VerticalLayout();
    whole.setMargin(true);
    whole.addComponents(horIn, whiteSp, groupParticipants, whiteSp1, hor);
    return whole;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getPC() {

    VerticalLayout cAgentInfo = new VerticalLayout();
    final HorizontalLayout cPlaceholder = new HorizontalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, true, true, true));
    cAgentInfo.setStyleName("c_details_test");

    final VerticalLayout cLBody = new VerticalLayout();

    cLBody.setStyleName("c_body_visible");
    tb = new Table("Linked child accounts");
    // addLinksTable();

    final VerticalLayout cAllProf = new VerticalLayout();

    HorizontalLayout cProfActions = new HorizontalLayout();
    final FormLayout cProfName = new FormLayout();

    cProfName.setStyleName("frm_profile_name");
    cProfName.setSizeUndefined();/* ww w  . j a va 2 s .c o m*/

    final Label lbProf = new Label();
    final TextField tFProf = new TextField();

    lbProf.setCaption("Profile Name: ");
    lbProf.setValue("Certified Authorized User.");

    tFProf.setCaption(lbProf.getCaption());
    cProfName.addComponent(lbProf);

    final Button btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.setStyleName("btn_link");
    btnEdit.setDescription("Edit profile name");

    final Button btnCancel = new Button();
    btnCancel.setIcon(FontAwesome.UNDO);
    btnCancel.setStyleName("btn_link");
    btnCancel.setDescription("Cancel Profile name editting.");

    Button btnAdd = new Button("+");
    // btnAdd.setIcon(FontAwesome.EDIT);
    btnAdd.setStyleName("btn_link");
    btnAdd.setDescription("Set new profile");

    Button btnRemove = new Button("-");
    // btnRemove.setIcon(FontAwesome.EDIT);
    btnRemove.setStyleName("btn_link");
    btnRemove.setDescription("Remove current profile");

    // cProf.addComponent(cProfName);
    cProfActions.addComponent(btnEdit);
    cProfActions.addComponent(btnCancel);
    cProfActions.addComponent(btnAdd);
    cProfActions.addComponent(btnRemove);

    btnCancel.setVisible(false);

    cAllProf.addComponent(cProfName);
    cAllProf.addComponent(cProfActions);
    cAllProf.setComponentAlignment(cProfActions, Alignment.TOP_CENTER);

    cLBody.addComponent(cAllProf);

    // cLBody.addComponent(tb);

    tb.setSelectable(true);

    cAgentInfo.addComponent(cLBody);

    btnLink = new Button("Add New Link");
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.setDescription("Link new account.");

    // cLBody.addComponent(btnLink);
    // cLBody.setComponentAlignment(btnLink, Alignment.TOP_LEFT);
    btnLink.addClickListener(new LinkClickHandler());

    cPlaceholder.setVisible(false);
    addLinkUserContainer();
    cPlaceholder.setWidth("100%");

    cLBody.addComponent(cPlaceholder);
    cLBody.setComponentAlignment(cPlaceholder, Alignment.TOP_CENTER);
    HorizontalLayout c = new HorizontalLayout();
    c.addComponent(cAgentInfo);

    btnEdit.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8427226211153164650L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (btnEdit.getIcon().equals(FontAwesome.EDIT)) {

                tFProf.setValue(lbProf.getValue());
                tFProf.selectAll();
                cProfName.replaceComponent(lbProf, tFProf);
                btnEdit.setIcon(FontAwesome.SAVE);
                btnCancel.setVisible(true);
                return;

            } else if (btnEdit.getIcon().equals(FontAwesome.SAVE)) {

                lbProf.setValue(tFProf.getValue());
                cProfName.replaceComponent(tFProf, lbProf);
                btnEdit.setIcon(FontAwesome.EDIT);
                btnCancel.setVisible(false);

                return;
            }
            lbProf.setValue(tFProf.getValue());
            cProfName.replaceComponent(tFProf, lbProf);
            btnEdit.setIcon(FontAwesome.EDIT);
            btnCancel.setVisible(false);

        }
    });

    btnCancel.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -2870045546205986347L;

        @Override
        public void buttonClick(ClickEvent event) {
            cProfName.replaceComponent(tFProf, lbProf);
            btnEdit.setIcon(FontAwesome.EDIT);
            btnCancel.setVisible(false);

        }
    });

    btnAdd.addClickListener(new AddProfileHandler(cAllProf, cPlaceholder));

    btnRemove.addClickListener(new RemoveProfileHandler(pop));

    return c;

}

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   www .j a v a 2  s  .  c o  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);/*  w  w w  .  j  a v a2s. co  m*/
    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//  ww w.j  ava 2 s  .com
        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 va  2 s .  c o 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.vaadin.uitest.Accordions.java

License:Apache License

public Accordions() {
    setSpacing(false);//from   w ww. jav a2s.  c o m

    Label h1 = new Label("Accordions");
    h1.addStyleName(ValoTheme.LABEL_H1);
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.setWidth("100%");
    addComponent(row);

    row.addComponent(getAccordion("Normal"));

    Accordion ac = getAccordion("Borderless");
    ac.addStyleName(ValoTheme.ACCORDION_BORDERLESS);
    row.addComponent(ac);

}