Search in sources :

Example 1 with Order

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;
}
Also used : Order(org.eclipse.scout.rt.platform.Order)

Example 2 with Order

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;
}
Also used : TextTransferObject(org.eclipse.scout.rt.client.ui.dnd.TextTransferObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 3 with Order

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;
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 4 with Order

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());
}
Also used : Calendar(java.util.Calendar) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 5 with Order

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));
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Aggregations

Order (org.eclipse.scout.rt.platform.Order)26 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)20 IDataModelEntity (org.eclipse.scout.rt.shared.data.model.IDataModelEntity)4 EntityNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode)3 LinkedList (java.util.LinkedList)2 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)2 EitherOrNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode)2 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashSet (java.util.HashSet)1 TreeMap (java.util.TreeMap)1 BookmarkServiceEvent (org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceEvent)1 BookmarkServiceListener (org.eclipse.scout.rt.client.services.common.bookmark.BookmarkServiceListener)1 IBookmarkService (org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService)1 FormFieldProvisioningContext (org.eclipse.scout.rt.client.services.lookup.FormFieldProvisioningContext)1 ILookupCallProvisioningService (org.eclipse.scout.rt.client.services.lookup.ILookupCallProvisioningService)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1