Java 类com.vaadin.server.VaadinRequest 实例源码

项目:AllAboutGridWebinar    文件:AllAboutGridUI.java   
@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    Grid grid = new Grid();

    initializeGrid(grid);
    grid.setWidth("700px");
    grid.setHeight("500px");

    applyDemoHacks(grid);

    layout.addComponent(grid);
}
项目:spring-boot-plugins-example    文件:VaadinUI.java   
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);
    MHorizontalLayout horizontalLayout = new MHorizontalLayout();
    for (MenuEntry menuEntry : menuEntries) {
        horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
            navigator.navigateTo(menuEntry.getNavigationTarget());
        }));
    }
    root.addComponent(horizontalLayout);
    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();
    root.addComponent(springViewDisplay);
    root.setExpandRatio(springViewDisplay, 1.0f);

}
项目:svgexamples    文件:MyUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    setNavigator(new Navigator(this, (View view) -> {
        tabs.setSelectedTab((Component) view);
    }));

    registerExample(SvgInVaadin.class);
    registerExample(SimplyAsAnImageOrIcon.class);
    registerExample(FileExample.class);
    registerExample(AnimationExample.class);
    registerExample(Java2DExample.class);
    registerExample(JungExample.class);

    getNavigator().setErrorView(SvgInVaadin.class);
    tabs.addSelectedTabChangeListener(e -> {
        if (e.isUserOriginated()) {
            getNavigator().navigateTo(e.getTabSheet().getSelectedTab().getClass().getSimpleName());
        }
    });
    String state = getNavigator().getState();
    getNavigator().navigateTo(state);

    tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
    setContent(tabs);
}
项目:spring-boot-vaadin-rabbitmq-pipeline-demo    文件:NavigatorUI.java   
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    setContent(rootLayout);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navigationBar.addComponent(createNavigationButton("Demo View (Default)",
            Constants.VIEW_DEFAULT));
    navigationBar.addComponent(createNavigationButton("Stream View",
            Constants.VIEW_STREAM));
    rootLayout.addComponent(navigationBar);

    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();

    rootLayout.addComponent(springViewDisplay);
    rootLayout.setExpandRatio(springViewDisplay, 1.0f);

}
项目:vaadin-binders    文件:BinderUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    // crate a binder for a form, specifying the data class that will be used in binding
    Binder<ImageData> binder = new Binder<>(ImageData.class);

    // specify explicit binding in order to add validation and converters
    binder.forMemberField(imageSize)
            // input should not be null or empty
            .withValidator(string -> string != null && !string.isEmpty(), "Input values should not be empty")
            // convert String to Integer, throw ValidationException if String is in incorrect format
            .withConverter(new StringToIntegerConverter("Input value should be an integer"))
            // validate converted integer: it should be positive
            .withValidator(integer -> integer > 0, "Input value should be a positive integer");

    // tell binder to bind use all fields from the current class, but considering already existing bindings
    binder.bindInstanceFields(this);

    // crate data object with predefined imageName and imageSize
    ImageData imageData = new ImageData("Lorem ipsum", 2);

    // fill form with predefined data from data object and
    // make binder to automatically update the object from the form, if no validation errors are present
    binder.setBean(imageData);

    binder.addStatusChangeListener(e -> {
        // the real image drawing will not be considered in this article

        if (e.hasValidationErrors() || !e.getBinder().isValid()) {
            Notification.show("Form contains validation errors, no image will be drawn");
        } else {
            Notification.show(String.format("I will draw image with \"%s\" text and width %d\n",
                    imageData.getText(), imageData.getSize()));
        }
    });

    // add a form to layout
    setContent(new VerticalLayout(text, imageSize));
}
项目:esup-ecandidat    文件:OnDemandFileDownloader.java   
@Override
public boolean handleConnectorRequest(VaadinRequest request,
        VaadinResponse response, String path) throws IOException {      
    final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
    final UI ui = UI.getCurrent();
    ui.access(() -> ui.addWindow(busyIndicatorWindow));
    try {
        //on charge le fichier
        getStreamSource().loadOndemandFile();
        if (getStreamSource().getStream()==null){
            return true;
        }
        getResource().setFilename(getStreamSource().getFileName());
        return super.handleConnectorRequest(request, response, path);
    }catch(Exception e){
        return true;
    }
    finally {
        busyIndicatorWindow.close();
    }       
}
项目:esup-ecandidat    文件:OnDemandPdfBrowserOpener.java   
@Override
public boolean handleConnectorRequest(VaadinRequest request,
        VaadinResponse response, String path) throws IOException {      
    final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
    final UI ui = UI.getCurrent();
    ui.access(() -> ui.addWindow(busyIndicatorWindow));
    try {
        getStreamSource().loadOndemandFile();
        if (getStreamSource().getStream()==null){
            return true;
        }
        getDownloadStreamSource().setMIMEType("application/pdf");
        getDownloadStreamSource().getStream().setParameter(
                "Content-Disposition",
                "attachment; filename="+getStreamSource().getFileName());
        return super.handleConnectorRequest(request, response, path);
    }catch(Exception e){
        return true;
    }finally {
        busyIndicatorWindow.close();
    }       
}
项目:tinypounder    文件:TinyPounderMainUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
  VaadinSession.getCurrent().getSession().setMaxInactiveInterval(-1);
  Page.getCurrent().setTitle("Tiny Pounder (" + VERSION + ")");

  setupLayout();
  addKitControls();
  updateKitControls();
  initVoltronConfigLayout();
  initVoltronControlLayout();
  initRuntimeLayout();
  addExitCloseTab();
  updateServerGrid();

  // refresh consoles if any
  consoleRefresher = scheduledExecutorService.scheduleWithFixedDelay(
      () -> access(() -> runningServers.values().forEach(RunningServer::refreshConsole)),
      2, 2, TimeUnit.SECONDS);
}
项目:material-theme-fw8    文件:DemoUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    root = new CssLayout(appBar, navigationDrawer, content);
    root.setPrimaryStyleName("root");
    root.setSizeFull();
    Responsive.makeResponsive(root);
    setContent(root);

    appBar.getNaviIcon().addClickListener(event -> navigationDrawer.toggle());

    content.setPrimaryStyleName("content");
    content.setSizeFull();

    initNavigationItems();
    initDummyContent();
}
项目:md-stepper    文件:DemoUI.java   
@Override
protected void init(VaadinRequest request) {
  rootLayout = getRootLayout();
  setContent(rootLayout);

  Label title = getTitleLabel();

  StepperPropertiesLayout layout = new StepperPropertiesLayout();
  layout.addStepperCreateListener(this);
  layout.setWidth(300, Unit.PIXELS);

  Spacer spacer = new Spacer();
  spacer.setWidth(100, Unit.PIXELS);

  rootLayout.addComponent(title, 0, 0, 2, 0);
  rootLayout.addComponent(spacer, 1, 1);
  rootLayout.addComponent(layout, 0, 1);
  rootLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);

  layout.start();
}
项目:vaadin-javaee-jaas-example    文件:JaasExampleUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout contentArea = new VerticalLayout();
    contentArea.setMargin(false);
    setContent(contentArea);

    final Navigator navigator = new Navigator(this, contentArea);
    navigator.addProvider(viewProvider);
    navigator.setErrorView(InaccessibleErrorView.class);

    String defaultView = Page.getCurrent().getUriFragment();
    if (defaultView == null || defaultView.trim().isEmpty()) {
        defaultView = SecureView.VIEW_NAME;
    }

    if (isUserAuthenticated(vaadinRequest)) {
        navigator.navigateTo(defaultView);
    } else {
        navigator.navigateTo(LoginView.VIEW_NAME + "/" + defaultView);
    }
}
项目:bean-grid    文件:TestUI.java   
@Override
protected void init(VaadinRequest request) {
    setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(true);

    testGrid.setSizeFull();
    testGrid.getEditor().setEnabled(true);

    testGrid.setItems(getCustomers());

    layout.addComponent(testGrid);

    setContent(layout);
}
项目:vaadin-karaf    文件:MyUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Type your name here:");

    Button button = new Button("Click Me");
    button.addClickListener(e -> {
        layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
    });

    layout.addComponents(name, button);

    setContent(layout);
}
项目:live-image-editor    文件:DemoUI.java   
@Override
protected void init(VaadinRequest request) {
    Label title = new Label("Live Image Editor add-on for Vaadin");
    title.addStyleName(ValoTheme.LABEL_H2);
    title.addStyleName(ValoTheme.LABEL_COLORED);

    instructions.setContentMode(ContentMode.HTML);
    instructions.setWidth(600, Unit.PIXELS);

    upload.addSucceededListener(this::uploadSucceeded);

    imageEditor.setWidth(100, Unit.PERCENTAGE);
    imageEditor.setBackgroundColor(0, 52, 220);

    VerticalLayout layout = new VerticalLayout(title, upload, instructions, imageEditor, send, result, editedImage);
    layout.setSizeUndefined();
    layout.setMargin(true);
    layout.setSpacing(true);
    setContent(layout);

    setupUploadStep();
}
项目:imotSpot    文件:DashboardUI.java   
@Override
protected void init(final VaadinRequest request) {
    setLocale(Locale.US);

    DashboardEventBus.register(this);
    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);

    updateContent();

    // Some views need to be aware of browser resize events so a
    // BrowserResizeEvent gets fired to the event bus on every occasion.
    Page.getCurrent().addBrowserWindowResizeListener(
            new BrowserWindowResizeListener() {
                @Override
                public void browserWindowResized(
                        final BrowserWindowResizeEvent event) {
                    DashboardEventBus.post(new BrowserResizeEvent());
                }
            });
}
项目:garantia    文件:LoginUI.java   
@Override
protected void init(VaadinRequest request) {
    log.info("Levanto la pagina UI");

    final VerticalLayout root = new VerticalLayout();
       root.setSizeFull();
       root.setMargin(true);
       root.setSpacing(true);
       setContent(root);

       final Panel viewContainer = new Panel();
       viewContainer.setSizeFull();
       root.addComponent(viewContainer);
       root.setExpandRatio(viewContainer, 1.0f);

       Navigator navigator = new Navigator(this, viewContainer);
       //Navigator navigator = new Navigator(this, this);
       navigator.addProvider(viewProvider);

       log.info("Termina de levantar la pagina UI");

}
项目:vaadin-vertx-samples    文件:VertxVaadinService.java   
@Override
public String getStaticFileLocation(VaadinRequest request) {
    String staticFileLocation;
    // if property is defined in configurations, use that
    staticFileLocation = getDeploymentConfiguration().getResourcesPath();
    if (staticFileLocation != null) {
        return staticFileLocation;
    }

    VertxVaadinRequest vertxRequest = (VertxVaadinRequest) request;
    String requestedPath = vertxRequest.getRequest().path()
        .substring(
            Optional.ofNullable(vertxRequest.getRoutingContext().mountPoint())
                .map(String::length).orElse(0)
        );
    return VaadinServletService.getCancelingRelativePath(requestedPath);
}
项目:vaadin-vertx-samples    文件:VertxVaadinService.java   
@Override
public String getMainDivId(VaadinSession session, VaadinRequest request, Class<? extends UI> uiClass) {
    String appId = request.getPathInfo();
    if (appId == null || "".equals(appId) || "/".equals(appId)) {
        appId = "ROOT";
    }
    appId = appId.replaceAll("[^a-zA-Z0-9]", "");
    // Add hashCode to the end, so that it is still (sort of)
    // predictable, but indicates that it should not be used in CSS
    // and
    // such:
    int hashCode = appId.hashCode();
    if (hashCode < 0) {
        hashCode = -hashCode;
    }
    appId = appId + "-" + hashCode;
    return appId;
}
项目:vaadin-vertx-samples    文件:SimpleUI.java   
@Override
protected void init(VaadinRequest request) {

    VertxVaadinRequest req = (VertxVaadinRequest) request;
    Cookie cookie = new Cookie("myCookie", "myValue");
    cookie.setMaxAge(120);
    cookie.setPath(req.getContextPath());
    VaadinService.getCurrentResponse().addCookie(cookie);

    Label sessionAttributeLabel = new MLabel().withCaption("Session listener");


    String deploymentId = req.getService().getVertx().getOrCreateContext().deploymentID();

    setContent(new MVerticalLayout(
        new Header("Vert.x Vaadin Sample").setHeaderLevel(1),
        new Label(String.format("Verticle %s deployed on Vert.x", deploymentId)),
        new Label("Session created at " + Instant.ofEpochMilli(req.getWrappedSession().getCreationTime())),
        sessionAttributeLabel
    ).withFullWidth());
}
项目:vaadin-vertx-samples    文件:DashboardUI.java   
@Override
protected void init(final VaadinRequest request) {
    setLocale(Locale.US);

    DashboardEventBus.register(this);
    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);

    updateContent();

    // Some views need to be aware of browser resize events so a
    // BrowserResizeEvent gets fired to the event bus on every occasion.
    Page.getCurrent().addBrowserWindowResizeListener(
            new BrowserWindowResizeListener() {
                @Override
                public void browserWindowResized(
                        final BrowserWindowResizeEvent event) {
                    DashboardEventBus.post(new BrowserResizeEvent());
                }
            });
}
项目:dungeonstory-java    文件:DungeonStoryUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    Responsive.makeResponsive(this);
    getPage().setTitle("DungeonStory");

    if (Configuration.getInstance().isMock()) {
        accessControl = new BasicAccessControl();
    } else {
        accessControl = new DsAccessControl();
    }

    setupEventBus();

    if (!accessControl.isUserSignedIn()) {
        setContent(new LoginScreen(accessControl, this::showMainView));
    } else {
        showMainView();
    }

    setLocale(vaadinRequest.getLocale());

    ImageFactory.getInstance();
}
项目:GridFastNavigation    文件:DemoUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    initMessageTable();

    final Grid grid = new Grid();
    initGrid(grid);
    initNavigation(grid);

    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(grid);
    layout.addComponent(messageTable);
    layout.setSizeFull();
    setContent(layout);
}
项目:cuba    文件:AppUI.java   
public void processExternalLink(VaadinRequest request) {
    WrappedSession wrappedSession = request.getWrappedSession();

    String action = (String) wrappedSession.getAttribute(LAST_REQUEST_ACTION_ATTR);

    if (webConfig.getLinkHandlerActions().contains(action)) {
        //noinspection unchecked
        Map<String, String> params =
                (Map<String, String>) wrappedSession.getAttribute(LAST_REQUEST_PARAMS_ATTR);
        params = params != null ? params : Collections.emptyMap();

        try {
            LinkHandler linkHandler = AppBeans.getPrototype(LinkHandler.NAME, app, action, params);
            if (app.connection.isConnected() && linkHandler.canHandleLink()) {
                linkHandler.handle();
            } else {
                app.linkHandler = linkHandler;
            }
        } catch (Exception e) {
            error(new com.vaadin.server.ErrorEvent(e));
        }
    }
}
项目:cuba    文件:ConnectionImpl.java   
@Nullable
protected String getUserRemoteAddress() {
    VaadinRequest currentRequest = VaadinService.getCurrentRequest();

    String userRemoteAddress = null;

    if (currentRequest != null) {
        String xForwardedFor = currentRequest.getHeader("X_FORWARDED_FOR");
        if (StringUtils.isNotBlank(xForwardedFor)) {
            String[] strings = xForwardedFor.split(",");
            String userAddressFromHeader = StringUtils.trimToEmpty(strings[strings.length - 1]);

            if (StringUtils.isNotEmpty(userAddressFromHeader)) {
                userRemoteAddress = userAddressFromHeader;
            } else {
                userRemoteAddress = currentRequest.getRemoteAddr();
            }
        } else {
            userRemoteAddress = currentRequest.getRemoteAddr();
        }
    }

    return userRemoteAddress;
}
项目:relproxy_examples    文件:VaadinUIDelegateImpl.java   
@Override
public void init(VaadinRequest request) {

    final WrappedSession session = request.getWrappedSession();

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    parent.setContent(layout);

    Button button = new Button("Click Me");
    button.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {

            Integer counter = (Integer)session.getAttribute("counter");     
            if (counter == null) { counter = 0; }
            counter++;
            session.setAttribute("counter", counter);       

            layout.addComponent(new Label("Thank you for clicking, counter:" + counter));           
        }
    });

    layout.addComponent(button);            
}
项目:hawkbit    文件:AbstractHawkbitLoginUI.java   
@Override
protected void init(final VaadinRequest request) {
    SpringContextHelper.setContext(context);

    params = UriComponentsBuilder.fromUri(Page.getCurrent().getLocation()).build().getQueryParams();

    if (params.containsKey(DEMO_PARAMETER)) {
        login(uiProperties.getDemo().getTenant(), uiProperties.getDemo().getUser(),
                uiProperties.getDemo().getPassword(), false);
    }

    setContent(buildContent());

    filloutUsernameTenantFields();
    readCookie();
}
项目:FontAwesomeRenderer    文件:DemoUI.java   
@Override
protected void init(VaadinRequest request) {

    // Show it in the middle of the screen
    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    setContent(layout);

    Grid grid = new Grid();

    grid.addColumn("name", String.class).setHeaderCaption("Name");
    grid.addColumn("icon", String.class)
            .setHeaderCaption("icon")
            .setRenderer(new FontIconRenderer(e -> Notification.show(e.toString())));

    grid.getDefaultHeaderRow().join("name", "icon").setText("Brand");

    grid.addRow("Android", FontAwesome.ANDROID.getHtml());
    grid.addRow("Ios", FontAwesome.APPLE.getHtml());
    grid.addRow("Who cares", FontAwesome.WINDOWS.getHtml());
    layout.addComponent(grid);

}
项目:vaadin-jcrop    文件:Jcrop.java   
/**
 * initalize a unique RequestHandler
 */
