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:com.pushinginertia.wicket.core.converter.TextFieldTitleCaseConverter.java
License:Open Source License
/** * Converts to the value used internally. This is where changes take place. *///from www .j a v a2s. c o m @Override public String convertToObject(final String value, final Locale locale) { // 1. if no input, return null if ((value == null) || Strings.isEmpty(value)) return null; final String normalized = NormalizeStringCaseUtils.normalizeCase(value, NormalizeStringCaseUtils.TargetCase.TITLE, NormalizeStringCaseUtils.Scope.PER_WORD, uppercaseThreshold, lowercaseThreshold); if (!value.equals(normalized)) { LOG.info("Normalized input string to title case from [{}] to [{}].", value, normalized); } return normalized; }
From source file:com.romeikat.datamessie.core.base.ui.page.SignInPage.java
License:Open Source License
@Override protected void onInitialize() { super.onInitialize(); // Signin page sould be stateless setStatelessHint(true);/*w ww . j a v a2s . c om*/ // Form final StatelessForm<Void> form = new StatelessForm<Void>("signInForm") { private static final long serialVersionUID = 1L; @Override protected void onSubmit() { if (Strings.isEmpty(username)) { return; } // Authenticate final boolean authResult = AuthenticatedWebSession.get().signIn(username, password); // If authentication succeeds, redirect user to the requested page if (authResult) { continueToOriginalDestination(); // If we reach this line there was no intercept page, so go to home page setResponsePage(getApplication().getHomePage()); } } }; form.setDefaultModel(new CompoundPropertyModel<SignInPage>(this)); add(form); // Username final TextField<String> usernameTextField = new TextField<String>("username"); usernameTextField.add(new FocusBehavior()); form.add(usernameTextField); // Password final PasswordTextField passwordTextField = new PasswordTextField("password"); form.add(passwordTextField); }
From source file:com.servoy.j2db.server.headlessclient.dataui.WebBaseButton.java
License:Open Source License
@SuppressWarnings("nls") protected static String instrumentBodyText(CharSequence bodyText, int halign, int valign, boolean hasHtmlOrImage, Border border, Insets margin, String cssid, char mnemonic, String elementID, String imgURL, Dimension size, boolean isButton, Cursor bodyCursor, boolean isAnchored, int anchors, String cssClass, int rotation, boolean isEnabled, ComponentTag openTag) { boolean isElementAnchored = anchors != IAnchorConstants.DEFAULT; Insets padding = null;//from w ww .j a v a2 s . co m Insets borderMargin = null; boolean usePadding = false; if (border == null) { padding = margin; } // empty border gets handled as margin else if (border instanceof EmptyBorder && !(border instanceof MatteBorder)) { usePadding = true; padding = ComponentFactoryHelper.getBorderInsetsForNoComponent(border); } // empty border inside compound border gets handled as margin else if (border instanceof CompoundBorder) { Border inside = ((CompoundBorder) border).getInsideBorder(); if (inside instanceof EmptyBorder && !(border instanceof MatteBorder)) { usePadding = true; padding = ComponentFactoryHelper.getBorderInsetsForNoComponent(inside); } Border outside = ((CompoundBorder) border).getOutsideBorder(); if (outside != null) { borderMargin = ComponentFactoryHelper.getBorderInsetsForNoComponent(outside); } } else if (!(border instanceof BevelBorder) && !(border instanceof EtchedBorder)) { if (border instanceof TitledBorder) { usePadding = true; padding = new Insets(5, 7, 5, 7); // margin + border + padding, see beneath padding.top += ComponentFactoryHelper.getTitledBorderHeight(border); // add the legend height } else { padding = ComponentFactoryHelper.getBorderInsetsForNoComponent(border); } } // In order to vertically align the text inside the <button>, we wrap the text inside a <span>, and we absolutely // position the <span> in the <button>. However, for centering vertically we drop this absolute positioning and // rely on the fact that by default the <button> tag vertically centers its content. StringBuffer instrumentedBodyText = new StringBuffer(); String onFocus = "onfocus=\"this.parentNode.focus()\""; if (openTag.getAttribute("onfocus") != null && openTag.getAttribute("onfocus").length() > 0 && openTag.getName().equals("label")) onFocus = "onclick=" + "\"" + openTag.getAttribute("onfocus").replaceFirst("this", "this.parentNode") + "\""; // the latest browsers (except for IE), do not trigger an onfocus neither on the span nor on the parent label element // as a workaround, an onclick is added in the span of label elements that does what the parent onfocus does instrumentedBodyText.append("<span " + onFocus + " style='" + //$NON-NLS-1$ (bodyCursor == null ? "" : "cursor: " + (bodyCursor.getType() == Cursor.HAND_CURSOR ? "pointer" : "default") + "; ") + "display: block;"); int top = 0; int bottom = 0; int left = 0; int right = 0; if (padding != null && usePadding) { top = padding.top; bottom = padding.bottom; left = padding.left; right = padding.right; } if (rotation == 0 || size.width >= size.height) { // Horizontal alignment and anchoring. instrumentedBodyText.append(" left: " + left + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ instrumentedBodyText.append(" right: " + right + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ // Vertical alignment and anchoring. if (cssid == null) { if (valign == ISupportTextSetup.TOP) instrumentedBodyText.append(" top: " + top + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ else if (valign == ISupportTextSetup.BOTTOM) instrumentedBodyText.append(" bottom: " + bottom + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ } // Full height. if (hasHtmlOrImage && valign != ISupportTextSetup.CENTER && cssid == null) instrumentedBodyText.append(" height: 100%;"); //$NON-NLS-1$ else if ((cssid != null) || (valign != ISupportTextSetup.CENTER)) instrumentedBodyText.append(" position: absolute;"); //$NON-NLS-1$ else if (!isButton && !hasHtmlOrImage && imgURL == null) { int innerHeight = size.height; if (padding != null) innerHeight -= padding.top + padding.bottom; if (borderMargin != null) innerHeight -= borderMargin.top + borderMargin.bottom; instrumentedBodyText.append("height: " + innerHeight + "px;line-height: " + innerHeight + "px;"); } if (isAnchored) { instrumentedBodyText.append(" position: relative;"); //$NON-NLS-1$ } } else { // this is a special case, invert width and height so that text is fully visible when rotated int innerWidth = size.height; if (padding != null) innerWidth -= padding.top + padding.bottom; if (borderMargin != null) innerWidth -= borderMargin.top + borderMargin.bottom; int innerHeight = size.width; if (padding != null) innerHeight -= padding.left + padding.right; if (borderMargin != null) innerHeight -= borderMargin.left + borderMargin.right; int rotationOffset = (innerWidth - innerHeight) / 2; instrumentedBodyText.append(" left: -" + rotationOffset + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ instrumentedBodyText.append(" top: " + rotationOffset + "px;"); //$NON-NLS-1$ //$NON-NLS-2$ instrumentedBodyText.append(" position: absolute;"); instrumentedBodyText.append(" height: " + innerHeight + "px;"); instrumentedBodyText.append(" width: " + innerWidth + "px;"); instrumentedBodyText.append("line-height: " + innerHeight + "px;"); } if (!hasHtmlOrImage) instrumentedBodyText.append(" overflow: hidden;"); if (halign == ISupportTextSetup.LEFT) instrumentedBodyText.append(" text-align: left;"); //$NON-NLS-1$ else if (halign == ISupportTextSetup.RIGHT) instrumentedBodyText.append(" text-align: right;"); //$NON-NLS-1$ else instrumentedBodyText.append(" text-align: center;"); //$NON-NLS-1$ if (rotation > 0) { String rotationCss = "rotate(" + rotation + "deg)"; instrumentedBodyText.append(" -ms-transform: " + rotationCss + ";" + " -moz-transform: " + rotationCss //$NON-NLS-1$ + ";" + " -webkit-transform: " + rotationCss + ";" + " -o-transform: " + rotationCss + ";" + " transform: " + rotationCss + ";"); } if (cssid != null && cssClass == null) instrumentedBodyText.append(" visibility: hidden;"); //$NON-NLS-1$ instrumentedBodyText.append("'"); //$NON-NLS-1$ if (cssClass != null) { instrumentedBodyText.append(" class='"); //$NON-NLS-1$ instrumentedBodyText.append(cssClass); instrumentedBodyText.append("'"); //$NON-NLS-1$ } if (cssid != null) { instrumentedBodyText.append(" id='"); //$NON-NLS-1$ instrumentedBodyText.append(cssid); instrumentedBodyText.append("'"); //$NON-NLS-1$ } instrumentedBodyText.append(">"); //$NON-NLS-1$ //in ie<8 the filter:alpha(opacity=50) applied on the <button> element is not applied to the <img> element String IE8filterFIx = ""; if (!isEnabled) { WebClientInfo webClientInfo = new WebClientInfo((WebRequestCycle) RequestCycle.get()); ClientProperties cp = webClientInfo.getProperties(); if (cp.isBrowserInternetExplorer() && cp.getBrowserVersionMajor() != -1 && cp.getBrowserVersionMajor() < 9) { IE8filterFIx = "filter:alpha(opacity=50);"; } } if (!Strings.isEmpty(bodyText)) { CharSequence bodyTextValue = bodyText; if (mnemonic > 0 && !hasHtmlOrImage) { StringBuffer sbBodyText = new StringBuffer(bodyTextValue); int mnemonicIdx = sbBodyText.indexOf(Character.toString(mnemonic)); if (mnemonicIdx != -1) { sbBodyText.insert(mnemonicIdx + 1, "</u>"); sbBodyText.insert(mnemonicIdx, "<u>"); bodyTextValue = sbBodyText.toString(); } } if (imgURL != null) { String onLoadCall = isElementAnchored ? " onload=\"Servoy.Utils.setLabelChildHeight('" + elementID + "', " + valign + ");\"" : ""; StringBuffer sb = new StringBuffer("<img id=\"").append(elementID).append("_img") .append("\" src=\"").append(imgURL) .append("\" style=\"vertical-align: middle;" + IE8filterFIx + (isElementAnchored && (cssClass == null) ? "visibility:hidden;" : "") + "\"") .append(onLoadCall).append("/>"); sb.append("<span style=\"vertical-align:middle;\"> ").append(bodyTextValue); bodyTextValue = sb.toString(); } instrumentedBodyText.append(bodyTextValue); if (imgURL != null) { instrumentedBodyText.append("</span>"); } } else if (imgURL != null) { instrumentedBodyText.append("<img id=\""); instrumentedBodyText.append(elementID).append("_img\""); instrumentedBodyText.append("style=\"" + (isElementAnchored && (cssClass == null) ? " visibility:hidden;" : "") + IE8filterFIx + "\""); // hide it until setLabelChildHeight is calculated instrumentedBodyText.append(" src=\""); instrumentedBodyText.append(imgURL); String onLoadCall = isElementAnchored ? " onload=\"Servoy.Utils.setLabelChildHeight('" + elementID + "', " + valign + ");\"" : ""; instrumentedBodyText.append("\" align=\"middle\"").append(onLoadCall).append("/>"); } instrumentedBodyText.append("</span>"); //$NON-NLS-1$ if (border instanceof TitledBorder) { instrumentedBodyText = new StringBuffer(getTitledBorderOpenMarkup((TitledBorder) border) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup()); } if (border instanceof CompoundBorder) { Border outside = ((CompoundBorder) border).getOutsideBorder(); if (outside != null && outside instanceof TitledBorder) { instrumentedBodyText = new StringBuffer(getTitledBorderOpenMarkup((TitledBorder) outside) + instrumentedBodyText.toString() + getTitledBorderCloseMarkup()); } } return instrumentedBodyText.toString(); }
From source file:com.servoy.j2db.server.headlessclient.dataui.WebDataField.java
License:Open Source License
@Override protected Object convertValue(String[] value) throws ConversionException { String tmp = value != null && value.length > 0 ? value[0] : null; if (getConvertEmptyInputStringToNull() && Strings.isEmpty(tmp)) { return null; }//w w w. j a v a2 s. c o m return tmp; }
From source file:com.servoy.j2db.server.headlessclient.WebClientsApplication.java
License:Open Source License
/** * @see wicket.protocol.http.WebApplication#init() */// w ww. j a v a2s . com @Override protected void init() { if (ApplicationServerRegistry.get() == null) return; // TODO this is a workaround to allow mobile test client that only starts Tomcat not to give exceptions (please remove if mobile test client initialises a full app. server in the future) getResourceSettings().setResourceWatcher(new ServoyModificationWatcher(Duration.seconds(5))); // getResourceSettings().setResourcePollFrequency(Duration.seconds(5)); getResourceSettings().setAddLastModifiedTimeToResourceReferenceUrl(true); getResourceSettings().setDefaultCacheDuration((int) Duration.days(365).seconds()); getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setMarkupCache(new ServoyMarkupCache(this)); // getMarkupSettings().setStripWicketTags(true); getResourceSettings().setResourceStreamLocator(new ServoyResourceStreamLocator(this)); getResourceSettings().setPackageResourceGuard(new ServoyPackageResourceGuard()); // getResourceSettings().setResourceFinder(createResourceFinder()); getResourceSettings().setThrowExceptionOnMissingResource(false); getApplicationSettings().setPageExpiredErrorPage(ServoyExpiredPage.class); getApplicationSettings().setClassResolver(new ServoyClassResolver()); getSessionSettings().setMaxPageMaps(15); // getRequestCycleSettings().setGatherExtendedBrowserInfo(true); getSecuritySettings().setCryptFactory(new CachingKeyInSessionSunJceCryptFactory()); Settings settings = Settings.getInstance(); getDebugSettings().setOutputComponentPath( Utils.getAsBoolean(settings.getProperty("servoy.webclient.debug.wicketpath", "false"))); //$NON-NLS-1$ //$NON-NLS-2$ if (Utils.getAsBoolean(settings.getProperty("servoy.webclient.nice.urls", "false"))) //$NON-NLS-1$ //$NON-NLS-2$ { mount(new HybridUrlCodingStrategy("/solutions", SolutionLoader.class)); //$NON-NLS-1$ mount(new HybridUrlCodingStrategy("/application", MainPage.class)); //$NON-NLS-1$ mount(new HybridUrlCodingStrategy("/ss", SolutionLoader.class) //$NON-NLS-1$ { /** * @see wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy#matches(wicket.IRequestTarget) */ @Override public boolean matches(IRequestTarget requestTarget) { return false; } }); } else { mountBookmarkablePage("/solutions", SolutionLoader.class); //$NON-NLS-1$ mount(new BookmarkablePageRequestTargetUrlCodingStrategy("/ss", SolutionLoader.class, null) //$NON-NLS-1$ { /** * @see wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy#matches(wicket.IRequestTarget) */ @Override public boolean matches(IRequestTarget requestTarget) { return false; } }); } long maxSize = Utils.getAsLong(settings.getProperty("servoy.webclient.maxuploadsize", "0"), false); //$NON-NLS-1$ //$NON-NLS-2$ if (maxSize > 0) { getApplicationSettings().setDefaultMaximumUploadSize(Bytes.kilobytes(maxSize)); } getSharedResources().putClassAlias(IApplication.class, "application"); //$NON-NLS-1$ getSharedResources().putClassAlias(PageContributor.class, "pc"); //$NON-NLS-1$ getSharedResources().putClassAlias(MaskBehavior.class, "mask"); //$NON-NLS-1$ getSharedResources().putClassAlias(Application.class, "servoy"); //$NON-NLS-1$ getSharedResources().putClassAlias(org.wicketstuff.calendar.markup.html.form.DatePicker.class, "datepicker"); //$NON-NLS-1$ getSharedResources().putClassAlias(YUILoader.class, "yui"); //$NON-NLS-1$ getSharedResources().putClassAlias(JQueryLoader.class, "jquery"); //$NON-NLS-1$ getSharedResources().putClassAlias(TinyMCELoader.class, "tinymce"); //$NON-NLS-1$ getSharedResources().putClassAlias(org.apache.wicket.markup.html.WicketEventReference.class, "wicketevent"); //$NON-NLS-1$ getSharedResources().putClassAlias(org.apache.wicket.ajax.WicketAjaxReference.class, "wicketajax"); //$NON-NLS-1$ getSharedResources().putClassAlias(MainPage.class, "servoyjs"); //$NON-NLS-1$ getSharedResources().putClassAlias(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.class, "modalwindow"); //$NON-NLS-1$ PackageResource.bind(this, IApplication.class, "images/open_project.gif"); //$NON-NLS-1$ PackageResource.bind(this, IApplication.class, "images/save.gif"); //$NON-NLS-1$ mountSharedResource("/formcss", "servoy/formcss"); //$NON-NLS-1$//$NON-NLS-2$ sharedMediaResource = new SharedMediaResource(); getSharedResources().add("media", sharedMediaResource); //$NON-NLS-1$ mount(new SharedResourceRequestTargetUrlCodingStrategy("mediafolder", "servoy/media") //$NON-NLS-1$ //$NON-NLS-2$ { @Override protected void appendParameters(AppendingStringBuffer url, Map<String, ?> parameters) { if (parameters != null && parameters.size() > 0) { Object solutionName = parameters.get("s"); //$NON-NLS-1$ if (solutionName != null) appendPathParameter(url, null, solutionName.toString()); Object resourceId = parameters.get("id"); //$NON-NLS-1$ if (resourceId != null) appendPathParameter(url, null, resourceId.toString()); StringBuilder queryParams = new StringBuilder(); for (Entry<?, ?> entry1 : parameters.entrySet()) { Object value = ((Entry<?, ?>) entry1).getValue(); if (value != null) { Object key = ((Entry<?, ?>) entry1).getKey(); if (!"s".equals(key) && !"id".equals(key)) //$NON-NLS-1$ //$NON-NLS-2$ { if (value instanceof String[]) { String[] values = (String[]) value; for (String value1 : values) { if (queryParams.length() > 0) queryParams.append("&"); //$NON-NLS-1$ queryParams.append(key).append("=").append(value1);//$NON-NLS-1$ } } else { if (queryParams.length() > 0) queryParams.append("&"); //$NON-NLS-1$ queryParams.append(key).append("=").append(value);//$NON-NLS-1$ } } } } if (queryParams.length() > 0) { url.append("?").append(queryParams);//$NON-NLS-1$ } } } @Override protected void appendPathParameter(AppendingStringBuffer url, String key, String value) { String escapedValue = value; String[] values = escapedValue.split("/");//$NON-NLS-1$ if (values.length > 1) { StringBuilder sb = new StringBuilder(escapedValue.length()); for (String str : values) { sb.append(urlEncodePathComponent(str)); sb.append('/'); } sb.setLength(sb.length() - 1); escapedValue = sb.toString(); } else { escapedValue = urlEncodePathComponent(escapedValue); } if (!Strings.isEmpty(escapedValue)) { if (!url.endsWith("/"))//$NON-NLS-1$ { url.append("/");//$NON-NLS-1$ } if (key != null) url.append(urlEncodePathComponent(key)).append("/");//$NON-NLS-1$ url.append(escapedValue); } } /* * (non-Javadoc) * * @see org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy#decodeParameters(java.lang.String, java.util.Map) */ @Override protected ValueMap decodeParameters(String urlFragment, Map<String, ?> urlParameters) { ValueMap map = new ValueMap(); final String[] pairs = urlFragment.split("/"); //$NON-NLS-1$ if (pairs.length > 1) { map.add("s", pairs[1]); //$NON-NLS-1$ StringBuffer sb = new StringBuffer(); for (int i = 2; i < pairs.length; i++) { sb.append(pairs[i]); sb.append("/"); //$NON-NLS-1$ } sb.setLength(sb.length() - 1); map.add("id", sb.toString()); //$NON-NLS-1$ } if (urlParameters != null) { map.putAll(urlParameters); } return map; } }); getSharedResources().add("resources", new ServeResources()); //$NON-NLS-1$ getSharedResources().add("formcss", new FormCssResource(this)); //$NON-NLS-1$ if (settings.getProperty("servoy.webclient.error.page", null) != null) //$NON-NLS-1$ { getApplicationSettings().setInternalErrorPage(ServoyErrorPage.class); } if (settings.getProperty("servoy.webclient.pageexpired.page", null) != null) //$NON-NLS-1$ { getApplicationSettings().setPageExpiredErrorPage(ServoyPageExpiredPage.class); } addPreComponentOnBeforeRenderListener(new IComponentOnBeforeRenderListener() { public void onBeforeRender(Component component) { if (component instanceof IServoyAwareBean) { IModel model = component.getInnermostModel(); WebForm webForm = component.findParent(WebForm.class); if (model instanceof RecordItemModel && webForm != null) { IRecord record = (IRecord) ((RecordItemModel) model).getObject(); FormScope fs = webForm.getController().getFormScope(); if (record != null && fs != null) { ((IServoyAwareBean) component).setSelectedRecord(new ServoyBeanState(record, fs)); } } } else { if (!component.isEnabled()) { boolean hasOnRender = (component instanceof IFieldComponent && ((IFieldComponent) component) .getScriptObject() instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback) ((IFieldComponent) component).getScriptObject()) .getRenderEventExecutor().hasRenderCallback()); if (!hasOnRender) { // onrender may change the enable state return; } } Component targetComponent = null; boolean hasFocus = false, hasBlur = false; if (component instanceof IFieldComponent && ((IFieldComponent) component).getEventExecutor() != null) { targetComponent = component; if (component instanceof WebBaseSelectBox) { Component[] cs = ((WebBaseSelectBox) component).getFocusChildren(); if (cs != null && cs.length == 1) targetComponent = cs[0]; } if (component instanceof WebDataHtmlArea) hasFocus = true; // always install a focus handler when in a table view to detect change of selectedIndex and test for record validation if (((IFieldComponent) component).getEventExecutor().hasEnterCmds() || component.findParent(WebCellBasedView.class) != null || (((IFieldComponent) component) .getScriptObject() instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback) ((IFieldComponent) component) .getScriptObject()).getRenderEventExecutor().hasRenderCallback())) { hasFocus = true; } // Always trigger event on focus lost: // 1) check for new selected index, record validation may have failed preventing a index changed // 2) prevent focus gained to be called when field validation failed // 3) general ondata change hasBlur = true; } else if (component instanceof WebBaseLabel) { targetComponent = component; hasFocus = true; } if (targetComponent != null) { MainPage mainPage = targetComponent.findParent(MainPage.class); if (mainPage.isUsingAjax()) { AbstractAjaxBehavior eventCallback = mainPage.getPageContributor().getEventCallback(); if (eventCallback != null) { String callback = eventCallback.getCallbackUrl().toString(); if (component instanceof WebDataRadioChoice || component instanceof WebDataCheckBoxChoice || component instanceof WebDataLookupField || component instanceof WebDataComboBox || component instanceof WebDataListBox || component instanceof WebDataHtmlArea) { // is updated via ServoyChoiceComponentUpdatingBehavior or ServoyFormComponentUpdatingBehavior, this is just for events callback += "&nopostdata=true"; } for (IBehavior behavior : targetComponent.getBehaviors()) { if (behavior instanceof EventCallbackModifier) { targetComponent.remove(behavior); } } if (hasFocus) { StringBuilder js = new StringBuilder(); js.append("eventCallback(this,'focus','").append(callback).append("',event)"); //$NON-NLS-1$ //$NON-NLS-2$ targetComponent.add(new EventCallbackModifier("onfocus", true, //$NON-NLS-1$ new Model<String>(js.toString()))); targetComponent.add(new EventCallbackModifier("onmousedown", true, //$NON-NLS-1$ new Model<String>("focusMousedownCallback(event)"))); //$NON-NLS-1$ } if (hasBlur) { boolean blockRequest = false; // if component has ondatachange, check for blockrequest if (component instanceof ISupportEventExecutor && ((ISupportEventExecutor) component).getEventExecutor() .hasChangeCmd()) { WebClientSession webClientSession = WebClientSession.get(); blockRequest = webClientSession != null && webClientSession.blockRequest(); } StringBuilder js = new StringBuilder(); js.append("postEventCallback(this,'blur','").append(callback) //$NON-NLS-1$ .append("',event," + blockRequest + ")"); //$NON-NLS-1$ targetComponent.add(new EventCallbackModifier("onblur", true, //$NON-NLS-1$ new Model<String>(js.toString()))); } } } } } } }); }
From source file:com.vaynberg.wicket.select2.Select2Choice.java
License:Apache License
@Override protected void convertInput() { String input = getWebRequest().getRequestParameters().getParameterValue(getInputName()).toString(); if (Strings.isEmpty(input)) { setConvertedInput(null);/* ww w. ja v a2s . c o m*/ } else { setConvertedInput(getProvider().toChoices(Collections.singleton(input)).iterator().next()); } }
From source file:com.vaynberg.wicket.select2.Select2MultiChoice.java
License:Apache License
@Override protected void convertInput() { String input = getWebRequest().getRequestParameters().getParameterValue(getInputName()).toString(); final Collection<T> choices; if (Strings.isEmpty(input)) { choices = new ArrayList<T>(); } else {//from ww w.j av a 2 s . c o m choices = getProvider().toChoices(Arrays.asList(input.split(","))); } setConvertedInput(choices); }
From source file:com.vk.bingmaps.api.event.ClickListener.java
License:Apache License
@Override protected void onEvent(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); String s = request.getParameter("location"); if (!Strings.isEmpty(s)) { BLocation loc = BLocation.parse(s); onClick(target, loc);/* ww w . j a v a 2 s .c o m*/ } else { //TODO warn } }
From source file:com.vk.bingmaps.api.obj.BInfobox.java
License:Apache License
/** * Set the options.// w w w. ja va 2 s . c o m * * @param htmlContent content */ public void setHtmlContent(String htmlContent) { if (!Strings.isEmpty(htmlContent)) { if (AjaxRequestTarget.get() != null) { AjaxRequestTarget.get().appendJavascript(getParent().getJSsetInfoboxHtml(this, htmlContent)); } } }
From source file:com.vk.bingmaps.api.obj.BInfobox.java
License:Apache License
@Override protected void updateOnAjaxCall(AjaxRequestTarget target, BEvent overlayEvent) { Request request = RequestCycle.get().getRequest(); String s = request.getParameter("overlay.location"); if (!Strings.isEmpty(s)) { this.location = BLocation.parse(s); } else {//from w w w. java2s . com //TODO warn } String vis = request.getParameter("overlay.visible"); if (!Strings.isEmpty(vis)) { visible = Boolean.valueOf(vis); } }