@Test public void shouldLoadValuesFromOption() throws JSONException { SelectComponentPattern pattern = (SelectComponentPattern)getField(componentState, "selectComponentPattern"); setField(pattern, "fieldDefinition", null); stubValuesOption("yes,no"); JSONObject content = componentState.renderContent(); assertNotNull(content.getJSONArray("values")); assertEquals(2, content.getJSONArray("values").length()); assertEquals("yes", content.getJSONArray(VALUES).getJSONObject(0).getString(KEY)); assertEquals("no", content.getJSONArray(VALUES).getJSONObject(1).getString(KEY)); }
@Override protected JSONObject renderContent() throws JSONException { JSONObject json = super.renderContent(); JSONArray valuesJson = selectComponentPattern.getValuesJson(getLocale()); includeDeactivatedValue(valuesJson, getFieldValue()); json.put("values", valuesJson); return json; }
SelectComponentState extends FieldComponentState { @Override protected JSONObject renderContent() throws JSONException { JSONObject json = super.renderContent(); JSONArray valuesJson = selectComponentPattern.getValuesJson(getLocale()); includeDeactivatedValue(valuesJson, getFieldValue()); json.put("values", valuesJson); return json; } }
SelectComponentState extends FieldComponentState { @Override protected JSONObject renderContent() throws JSONException { JSONObject json = super.renderContent(); JSONArray valuesJson = selectComponentPattern.getValuesJson(getLocale()); includeDeactivatedValue(valuesJson, getFieldValue()); json.put("values", valuesJson); return json; } SelectComponentState(final SelectComponentPattern selectComponentPattern, final List<String> values); }
SelectComponentState extends FieldComponentState { @Override protected JSONObject renderContent() throws JSONException { JSONObject json = super.renderContent(); JSONArray valuesJson = selectComponentPattern.getValuesJson(getLocale()); includeDeactivatedValue(valuesJson, getFieldValue()); json.put("values", valuesJson); return json; } SelectComponentState(final SelectComponentPattern selectComponentPattern, final List<String> values);  }
SelectComponentState extends FieldComponentState { @Override protected JSONObject renderContent() throws JSONException { JSONObject json = super.renderContent(); JSONArray valuesJson = selectComponentPattern.getValuesJson(getLocale()); includeDeactivatedValue(valuesJson, getFieldValue()); json.put("values", valuesJson); return json; } SelectComponentState(final SelectComponentPattern selectComponentPattern, final List<String> values);   }