private void initRequestHandler() {
    if (this.requestHandlerUri == null) {
        this.requestHandlerUri = UUID.randomUUID()
                .toString();
        VaadinSession.getCurrent()
                .addRequestHandler(new RequestHandler() {

                    @Override
                    public boolean handleRequest(final VaadinSession session, final VaadinRequest request, final VaadinResponse response)
                            throws IOException {
                        if (String.format("/%s", Jcrop.this.requestHandlerUri)
                                .equals(request.getPathInfo())) {
                            Jcrop.this.resource.getStream()
                                    .writeResponse(request, response);
                            return true;
                        } else {
                            return false;
                        }
                    }
                });
    }
}
项目:KrishnasSpace    文件:VaadinUI.java   
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout mainLayout = new VerticalLayout();
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    CssLayout viewLayout = new CssLayout();
    Page.getCurrent().setTitle("Vaadin Demo");
    mainLayout.setSizeFull();
    viewLayout.setSizeFull();
    mainLayout.setMargin(true);
    setContent(mainLayout);
    mainLayout.addComponent(horizontalLayout);
    mainLayout.addComponent(viewLayout);
    mainLayout.setExpandRatio(viewLayout, 1f);
    Navigator navigator = new Navigator(this, viewLayout);
    setNavigator(navigator);
    setupHeader(horizontalLayout);
    Map<String, Class<? extends MyView>> myViews = getViewProvider();
    navigator.addView("", new HomeView(myViews.keySet()));
    navigator.addProvider(new CachedViewProvider(myViews));
}
项目:StockScreener    文件:StockScreenerControlUI.java   
@Override
    protected void init(VaadinRequest request) {
        processBtn.addClickListener( e -> { 
            Notification.show("Starting run");
            mainController.launchAnalysis(new AnalysisResultListenerImpl());
        });
        loadHistoricalQuotesBtn.addClickListener(e -> {
            Notification.show("Collecting historical Quotes");
            mainController.loadHistoricalQuotes();
        });
//      initContent0();
//      initContent1();
        initContent2();

        initScreen0Grid();
        initControlGrid();
        main.addComponents(screen0Grid,controlGrid);
        main.setWidth("100%");
    }
