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());
}
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);
}
}
}
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;
}
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);
}
}
}
}
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());
}
}
Aggregations