/** * Same as {@link #getName()}. This method exists simply to clarify the relationship between the WCheckBox, its * Action, and the ActionEvent sent to the execute() method of the Action. * * @return this checkbox's name. */ @Override public String getActionCommand() { return getId(); }
/** * {@inheritDoc} */ @Override public Boolean getRequestValue(final Request request) { if (isPresent(request)) { String aText = request.getParameter(getId()); return "true".equals(aText); } else { return getValue(); } }
/** * @param target the check box target * @param request the request being setup * @param condition true if checked */ private void setupCheckBoxRequest(final WCheckBox target, final MockRequest request, final boolean condition) { if (condition) { request.setParameter(target.getId(), "true"); } } }
/** * @param target the subordinate check box target * @param request the request to be processed * @param condition the flag if the check box is selected */ private void setupCheckBoxRequest(final WCheckBox target, final MockRequest request, final boolean condition) { if (condition) { request.setParameter(target.getId(), "true"); } }
/** * @param target the check box target * @param request the request being setup * @param condition true if checked */ private void setupCheckBoxRequest(final WCheckBox target, final MockRequest request, final boolean condition) { if (condition) { request.setParameter(target.getId(), "true"); } } }
/** * @param target the target component * @param selected true if the component is selected * @return the mock request */ private MockRequest setupRequest(final WCheckBox target, final boolean selected) { MockRequest request = new MockRequest(); request.setParameter(target.getId(), selected ? "true" : ""); return request; }
@Test public void testGetActionCommand() { WCheckBox wcbTest = new WCheckBox(); setActiveContext(createUIContext()); Assert.assertEquals("Action command should match the name", wcbTest.getId(), wcbTest. getActionCommand()); }
assertXpathEvaluatesTo(wcbTest.getId(), "//ui:checkbox/@id", wcbTest);