Search in sources :

Example 71 with ITableRow

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

the class AbstractColumn method getDeletedValues.

@Override
public List<VALUE> getDeletedValues() {
    List<ITableRow> deletedRows = m_table.getDeletedRows();
    List<VALUE> values = new ArrayList<VALUE>(deletedRows.size());
    for (ITableRow row : deletedRows) {
        values.add(getValue(row));
    }
    return values;
}
Also used : ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 72 with ITableRow

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

the class OrganizeColumnsForm method createColumnsTableRows.

protected List<ITableRow> createColumnsTableRows(Table columnsTable) {
    List<ITableRow> rowList = new ArrayList<ITableRow>();
    for (IColumn<?> col : m_organizedTable.getColumnSet().getAllColumnsInUserOrder()) {
        if (acceptColumnForColumnsTable(col)) {
            IHeaderCell headerCell = col.getHeaderCell();
            TableRow row = new TableRow(columnsTable.getColumnSet());
            // Key
            columnsTable.getKeyColumn().setValue(row, col);
            // Column Title
            String columnTitle = headerCell.getText();
            if (StringUtility.isNullOrEmpty(columnTitle)) {
                columnTitle = headerCell.getTooltipText();
                row.setFont(FontSpec.parse("ITALIC"));
            }
            columnsTable.getTitleColumn().setValue(row, columnTitle);
            // grouping and sorting
            StringBuilder sb = new StringBuilder();
            if (col.isSortActive()) {
                sb.append(col.isSortAscending() ? "\u2191" : "\u2193");
                sb.append(col.getSortIndex() + 1);
            }
            if (col.isGroupingActive()) {
                sb.append(TEXTS.get("GroupingAbbreviation"));
            }
            columnsTable.getGroupAndSortColumn().setValue(row, sb.toString());
            // CustomColumn
            if (col instanceof ICustomColumn<?>) {
                columnsTable.getCustomColumnColumn().setValue(row, TEXTS.get("CustomColumAbbreviation"));
            }
            // filter
            if (col.isColumnFilterActive()) {
                columnsTable.getFilterColumn().setValue(row, TEXTS.get("FilterAbbreviation"));
            }
            // width
            columnsTable.getWidthColumn().setValue(row, col.getWidth());
            rowList.add(row);
        }
    }
    return rowList;
}
Also used : IHeaderCell(org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) TableRow(org.eclipse.scout.rt.client.ui.basic.table.TableRow) ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ICustomColumn(org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn)

Example 73 with ITableRow

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

the class OrganizeColumnsForm method enableDisableMenus.

public void enableDisableMenus() {
    boolean addEnabled = false, modifyEnabled = false, removeEnabled = false, removeFilterEnabled = false;
    Table columnsTable = getColumnsTableField().getTable();
    List<ITableRow> selectedRows = columnsTable.getSelectedRows();
    addEnabled = isColumnAddable();
    for (ITableRow row : selectedRows) {
        IColumn<?> selectedColumn = columnsTable.getKeyColumn().getValue(row);
        if (isColumnRemovable(selectedColumn)) {
            removeEnabled = true;
        }
        if (isColumnModifiable(selectedColumn)) {
            modifyEnabled = true;
        }
        if (selectedColumn.isColumnFilterActive()) {
            removeFilterEnabled = true;
        }
    }
    setEnabledAndVisible(columnsTable, AddColumnMenu.class, addEnabled);
    setEnabledAndVisible(columnsTable, AddColumnEmptySpaceMenu.class, addEnabled && columnsTable.getSelectedRows().size() == 0);
    setEnabledAndVisible(columnsTable, ModifyCustomColumnMenu.class, modifyEnabled);
    setEnabledAndVisible(columnsTable, RemoveMenu.class, removeEnabled);
    setEnabledAndVisible(columnsTable, RemoveFilterMenu.class, removeFilterEnabled);
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) Table(org.eclipse.scout.rt.client.ui.basic.table.organizer.OrganizeColumnsForm.MainBox.GroupBox.ColumnsGroupBox.ColumnsTableField.Table) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 74 with ITableRow

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

the class AbstractColumn method getSelectedValues.

@Override
public List<VALUE> getSelectedValues() {
    List<ITableRow> selectedRows = m_table.getSelectedRows();
    List<VALUE> values = new ArrayList<VALUE>(selectedRows.size());
    for (ITableRow row : selectedRows) {
        values.add(getValue(row));
    }
    return values;
}
Also used : ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 75 with ITableRow

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

the class AbstractColumn method refreshValues.

/**
 * Refresh all column values to trigger re-validate and re-format
 */
public void refreshValues() {
    if (isInitialized() && getTable() != null) {
        List<ITableRow> rows = getTable().getRows();
        for (ITableRow row : rows) {
            setValue(row, getValue(row));
        }
        updateDisplayTexts();
        decorateCells();
    }
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)127 Test (org.junit.Test)77 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)47 ArrayList (java.util.ArrayList)23 JSONObject (org.json.JSONObject)22 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)16 JSONArray (org.json.JSONArray)13 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)7 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)7 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)6 IMixedSmartField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IMixedSmartField)5 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 DecimalFormat (java.text.DecimalFormat)4 List (java.util.List)4 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)4 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)4 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4