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.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java

public UserDetailsWidget() {
    HorizontalLayout h = new HorizontalLayout();
    addComponent(h);//w ww. j a v  a2  s. co m

    h.setSizeFull();
    //h.setSpacing(true);

    Button userPhoto = new Button();
    userPhoto.setIcon(FontAwesome.USER);
    userPhoto.setHeight("100px");
    userPhoto.setWidth("100px");
    h.addComponent(userPhoto);
    //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT);

    VerticalLayout v = new VerticalLayout();
    //v.setStyleName("backColorBlack");
    h.addComponent(v);
    v.setStyleName("v-layout-padding-left");
    //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT);
    v.setHeight("106px");
    v.setWidth("100px");

    // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER);
    Button editProfile = new Button("Profile");
    editProfile.setStyleName("v-button-type3");
    editProfile.setIcon(FontAwesome.USER);
    editProfile.setWidth("100px");
    editProfile.setWidth("102px");
    v.addComponent(editProfile);
    //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT);

    Button settings = new Button("Settings");
    settings.setStyleName("v-button-type3");
    settings.setIcon(FontAwesome.WRENCH);
    settings.setWidth("100px");
    settings.setWidth("102px");
    v.addComponent(settings);
    //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT);

    Button logOut = new Button("Log Out");
    logOut.setStyleName("v-button-type3");
    logOut.setIcon(FontAwesome.KEY);
    logOut.setWidth("100px");
    logOut.setWidth("102px");
    v.addComponent(logOut);
    //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT);

    //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER);
}

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * @param audioFile//ww  w  .  j  a  va 2 s.co  m
 */
protected void buildInformationPanel(AudioFile audioFile) {
    if (bottom == null) {
        this.bottom = new HorizontalLayout();
        bottom.setWidth("100%");
        content.addComponent(bottom);

        VerticalLayout side = new VerticalLayout();
        side.setMargin(true);
        side.setSpacing(true);
        side.setWidth("170px");
        bottom.addComponent(side);

        CssLayout musicFile = new CssLayout();
        musicFile.addStyleName(Runo.CSSLAYOUT_SHADOW);
        musicFile.addComponent(createPlayImage(audioFile, audioFile.getCover()));
        side.addComponent(musicFile);

        side.addComponent(setFavorite());
        side.addComponent(setRate());

        Component details = addDetails(audioFile);
        bottom.addComponent(details);
        bottom.setExpandRatio(details, 1);

    } else {
        bottom.removeAllComponents();
        content.removeComponent(bottom);
        this.bottom = null;
        buildInformationPanel(audioFile);
    }

}

From source file:com.mycollab.mobile.module.project.ui.ProjectAttachmentDisplayComp.java

License:Open Source License

private void constructUI() {
    this.setStyleName("attachment-display-comp");
    this.addComponent(FormSectionBuilder.build(FontAwesome.FILE, GenericI18Enum.FORM_ATTACHMENTS));
    VerticalLayout comp = new VerticalLayout();
    comp.setStyleName("attachment-view-panel");
    comp.setWidth("100%");

    for (final Content attachment : attachments) {
        Component attachmentRow = MobileAttachmentUtils.renderAttachmentRow(attachment);
        comp.addComponent(attachmentRow);
    }//from   w ww.  ja v  a  2s  .c o  m
    this.addComponent(comp);
}

From source file:com.mycollab.mobile.module.project.ui.TimeLogEditView.java

License:Open Source License

private void constructSpentTimeEntryPanel() {
    final VerticalLayout totalLayout = new VerticalLayout();
    totalLayout.setMargin(new MarginInfo(false, true, false, true));
    totalLayout.setWidth("100%");
    final Label lbTimeInstructTotal = new Label(
            UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS));
    totalLayout.addComponent(lbTimeInstructTotal);
    this.totalSpentTimeLbl = new ELabel("_").withStyleName("h2");
    totalLayout.addComponent(this.totalSpentTimeLbl);

    headerPanel.addComponent(totalLayout);
}

