org.apache.wicket.protocol.ws.api.WebSocketBehavior Java Examples
The following examples show how to use
org.apache.wicket.protocol.ws.api.WebSocketBehavior.
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: WebSocketTestPage.java From inception with Apache License 2.0 | 6 votes |
public WebSocketTestPage(TestEnv aTestVars) { testVars = aTestVars; // add WebSocketBehaviour to listen to messages add(new WebSocketBehavior() { private static final long serialVersionUID = -4076782377506950851L; @Override protected void onPush(WebSocketRequestHandler aHandler, IWebSocketPushMessage aMessage) { assertThat(aMessage).isEqualTo(testVars.getTestMessage()); super.onPush(aHandler, aMessage); } }); }
Example #2
Source File: CustomerListPage.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
public CustomerListPage() { FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); add(new WebSocketBehavior() { @Override protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) { if (message instanceof CustomerChangedEvent) { CustomerChangedEvent event = (CustomerChangedEvent)message; info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); handler.add(feedbackPanel); } } }); customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter()); CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel); queue(new BookmarkablePageLink<Customer>("create", CustomerCreatePage.class)); queue(new ValidationForm<>("form", customerFilterModel)); queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id"))); queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike"))); queue(new LabeledFormBorder<>(getString("firstname"), new TextField<String>("firstnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("lastname"), new TextField<String>("lastnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active"))); queue(cancelButton()); customerDataTable(customerDataProvider); }