Search in sources :

Example 1 with ICustomColumn

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

the class OrganizeColumnsForm method execRemoveColumnAction.

/**
 * Calls removeColumn() method of table-customizer, if table has a customizer and selected row is a custom column.
 * Override this method if a different behavior is required.
 */
protected void execRemoveColumnAction() {
    if (isCustomizable()) {
        Table columnsTable = getColumnsTableField().getTable();
        for (ITableRow selectedRow : columnsTable.getSelectedRows()) {
            IColumn<?> selectedColumn = columnsTable.getKeyColumn().getValue(selectedRow);
            if (selectedColumn instanceof ICustomColumn) {
                m_organizedTable.getTableCustomizer().removeColumn((ICustomColumn) selectedColumn);
            }
        }
        getColumnsTableField().reloadTableData();
    }
}
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) ICustomColumn(org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn)

Example 2 with ICustomColumn

use of org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn 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)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)2 ICustomColumn (org.eclipse.scout.rt.client.ui.basic.table.customizer.ICustomColumn)2 ArrayList (java.util.ArrayList)1 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)1 IHeaderCell (org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 TableRow (org.eclipse.scout.rt.client.ui.basic.table.TableRow)1 Table (org.eclipse.scout.rt.client.ui.basic.table.organizer.OrganizeColumnsForm.MainBox.GroupBox.ColumnsGroupBox.ColumnsTableField.Table)1