From source file:com.mycollab.mobile.module.project.ui.TimeLogEditView.java

License:Open Source License

private void constructRemainTimeEntryPanel() {
    final VerticalLayout updateLayout = new VerticalLayout();
    updateLayout.setMargin(new MarginInfo(false, true, false, true));
    updateLayout.setWidth("100%");

    final Label lbTimeInstructTotal = new Label(
            UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS));
    updateLayout.addComponent(lbTimeInstructTotal);
    remainTimeLbl = new ELabel("_").withStyleName("h2");
    updateLayout.addComponent(this.remainTimeLbl);

    headerPanel.addComponent(updateLayout);
}

From source file:com.mycollab.mobile.module.project.view.bug.BugFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/* w w w. j a v  a2 s .co  m*/
    layout.setWidth("100%");
    layout.addComponent(FormSectionBuilder.build(AppContext.getMessage(BugI18nEnum.SINGLE)));

    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 14);
    layout.addComponent(informationLayout.getLayout());
    layout.setComponentAlignment(informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    layout.setExpandRatio(informationLayout.getLayout(), 1.0f);
    return layout;
}

From source file:com.mycollab.mobile.module.project.view.bug.ReOpenView.java

License:Open Source License

private void constructUI() {
    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setWidth("100%");
    contentLayout.addComponent(this.editForm);

    final Button reOpenBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_REOPEN), clickEvent -> {
        if (editForm.validateForm()) {
            bug.setStatus(BugStatus.ReOpen.name());

            // Save bug status and assignee
            final BugService bugService = AppContextUtil.getSpringBean(BugService.class);
            bugService.updateSelectiveWithSession(bug, UserUIContext.getUsername());

            // Save comment
            final String commentValue = editForm.commentArea.getValue();
            if (commentValue != null && !commentValue.trim().equals("")) {
                final CommentWithBLOBs comment = new CommentWithBLOBs();
                comment.setComment(commentValue);
                comment.setCreatedtime(new GregorianCalendar().getTime());
                comment.setCreateduser(UserUIContext.getUsername());
                comment.setSaccountid(MyCollabUI.getAccountId());
                comment.setType(ProjectTypeConstants.BUG);
                comment.setTypeid("" + bug.getId());
                comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                final CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                commentService.saveWithSession(comment, UserUIContext.getUsername());
            }/*from   ww w  .  j  a  v  a  2  s . c  om*/
            callbackForm.previewItem(bug);
            EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null));
        }
    });
    this.setRightComponent(reOpenBtn);
    this.setContent(contentLayout);
}

From source file:com.mycollab.mobile.module.project.view.milestone.MilestoneFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setMargin(false);//from  w w  w .  ja v  a 2 s .  c  o  m
    layout.addComponent(FormSectionBuilder.build(AppContext.getMessage(MilestoneI18nEnum.SINGLE)));

    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 8);
    layout.addComponent(informationLayout.getLayout());
    return layout;
}

From source file:com.mycollab.mobile.module.project.view.ProjectDashboardViewImpl.java

License:Open Source License

