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.mycollab.module.crm.view.account.AccountContactListComp.java

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {//from   w w w .java2  s .com
                    final AccountContactSelectionWindow contactsWindow = new AccountContactSelectionWindow(
                            AccountContactListComp.this);
                    final ContactSearchCriteria criteria = new ContactSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(contactsWindow);
                    contactsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));

        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

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

    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.account.AccountLeadListComp.java

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            AccountLeadSelectionWindow leadsWindow = new AccountLeadSelectionWindow(AccountLeadListComp.this);
            LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));

        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }// w ww.j a  va2s.com
    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignAccountListComp.java

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(AccountI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {//from  www  .j a v a2s  .  c o m
                    final CampaignAccountSelectionWindow accountsWindow = new CampaignAccountSelectionWindow(
                            CampaignAccountListComp.this);
                    final AccountSearchCriteria criteria = new AccountSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(accountsWindow);
                    accountsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

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

    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignContactListComp.java

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {/*from  ww  w .  j a  v a2  s.  c om*/
                    final CampaignContactSelectionWindow contactsWindow = new CampaignContactSelectionWindow(
                            CampaignContactListComp.this);
                    final ContactSearchCriteria criteria = new ContactSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(contactsWindow);
                    contactsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

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

    return controlsBtnWrap;
}

From source file:com.mycollab.module.crm.view.campaign.CampaignLeadListComp.java

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT),
                clickEvent -> {/*from   w  ww  .  j  av a 2 s. com*/
                    CampaignLeadSelectionWindow leadsWindow = new CampaignLeadSelectionWindow(
                            CampaignLeadListComp.this);
                    LeadSearchCriteria criteria = new LeadSearchCriteria();
                    criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
                    UI.getCurrent().addWindow(leadsWindow);
                    leadsWindow.setSearchCriteria(criteria);
                    controlsBtn.setPopupVisible(false);
                });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));
        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

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

    return controlsBtnWrap;
}

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

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            CaseContactSelectionWindow contactsWindow = new CaseContactSelectionWindow(
                    CaseContactListComp.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        });//from   w  ww  . ja v  a2 s.c  o m
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT));
        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);

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

    return controlsBtnWrap;
}

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

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(OpportunityI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        controlsBtn.setSizeUndefined();/*from   w  w  w.  j  a  v  a  2 s .com*/
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            ContactOpportunitySelectionWindow opportunitiesWindow = new ContactOpportunitySelectionWindow(
                    ContactOpportunityListComp.this);
            OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(opportunitiesWindow);
            opportunitiesWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));

        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);
        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }
    return controlsBtnWrap;
}

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

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.setSizeUndefined();/* ww  w.  java  2 s  .  com*/
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(CampaignI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow(
                    LeadCampaignListComp.this);
            CampaignSearchCriteria criteria = new CampaignSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        });
        selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN));
        OptionPopupContent buttonControlsLayout = new OptionPopupContent();
        buttonControlsLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlsLayout);

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

    return controlBtnWrap;
}

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

License:Open Source License

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

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) {
        final SplitButton controlsBtn = new SplitButton();
        controlsBtn.addStyleName(WebThemes.BUTTON_ACTION);
        controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW));
        controlsBtn.setIcon(FontAwesome.PLUS);
        controlsBtn.addClickListener(event -> fireNewRelatedItem(""));
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow(
                    OpportunityLeadListComp.this);
            final LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId()));
            UI.getCurrent().addWindow(leadsWindow);
            leadsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD));

        OptionPopupContent buttonControlLayout = new OptionPopupContent();
        buttonControlLayout.addOption(selectBtn);
        controlsBtn.setContent(buttonControlLayout);

        controlsBtnWrap.addComponent(controlsBtn);
        controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    }//  w ww .j  ava 2 s.  c o m

    return controlsBtnWrap;
}

From source file:com.mycollab.module.user.accountsettings.customize.view.LogoEditWindow.java

License:Open Source License

private void editPhoto(byte[] imageData) {
    try {//from w  w w. j  a  v  a2  s .  co m
        originalImage = ImageIO.read(new ByteArrayInputStream(imageData));
    } catch (IOException e) {
        throw new UserInvalidInputException("Invalid image type");
    }
    originalImage = ImageUtil.scaleImage(originalImage, 650, 650);

    MHorizontalLayout previewBox = new MHorizontalLayout().withMargin(new MarginInfo(false, true, true, false))
            .withFullWidth();

    final String logoPath = MyCollabUI.getBillingAccount().getLogopath();
    Resource defaultPhoto = AccountAssetsResolver.createLogoResource(logoPath, 150);
    previewImage = new Embedded(null, defaultPhoto);
    previewImage.setWidth("100px");
    previewBox.addComponent(previewImage);
    previewBox.setComponentAlignment(previewImage, Alignment.TOP_LEFT);

    MVerticalLayout previewBoxRight = new MVerticalLayout().withSpacing(false)
            .withMargin(new MarginInfo(false, true, false, true));

    previewBoxRight
            .addComponent(ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_IMAGE_EDIT_INSTRUCTION)));

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new SettingEvent.GotoGeneralSetting(LogoEditWindow.this, null)))
                            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton acceptBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ACCEPT), clickEvent -> {
        if (scaleImageData != null && scaleImageData.length > 0) {
            try {
                BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData));
                AccountLogoService accountLogoService = AppContextUtil.getSpringBean(AccountLogoService.class);
                accountLogoService.upload(UserUIContext.getUsername(), image, MyCollabUI.getAccountId());
                Page.getCurrent().getJavaScript().execute("window.location.reload();");
            } catch (IOException e) {
                throw new MyCollabException("Error when saving account logo", e);
            }
        }
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE)
            .withClickShortcut(ShortcutAction.KeyCode.ENTER);

    MHorizontalLayout controlBtns = new MHorizontalLayout(acceptBtn, cancelBtn);
    previewBoxRight.with(controlBtns).withAlign(controlBtns, Alignment.TOP_LEFT);
    previewBox.with(previewBoxRight).expand(previewBoxRight);
    content.addComponent(previewBox);

    CssLayout cropBox = new CssLayout();
    cropBox.setWidth("100%");
    VerticalLayout currentPhotoBox = new VerticalLayout();
    Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage),
            "image/png");
    CropField cropField = new CropField(resource);
    cropField.setImmediate(true);
    cropField.setSelectionAspectRatio(150 / 28);
    cropField.addValueChangeListener(valueChangeEvent -> {
        VCropSelection newSelection = (VCropSelection) valueChangeEvent.getProperty().getValue();
        int x1 = newSelection.getXTopLeft();
        int y1 = newSelection.getYTopLeft();
        int x2 = newSelection.getXBottomRight();
        int y2 = newSelection.getYBottomRight();
        if (x2 > x1 && y2 > y1) {
            BufferedImage subImage = originalImage.getSubimage(x1, y1, (x2 - x1), (y2 - y1));
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            try {
                ImageIO.write(subImage, "png", outStream);
                scaleImageData = outStream.toByteArray();
                displayPreviewImage();
            } catch (IOException e) {
                LOG.error("Error while scale image: ", e);
            }
        }
    });
    currentPhotoBox.setWidth("650px");
    currentPhotoBox.setHeight("650px");
    currentPhotoBox.addComponent(cropField);
    cropBox.addComponent(currentPhotoBox);

    content.with(previewBox, ELabel.hr(), cropBox);
}