Example usage for com.vaadin.ui VerticalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.esofthead.mycollab.module.crm.view.cases.CaseListNoItemView.java

License:Open Source License

public CaseListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//w  w w  .j ava 2s  .  c  o  m
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/case.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CaseEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Cases", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.contact.ContactListNoItemView.java

License:Open Source License

public ContactListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//from   www .  jav a  2s .  c o m
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/contact.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Contacts", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.contact.ContactOpportunityListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from w w w.j a v  a 2s. com
        public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    controlsBtn.setSizeUndefined();
    Button selectBtn = new Button("Select from existing opportunities", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ContactOpportunitySelectionWindow opportunitiesWindow = new ContactOpportunitySelectionWindow(
                    ContactOpportunityListComp.this);
            OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(opportunitiesWindow);
            opportunitiesWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");

    VerticalLayout buttonControlsLayout = new VerticalLayout();
    buttonControlsLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadCampaignListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlBtnWrap = new VerticalLayout();
    controlBtnWrap.setWidth("100%");

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();/*from   w  w w  . j ava  2s  .c o m*/
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1099580202385205069L;

        @Override
        public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    Button selectBtn = new Button("Select from existing campaigns", new Button.ClickListener() {
        private static final long serialVersionUID = 3046728004767791528L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow(
                    LeadCampaignListComp.this);
            CampaignSearchCriteria criteria = new CampaignSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");

    VerticalLayout buttonControlsLayout = new VerticalLayout();
    buttonControlsLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlBtnWrap.addComponent(controlsBtn);
    controlBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);

    return controlBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadListNoItemView.java

License:Open Source License

public LeadListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//from   w w w.j a v a 2s  . c o m
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/lead.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button("New Lead", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null));
        }
    });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityLeadListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();//from  w ww .j a  v a 2  s  .  c o  m
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow(
                    OpportunityLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityListNoItemView.java

License:Open Source License

public OpportunityListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//from  w  w w.  j a  va  2 s. c om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/opportunity.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Leads", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     * 
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     * 
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     * 
     * 
     * links.addComponent(btImportContact);
     */
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java

License:Open Source License

private void initUI() {
    final PopupButton saleChartPopup = new PopupButton("");
    saleChartPopup.addStyleName("popuplistindicator");

    final VerticalLayout filterBtnLayout = new VerticalLayout();
    filterBtnLayout.setMargin(true);//from   w w  w  .  j  a v  a 2  s.com
    filterBtnLayout.setSpacing(true);
    filterBtnLayout.setWidth("200px");

    final Button btnOpportunitySales = new Button("Opportunity Sales Stage", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            saleChartPopup.setPopupVisible(false);
            SalesDashboardView.this.currentReportIndex = 0;
            SalesDashboardView.this.displayReport();
        }
    });
    btnOpportunitySales.setStyleName("link");
    filterBtnLayout.addComponent(btnOpportunitySales);

    final Button btnOpportunityLead = new Button("Opportunity Lead Source", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            saleChartPopup.setPopupVisible(false);
            SalesDashboardView.this.currentReportIndex = 1;
            SalesDashboardView.this.displayReport();
        }
    });
    btnOpportunityLead.setStyleName("link");
    filterBtnLayout.addComponent(btnOpportunityLead);

    this.displayReport();

    saleChartPopup.setContent(filterBtnLayout);
    this.addHeaderElement(saleChartPopup);
}

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java

License:Open Source License

private void constructSpentTimeEntryPanel() {
    VerticalLayout spentTimePanel = new VerticalLayout();
    spentTimePanel.setSpacing(true);/*from  ww  w  . j  a  v a  2  s  . c o m*/
    headerPanel.addComponent(spentTimePanel);

    final VerticalLayout totalLayout = new VerticalLayout();
    totalLayout.setMargin(true);
    totalLayout.addStyleName("boxTotal");
    totalLayout.setWidth("100%");
    spentTimePanel.addComponent(totalLayout);
    final Label lbTimeInstructTotal = new Label(
            AppContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS));
    totalLayout.addComponent(lbTimeInstructTotal);
    this.totalSpentTimeLbl = new Label("_");
    this.totalSpentTimeLbl.addStyleName("numberTotal");
    totalLayout.addComponent(this.totalSpentTimeLbl);

    final MHorizontalLayout addLayout = new MHorizontalLayout();
    addLayout.setSizeUndefined();
    addLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    spentTimePanel.addComponent(addLayout);

    this.newTimeInputField = new NumericTextField();
    this.newTimeInputField.setWidth("80px");

    this.forDateField = new DateFieldExt();
    this.forDateField.setValue(new GregorianCalendar().getTime());

    this.isBillableField = new CheckBox(AppContext.getMessage(TimeTrackingI18nEnum.FORM_IS_BILLABLE), true);

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

        @Override
        public void buttonClick(final ClickEvent event) {
            double d = 0;
            try {
                d = Double.parseDouble(newTimeInputField.getValue());
            } catch (NumberFormatException e) {
                NotificationUtil.showWarningNotification("You must enter a positive number value");
            }
            if (d > 0) {
                saveTimeInvest();
                loadTimeValue();
                newTimeInputField.setValue("0.0");
            }
        }

    });

    btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd());
    btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK);
    btnAdd.setIcon(FontAwesome.PLUS);
    addLayout.with(this.newTimeInputField, this.forDateField, this.isBillableField, btnAdd);
}

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java

License:Open Source License

private void constructRemainTimeEntryPanel() {
    VerticalLayout remainTimePanel = new VerticalLayout();
    remainTimePanel.setSpacing(true);//from   ww  w . ja  v  a2  s .c  o m
    this.headerPanel.addComponent(remainTimePanel);

    final VerticalLayout updateLayout = new VerticalLayout();
    updateLayout.setMargin(true);
    updateLayout.addStyleName("boxTotal");
    updateLayout.setWidth("100%");
    remainTimePanel.addComponent(updateLayout);

    final Label lbTimeInstructTotal = new Label(
            AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS));
    updateLayout.addComponent(lbTimeInstructTotal);
    this.remainTimeLbl = new Label("_");
    this.remainTimeLbl.addStyleName("numberTotal");
    updateLayout.addComponent(this.remainTimeLbl);

    final MHorizontalLayout addLayout = new MHorizontalLayout();
    addLayout.setSizeUndefined();
    remainTimePanel.addComponent(addLayout);

    this.remainTimeInputField = new NumericTextField();
    this.remainTimeInputField.setWidth("80px");
    addLayout.addComponent(this.remainTimeInputField);
    addLayout.setComponentAlignment(this.remainTimeInputField, Alignment.MIDDLE_LEFT);

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

        @Override
        public void buttonClick(final ClickEvent event) {

            try {
                double d = 0;
                try {
                    d = Double.parseDouble(remainTimeInputField.getValue());
                } catch (Exception e) {
                    NotificationUtil.showWarningNotification("You must enter a positive number value");
                }
                if (d >= 0) {
                    updateTimeRemain();
                    remainTimeLbl.setValue(remainTimeInputField.getValue());
                    remainTimeInputField.setValue("0.0");
                }
            } catch (final Exception e) {
                remainTimeInputField.setValue("0.0");
            }
        }

    });

    btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd());
    btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK);
    addLayout.addComponent(btnAdd);
    addLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_LEFT);
}