@Override
public void displayDashboard() {
    mainLayout.removeAllComponents();/*from  ww w . j a v  a  2 s.  c  o  m*/
    SimpleProject currentProject = CurrentProjectVariables.getProject();
    VerticalLayout projectInfo = new VerticalLayout();
    projectInfo.setStyleName("project-info-layout");
    projectInfo.setWidth("100%");
    projectInfo.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    ELabel projectIcon = ELabel.fontIcon(FontAwesome.BUILDING_O).withStyleName("project-icon")
            .withWidthUndefined();
    projectInfo.addComponent(projectIcon);

    ELabel projectName = new ELabel(currentProject.getName()).withFullWidth().withStyleName("project-name");
    projectInfo.addComponent(projectName);

    MHorizontalLayout metaInfo = new MHorizontalLayout();

    Label projectMemberBtn = ELabel
            .html(FontAwesome.USERS.getHtml() + " " + currentProject.getNumActiveMembers())
            .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS))
            .withStyleName(UIConstants.META_INFO);

    metaInfo.addComponent(projectMemberBtn);
    Label createdTimeLbl = ELabel
            .html(FontAwesome.CLOCK_O.getHtml() + " "
                    + UserUIContext.formatPrettyTime(currentProject.getCreatedtime()))
            .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(createdTimeLbl);

    Label billableHoursLbl = ELabel
            .html(FontAwesome.MONEY.getHtml() + " "
                    + NumberUtils.roundDouble(2, currentProject.getTotalBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(billableHoursLbl);

    Label nonBillableHoursLbl = ELabel
            .html(FontAwesome.GIFT.getHtml() + " "
                    + NumberUtils.roundDouble(2, currentProject.getTotalNonBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS))
            .withStyleName(UIConstants.META_INFO);
    metaInfo.addComponent(nonBillableHoursLbl);
    projectInfo.addComponent(metaInfo);

    int openAssignments = currentProject.getNumOpenBugs() + currentProject.getNumOpenTasks()
            + currentProject.getNumOpenRisks();
    int totalAssignments = currentProject.getNumBugs() + currentProject.getNumTasks()
            + currentProject.getNumRisks();
    ELabel progressInfoLbl;
    if (totalAssignments > 0) {
        progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_PROJECT_TICKET,
                (totalAssignments - openAssignments), totalAssignments,
                (totalAssignments - openAssignments) * 100 / totalAssignments)).withWidthUndefined()
                        .withStyleName(UIConstants.META_INFO);
    } else {
        progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET))
                .withWidthUndefined().withStyleName(UIConstants.META_INFO);
    }
    projectInfo.addComponent(progressInfoLbl);

    mainLayout.addComponent(projectInfo);

    VerticalComponentGroup btnGroup = new VerticalComponentGroup();

    NavigationButton activityBtn = new NavigationButton(
            UserUIContext.getMessage(ProjectCommonI18nEnum.M_VIEW_PROJECT_ACTIVITIES));
    activityBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new ProjectEvent.MyProjectActivities(this, CurrentProjectVariables.getProjectId())));
    btnGroup.addComponent(new NavigationButtonWrap(FontAwesome.INBOX, activityBtn));

    NavigationButton messageBtn = new NavigationButton(UserUIContext.getMessage(MessageI18nEnum.LIST));
    messageBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new MessageEvent.GotoList(this, null)));
    btnGroup.addComponent(
            new NavigationButtonWrap(ProjectAssetsManager.getAsset(ProjectTypeConstants.MESSAGE), messageBtn));

    NavigationButton milestoneBtn = new NavigationButton(UserUIContext.getMessage(MilestoneI18nEnum.LIST));
    milestoneBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new MilestoneEvent.GotoList(this, null)));
    btnGroup.addComponent(new NavigationButtonWrap(
            ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE), milestoneBtn));

    NavigationButton taskBtn = new NavigationButton(UserUIContext.getMessage(TicketI18nEnum.LIST));
    taskBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new TicketEvent.GotoDashboard(this, null)));
    btnGroup.addComponent(
            new NavigationButtonWrap(ProjectAssetsManager.getAsset(ProjectTypeConstants.TICKET), taskBtn));

    NavigationButton userBtn = new NavigationButton(UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    userBtn.addClickListener(navigationButtonClickEvent -> EventBusFactory.getInstance()
            .post(new ProjectMemberEvent.GotoList(this, null)));
    btnGroup.addComponent(new NavigationButtonWrap(FontAwesome.USERS, userBtn));

    mainLayout.addComponent(btnGroup);
}

From source file:com.mycollab.mobile.ui.ConfirmDialog.java

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();/*from w ww  .  j ava 2 s .  c o m*/
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    ClickListener listener = (clickEvent) -> {
        ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn);
        if (ConfirmDialog.this.getListener() != null) {
            ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
        }
        close();
    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}