use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class OutlineMediator method mediateTreeNodeAction.
public void mediateTreeNodeAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
if (e.isConsumed()) {
return;
}
ITableRow row = pageWithTable.getTableRowFor(e.getNode());
ITable table = pageWithTable.getTable();
if (row != null) {
e.consume();
/*
* ticket 78684: this line added
*/
table.getUIFacade().setSelectedRowsFromUI(CollectionUtility.arrayList(row));
table.getUIFacade().fireRowActionFromUI(row);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class OutlineMediator method mediateTreeNodesDragRequest.
public void mediateTreeNodesDragRequest(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
List<ITableRow> rows = pageWithTable.getTableRowsFor(e.getNodes());
ITable table = pageWithTable.getTable();
table.getUIFacade().setSelectedRowsFromUI(rows);
TransferObject t = table.getUIFacade().fireRowsDragRequestFromUI();
if (t != null) {
e.setDragObject(t);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractPageWithTable method loadChildrenImpl.
/**
* load tree children<br>
* this method delegates to the table reload<br>
* when the table is loaded and this node is not a leaf node then the table rows are mirrored in child nodes
*/
@Override
protected final void loadChildrenImpl() {
ITree tree = getTree();
try {
if (tree != null) {
tree.setTreeChanging(true);
}
//
// backup currently selected tree node and its path to root
boolean oldSelectionOwned = false;
int oldSelectionDirectChildIndex = -1;
ITreeNode oldSelectedNode = null;
if (tree != null) {
oldSelectedNode = tree.getSelectedNode();
}
List<Object> oldSelectedRowKeys = null;
if (oldSelectedNode != null) {
ITreeNode t = oldSelectedNode;
while (t != null && t.getParentNode() != null) {
if (t.getParentNode() == this) {
oldSelectionOwned = true;
oldSelectedRowKeys = getTableRowFor(t).getKeyValues();
oldSelectionDirectChildIndex = t.getChildNodeIndex();
break;
}
t = t.getParentNode();
}
}
//
setChildrenLoaded(false);
fireBeforeDataLoaded();
try {
loadTableDataImpl();
} catch (ThreadInterruptedError | FutureCancelledError e) {
// NOSONAR
// NOOP
} finally {
fireAfterDataLoaded();
}
setChildrenLoaded(true);
setChildrenDirty(false);
// table events will handle automatic tree changes in case table is mirrored in tree.
// restore currently selected tree node when it was owned by our table rows.
// in case selection was lost, try to select similar index as before
T table = getTable();
if (tree != null && table != null && oldSelectionOwned && tree.getSelectedNode() == null) {
ITreeNode newSelectedNode = null;
ITableRow row = table.getSelectedRow();
if (row != null) {
newSelectedNode = getTreeNodeFor(row);
} else {
row = table.findRowByKey(oldSelectedRowKeys);
if (row != null) {
newSelectedNode = getTreeNodeFor(row);
} else if (oldSelectedNode != null && oldSelectedNode.getTree() == tree) {
// NOSONAR
newSelectedNode = oldSelectedNode;
} else {
int index = Math.max(-1, Math.min(oldSelectionDirectChildIndex, getChildNodeCount() - 1));
if (index >= 0 && index < getChildNodeCount()) {
newSelectedNode = getChildNode(index);
} else {
newSelectedNode = this;
}
}
}
if (newSelectedNode != null) {
tree.selectNode(newSelectedNode);
}
}
} finally {
if (tree != null) {
tree.setTreeChanging(false);
}
}
IDesktop desktop = ClientSessionProvider.currentSession().getDesktop();
if (desktop != null) {
desktop.afterTablePageLoaded(this);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractPageWithTable method getChildPagesFor.
/**
* Computes the list of linked child pages for the given table rows. Revalidates the the pages cell if
* <code>updateChildPageCells</code> is true. Otherwise, the cells are not updated.
*/
private List<IPage<?>> getChildPagesFor(List<? extends ITableRow> tableRows, boolean updateChildPageCells) {
List<IPage<?>> result = new ArrayList<IPage<?>>();
try {
for (ITableRow row : tableRows) {
IPage<?> page = getPageFor(row);
if (page != null) {
result.add(page);
if (updateChildPageCells) {
// update tree nodes from table rows
page.setEnabled(row.isEnabled(), IDimensions.ENABLED);
T table = getTable();
if (table != null) {
ICell tableCell = table.getSummaryCell(row);
page.getCellForUpdate().updateFrom(tableCell);
}
}
}
}
} catch (RuntimeException | PlatformError e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
return result;
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractColumn method getNotDeletedValues.
@Override
public List<VALUE> getNotDeletedValues() {
List<ITableRow> notDeletedRows = m_table.getNotDeletedRows();
List<VALUE> values = new ArrayList<VALUE>(notDeletedRows.size());
for (ITableRow row : notDeletedRows) {
values.add(getValue(row));
}
return values;
}
Aggregations