List of usage examples for org.apache.wicket.util.lang Generics newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:com.wicketinaction.HandlebarsButton.java
License:Apache License
/** * Constructor./* w w w .j a v a 2 s . c o m*/ * * @param id the component id * @param templateId the id of the Handlebars template * E.g. <script id="THIS_ID" type="text/x-handlebars-template"> * @param targetSelector the css selector to use to find the HTML element that * should be updated with the populated Handlebars template */ public HandlebarsButton(String id, String templateId, String targetSelector) { super(id); Args.notEmpty(templateId, "templateId"); Args.notEmpty(targetSelector, "targetSelector"); PackageTextTemplate blogJs = new PackageTextTemplate(HandlebarsButton.class, "HandlebarsButton.js.tmpl"); Map<String, Object> variables = Generics.newHashMap(); variables.put("templateId", templateId); variables.put("targetSelector", targetSelector); this.onSuccessFunction = new JsonFunction(blogJs.asString(variables)); }
From source file:org.wicketTutorial.chatExample.ChatRoomPanel.java
License:Apache License
public ChatRoomPanel(String id) { super(id);// w ww. j a v a 2 s .c om add(new AbstractWebsocketBehavior(false) { @Override protected Url getSocketCreationURL() { Url url = getContextPathURL(); url.getSegments().add("chat"); return url; } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); Map<String, Object> variables = Generics.newHashMap(); variables.put("componentId", component.getMarkupId()); PackageTextTemplate webSocketSetupTemplate = new PackageTextTemplate(ChatRoomPanel.class, "ChatRoomPanel.template.js"); response.render( JavaScriptContentHeaderItem.forScript(webSocketSetupTemplate.asString(variables), null)); } @Override protected CharSequence onMessageJsFunction() { return "onChatMessage(evt)"; } @Override protected CharSequence onOpenJsFunction() { return "joinMessage()"; } @Override protected CharSequence onErrorJsFunction() { return ""; } @Override protected HeaderItem wrapSocketCreationScript(PackageTextTemplate template, Map<String, Object> variables) { return OnEventHeaderItem.forScript("'joinButton'", "click", template.asString(variables)); } }); }