Here are the examples of the java api com.vaadin.flow.component.AttachEvent taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
32 Examples
18
Source : LoginView.java
with The Unlicense
from vaadin-learning-center
with The Unlicense
from vaadin-learning-center
@Override
protected void onAttach(AttachEvent attachEvent) {
getElement().setText("Do you wonder why you do not see any login UI? Well, this is the master branch only containing the security setup. For different UI implementations check the other branches :)");
}
18
Source : PolymerModelPropertiesView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
getUI().get().add(addUpdateElement("property-value"));
}
18
Source : LazyWidgetView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
getModel().setHasGreeting(false);
getModel().setGreeting("");
}
18
Source : PushSettingsView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
setId("pushMode");
setText("Push mode: " + attachEvent.getUI().getPushConfiguration().getPushMode());
}
18
Source : LongPollingMultipleThreadsView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
updateDiv(new ArrayList<>());
ui = attachEvent.getUI();
}
18
Source : FragmentLinkView2.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
// do not call super onAttach since it adds a hashchangelistener
}
18
Source : DependenciesLoadingBaseView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
// See eager.js for attachTestDiv code
getPage().executeJs("attachTestDiv($0)", DOM_CHANGE_TEXT);
}
18
Source : MainLayout.java
with Apache License 2.0
from jreznot
with Apache License 2.0
from jreznot
@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");
}
}
18
Source : SlottedMenuItem.java
with Apache License 2.0
from FlowingCode
with Apache License 2.0
from FlowingCode
@Override
protected void onAttach(AttachEvent attachEvent) {
if (getParent().orElse(null) instanceof SlottedMenuItem) {
getElement().setAttribute("slot", "menu-item");
} else {
getElement().removeAttribute("slot");
}
super.onAttach(attachEvent);
}
18
Source : AbstractFcAppRouterLayout.java
with Apache License 2.0
from FlowingCode
with Apache License 2.0
from FlowingCode
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
configure(app);
}
18
Source : StreamingDataExampleView.java
with Apache License 2.0
from appreciated
with Apache License 2.0
from appreciated
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
thread = new Thread(() -> {
ArrayList<Double> arrayList = new ArrayList<>();
arrayList.add(0.0);
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
final SecureRandom random = new SecureRandom();
arrayList.add(random.nextDouble());
getUI().ifPresent(ui -> ui.access(() -> chart.updateSeries(new Series<>(arrayList.toArray(new Double[] {})))));
}
});
thread.start();
}
18
Source : ServiceMeshView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
this.trafficAccessGrid.sereplacedems(appTrafficAccesses(handlerRegistry));
}
18
Source : MainLayout.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
closeSubscribeQuietly();
this.notificationSubscribe = this.notificationProcessor.subscribe(text -> {
attachEvent.getUI().access(() -> {
Notification.show(text);
});
});
}
18
Source : DNSView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
this.domainNameGrid.sereplacedems(domains());
}
18
Source : GridCrud.java
with Apache License 2.0
from alejandro-du
with Apache License 2.0
from alejandro-du
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
refreshGrid();
}
17
Source : PreserveOnRefreshView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent event) {
attached += 1;
attachCounter.setText(Integer.toString(attached));
}
17
Source : UsageStatisticsView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
attachEvent.getUI().getPage().executeJs("window.Vaadin.runIfDevelopmentMode('vaadin-usage-statistics');");
}
17
Source : AbstractPushUpdateDivView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
updateDiv();
scheduleUpdate(attachEvent.getUI());
}
17
Source : AppLayoutRouterLayoutBase.java
with Apache License 2.0
from appreciated
with Apache License 2.0
from appreciated
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
if (getClreplaced().getAnnotation(Theme.clreplaced) != null && getClreplaced().getAnnotation(Theme.clreplaced).value() != Lumo.clreplaced) {
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();
}));
}
17
Source : ComponentBadgeWrapper.java
with Apache License 2.0
from appreciated
with Apache License 2.0
from appreciated
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
badge.notifyResize();
}
17
Source : SearchOverlayButton.java
with Apache License 2.0
from appreciated
with Apache License 2.0
from appreciated
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
attachEvent.getUI().add(searchView);
}
17
Source : NotificationButton.java
with Apache License 2.0
from appreciated
with Apache License 2.0
from appreciated
@Override
protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
attachEvent.getUI().add(notificationOverlay);
}
17
Source : ServicesView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
servicesGrid.sereplacedems(services(handlerRegistry, routingSelector));
}
17
Source : AppsView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
appMetadataGrid.sereplacedems(appMetadataList(handlerRegistry));
}
16
Source : TimingInfoReportedView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
// @formatter:on
@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);
}
16
Source : RSocketFiltersView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
filterGrid.sereplacedems(filterChain.getFilters());
}
16
Source : DashboardView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@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.sereplacedems(appMetadataList(handlerRegistry));
}
16
Source : BrokersView.java
with Apache License 2.0
from alibaba
with Apache License 2.0
from alibaba
@Override
protected void onAttach(AttachEvent attachEvent) {
brokerDataGrid.sereplacedems(brokerManager.currentBrokers());
}
15
Source : ExceptionsDuringPropertyUpdatesView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@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.addClreplacedName("error");
add(div);
});
}
}
15
Source : PushRouteNotFoundView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@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);
}
}
15
Source : DynamicDependencyView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@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 = doreplacedent.createElement(\"div\");\n" + " div.setAttribute('id','dep');\n" + " div.textContent = doreplacedent.querySelector('#new-component')==null;\n" + " doreplacedent.body.appendChild(div);resolve('');}" + ");");
add(createLoadButton("nopromise", "Load non-promise dependency", "doreplacedent.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')); });"));
}
}
12
Source : FragmentLinkView.java
with MIT License
from mcollovati
with MIT License
from mcollovati
@Override
protected void onAttach(AttachEvent attachEvent) {
Page page = attachEvent.getUI().getPage();
page.executeJs("var i = 0;" + "window.addEventListener('hashchange', function(event) {" + "var x = doreplacedent.createElement('span');" + "x.textContent = ' ' + i;" + "i++;" + "x.clreplaced = 'hashchange';" + "doreplacedent.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);
}
});
}