List of usage examples for org.apache.wicket Component getMarkupId
public String getMarkupId()
From source file:org.sakaiproject.profile2.tool.components.FocusOnLoadBehaviour.java
License:Educational Community License
@Override public void renderHead(Component component, IHeaderResponse response) { response.render(OnDomReadyHeaderItem .forScript("document.getElementById('" + component.getMarkupId() + "').focus()")); }
From source file:org.wicketstuff.animator.MarkupIdModel.java
License:Apache License
@Override protected Object load() { Set<String> ids = new HashSet<String>(); for (Component component : components) { ids.add(component.getMarkupId()); }/*from w ww.j av a 2 s .c o m*/ return ids; }
From source file:org.wicketstuff.calendar.markup.html.form.DatePicker.java
License:Apache License
/** * @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component) *///from w w w .j a v a 2 s. com public void onRendered(Component component) { super.onRendered(component); // Append the span and img icon right after the rendering of the // component. Not as pretty as working with a panel etc, but works // for behaviors and is more efficient Response response = component.getResponse(); response.write("\n<span> <img style=\""); response.write(getIconStyle()); response.write("\" id=\""); response.write(getIconId()); response.write("\" src=\""); CharSequence iconUrl = getIconUrl(); //displayCalendar(document.forms[0].theDate,'yyyy/mm/dd',this) response.write(Strings.escapeMarkup(iconUrl != null ? iconUrl.toString() : "")); response.write("\" onclick=\"displayCalendar(document.getElementById('"); response.write(component.getMarkupId()); response.write("'),'"); String datePattern = getDatePattern().replaceAll("mm", "ii").toLowerCase(); datePattern = datePattern.replace('s', '0'); // (mili)seconds are not supported response.write(datePattern); if (datePattern.indexOf("h") == -1) { response.write("',this)\""); } else { response.write("',this,true)\""); } response.write(" /></span>"); }
From source file:org.wicketstuff.console.ClearButton.java
License:Apache License
private void addClearOnClick(final Component component) { final String markupId = component.getMarkupId(); final String clearJs = String.format("clearValue('%s')", markupId); add(new AttributeAppender("onclick", Model.of(clearJs), ";")); }
From source file:org.wicketstuff.datatable_autocomplete.panel.AJAXAutoCompleteBehavior.java
License:Apache License
@Override protected final CharSequence getCallbackScript() { /*/*from w w w.j a v a2s . co m*/ * Encode the callback script appending to the url the current client side value of the * component values. */ CharSequence baseUrl = super.getCallbackUrl(); CharSequence callbackScript = baseUrl; List<String> parameterList = new ArrayList<String>(); for (String parameter : dependencyProcessor.getQueryParameterToComponentMap().keySet()) { Component c = dependencyProcessor.getQueryParameterToComponentMap().get(parameter); String adjustedUrl = "&" + parameter + "='+Wicket.$('" + c.getMarkupId() + "').value"; parameterList.add(adjustedUrl); } callbackScript = StringUtils.join(new StringBuffer(callbackScript), parameterList, "+'").toString(); String script = "wicketAjaxGet('" + callbackScript + ");"; if (dependencyProcessor.getThrottingDuration() != null) return AbstractDefaultAjaxBehavior.throttleScript(script, getComponent().getMarkupId(), dependencyProcessor.getThrottingDuration()); else return script; }
From source file:org.wicketstuff.dojo11.dojofx.Animation.java
License:Apache License
/** * @param target// w w w .j a v a 2 s .c om * @param component * @param animation */ public static void appendAjaxLoadAnimation(AjaxRequestTarget target, Component component, Animation animation) { target.appendJavascript(animation.getAnimationScript(component.getMarkupId()) + ".play()"); }
From source file:org.wicketstuff.dojo11.dojofx.Animation.java
License:Apache License
/** * @param target/* w ww.j av a 2s .c o m*/ * @param component * @param animation */ public static void prependAjaxLoadAnimation(AjaxRequestTarget target, Component component, Animation animation) { target.prependJavascript(animation.getAnimationScript(component.getMarkupId()) + ".play()"); }
From source file:org.wicketstuff.dojo11.dojofx.ToggleAnimations.java
License:Apache License
/** * // w w w .j a v a 2 s . co m * @param component * @return JavaScript hide function */ public final String getShowFunction(Component component) { return getShowAnim().getAnimationScript(component.getMarkupId()); }
From source file:org.wicketstuff.dojo11.dojofx.ToggleAnimations.java
License:Apache License
/** * //from ww w .ja v a2 s. co m * @param component * @return JavaScript hide function */ public final String getHideFunction(Component component) { return getHideAnim().getAnimationScript(component.getMarkupId()); }
From source file:org.wicketstuff.dojo11.DojoTargetRefresherManager.java
License:Apache License
/** * @see org.apache.wicket.ajax.AjaxRequestTarget.IListener#onAfterRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget.IJavascriptResponse) *//*from w ww .j a va 2 s . com*/ @SuppressWarnings("unchecked") public void onAfterRespond(Map map, IJavaScriptResponse response) { //we need to find all dojoWidget that should be reParsed Iterator<Entry<String, Component>> it = dojoComponents.entrySet().iterator(); HashMap<String, Component> real = new HashMap<String, Component>(); String requires = ""; while (it.hasNext()) { Component c = (Component) ((Entry<String, Component>) it.next()).getValue(); for (Object behavior : c.getBehaviors()) { if (behavior instanceof AbstractRequireDojoBehavior) { requires += ((AbstractRequireDojoBehavior) behavior).getRequire(); } } if (!hasParentAdded(c) && c instanceof IDojoWidget) { //we do not need to reParse This widget, remove it real.put(c.getMarkupId(), c); } } dojoComponents = real; if (generateReParseJs() != null) { response.addJavaScript(requires + generateReParseJs()); } }