Search in sources :

Example 1 with IBooleanColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn in project scout.rt by eclipse.

the class AbstractTable method interceptRowClickSingleObserver.

protected void interceptRowClickSingleObserver(ITableRow row, MouseButton mouseButton) {
    // Only toggle checked state if the table and row are enabled.
    if (!row.isEnabled() || !isEnabled()) {
        return;
    }
    // Only toggle checked state if being fired by the left mousebutton (https://bugs.eclipse.org/bugs/show_bug.cgi?id=453543).
    if (mouseButton != MouseButton.Left) {
        return;
    }
    IColumn<?> ctxCol = getContextColumn();
    if (isCellEditable(row, ctxCol)) {
        // cell-level checkbox
        if (ctxCol instanceof IBooleanColumn) {
            // editable boolean columns consume this click
            IFormField field = ctxCol.prepareEdit(row);
            if (field instanceof IBooleanField) {
                IBooleanField bfield = (IBooleanField) field;
                bfield.toggleValue();
                ctxCol.completeEdit(row, field);
            }
        } else {
        // other editable columns have no effect HERE, the ui will open an editor
        }
    }
}
Also used : IBooleanColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn) IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) IBooleanField(org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField)

Aggregations

IBooleanColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IBooleanColumn)1 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)1 IBooleanField (org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField)1