List of usage examples for org.apache.wicket.util.string Strings isEmpty
public static boolean isEmpty(final CharSequence string)
string
is considered empty. From source file:org.wicketstuff.dojo11.dojofx.AbstractAnimationBehavior.java
License:Apache License
@Override protected void onComponentTag(ComponentTag tag) { String style = getAnimation().getInitStyle(); if (!Strings.isEmpty(style)) { String currentStyle = (String) tag.getAttributes().get("style"); if (!Strings.isEmpty(currentStyle)) { style = currentStyle + ";" + style; }//from www . j a v a 2 s . co m tag.getAttributes().put("style", style); } super.onComponentTag(tag); }
From source file:org.wicketstuff.dojo11.dojofx.AbstractAnimationBehavior.java
License:Apache License
/** * @see org.wicketstuff.dojo11.AbstractRequireDojoBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse) *///w w w.ja v a 2 s .c om @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); String init = getAnimation().getInitJavaScript(getComponent().getMarkupId()); if (!Strings.isEmpty(init)) { response.renderOnDomReadyJavascript(init); } }
From source file:org.wicketstuff.dojo11.dojofx.AnimationBehavior.java
License:Apache License
@Override protected void onComponentTag(ComponentTag tag) { String animation = getAnimation().getAnimationScript(getComponent().getMarkupId()); String current = tag.getAttributes().getString(event.getName()); if (!Strings.isEmpty(current)) { animation = current + ";" + animation; }/*w ww .j a va 2 s . com*/ tag.getAttributes().put(event.getName(), animation); super.onComponentTag(tag); }
From source file:org.wicketstuff.extjs.behavior.ExtDataLinkBehavior.java
License:Apache License
private Store createStore() { /*/* ww w . j a va2s. c o m*/ * record definition for reader */ Map<String, Object> sample = provider.mapObject(null, null); Object[] record = {}; if (sample != null) { record = new Object[sample.size()]; int i = 0; Iterator<String> iterator = sample.keySet().iterator(); while (iterator.hasNext()) { record[i++] = new Config("name", iterator.next()); } } /* * Xml reader to fetch the response data */ Config config = new Config(); config.set("record", XmlRenderer.ITEM); config.set("id", "id"); config.set("totalRecords", XmlRenderer.TOTAL_SIZE); XmlReader xmlReader = new XmlReader(config, record); /* * main datastore object */ Config storeConfig = new Config(); storeConfig.set("url", getCallbackUrl()); storeConfig.set("reader", xmlReader); boolean isGroupping = !Strings.isEmpty(groupField); if (isGroupping) { storeConfig.set("groupField", groupField); } if (!Strings.isEmpty(sortField) || !Strings.isEmpty(sortDirection)) { Config sorting = new Config(); sorting.put("field", sortField); sorting.put("direction", sortDirection); storeConfig.set("sortInfo", sorting); storeConfig.set("remoteSort", true); } return isGroupping ? new GroupingStore(storeConfig) : new Store(storeConfig); }
From source file:org.wicketstuff.extjs.ExtContributionFactory.java
License:Apache License
/** * Default load strategy/* w w w . java2s . com*/ */ public ExtContribution load() { Enumeration<URL> resources; try { resources = Thread.currentThread().getContextClassLoader().getResources("META-INF/ext.properties"); while (resources.hasMoreElements()) { InputStream in = null; try { final URL url = resources.nextElement(); final Properties properties = new Properties(); in = url.openStream(); properties.load(in); String bundle = properties.getProperty("bundle"); if (!Strings.isEmpty(bundle)) { log.info("Loading Wicket-Ext bundle class --> {}", bundle); return (ExtContribution) Objects.newInstance(bundle); } } finally { if (in != null) { in.close(); } } } } catch (IOException e) { log.error("Unable to load 'ext.properties'", e); } throw new RuntimeException( "Unable to initialize Wicket-Ext. You must provide the Ext resources bundle factory in the 'ext.properties' configuration file "); }
From source file:org.wicketstuff.extjs.ExtFunction.java
License:Apache License
@Override public String toString() { StringBuilder result = new StringBuilder("function"); result.append("("); if (!Strings.isEmpty(arguments)) { result.append(arguments);//ww w . ja va2s .c o m } result.append(")"); result.append("{ ").append(body).append(" }"); return result.toString(); }
From source file:org.wicketstuff.extjs.grid.ColumnMap.java
License:Apache License
public String getProperty() { return !Strings.isEmpty(property) ? property : getDataIndex(); }
From source file:org.wicketstuff.gmap.GMap.java
License:Apache License
/** * Build the JavaScript for fitBounds() with the bounds property * /*w w w . j a v a 2 s . co m*/ * @return JavaScript for the fitBounds-Function */ private String getJSfitBounds() { if (null == bounds || Strings.isEmpty(bounds.getJSconstructor())) { return ""; } // else return getJSinvoke("fitBounds(" + bounds.getJSconstructor() + ")"); }
From source file:org.wicketstuff.js.ext.util.ExtThemeBehavior.java
License:Apache License
private String getLocalizedResource() { Locale locale = Session.get().getLocale(); // Get language and country, either of which may be the empty string final String language = locale.getLanguage(); final String country = locale.getCountry(); final String variant = locale.getVariant(); if (!Strings.isEmpty(variant)) { if (resourceExists(LOCALE_PATH_PREFIX, locale)) { return getResource(LOCALE_PATH_PREFIX, locale); }/*from ww w .ja v a 2 s .co m*/ } Locale currentLocale; if (!Strings.isEmpty(language) && !Strings.isEmpty(country)) { currentLocale = new Locale(language, country); if (resourceExists(LOCALE_PATH_PREFIX, currentLocale)) { return getResource(LOCALE_PATH_PREFIX, currentLocale); } } if (!Strings.isEmpty(language)) { currentLocale = new Locale(language); if (resourceExists(LOCALE_PATH_PREFIX, currentLocale)) { return getResource(LOCALE_PATH_PREFIX, currentLocale); } } return null; }
From source file:org.wicketstuff.mergedresources.annotations.ContributionScanner.java
License:Apache License
private void addJsContributions(Class<?> scope, JsContribution js, Map<String, SortedSet<WeightedResourceSpec>> contributions) { for (String file : js.value()) { if (Strings.isEmpty(file)) { file = scope.getSimpleName() + ".js"; }//from w ww . j a va 2 s . c o m String path = Strings.isEmpty(js.path()) ? DEFAULT_PATH_JS : js.path(); SortedSet<WeightedResourceSpec> specs = contributions.get(path); if (specs == null) { specs = new TreeSet<WeightedResourceSpec>(WeightedResourceSpecComparator.INSTANCE); contributions.put(path, specs); } if (!specs.add(new WeightedResourceSpec(scope, file, js.order()))) { throw new WicketRuntimeException("duplicate resource contribution: " + js + ", scope=" + scope); } } }