use of org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField in project scout.rt by eclipse.
the class JsonTableFieldTest method testPreventTableDisposal2.
@Test
public void testPreventTableDisposal2() {
// Create tablePage
IPageWithTable<?> tablePage = createTablePageAndSelectNode();
ITable tablePageTable = tablePage.getTable();
JsonOutline<IOutline> jsonOutline = UiSessionTestUtility.newJsonAdapter(m_uiSession, tablePage.getOutline(), null);
Assert.assertNotNull(jsonOutline.getAdapter(tablePageTable));
// Create table field which uses the table from the table page
ITableField<ITable> tableField = new TableField<ITable>();
JsonTableField<ITableField<?>> jsonTableField = UiSessionTestUtility.newJsonAdapter(m_uiSession, tableField, null);
tableField.setTable(tablePageTable, true);
// Switch table -> table must not be disposed because table page still needs it
ITable table2 = new Table();
tableField.setTable(table2, true);
assertNotNull(jsonTableField.getAdapter(table2));
assertTrue(jsonTableField.getAdapter(table2).isInitialized());
assertNotNull(jsonOutline.getAdapter(tablePageTable));
assertTrue(jsonOutline.getAdapter(tablePageTable).isInitialized());
}
use of org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField in project scout.rt by eclipse.
the class JsonTableFieldTest method testTableDisposal.
@Test
public void testTableDisposal() {
ITable table = new Table();
ITableField<ITable> tableField = new TableField<ITable>(table);
JsonTableField<ITableField<?>> jsonTableField = UiSessionTestUtility.newJsonAdapter(m_uiSession, tableField, null);
assertNotNull(jsonTableField.getAdapter(table));
jsonTableField.dispose();
assertNull(jsonTableField.getAdapter(table));
}
use of org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField in project scout.rt by eclipse.
the class JsonTableFieldTest method testTableDisposalOnPropertyChange.
@Test
public void testTableDisposalOnPropertyChange() {
ITable table = new Table();
ITable table2 = new Table();
ITableField<ITable> tableField = new TableField<ITable>(table);
JsonTableField<ITableField<?>> jsonTableField = UiSessionTestUtility.newJsonAdapter(m_uiSession, tableField, null);
// Switch table -> old one needs to be disposed
assertNotNull(jsonTableField.getAdapter(table));
tableField.setTable(table2, false);
assertNull(jsonTableField.getAdapter(table));
assertNotNull(jsonTableField.getAdapter(table2));
assertTrue(jsonTableField.getAdapter(table2).isInitialized());
jsonTableField.dispose();
assertNull(jsonTableField.getAdapter(table2));
}
use of org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField in project scout.rt by eclipse.
the class JsonTableFieldTest method testPreventTableDisposal.
@Test
public void testPreventTableDisposal() {
// Create tablePage
IPageWithTable<?> tablePage = createTablePageAndSelectNode();
ITable tablePageTable = tablePage.getTable();
JsonOutline<IOutline> jsonOutline = UiSessionTestUtility.newJsonAdapter(m_uiSession, tablePage.getOutline(), null);
Assert.assertNotNull(jsonOutline.getAdapter(tablePageTable));
// Create table field which uses the table from the table page
ITableField<ITable> tableField = new TableField<ITable>();
JsonTableField<ITableField<?>> jsonTableField = UiSessionTestUtility.newJsonAdapter(m_uiSession, tableField, null);
tableField.setTable(tablePageTable, true);
// Dispose table field -> table must not be disposed because table page still needs it
jsonTableField.dispose();
assertNotNull(jsonOutline.getAdapter(tablePageTable));
assertTrue(jsonOutline.getAdapter(tablePageTable).isInitialized());
}
Aggregations