List of usage examples for org.apache.wicket.util.collections MiniMap put
@Override public V put(final K key, final V value)
From source file:com.marc.lastweek.web.components.jquerytexteditor.JQueryTextEditor.java
License:Open Source License
private MiniMap getToolbarImageMap() { MiniMap images = new MiniMap(4); images.put("BOLD_IMG", getRequestCycle().urlFor(new ResourceReference(JQueryTextEditor.class, "images/bold.gif"))); images.put("ITALIC_IMG", getRequestCycle().urlFor(new ResourceReference(JQueryTextEditor.class, "images/italic.gif"))); images.put("LINK_IMG", getRequestCycle().urlFor(new ResourceReference(JQueryTextEditor.class, "images/link.png"))); images.put("UNORDERED_IMG", getRequestCycle().urlFor(new ResourceReference(JQueryTextEditor.class, "images/unordered.gif"))); return images; }
From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializer.java
License:Apache License
@Override public MiniMap<Object, Object> read(final Kryo kryo, final Input input, final Class<MiniMap<Object, Object>> type) { final int maxEntries = input.readInt(true); final MiniMap<Object, Object> result = new MiniMap<Object, Object>(maxEntries); final int size = input.readInt(true); for (int i = 0; i < size; i++) { final Object key = kryo.readClassAndObject(input); final Object value = kryo.readClassAndObject(input); result.put(key, value); }/* w w w.j a v a 2 s . co m*/ return result; }
From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializerTest.java
License:Apache License
@Test(enabled = true) public void testMiniMapExactNumberOfEntries() { final MiniMap<String, String> obj = new MiniMap<String, String>(1); obj.put("foo", "bar"); final byte[] serialized = serialize(_kryo, obj); final MiniMap<?, ?> deserialized = deserialize(_kryo, serialized, MiniMap.class); Assert.assertEquals(deserialized.size(), obj.size()); final Entry<?, ?> deserializedNext = deserialized.entrySet().iterator().next(); final Entry<?, ?> origNext = obj.entrySet().iterator().next(); Assert.assertEquals(deserializedNext.getKey(), origNext.getKey()); Assert.assertEquals(deserializedNext.getValue(), origNext.getValue()); }
From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializerTest.java
License:Apache License
@Test(enabled = true) public void testMiniMapLessThanMaxEntries() { final MiniMap<String, String> obj = new MiniMap<String, String>(2); obj.put("foo", "bar"); final byte[] serialized = serialize(_kryo, obj); final MiniMap<?, ?> deserialized = deserialize(_kryo, serialized, MiniMap.class); Assert.assertEquals(deserialized.size(), obj.size()); }
From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializerTest.java
License:Apache License
@SuppressWarnings("unchecked") @Test(enabled = true)//from w w w.jav a 2s.c om public void testMiniMapAddEntriesAfterDeserialization() { final MiniMap<String, String> obj = new MiniMap<String, String>(2); obj.put("foo", "bar"); final byte[] serialized = serialize(_kryo, obj); final MiniMap<String, String> deserialized = deserialize(_kryo, serialized, MiniMap.class); Assert.assertEquals(deserialized.size(), obj.size()); deserialized.put("bar", "baz"); try { deserialized.put("this should", "fail"); Assert.fail("We told the orig MiniMap to accept 2 entries at max," + " therefore we should not be allowed to put more."); } catch (final RuntimeException e) { // this is expected - didn't use @Test.expectedExceptions // as this would tie us to the exactly thrown exception } }
From source file:org.wicketstuff.dojo11.AbstractDefaultDojoBehavior.java
License:Apache License
protected void renderConfig(IHeaderResponse response) { DojoPackagedTextTemplate template = new DojoPackagedTextTemplate(AbstractDefaultDojoBehavior.class, AbstractDefaultDojoBehavior.class.getSimpleName() + ".js"); MiniMap map = new MiniMap(3); map.put("debug", RuntimeConfigurationType.DEVELOPMENT.equals(Application.get().getConfigurationType())); map.put("baseUrl", DojoSettings.get().getDojoBaseUrl()); map.put("locale", ((IDojoApplication) Application.get()).getDojoSettings().getDefaultLocale().toString() .replace('_', '-')); response.renderJavaScript(template.asString(map), template.getStaticKey()); }
From source file:org.wicketstuff.dojo11.push.cometd.CometdJavascriptBehavior.java
License:Apache License
/** * @see org.wicketstuff.dojo11.push.cometd.CometdAbstractBehavior#getCometdInterceptorScript() *//*from w w w . j av a 2 s . c o m*/ @Override public String getCometdInterceptorScript() { final MiniMap map = new MiniMap(3); map.put("markupId", isComponentIndependent() ? _behaviorId : getComponent().getMarkupId()); map.put("url", isComponentIndependent() ? "" : getCallbackUrl().toString()); map.put("callback", _callbackMethod); return new DojoPackagedTextTemplate(CometdBehavior.class, "CometdJavascriptBehaviorTemplate.js") .asString(map); }
From source file:org.wicketstuff.lightbox.LightboxJavaScriptResource.java
License:Creative Commons License
/** * Generates the javascript required by the component by using a standard text template. * * @return the javascript for the lightbox behavior, in string form */// w w w .j a va2 s. co m private static String getJavaScript() { // Calculate the urls for the images we need to insert into the template... ServletWebRequest servletWebRequest = (ServletWebRequest) RequestCycle.get().getRequest(); HttpServletRequest request = servletWebRequest.getHttpServletRequest(); String contextPath = request.getContextPath(); String loading_url = contextPath + LOADING_GIF_PATH; String closing_url = contextPath + CLOSING_GIF_PATH; // Create the template's substitution map... MiniMap params = new MiniMap(2); params.put("loading-gif", loading_url); params.put("close-label-gif", closing_url); // Run the substitutions through the template, and return the result... PackagedTextTemplate template = new PackagedTextTemplate(LightboxBehavior.class, LIGHTBOX_JS_TEMPLATE); return template.asString(params); }