use of org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl in project scout.rt by eclipse.
the class JsonTableTest method testMultipleTableControlDisposallOnPropertyChange.
@Test
public void testMultipleTableControlDisposallOnPropertyChange() throws JSONException {
ITable table = new TableWithoutMenus();
table.initTable();
JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
jsonTable.toJson();
// ----------
FormTableControl tableControl1 = new FormTableControl();
FormTableControl tableControl2 = new FormTableControl();
table.addTableControl(tableControl1);
table.addTableControl(tableControl2);
assertNotNull(jsonTable.getAdapter(tableControl1));
assertTrue(jsonTable.getAdapter(tableControl1).isInitialized());
assertNotNull(jsonTable.getAdapter(tableControl2));
assertTrue(jsonTable.getAdapter(tableControl2).isInitialized());
table.removeTableControl(tableControl1);
assertNull(jsonTable.getAdapter(tableControl1));
assertNotNull(jsonTable.getAdapter(tableControl2));
assertTrue(jsonTable.getAdapter(tableControl2).isInitialized());
}
use of org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl in project scout.rt by eclipse.
the class JsonFormTableControlTest method testLazyLoadingForm_onModelSelectionChanged.
@Test
public void testLazyLoadingForm_onModelSelectionChanged() throws JSONException {
FormWithOneField form = new FormWithOneField();
form.setShowOnStart(false);
FormTableControl control = new FormTableControl();
control.setTable(new Table());
control.setForm(form);
control.decorateForm();
JsonTableControl<ITableControl> jsonControl = UiSessionTestUtility.newJsonAdapter(m_uiSession, control, null);
assertNull(jsonControl.getAdapter(form));
control.setSelected(true);
IJsonAdapter<?> formAdapter = jsonControl.getAdapter(form);
assertNotNull(formAdapter);
String formId = JsonTestUtility.extractProperty(m_uiSession.currentJsonResponse(), jsonControl.getId(), "form");
assertEquals(formAdapter.getId(), formId);
}
use of org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl in project scout.rt by eclipse.
the class JsonTableTest method testTableControlDisposalOnPropertyChange.
@Test
public void testTableControlDisposalOnPropertyChange() throws JSONException {
ITable table = new TableWithoutMenus();
table.initTable();
JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
jsonTable.toJson();
// ----------
FormTableControl control = new FormTableControl();
table.addTableControl(control);
assertNotNull(jsonTable.getAdapter(control));
assertTrue(jsonTable.getAdapter(control).isInitialized());
table.removeTableControl(control);
assertNull(jsonTable.getAdapter(control));
}
use of org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl in project scout.rt by eclipse.
the class JsonFormTableControlTest method testLazyLoadingForm_onModelFormChanged.
@Test
public void testLazyLoadingForm_onModelFormChanged() throws JSONException {
FormWithOneField form = new FormWithOneField();
form.setShowOnStart(false);
FormTableControl control = new FormTableControl();
control.setTable(new Table());
control.setForm(form);
control.decorateForm();
JsonTableControl<ITableControl> jsonControl = UiSessionTestUtility.newJsonAdapter(m_uiSession, control, null);
assertNull(jsonControl.getAdapter(form));
FormWithOneField anotherForm = new FormWithOneField();
anotherForm.setShowOnStart(false);
control.setForm(anotherForm);
control.decorateForm();
// Both forms have to be null because the control has not been selected yet
assertNull(jsonControl.getAdapter(form));
assertNull(jsonControl.getAdapter(anotherForm));
control.setSelected(true);
IJsonAdapter<?> formAdapter = jsonControl.getAdapter(anotherForm);
// Form is still null because it was exchanged with anotherForm
assertNull(jsonControl.getAdapter(form));
assertNotNull(formAdapter);
String formId = JsonTestUtility.extractProperty(m_uiSession.currentJsonResponse(), jsonControl.getId(), "form");
assertEquals(formAdapter.getId(), formId);
}
use of org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl in project scout.rt by eclipse.
the class JsonFormTableControlTest method testNonLazyLoadingFormWhenSelected.
@Test
public void testNonLazyLoadingFormWhenSelected() throws JSONException {
FormWithOneField form = new FormWithOneField();
FormTableControl control = new FormTableControl();
control.setTable(new Table());
control.setForm(form);
control.decorateForm();
control.setSelected(true);
JsonTableControl<ITableControl> jsonControl = UiSessionTestUtility.newJsonAdapter(m_uiSession, control, null);
IJsonAdapter<?> formAdapter = jsonControl.getAdapter(form);
assertNotNull(formAdapter);
// Expects formId is sent along with the control and not with a separate property change event
String formId = JsonTestUtility.extractProperty(m_uiSession.currentJsonResponse(), jsonControl.getId(), "form");
assertNull(formId);
}
Aggregations