Example usage for com.vaadin.ui CustomLayout addComponent

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

Introduction

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

Prototype

public void addComponent(Component c, String location) 

Source Link

Document

Adds the component into this container to given location.

Usage

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

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    super.enter(event);
    setHeightUndefined();/*from   w  w w .j a va2 s .  com*/

    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();/*  ww  w.j  av  a2s  . com*/

    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 ww. j a 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, 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:info.joseluismartin.gtc.admin.AdminApplication.java

License:Apache License

/**
 * {@inheritDoc}// w  ww. j  av a 2 s.  c  o  m
 */
@Override
public void init() {
    ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(
            ((WebApplicationContext) getContext()).getHttpSession().getServletContext());
    TilaGuiFactory guiFactory = (TilaGuiFactory) ctx.getBean("guiFactory");
    setTheme("tila");
    Window mainWindow = new Window("Tila Administration");
    CustomLayout cl = new CustomLayout("main");
    Component main = guiFactory.getComponent("main");
    cl.addComponent(main, "main");
    cl.setSizeFull();
    mainWindow.setContent(cl);
    setMainWindow(mainWindow);
}

From source file:org.escidoc.browser.ui.maincontent.SimpleSearch.java

License:Open Source License

public SimpleSearch(final Router router, LayoutDesign layout, final EscidocServiceLocation serviceLocation,
        final Repositories repositories) {
    Preconditions.checkNotNull(router, "mainSite is null: %s", router);
    Preconditions.checkNotNull(serviceLocation, "serviceLocation is null: %s", serviceLocation);
    Preconditions.checkNotNull(repositories, "repositories is null: %s", repositories);
    this.router = router;
    this.layout = layout;
    this.serviceLocation = serviceLocation;
    this.repositories = repositories;

    final CustomLayout custom = new CustomLayout("simplesearch");
    addComponent(custom);/*from  w w  w . j  av a2s  .c  o m*/

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    searchField = new TextField();
    searchField.setWidth("268px");
    searchField.setHeight("-1px");
    searchField.setImmediate(false);

    // button_1
    searchBtn = new Button("Search", this, "onClick");
    searchBtn.setImmediate(true);

    // Advanced
    advancedBtn = new Button("Advanced Search", this, "onClickAdvSearch");
    advancedBtn.setStyleName(BaseTheme.BUTTON_LINK);
    advancedBtn.setImmediate(true);

    custom.addComponent(advancedBtn, "btnAdvanced");
    custom.addComponent(searchField, "searchfld");
    custom.addComponent(searchBtn, "searchbtn");

}

From source file:org.fossa.rolp.demo.DemoWelcomeScreen.java

License:Open Source License

public DemoWelcomeScreen(RolpApplication app, FossaAuthorizer authorizer) {
    super(app);//from  ww w .ja va 2  s .  co m
    this.app = app;
    setStyleName("demo");
    setWidth("900px");
    center();
    this.authorizer = authorizer;
    CustomLayout layout = new CustomLayout("./demo/welcomeScreen");
    CustomLayout layoutTop = new CustomLayout("./demo/welcomeScreenTop");
    CustomLayout layoutMiddle = new CustomLayout("./demo/welcomeScreenMiddle");
    CustomLayout layoutBottom = new CustomLayout("./demo/welcomeScreenBottom");

    Embedded logoRolp = new Embedded(null, new ThemeResource(DEMO_LOGO_ROLP_PATH));
    logoRolp.setType(Embedded.TYPE_IMAGE);
    logoRolp.setWidth("100px");
    logoRolp.setHeight("96px");

    Label rolpDemoText = new Label(
            "<h2>Wilkommen</h2>Dies ist eine Demoversion der Software ROLP. Whlen Sie eine Rolle aus, um in das entsprechende Szenario zu gelangen. Der Schulleiter hat eine eigene Verwaltungsoberflche, wo er die Lehrer und Klassen berblicken und zuweisen kann. Als Klassenlehrer und Fachlehrer gelangt man auf den Startbildschirm. Von da aus gelangt man zum Klassenlehrer-Dashboard und dem Fachlehrer-Dashboard. Der Klassenlehrer hat Zugang zu beiden Dashboards, da er im Normalfall auch Fcher unterrichtet.",
            Label.CONTENT_XHTML);
    Label githubLinkDummy = new Label(
            "ROLP auf <a href=\"https://github.com/fossaag/rolp\" target=\"_blank\">GitHub.com</a>",
            Label.CONTENT_XHTML);

    Embedded logoFossa = new Embedded(null, new ThemeResource(DEMO_LOGO_FOSSA_PATH));
    logoFossa.setType(Embedded.TYPE_IMAGE);
    logoFossa.setWidth("150px");

    Label roleSelectCaption = new Label("Bitte whlen Sie eine Rolle aus:", Label.CONTENT_XHTML);

    BeanItemContainer<String> roles = new BeanItemContainer<String>(String.class);
    roles.addBean("Fachlehrer");
    roles.addBean("Klassenlehrer");
    roles.addBean("Schulleiter");
    roleSelect.setContainerDataSource(roles);
    roleSelect.setWidth("200px");

    layoutTop.addComponent(logoRolp, "logoRolp");
    layoutTop.addComponent(rolpDemoText, "rolpDemoText");
    layoutTop.addComponent(logoFossa, "logoFossa");
    layout.addComponent(layoutTop, "layoutTop");

    layoutMiddle.addComponent(roleSelectCaption, "roleSelectCaption");
    layoutMiddle.addComponent(roleSelect, "roleSelect");
    layoutMiddle.addComponent(okButton, "okButton");
    layout.addComponent(layoutMiddle, "layoutMiddle");

    layoutBottom.addComponent(githubLinkDummy, "githubLinkDummy");
    layout.addComponent(layoutBottom, "layoutBottom");
    setContent(layout);
}

