@Test public void no_form() { Hidden hidden = new Hidden(); try { hidden.beginRender(null); unreachable(); } catch (RuntimeException ex) { assertEquals(ex.getMessage(), "The Hidden component must be enclosed by a Form component."); } }
boolean beginRender(MarkupWriter writer) { if (formSupport == null) { throw new RuntimeException("The Hidden component must be enclosed by a Form component."); } controlName = formSupport.allocateControlName(resources.getId()); clientId = null; formSupport.store(this, new ProcessSubmission(controlName)); Object toEncode = value == null ? nulls.replaceToClient() : value; String encoded = toEncode == null ? "" : encoder.toClient(toEncode); hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded); resources.renderInformalParameters(writer); writer.end(); return false; }
Hidden implements ClientElement { boolean beginRender(MarkupWriter writer) { if (formSupport == null) { throw new RuntimeException("The Hidden component must be enclosed by a Form component."); } controlName = formSupport.allocateControlName(resources.getId()); clientId = null; formSupport.store(this, new ProcessSubmission(controlName)); Object toEncode = value == null ? nulls.replaceToClient() : value; String encoded = toEncode == null ? "" : encoder.toClient(toEncode); hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded); resources.renderInformalParameters(writer); writer.end(); return false; } }
Hidden implements ClientElement { boolean beginRender(MarkupWriter writer) { if (formSupport == null) { throw new RuntimeException("The Hidden component must be enclosed by a Form component."); } controlName = formSupport.allocateControlName(resources.getId()); clientId = null; formSupport.store(this, new ProcessSubmission(controlName)); Object toEncode = value == null ? nulls.replaceToClient() : value; String encoded = toEncode == null ? "" : encoder.toClient(toEncode); hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded); resources.renderInformalParameters(writer); writer.end(); return false; }  }
Hidden implements ClientElement { boolean beginRender(MarkupWriter writer) { if (formSupport == null) { throw new RuntimeException("The Hidden component must be enclosed by a Form component."); } controlName = formSupport.allocateControlName(resources.getId()); clientId = null; formSupport.store(this, new ProcessSubmission(controlName)); Object toEncode = value == null ? nulls.replaceToClient() : value; String encoded = toEncode == null ? "" : encoder.toClient(toEncode); hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded); resources.renderInformalParameters(writer); writer.end(); return false; }  String getClientId(); String getControlName(); }
Hidden implements ClientElement { boolean beginRender(MarkupWriter writer) { if (formSupport == null) { throw new RuntimeException("The Hidden component must be enclosed by a Form component."); } controlName = formSupport.allocateControlName(resources.getId()); clientId = null; formSupport.store(this, new ProcessSubmission(controlName)); Object toEncode = value == null ? nulls.replaceToClient() : value; String encoded = toEncode == null ? "" : encoder.toClient(toEncode); hiddenInputElement = writer.element("input", "type", "hidden", "name", controlName, "value", encoded); resources.renderInformalParameters(writer); writer.end(); return false; }  String getClientId(); String getControlName();  }