Example usage for com.vaadin.ui CustomLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:com.klwork.explorer.project.ProjectSearchPanel.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);/* ww  w. j a va  2  s  . c o  m*/

    inputField = new TextField();
    inputField.setWidth(50, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt("??");
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:com.klwork.explorer.ui.business.outproject.ProjectSearchPanel.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    //csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);/*  w w  w  .j  a v a 2s  .  com*/

    inputField = new TextField();
    inputField.setWidth(50, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt("??");
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:com.klwork.explorer.ui.custom.TaskListHeader.java

License:Apache License

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    //CssLayout csslayout2 = new CssLayout();
    CustomLayout csslayout = new CustomLayout("circularButton");
    csslayout.setHeight(24, Unit.PIXELS);
    csslayout.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(csslayout);//  w ww  .  j  av  a  2 s . com

    inputField = new TextField();
    inputField.setWidth(100, Unit.PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField, "searchInput");

    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}

From source file:de.symeda.sormas.ui.caze.CaseDataView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    super.enter(event);
    setHeightUndefined();/*  ww w  . ja  v  a 2s .  c  o m*/

    CaseDataDto caze = FacadeProvider.getCaseFacade().getCaseDataByUuid(getCaseRef().getUuid());

    String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, CASE_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, TASKS_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, SAMPLES_LOC));

    VerticalLayout container = new VerticalLayout();
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    CustomLayout layout = new CustomLayout();
    layout.addStyleName(CssStyles.ROOT_COMPONENT);
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();
    container.addComponent(layout);

    CommitDiscardWrapperComponent<?> editComponent;
    if (getViewMode() == ViewMode.SIMPLE) {
        editComponent = ControllerProvider.getCaseController()
                .getCaseCombinedEditComponent(getCaseRef().getUuid(), ViewMode.SIMPLE);
    } else {
        editComponent = ControllerProvider.getCaseController().getCaseDataEditComponent(getCaseRef().getUuid(),
                ViewMode.NORMAL);
    }

    // setSubComponent(editComponent);
    editComponent.setMargin(false);
    editComponent.setWidth(100, Unit.PERCENTAGE);
    editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
    editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
    layout.addComponent(editComponent, CASE_LOC);

    TaskListComponent taskList = new TaskListComponent(TaskContext.CASE, getCaseRef());
    taskList.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(taskList, TASKS_LOC);

    if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW) && !caze.isUnreferredPortHealthCase()) {
        SampleListComponent sampleList = new SampleListComponent(getCaseRef());
        sampleList.addStyleName(CssStyles.SIDE_COMPONENT);
        layout.addComponent(sampleList, SAMPLES_LOC);
    }
}

From source file:de.symeda.sormas.ui.contact.ContactDataView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    super.enter(event);
    setHeightUndefined();/*ww  w  .ja v a  2 s.  c  o  m*/

    String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, EDIT_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CASE_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, TASKS_LOC));

    VerticalLayout container = new VerticalLayout();
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    CustomLayout layout = new CustomLayout();
    layout.addStyleName(CssStyles.ROOT_COMPONENT);
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();
    container.addComponent(layout);

    CommitDiscardWrapperComponent<?> editComponent = ControllerProvider.getContactController()
            .getContactDataEditComponent(getContactRef().getUuid());
    editComponent.setMargin(false);
    editComponent.setWidth(100, Unit.PERCENTAGE);
    editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
    editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
    layout.addComponent(editComponent, EDIT_LOC);

    ContactDto contactDto = FacadeProvider.getContactFacade().getContactByUuid(getContactRef().getUuid());
    CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(contactDto.getCaze().getUuid());
    CaseInfoLayout caseInfoLayout = new CaseInfoLayout(caseDto);
    caseInfoLayout.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(caseInfoLayout, CASE_LOC);

    TaskListComponent taskList = new TaskListComponent(TaskContext.CONTACT, getContactRef());
    taskList.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(taskList, TASKS_LOC);
}