From source file:org.fossa.rolp.ui.dashboard.AdminDashboard.java

License:Open Source License

public AdminDashboard(RolpApplication app) {
    super("./applicationMainLayout/adminLayout");
    this.app = app;

    buildButtonBattery();/*  w w  w . j av a2 s  .c  om*/

    CustomLayout lehrerListe = new CustomLayout("./lehrerDashboards/liste");
    lehrerListe.addStyleName("liste");

    lehrerListe.addComponent(getLehrerList(), "list");
    lehrerListe.setHeight("260px");

    addComponent(lehrerListe, "liste");
    addComponent(horizontalButtonBattery, "horizontalButtonBattery");
    addComponent(verticalButtonBattery, "verticalButtonBattery");
}

From source file:org.fossa.rolp.ui.dashboard.FachlehrerDashboard.java

License:Open Source License

public FachlehrerDashboard(RolpApplication app) {
    super(app);//from  w w w.  j av a  2s. c om
    this.app = app;
    setCaption(" - FachlehrerDashboard - ");
    setWidth("100%");
    setHeight("100%");

    buildButtonBatteries();

    CustomLayout layout = new CustomLayout("./lehrerDashboards/fachLehrerDashboardMain");
    setContent(layout);

    CustomLayout headline = new CustomLayout("./lehrerDashboards/headline");
    headline.addStyleName("headline");

    Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH));
    logo.setType(Embedded.TYPE_IMAGE);
    logo.setWidth("100px");
    logo.setHeight("96px");

    headline.addComponent(logo, "logo");

    CustomLayout faecherListe = new CustomLayout("./lehrerDashboards/liste");
    faecherListe.addStyleName("liste");
    faecherList = getFaecherList();
    faecherList.setHeight("250px");
    faecherList.setStyleName("list");
    faecherListe.addComponent(faecherList, "list");
    faecherListe.setHeight("260px");

    layout.addComponent(faecherListe, "liste");
    layout.addComponent(headline, "headline");
    layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery");

    lehrerBlog = getLehrerBlog();
    layout.addComponent(lehrerBlog, "blog");
    windowCloseButton.setWidth("100%");
    layout.addComponent(windowCloseButton, "windowCloseButton");

}

From source file:org.fossa.rolp.ui.dashboard.KlassenlehrerDashboard.java

License:Open Source License

public KlassenlehrerDashboard(RolpApplication app) {
    super(app);/*from w ww  .  j av  a2 s .  c  o m*/
    this.app = app;
    setCaption(" - KlassenlehrerDashboard - ");
    setWidth("100%");
    setHeight("100%");

    buildButtonBatteries();

    CustomLayout layout = new CustomLayout("./lehrerDashboards/klassenLehrerDashboardMain");
    setContent(layout);

    CustomLayout headline = new CustomLayout("./lehrerDashboards/headline");
    headline.addStyleName("headline");

    Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH));
    logo.setType(Embedded.TYPE_IMAGE);
    logo.setWidth("100px");
    logo.setHeight("96px");

    headline.addComponent(logo, "logo");
    headline.addComponent(headdataEditingPanel, "headdataEditingPanel");

    Panel hints = new Panel();
    hints.addStyleName("hints");
    hinweistext = new Label();
    hinweistext.setContentMode(Label.CONTENT_XHTML);
    hinweistext.setReadOnly(true);
    hinweistext.setHeight("250px");
    hints.setHeight("250px");
    hints.setScrollable(true);
    hints.addComponent(hinweistext);
    refreshHinweistext();

    CustomLayout schuelerListe = new CustomLayout("./lehrerDashboards/liste");
    schuelerListe.addStyleName("liste");
    schuelerList = getSchuelerList();
    schuelerList.setHeight("250px");
    schuelerList.setStyleName("list");
    schuelerListe.addComponent(schuelerList, "list");
    schuelerListe.setHeight("260px");
    layout.addComponent(schuelerListe, "liste");

    layout.addComponent(headline, "headline");
    layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery");
    layout.addComponent(verticalButtonBattery, "verticalButtonBattery");

    layout.addComponent(hints, "hints");
    windowCloseButton.setWidth("100%");
    layout.addComponent(windowCloseButton, "windowCloseButton");
    //      app.getAnimator().animate(horizontalButtonBattery, AnimType.ROLL_DOWN_OPEN_POP).setDuration(500).setDelay(500);
}

From source file:org.fossa.rolp.ui.einschaetzung.EinschaetzungAnlegen.java

License:Open Source License

public EinschaetzungAnlegen(FossaApplication app, EinschaetzungLaso einschaetzung, String caption,
        FossaLaso lasoToBeLocked) throws FossaLasoLockedException {
    super(app);/*from  ww w .jav a  2 s.co  m*/
    this.einschaetzungLaso = einschaetzung;
    this.lasoToBeLocked = lasoToBeLocked;
    if (lasoToBeLocked != null) {
        if (lasoToBeLocked.isLocked()) {
            throw new FossaLasoLockedException();
        } else {
            lasoToBeLocked.lock();
        }
    }
    setCaption(" - " + caption + " - ");
    setWidth("700px");
    center();
    CustomLayout layout = new CustomLayout("./subWindows/formAnlegen");
    setContent(layout);

    getEinschaetzungAnlegenForm();
    layout.addComponent(formEinschaetzungAnlegen, "form");
}