Search in sources :

Example 36 with ITable

use of org.eclipse.scout.rt.client.ui.basic.table.ITable in project scout.rt by eclipse.

the class JsonTableTest method testRowFilter_nop.

/**
 * Usecase:
 * <p>
 * 1. Add filter to table<br>
 * 2. Remove same filter so that no rows are removed<br>
 * Assert that no events are generated, especially no rowsDeleted event
 */
@Test
public void testRowFilter_nop() throws JSONException {
    TableWith3Cols table = new TableWith3Cols();
    table.fill(3);
    table.initTable();
    JsonTable<ITable> jsonTable = m_uiSession.createJsonAdapter(table, null);
    ITableRow row0 = table.getRow(0);
    ITableRow row1 = table.getRow(1);
    ITableRow row2 = table.getRow(2);
    jsonTable.toJson();
    assertNotNull(jsonTable.tableRowIdsMap().get(row0));
    assertNotNull(jsonTable.tableRowIdsMap().get(row1));
    assertNotNull(jsonTable.tableRowIdsMap().get(row2));
    ITableRowFilter filter = new ITableRowFilter() {

        @Override
        public boolean accept(ITableRow r) {
            // hide first row
            return r.getRowIndex() > 0;
        }
    };
    table.addRowFilter(filter);
    assertEquals(2, table.getFilteredRowCount());
    // Remove the just added filter -> Must not create any request
    table.removeRowFilter(filter);
    assertEquals(3, table.getFilteredRowCount());
    JsonTestUtility.processBufferedEvents(m_uiSession);
    assertNotNull(jsonTable.tableRowIdsMap().get(row1));
    assertNotNull(jsonTable.tableRowIdsMap().get(row1));
    assertNotNull(jsonTable.tableRowIdsMap().get(row2));
    assertEquals(0, m_uiSession.currentJsonResponse().getEventList().size());
}
Also used : ITableRowFilter(org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter) TableWith3Cols(org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 37 with ITable

use of org.eclipse.scout.rt.client.ui.basic.table.ITable in project scout.rt by eclipse.

the class JsonOutline method putDetailFormAndTable.

protected void putDetailFormAndTable(JSONObject json, IPage page) {
    putProperty(json, PROP_DETAIL_FORM_VISIBLE, page.isDetailFormVisible());
    if (page.isDetailFormVisible() && hasDetailForm(page)) {
        putAdapterIdProperty(json, PROP_DETAIL_FORM, page.getDetailForm());
    }
    putProperty(json, PROP_DETAIL_TABLE_VISIBLE, page.isTableVisible());
    if (page.isTableVisible()) {
        ITable table = page.getTable(false);
        if (table != null) {
            putAdapterIdProperty(json, PROP_DETAIL_TABLE, table);
        }
    }
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 38 with ITable

use of org.eclipse.scout.rt.client.ui.basic.table.ITable in project scout.rt by eclipse.

the class BookmarkUtility method bmLoadNodePage.

private static IPage<?> bmLoadNodePage(IPageWithNodes nodePage, NodePageState nodePageState, AbstractPageState childState, boolean resetViewAndWarnOnFail) {
    IPage<?> childPage = null;
    if (childState != null) {
        nodePage.ensureChildrenLoaded();
        IPage<?> p = BookmarkUtility.resolvePage(nodePage.getChildPages(), childState.getPageClassName(), childState.getBookmarkIdentifier());
        if (p != null) {
            ITable table = nodePage.getTable();
            // reset table column filter if requested
            if (resetViewAndWarnOnFail && !p.isFilterAccepted() && table.getUserFilterManager() != null) {
                table.getUserFilterManager().reset();
            }
            // check table column filter
            if (p.isFilterAccepted()) {
                childPage = p;
            }
        }
        // set appropriate warning if child page is not available or filtered out
        if (childPage == null && resetViewAndWarnOnFail) {
            nodePage.setTableStatus(new Status(TEXTS.get("BookmarkResolutionCanceled"), IStatus.ERROR));
        }
    }
    return childPage;
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 39 with ITable

use of org.eclipse.scout.rt.client.ui.basic.table.ITable in project scout.rt by eclipse.

the class AbstractMemoryPolicy method pageTableCreated.

@Override
public void pageTableCreated(IPage<?> p) {
    if (p instanceof IPageWithTable) {
        IPageWithTable<? extends ITable> pt = (IPageWithTable<?>) p;
        ITable table = pt.getTable(false);
        if (table != null) {
            String pageTableIdentifier = registerPageTable(pt, table);
            if (pageTableIdentifier != null) {
                loadUserFilterState(table, pageTableIdentifier);
            }
        }
    }
}
Also used : IPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 40 with ITable

use of org.eclipse.scout.rt.client.ui.basic.table.ITable in project scout.rt by eclipse.

the class OutlineMediator method mediateTreeNodeDropAction.

public void mediateTreeNodeDropAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
    ITableRow row = pageWithTable.getTableRowFor(e.getNode());
    ITable table = pageWithTable.getTable();
    if (row != null) {
        table.getUIFacade().fireRowDropActionFromUI(row, e.getDropObject());
    }
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Aggregations

ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)89 Test (org.junit.Test)64 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)45 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)28 JSONObject (org.json.JSONObject)23 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)16 JSONArray (org.json.JSONArray)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)10 ArrayList (java.util.ArrayList)9 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)8 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)6 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)6 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)4 IPageWithTable (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable)4 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)4 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)4