From source file:de.symeda.sormas.ui.events.EventDataView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    super.enter(event);
    setHeightUndefined();/*w  w w.j  a v  a2 s  .  c om*/

    String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, EVENT_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, TASKS_LOC));

    VerticalLayout container = new VerticalLayout();
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    CustomLayout layout = new CustomLayout();
    layout.addStyleName(CssStyles.ROOT_COMPONENT);
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();
    container.addComponent(layout);

    CommitDiscardWrapperComponent<?> editComponent = ControllerProvider.getEventController()
            .getEventDataEditComponent(getEventRef().getUuid());
    editComponent.setMargin(false);
    editComponent.setWidth(100, Unit.PERCENTAGE);
    editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
    editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
    layout.addComponent(editComponent, EVENT_LOC);

    TaskListComponent taskList = new TaskListComponent(TaskContext.EVENT, getEventRef());
    taskList.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(taskList, TASKS_LOC);
}

From source file:de.symeda.sormas.ui.samples.SampleDataView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    super.enter(event);
    setHeightUndefined();//from   w  w w  .j a  v a 2 s.co  m

    String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, EDIT_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CASE_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, PATHOGEN_TESTS_LOC),
            LayoutUtil.fluidColumnLoc(4, 0, 6, 0, ADDITIONAL_TESTS_LOC));

    VerticalLayout container = new VerticalLayout();
    container.setWidth(100, Unit.PERCENTAGE);
    container.setMargin(true);
    setSubComponent(container);
    CustomLayout layout = new CustomLayout();
    layout.addStyleName(CssStyles.ROOT_COMPONENT);
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();
    container.addComponent(layout);

    SampleDto sampleDto = FacadeProvider.getSampleFacade().getSampleByUuid(getSampleRef().getUuid());

    CommitDiscardWrapperComponent<SampleEditForm> editComponent = ControllerProvider.getSampleController()
            .getSampleEditComponent(getSampleRef().getUuid());
    editComponent.setMargin(false);
    editComponent.setWidth(100, Unit.PERCENTAGE);
    editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
    editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
    layout.addComponent(editComponent, EDIT_LOC);

    BiConsumer<PathogenTestResultType, Boolean> pathogenTestChangedCallback = new BiConsumer<PathogenTestResultType, Boolean>() {
        @Override
        public void accept(PathogenTestResultType pathogenTestResult, Boolean verified) {
            if (verified) {
                SampleDto componentSample = editComponent.getWrappedComponent().getValue();
                if (pathogenTestResult != componentSample.getPathogenTestResult()) {
                    ControllerProvider.getSampleController().showChangePathogenTestResultWindow(editComponent,
                            componentSample.getUuid(), pathogenTestResult);
                }
            }

            editComponent.getWrappedComponent().makePathogenTestResultRequired();
        }
    };

    CaseDataDto caseDto = FacadeProvider.getCaseFacade()
            .getCaseDataByUuid(sampleDto.getAssociatedCase().getUuid());
    CaseInfoLayout caseInfoLayout = new CaseInfoLayout(caseDto);
    caseInfoLayout.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(caseInfoLayout, CASE_LOC);

    PathogenTestListComponent pathogenTestList = new PathogenTestListComponent(getSampleRef(),
            pathogenTestChangedCallback);
    pathogenTestList.addStyleName(CssStyles.SIDE_COMPONENT);
    layout.addComponent(pathogenTestList, PATHOGEN_TESTS_LOC);

    if (UserProvider.getCurrent().hasUserRight(UserRight.ADDITIONAL_TEST_VIEW)) {
        AdditionalTestListComponent additionalTestList = new AdditionalTestListComponent(
                getSampleRef().getUuid());
        additionalTestList.addStyleName(CssStyles.SIDE_COMPONENT);
        layout.addComponent(additionalTestList, ADDITIONAL_TESTS_LOC);
    }
}

From source file:de.symeda.sormas.ui.utils.AbstractEditForm.java

License:Open Source License

@Override
public CustomLayout initContent() {

    String htmlLayout = createHtmlLayout();
    CustomLayout layout = new CustomLayout();
    layout.setTemplateContents(htmlLayout);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeightUndefined();// w  w  w  . j a v a2  s.c o m

    return layout;
}