use of org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox in project scout.rt by eclipse.
the class JsonTabBoxTest method testDontSendNonDisplayableGroups.
/**
* Tests whether non displayable groups are sent.
* <p>
* This reduces response size and also leverages security because the fields are never visible to the user, not even
* with the dev tools of the browser
*/
@Test
public void testDontSendNonDisplayableGroups() throws Exception {
ITabBox tabBox = new TabBoxWithNonDisplayableGroup();
JsonTestUtility.initField(tabBox);
JsonTabBox<ITabBox> jsonTabBox = UiSessionTestUtility.newJsonAdapter(m_uiSession, tabBox, null);
JsonGroupBox<IGroupBox> jsonDisplayableGroup = m_uiSession.getJsonAdapter(tabBox.getFieldByClass(TabBoxWithNonDisplayableGroup.DisplayableGroup.class), jsonTabBox);
JsonGroupBox<IGroupBox> jsonNonDisplayableGroup = m_uiSession.getJsonAdapter(tabBox.getFieldByClass(TabBoxWithNonDisplayableGroup.NonDisplayableGroup.class), jsonTabBox);
// Adapter for NonDisplayableField must not exist
assertNull(jsonNonDisplayableGroup);
// Json response must not contain NonDisplayableField
JSONObject json = jsonTabBox.toJson();
JSONArray jsonGroupBoxes = json.getJSONArray("tabItems");
assertEquals(1, jsonGroupBoxes.length());
assertEquals(jsonDisplayableGroup.getId(), jsonGroupBoxes.get(0));
}
use of org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox in project scout.rt by eclipse.
the class AbstractWrappedFormField method acceptVisitor.
@Override
public boolean acceptVisitor(IFormFieldVisitor visitor, int level, int fieldIndex, boolean includeThis) {
Collection<IFormField> innerFormRootGroupBox = null;
FORM innerForm = getInnerForm();
if (innerForm != null) {
IGroupBox rootGroupBox = innerForm.getRootGroupBox();
if (rootGroupBox != null) {
innerFormRootGroupBox = Collections.<IFormField>singletonList(rootGroupBox);
}
}
IFormField thisField = null;
if (includeThis) {
thisField = this;
}
return CompositeFieldUtility.applyFormFieldVisitor(visitor, thisField, innerFormRootGroupBox, level, fieldIndex);
}
use of org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox in project scout.rt by eclipse.
the class JsonGroupBoxTest method testDontSendNonDisplayableFields.
/**
* Tests whether non displayable fields are sent.
* <p>
* This reduces response size and also leverages security because the fields are never visible to the user, not even
* with the dev tools of the browser
*/
@Test
public void testDontSendNonDisplayableFields() throws Exception {
IGroupBox groupBox = new GroupBoxWithNonDisplayableField();
JsonTestUtility.initField(groupBox);
JsonGroupBox<IGroupBox> jsonGroupBox = UiSessionTestUtility.newJsonAdapter(m_uiSession, groupBox, null);
JsonFormField<IFormField> jsonDisplayableField = m_uiSession.getJsonAdapter(groupBox.getFieldByClass(GroupBoxWithNonDisplayableField.DisplayableField.class), jsonGroupBox);
JsonFormField<IFormField> jsonNonDisplayableField = m_uiSession.getJsonAdapter(groupBox.getFieldByClass(GroupBoxWithNonDisplayableField.NonDisplayableField.class), jsonGroupBox);
// Adapter for NonDisplayableField must not exist
assertNull(jsonNonDisplayableField);
// Json response must not contain NonDisplayableField
JSONObject json = jsonGroupBox.toJson();
JSONArray jsonFormFields = json.getJSONArray("fields");
assertEquals(1, jsonFormFields.length());
assertEquals(jsonDisplayableField.getId(), jsonFormFields.get(0));
}
Aggregations