com.vaadin.flow.component.AttachEvent Java Examples
The following examples show how to use
com.vaadin.flow.component.AttachEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicDependencyView.java From flow with Apache License 2.0 | 6 votes |
@Override protected void onAttach(AttachEvent attachEvent) { if (attachEvent.isInitialAttach()) { newComponent.setId("new-component"); add(newComponent); attachEvent.getUI().getPage() .addDynamicImport("return new Promise( " + " function( resolve, reject){ " + " var div = document.createElement(\"div\");\n" + " div.setAttribute('id','dep');\n" + " div.textContent = document.querySelector('#new-component')==null;\n" + " document.body.appendChild(div);resolve('');}" + ");"); add(createLoadButton("nopromise", "Load non-promise dependency", "document.querySelector('#new-component').textContent = 'import has been run'")); add(createLoadButton("throw", "Load throwing dependency", "throw Error('Throw on purpose')")); add(createLoadButton("reject", "Load rejecting dependency", "return new Promise(function(resolve, reject) { reject(Error('Reject on purpose')); });")); } }
Example #2
Source File: DirectionChangeView.java From flow with Apache License 2.0 | 6 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); locale.setText(attachEvent.getUI().getLocale().toString()); locale.setId("initial-direction"); NativeButton changeLocale = new NativeButton( "Swap location to " + Locale.SIMPLIFIED_CHINESE, event -> attachEvent.getUI() .setLocale(Locale.SIMPLIFIED_CHINESE)); changeLocale.setId("locale-button"); NativeButton ltrButton = new NativeButton( "Swap to " + Direction.LEFT_TO_RIGHT, event -> attachEvent .getUI().setDirection(Direction.LEFT_TO_RIGHT)); ltrButton.setId("ltr-button"); NativeButton rtlButton = new NativeButton( "Swap to " + Direction.RIGHT_TO_LEFT, event -> attachEvent .getUI().setDirection(Direction.RIGHT_TO_LEFT)); rtlButton.setId("rtl-button"); add(locale, ltrButton, rtlButton, changeLocale); }
Example #3
Source File: FragmentLinkView.java From flow with Apache License 2.0 | 6 votes |
@Override protected void onAttach(AttachEvent attachEvent) { Page page = attachEvent.getUI().getPage(); page.executeJs("var i = 0;" + "window.addEventListener('hashchange', function(event) {" + "var x = document.createElement('span');" + "x.textContent = ' ' + i;" + "i++;" + "x.class = 'hashchange';" + "document.getElementById('placeholder').appendChild(x);}," + " false);"); HistoryStateChangeHandler current = page.getHistory() .getHistoryStateChangeHandler(); page.getHistory().setHistoryStateChangeHandler(event -> { if (event.getLocation().getPath().equals("override")) { event.getSource().replaceState(null, "overridden#Scroll_Target2"); } else { current.onHistoryStateChange(event); } }); }
Example #4
Source File: AppLayoutRouterLayoutBase.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); if (getClass().getAnnotation(Theme.class) != null && getClass().getAnnotation(Theme.class).value() != Lumo.class) { attachEvent.getUI().getPage().addStyleSheet("./com/github/appreciated/app-layout/app-layout-styles-material.css"); } else { attachEvent.getUI().getPage().addStyleSheet("./com/github/appreciated/app-layout/app-layout-styles-lumo.css"); } getUI().ifPresent(ui -> ui.addAfterNavigationListener(event -> { closeDrawerIfNotPersistent(); })); }
Example #5
Source File: DependencyView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); UI ui = attachEvent.getUI(); getPage().addStyleSheet("/test-files/css/allred.css"); getPage().addJavaScript("/frontend/test-files/js/body-click-listener.js"); }
Example #6
Source File: InfoView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); if (attachEvent.isInitialAttach()) { update(attachEvent.getUI()); } }
Example #7
Source File: AbstractErrorHandlerView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { if (attachEvent.isInitialAttach()) { attachEvent.getSession().setErrorHandler(e -> { Div div = new Div( new Text("An error occurred: " + e.getThrowable())); div.addClassName("error"); add(div); }); } }
Example #8
Source File: ExceptionsDuringPropertyUpdatesView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { if (attachEvent.isInitialAttach()) { attachEvent.getSession().setErrorHandler(e -> { Div div = new Div( new Text("An error occurred: " + e.getThrowable())); div.addClassName("error"); add(div); }); } }
Example #9
Source File: MainLayout.java From electron-java-app with Apache License 2.0 | 5 votes |
@Override public void onAttach(AttachEvent attachEvent) { if (attachEvent.isInitialAttach()) { initLayout(); // Expose the @ClientCallable methods through the global window object getElement().executeJs("window.vaadinApi = this.$server"); } }
Example #10
Source File: TimingInfoReportedView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { getElement().executeJs(REPORT_TIMINGS); NativeButton button = new NativeButton("test request"); button.addClickListener( event -> getElement().executeJs(REPORT_TIMINGS)); add(button); }
Example #11
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); closeSubscribeQuietly(); this.notificationSubscribe = this.notificationProcessor.subscribe(text -> { attachEvent.getUI().access(() -> { Notification.show(text); }); }); }
Example #12
Source File: DashboardView.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { String brokerClusterType = rSocketBrokerManager.isStandAlone() ? "singleton" : "gossip"; this.brokersCount.setText(rSocketBrokerManager.currentBrokers().size() + " (" + brokerClusterType + ")"); this.appsCount.setText(String.valueOf(handlerRegistry.appHandlers().size())); this.servicesCount.setText(String.valueOf(serviceRoutingSelector.findAllServices().size())); this.connectionsCount.setText(String.valueOf(handlerRegistry.findAll().size())); this.requestsCounter.setText(metricsCounterValue("rsocket.request.counter")); this.appMetadataGrid.setItems(appMetadataList(handlerRegistry)); }
Example #13
Source File: PushRouteNotFoundView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { if (isPushPath) { Element div = ElementFactory.createDiv("Push mode: " + attachEvent.getUI().getPushConfiguration().getPushMode()); div.setAttribute("id", "push-mode"); getElement().appendChild(div); } }
Example #14
Source File: MultipleNpmPackageAnnotationsView.java From flow with Apache License 2.0 | 5 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); Element paperInput = new Element("paper-input"); paperInput.setText("Input"); Element paperCheckbox = new Element("paper-checkbox"); paperCheckbox.setText("Checkbox"); getElement().appendChild(paperInput); getElement().appendChild(paperCheckbox); initConnector(); }
Example #15
Source File: AbstractPushUpdateDivView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { updateDiv(); scheduleUpdate(attachEvent.getUI()); }
Example #16
Source File: UsageStatisticsView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { attachEvent.getUI().getPage().executeJs( "window.Vaadin.runIfDevelopmentMode('vaadin-usage-statistics');"); }
Example #17
Source File: PushSettingsView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { setId("pushMode"); setText("Push mode: " + attachEvent.getUI().getPushConfiguration().getPushMode()); }
Example #18
Source File: PathLayout.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); PushUtil.setupPush(); }
Example #19
Source File: FragmentLinkView2.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { // do not call super onAttach since it adds a hashchangelistener }
Example #20
Source File: PolymerModelPropertiesView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { getUI().get().add(addUpdateElement("property-value")); }
Example #21
Source File: LazyWidgetView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { getModel().setHasGreeting(false); getModel().setGreeting(""); }
Example #22
Source File: LongPollingMultipleThreadsView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { updateDiv(new ArrayList<>()); ui = attachEvent.getUI(); }
Example #23
Source File: ClientSelectComponent.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { add(new DepElement()); }
Example #24
Source File: PushComponent.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { updateDiv(); scheduleUpdate(attachEvent.getUI()); }
Example #25
Source File: DemoView.java From flow with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { if (tabComponents.size() <= 1) { remove(navBar); } }
Example #26
Source File: GridCrud.java From crudui with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); refreshGrid(); }
Example #27
Source File: AppsView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { appMetadataGrid.setItems(appMetadataList(handlerRegistry)); }
Example #28
Source File: BrokersView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { brokerDataGrid.setItems(brokerManager.currentBrokers()); }
Example #29
Source File: RSocketFiltersView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { filterGrid.setItems(filterChain.getFilters()); }
Example #30
Source File: DNSView.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
@Override protected void onAttach(AttachEvent attachEvent) { this.domainNameGrid.setItems(domains()); }