Search in sources :

Example 1 with TableField

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());
}
Also used : ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) Table(org.eclipse.scout.rt.ui.html.json.table.fixtures.Table) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) TableField(org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField) Test(org.junit.Test)

Example 2 with TableField

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));
}
Also used : ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) Table(org.eclipse.scout.rt.ui.html.json.table.fixtures.Table) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) TableField(org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField) Test(org.junit.Test)

Example 3 with TableField

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));
}
Also used : ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) Table(org.eclipse.scout.rt.ui.html.json.table.fixtures.Table) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) TableField(org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField) Test(org.junit.Test)

Example 4 with TableField

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());
}
Also used : ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) TableField(org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField) Test(org.junit.Test)

Aggregations

ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)4 TableField (org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.fixtures.TableField)4 Test (org.junit.Test)4 IPageWithTable (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable)3 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)3 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)2