use of org.eclipse.scout.rt.platform.Order in project scout.rt by eclipse.
the class AbstractCode method calculateViewOrder.
/**
* Calculates the column's view order, e.g. if the @Order annotation is set to 30.0, the method will return 30.0. If
* no {@link Order} annotation is set, the method checks its super classes for an @Order annotation.
*
* @since 3.10.0-M4
*/
@SuppressWarnings("squid:S1244")
protected double calculateViewOrder() {
double viewOrder = getConfiguredViewOrder();
Class<?> cls = getClass();
if (viewOrder == IOrdered.DEFAULT_ORDER) {
while (cls != null && ICode.class.isAssignableFrom(cls)) {
if (cls.isAnnotationPresent(Order.class)) {
Order order = (Order) cls.getAnnotation(Order.class);
return order.value();
}
cls = cls.getSuperclass();
}
}
return viewOrder;
}
use of org.eclipse.scout.rt.platform.Order 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.Order 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.Order 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.Order 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));
}
Aggregations