List of usage examples for org.apache.wicket.markup.html.form FormComponent getInputName
public String getInputName()
From source file:com.francetelecom.clara.cloud.presentation.tools.FieldFeedbackDecorator.java
License:Apache License
public void beforeRender(Component component) { FormComponent<?> fc = (FormComponent<?>) component; Response r = component.getResponse(); String label = (fc.getLabel() != null) ? fc.getLabel().getObject() : null; if (label != null) { r.write("<span class=\"param\">"); r.write("<label for=\""); r.write(fc.getMarkupId());/*from w w w . ja v a2 s . com*/ r.write("\""); if (!fc.isValid()) { r.write(" class=\"error\""); } r.write(" />"); r.write(Strings.escapeMarkup(label)); r.write("</label>"); r.write("</span>"); NotNull clazz; try { Field field = fc.getForm().getModelObject().getClass().getDeclaredField(fc.getInputName()); clazz = field.getAnnotation(NotNull.class); } catch (NoSuchFieldException e) { clazz = null; } if (clazz != null || fc.isRequired()) { r.write("<span class=\"required\" title=\""); r.write(fc.getString("portal.error.required.field.title")); r.write("\">"); r.write(fc.getString("portal.required.field") + "</span>"); } else { r.write("<span class=\"notrequired\"></span>"); } r.write("<span class=\"value\">"); } super.beforeRender(component); }
From source file:com.servoy.j2db.server.headlessclient.dataui.StripHTMLTagsConverter.java
License:Open Source License
public static String getTriggerJavaScript(FormComponent<?> component, String value) { ServoyForm form = (ServoyForm) component.getForm(); StringBuffer sb = new StringBuffer(100); sb.append("javascript:document.getElementById('"); //$NON-NLS-1$ sb.append(form.getHiddenField());// w w w . j a v a2 s . c o m sb.append("').name=\'"); //$NON-NLS-1$ sb.append(component.getInputName()); sb.append("';"); //$NON-NLS-1$ sb.append("document.getElementById('"); //$NON-NLS-1$ sb.append(form.getHiddenField()); sb.append("').value=\'"); //$NON-NLS-1$ sb.append(Utils.stringReplace(value, "\'", "\\\'")); //$NON-NLS-1$ //$NON-NLS-2$ sb.append("';"); //$NON-NLS-1$ sb.append("var f=document.getElementById('"); //$NON-NLS-1$ sb.append(form.getJavascriptCssId()); sb.append("');"); //$NON-NLS-1$ sb.append("if (f.onsubmit != undefined) { if (f.onsubmit()==false) return false; }"); //$NON-NLS-1$ sb.append("f.submit();return false;"); //$NON-NLS-1$ return sb.toString(); }
From source file:org.dcm4chee.web.war.common.UIDFieldBehavior.java
License:LGPL
@SuppressWarnings("unchecked") @Override/* w w w . j ava 2s . c om*/ protected final void onEvent(final AjaxRequestTarget target) { final FormComponent<String> formComponent = (FormComponent<String>) getComponent(); boolean b = QueryUtil.isUniversalMatch(formComponent.getModelObject()); try { formComponent.inputChanged(); formComponent.validate(); if (formComponent.hasErrorMessage()) { formComponent.invalid(); } else { formComponent.valid(); formComponent.updateModel(); if (b != QueryUtil.isUniversalMatch(formComponent.getModelObject())) { updateOtherFields(target.getPage().getRequest().getParameterMap(), formComponent.getInputName()); addToTarget(target); } } } catch (RuntimeException e) { onError(target, e); } }
From source file:org.geoserver.web.GeoServerWicketTestSupport.java
License:Open Source License
public void prefillForm(final FormTester tester) { Form form = tester.getForm();// w w w. j a v a 2s. com form.visitChildren(new Component.IVisitor() { public Object component(Component component) { if (component instanceof FormComponent) { FormComponent fc = (FormComponent) component; String name = fc.getInputName(); String value = fc.getValue(); tester.setValue(name, value); } return Component.IVisitor.CONTINUE_TRAVERSAL; } }); }
From source file:org.obiba.onyx.quartz.test.AbstractQuestionnaireTest.java
License:Open Source License
private void setFormComponentValue(FormComponent formComponent, String value) { wicketTester.getServletRequest().setParameter(formComponent.getInputName(), value); }
From source file:org.odlabs.wiquery.tester.WiQueryTester.java
License:Open Source License
/** * Sets the value on the input control.// w ww. j a v a 2 s .com */ public void setValue(FormComponent<?> input, String value) { getLastRequest().setParameter(input.getInputName(), value); }