/** * @return The text inputs of this component. */ public String[] getTextInputs() { return getValue(); }
/** * The string is a comma seperated list of the string inputs. * * @return A string concatenation of the string inputs. */ @Override public String getValueAsString() { String result = null; String[] inputs = getValue(); if (inputs != null && inputs.length > 0) { StringBuffer stringValues = new StringBuffer(); for (int i = 0; i < inputs.length; i++) { if (i > 0) { stringValues.append(", "); } stringValues.append(inputs[i]); } result = stringValues.toString(); } return result; }
/** * Set the inputs based on the incoming request. The text input values are set as an array of strings on the * parameter with this name {@link #getName()}. Any empty strings will be ignored. * * @param request the current request. * @return true if the inputs have changed, otherwise return false */ @Override protected boolean doHandleRequest(final Request request) { String[] values = getRequestValue(request); String[] current = getValue(); boolean changed = !Arrays.equals(values, current); if (changed) { setData(values); } return changed; }
/** * {@inheritDoc} */ @Override public String[] getRequestValue(final Request request) { if (isPresent(request)) { String[] paramValues = request.getParameterValues(getId()); return removeEmptyStrings(paramValues); } else { return getValue(); } }
super.validateComponent(diags); String[] values = getValue();
Assert.assertNull("Value should be null", field.getValue()); Assert.assertNull("Value should be null for empty array", field.getValue()); Arrays.equals(ENTERED_1_2, field.getValue())); Arrays.equals(ENTERED_1_2, field.getValue())); Assert.assertTrue( "Value should be an array with the two entries in the list without the empty entry", Arrays.equals(ENTERED_1_2, field.getValue())); field.getValue()));