Example usage for com.vaadin.ui VerticalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

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);/*from w w  w .  ja v  a2s .co 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);/*  w ww  .  j a v  a2s .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.lead.LeadConvertInfoWindow.java

License:Open Source License

private ComponentContainer createBody() {
    final CssLayout layout = new CssLayout();
    layout.setSizeFull();//from w ww.  j av  a 2s  . c  o  m

    Label shortDescription = new Label(
            "<p>&nbsp;&nbsp;&nbsp;By clicking the \"Convert\" button, the following tasks will be done:</p>",
            ContentMode.HTML);
    layout.addComponent(shortDescription);

    VerticalLayout infoLayout = new VerticalLayout();
    infoLayout.setMargin(new MarginInfo(false, true, true, true));
    infoLayout.setSpacing(true);

    String createAccountTxt = "Create Account: <span class='" + UIConstants.TEXT_BLUE + "'>"
            + lead.getAccountname() + "</span>";
    Label createAccountLbl = new Label(createAccountTxt, ContentMode.HTML);
    createAccountLbl.addStyleName(UIConstants.LABEL_CHECKED);
    infoLayout.addComponent(createAccountLbl);

    String createContactTxt = "Create Contact: <span class='" + UIConstants.TEXT_BLUE + "'>"
            + lead.getLastname() + (lead.getFirstname() != null ? " " + lead.getFirstname() : "") + "</span>";
    Label createContactLbl = new Label(createContactTxt, ContentMode.HTML);
    createContactLbl.addStyleName(UIConstants.LABEL_CHECKED);
    infoLayout.addComponent(createContactLbl);

    final CheckBox isCreateOpportunityChk = new CheckBox("Create a new opportunity for this account");
    isCreateOpportunityChk.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Boolean isSelected = isCreateOpportunityChk.getValue();
            if (isSelected) {
                opportunityForm = new LeadOpportunityForm();
                Opportunity opportunity = new Opportunity();

                // this is a trick to pass validation
                opportunity.setAccountid(0);
                opportunityForm.setBean(opportunity);
                layout.addComponent(opportunityForm);
            } else {
                layout.removeComponent(opportunityForm);
            }

        }
    });

    infoLayout.addComponent(isCreateOpportunityChk);

    layout.addComponent(infoLayout);
    return layout;
}

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 ww w.ja v  a 2  s  .co 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.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 va2  s. co  m
    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);
    filterBtnLayout.setSpacing(true);/*  ww w .java2  s  .  co m*/
    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  w  w w .ja 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);/* w  w w .j a  v  a 2s  .com*/
    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);
}

From source file:com.esofthead.mycollab.module.project.view.bug.AssignBugWindow.java

License:Open Source License

AssignBugWindow(final IBugCallbackStatusComp callbackForm, final SimpleBug bug) {
    super("Assign bug '" + bug.getSummary() + "'");
    this.setWidth("750px");
    this.setResizable(false);
    this.setModal(true);

    this.bug = bug;
    this.callbackForm = callbackForm;

    VerticalLayout contentLayout = new VerticalLayout();

    EditForm editForm = new EditForm();
    contentLayout.addComponent(editForm);
    editForm.setBean(bug);/*from  w w w.j av  a  2  s.co  m*/
    contentLayout.setMargin(new MarginInfo(false, false, true, false));

    this.setContent(contentLayout);
    this.center();
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugListWidget.java

License:Open Source License

public BugListWidget(final String title, final String backBtnLabel, final BugSearchCriteria bugSearchCriteria,
        final IBugReportDisplayContainer bugReportDisplayContainer) {
    super(title, new VerticalLayout());

    final VerticalLayout contentLayout = (VerticalLayout) this.bodyContent;
    contentLayout.setSpacing(true);//from w w  w.  ja  v a  2  s .c o  m
    contentLayout.setWidth("100%");

    final Button backToBugReportsBtn = new Button(backBtnLabel, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            bugReportDisplayContainer.displayBugReports();
        }
    });
    // contentLayout.addComponent(backToBugReportsBtn);
    final VerticalLayout backBtnWrapper = new VerticalLayout();
    backBtnWrapper.setMargin(new MarginInfo(false, false, true, false));

    backToBugReportsBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    backBtnWrapper.addComponent(backToBugReportsBtn);

    this.addComponentAsFirst(backBtnWrapper);

    this.tableItem = new BugTableDisplay(BugTableFieldDef.action,
            Arrays.asList(BugTableFieldDef.summary, BugTableFieldDef.assignUser, BugTableFieldDef.severity,
                    BugTableFieldDef.resolution, BugTableFieldDef.duedate));

    this.tableItem.addTableListener(new TableClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(final TableClickEvent event) {
            final SimpleBug bug = (SimpleBug) event.getData();
            if ("summary".equals(event.getFieldName())) {
                EventBusFactory.getInstance().post(new BugEvent.GotoRead(BugListWidget.this, bug.getId()));
            }
        }
    });

    this.tableItem.setWidth("100%");
    contentLayout.addComponent(this.tableItem);

    this.setSearchCriteria(bugSearchCriteria);
}