项目:Vaadin-Prime-Count    文件:Application.java   
@Override
protected void init(final VaadinRequest vaadinRequest)
{
    assert null != vaadinRequest : "Parameter 'vaadinRequest' of method 'init' must not be null";

    LOGGER.info("Let's count some primes!");

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);
    final PrimeCountUserStory userStory = new PrimeCountUserStory(this);
    layout.addComponent(userStory);

    /**
     * Add-on developers should note that this method is only meant for
     * the application developer.
     * An add-on should not set the poll interval directly, rather
     * instruct the user to set it.
     */
    setPollInterval(11000);
}
项目:vanilla    文件:DesktopUI.java   
@Override
protected void init(VaadinRequest request) {

    Table table = new Table();
    beanItemContainer = new BeanItemContainer<>(Product.class, productService.getAllProducts());
    table.setContainerDataSource(beanItemContainer);
    table.setRowHeaderMode(Table.RowHeaderMode.INDEX);
    table.setColumnHeaders("ID", "Name", "Price", "Stock Count");

    Button button = new Button("Add");
    button.addClickListener(new AddButtonClickListener());

    CustomLayout customLayout = new CustomLayout("desktop");
    customLayout.setSizeFull();
    customLayout.addComponent(table, "product-table");
    customLayout.addComponent(button, "add-product");
    setContent(customLayout);

    Notification.show("Welcome to " + ProductUI.BRAND.concat(" ").concat(ProductUI.DESCRIPTION));
}
项目:vanilla    文件:SimpleUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    Button button = new Button("Click Me");
    button.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            layout.addComponent(new Label("Thank you for clicking"));
        }
    });
    layout.addComponent(button);

}
项目:vanilla    文件:ProductUI.java   
@Override
protected void init(VaadinRequest request) {

    Component header = buildHeader();
    Component footer = buildFooter();
    Component center = buildCenter();

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.addComponent(header);
    mainLayout.addComponent(center);
    mainLayout.addComponent(footer);
    mainLayout.setExpandRatio(center, 1f);
    setContent(mainLayout);

    Notification.show("Welcome to " + BRAND.concat(" ").concat(DESCRIPTION));
}
项目:springbootcamp    文件:ApplicationUI.java   
@Override
protected void init(VaadinRequest vaadinRequest) {

  final VerticalLayout layout = new VerticalLayout();
  layout.setMargin(true);
  layout.setSpacing(true);
  layout.addComponent(labelTime);
  setContent(layout);

  eventBus.on(Selectors.$(TOPIC), new Consumer<reactor.bus.Event<LocalTime>>() {
    @Override
    public void accept(reactor.bus.Event<LocalTime> event) {
      access(() -> labelTime.setValue(event.getData().format(dateTimeFormatter)));
    }
  });
}
项目:flightservice    文件:FlightServiceUI.java   
@Override
protected void init(VaadinRequest request) {

    Panel panel = new Panel();
    panel.setSizeFull();

    Navigator navigator = new Navigator(this, panel);
    navigator.addView(NavigationState.HOME, HomeView.class);
    navigator.addView(NavigationState.AIRPORT_LIST, AirportListView.class);
    navigator.addView(NavigationState.FLIGHT_MAINTENANCE, FlightMaintenanceView.class);
    navigator.addView(NavigationState.FLIGHT_BOOKING, FlightBookingView.class);
    navigator.addView(NavigationState.BOOKING_CANCELLATION, BookingCancellationView.class);
    navigator.navigateTo(NavigationState.HOME);

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.addComponent(createMenu());
    verticalLayout.addComponent(panel);
    verticalLayout.setExpandRatio(panel, 1);
    setContent(verticalLayout);
}
项目:osgi-bridge-and-fragmentedui-demo    文件:VaadinOSGiUI.java   
@Override
protected void init(VaadinRequest request) {

    setPollInterval(1000);
    hl = new HorizontalSplitPanel();
    hl.setSizeFull();
    setContent(hl);

    buttonsOnTheLeft = new VerticalLayout();
    buttonsOnTheLeft.setSizeUndefined();

    hl.setFirstComponent(buttonsOnTheLeft);
    hl.setSplitPosition(25, Unit.PERCENTAGE);

    ServiceTracker<FragmentFactory, FragmentFactory> tracker = new ServiceTracker<FragmentFactory, FragmentFactory>(
            VaadinActivator.context, FragmentFactory.class, this);
    tracker.open();

    addDetachListener(new DetachListener() {

        @Override
        public void detach(DetachEvent event) {
            tracker.close();
        }
    });
}
项目:root    文件:WoundManagementUI.java   
@Override
protected void init(VaadinRequest request) {    

    initializeEnvironment(request);

    getEnvironment().setCurrentUriFragment("login");
    getPage().setUriFragment(getEnvironment().getCurrentUriFragment());

    getPage().addUriFragmentChangedListener(
               new UriFragmentChangedListener() {
           public void uriFragmentChanged(
                   UriFragmentChangedEvent source) {
               enter(source.getUriFragment());
            }
        });

        // Read the initial URI fragment
        enter(getPage().getUriFragment());
}
项目:viritin    文件:Java8LocaleNegotiationStrategy.java   
@Override
public Locale negotiate(List<Locale> supportedLocales,
        VaadinRequest vaadinRequest) {
    String languages = vaadinRequest.getHeader("Accept-Language");
    try {
        // Use reflection here, so the code compiles with jdk 1.7
        Class<?> languageRange = Class
                .forName("java.util.Locale$LanguageRange");
        Method parse = languageRange.getMethod("parse", String.class);
        Object priorityList = parse.invoke(null, languages);
        Method lookup = Locale.class.getMethod("lookup", List.class,
                Collection.class);
        return (Locale) lookup.invoke(null, priorityList, supportedLocales);
    } catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException e) {
        throw new RuntimeException(
                "Java8LocaleNegotiontionStrategy need java 1.8 or newer.",
                e);
    }

}
项目:viritin    文件:Issue309PojoForm.java   
@Override
protected void init(VaadinRequest request) {
    AbstractForm<Pojo> form = new AbstractForm<Pojo>(Pojo.class) {

        private static final long serialVersionUID = 1251886098275380006L;
        IntegerField myInteger = new IntegerField("My Integer");

        @Override
        protected Component createContent() {
            FormLayout layout = new FormLayout(myInteger, getToolbar());
            return layout;
        }
    };

    form.setResetHandler((Pojo entity) -> {
        form.setEntity(null);
    });

    form.setEntity(new Pojo());
    setContent(form);
}