use of org.eclipse.scout.rt.platform.annotations.ConfigOperation in project scout.rt by eclipse.
the class AbstractTable method execCopy.
/**
* Called by a <code>CTRL-C</code> event on the table to copy the given rows into the clipboard.
* <p>
* Subclasses can override this method. The default creates a {@link TextTransferObject} of the table content (HTML
* table).
*
* @param rows
* The selected table rows to copy.
* @return A transferable object representing the given rows or null to not populate the clipboard.
*/
@ConfigOperation
@Order(30)
protected TransferObject execCopy(List<? extends ITableRow> rows) {
if (!CollectionUtility.hasElements(rows)) {
return null;
}
StringBuilder plainText = new StringBuilder();
List<IColumn<?>> columns = getColumnSet().getVisibleColumns();
boolean firstRow = true;
for (ITableRow row : rows) {
appendCopyTextForRow(plainText, row, firstRow, columns);
firstRow = false;
}
TextTransferObject transferObject = new TextTransferObject(plainText.toString());
return transferObject;
}
use of org.eclipse.scout.rt.platform.annotations.ConfigOperation in project scout.rt by eclipse.
the class AbstractColumn method execPrepareEdit.
/**
* Prepares the editing of a cell in the table.
* <p>
* Cell editing is canceled (normally by typing escape) or saved (normally by clicking another cell, typing enter).
* <p>
* When saved, the method {@link #completeEdit(ITableRow, IFormField)} /
* {@link #interceptCompleteEdit(ITableRow, IFormField)} is called on this column.
* <p>
* Subclasses can override this method. The default returns an appropriate field based on the column data type.
* <p>
* The mapping from the cell value to the field value is achieved using {@link #cellToEditField(Object, String,
* IMultiStatus, IFormField))}
*
* @param row
* on which editing occurs
* @return a field for editing.
*/
@ConfigOperation
@Order(61)
protected IFormField execPrepareEdit(ITableRow row) {
IFormField f = prepareEditInternal(row);
if (f != null) {
f.setLabelVisible(false);
cellValueToEditor(row, f);
f.markSaved();
}
return f;
}
use of org.eclipse.scout.rt.platform.annotations.ConfigOperation in project scout.rt by eclipse.
the class AbstractPlanner method execDisplayModeChanged.
@ConfigOperation
@Order(30)
protected void execDisplayModeChanged(int displayMode) {
Calendar from = Calendar.getInstance();
Calendar to = Calendar.getInstance();
if (getViewRange() != null && getViewRange().getFrom() != null) {
from.setTime(getViewRange().getFrom());
to.setTime(getViewRange().getFrom());
}
DateUtility.truncCalendar(from);
DateUtility.truncCalendar(to);
switch(displayMode) {
case IPlannerDisplayMode.DAY:
to.add(Calendar.DAY_OF_WEEK, 1);
break;
case IPlannerDisplayMode.WEEK:
from.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.add(Calendar.DAY_OF_WEEK, 7);
break;
case IPlannerDisplayMode.WORK_WEEK:
from.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.add(Calendar.DAY_OF_WEEK, 5);
break;
case IPlannerDisplayMode.MONTH:
from.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.add(Calendar.MONTH, 2);
break;
case IPlannerDisplayMode.CALENDAR_WEEK:
from.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
to.add(Calendar.MONTH, 9);
break;
case IPlannerDisplayMode.YEAR:
to.add(Calendar.YEAR, 2);
break;
}
setViewRange(from.getTime(), to.getTime());
}
use of org.eclipse.scout.rt.platform.annotations.ConfigOperation in project scout.rt by eclipse.
the class AbstractPage method execComputeParentTablePageMenus.
/**
* The default implementation returns the single selection menus from the parent table page's table.
* <p>
* If this behavior is not desired return an empty list or filter the menus for your needs instead.
*
* @param parentTablePage
* Parent table page
* @return A list (non-null) of single selection menus.
*/
@Order(150)
@ConfigOperation
protected List<IMenu> execComputeParentTablePageMenus(IPageWithTable<?> parentTablePage) {
ITableRow row = parentTablePage.getTableRowFor(this);
if (row == null) {
return CollectionUtility.emptyArrayList();
}
ITable table = parentTablePage.getTable();
table.getUIFacade().setSelectedRowsFromUI(CollectionUtility.arrayList(row));
return ActionUtility.getActions(table.getContextMenu().getChildActions(), ActionUtility.createMenuFilterMenuTypes(CollectionUtility.hashSet(TableMenuType.SingleSelection), false));
}
use of org.eclipse.scout.rt.platform.annotations.ConfigOperation in project scout.rt by eclipse.
the class AbstractPage method execDataChanged.
/**
* Called by the data change listener registered with this page (and the current desktop) through
* {@link #registerDataChangeListener(Object...)}. Use this callback method to react to data change events by
* reloading current data, or throwing away cached data etc.
* <p>
* Subclasses can override this method.<br/>
* This default implementation does the following:
* <ol>
* <li>if this page is an ancestor of the selected page (or is selected itself) and this page is in the active
* outline, a full re-load of the page is performed
* <li>else the children of this page are marked dirty and the page itself is unloaded
* </ol>
*
* @see IDesktop#dataChanged(Object...)
*/
@ConfigOperation
@Order(55)
protected void execDataChanged(Object... dataTypes) {
if (getTree() == null) {
return;
}
//
HashSet<ITreeNode> pathsToSelections = new HashSet<ITreeNode>();
for (ITreeNode node : getTree().getSelectedNodes()) {
ITreeNode tmp = node;
while (tmp != null) {
pathsToSelections.add(tmp);
tmp = tmp.getParentNode();
}
}
IDesktop desktop = ClientSessionProvider.currentSession().getDesktop();
final boolean isActiveOutline = (desktop != null ? desktop.getOutline() == this.getOutline() : false);
final boolean isRootNode = pathsToSelections.isEmpty() && getTree() != null && getTree().getRootNode() == this;
if (isActiveOutline && (pathsToSelections.contains(this) || isRootNode)) {
try {
// TODO [7.0] fko: maybe remove when bookmarks can be done on outline level? (currently only pages)
if (isRootNode) {
this.reloadPage();
} else /*
* Ticket 77332 (deleting a node in the tree) also requires a reload So
* the selected and its ancestor nodes require same processing
*/
if (desktop != null) {
// NOSONAR
Bookmark bm = desktop.createBookmark();
setChildrenDirty(true);
// activate bookmark without activating the outline, since this would hide active tabs.
desktop.activateBookmark(bm, false);
}
} catch (RuntimeException | PlatformError e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
} else {
// not active outline OR not on selection path
setChildrenDirty(true);
if (isExpanded()) {
setExpanded(false);
}
try {
if (isChildrenLoaded()) {
getTree().unloadNode(this);
}
} catch (RuntimeException | PlatformError e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
}
}
Aggregations