org.apache.wicket.protocol.ws.api.WebSocketRequestHandler Java Examples

The following examples show how to use org.apache.wicket.protocol.ws.api.WebSocketRequestHandler. 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 vote down vote up
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 vote down vote up
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);

}
 
Example #3
Source File: OmWebSocketPanel.java    From openmeetings with Apache License 2.0 2 votes vote down vote up
/**
 * Override this method to add your own logic
 *
 * @param handler - handler to perform some updates
 */
protected void onConnect(WebSocketRequestHandler handler) {
}
 
Example #4
Source File: OmWebSocketPanel.java    From openmeetings with Apache License 2.0 2 votes vote down vote up
/**
 * Override this method to add your own logic
 *
 * @param handler - handler to perform some updates
 * @param m - incoming message as {@link JSONObject}
 *
 * @throws IOException in case some IO operation fails
 */
protected void onMessage(WebSocketRequestHandler handler, JSONObject m) throws IOException {
}