Search in sources :

Example 1 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractTreeNodeBuilder method createTreeNode.

public ITreeNode createTreeNode(ILookupRow<LOOKUP_ROW_TYPE> lookupRow, int nodeStatus, boolean markChildrenLoaded) {
    ITreeNode treeNode = createEmptyTreeNode();
    // fill values to treeNode
    treeNode.setPrimaryKey(lookupRow.getKey());
    treeNode.setEnabled(lookupRow.isEnabled(), IDimensions.ENABLED);
    treeNode.setStatusInternal(nodeStatus);
    if (markChildrenLoaded) {
        treeNode.setChildrenLoaded(markChildrenLoaded);
    }
    Cell cell = treeNode.getCellForUpdate();
    cell.setValue(lookupRow);
    cell.setText(lookupRow.getText());
    cell.setTooltipText(lookupRow.getTooltipText());
    if (cell.getIconId() == null) {
        cell.setIconId(lookupRow.getIconId());
    }
    cell.setCssClass(lookupRow.getCssClass());
    cell.setBackgroundColor(lookupRow.getBackgroundColor());
    cell.setForegroundColor(lookupRow.getForegroundColor());
    cell.setFont(lookupRow.getFont());
    // hint for inactive codes
    if (!lookupRow.isActive()) {
        if (cell.getFont() == null) {
            cell.setFont(FontSpec.parse("italic"));
        }
        cell.setText(lookupRow.getText() + " (" + TEXTS.get("InactiveState") + ")");
    }
    return treeNode;
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell)

Example 2 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractTable method addCellObserver.

/**
 * Add InternalTableRow as an observer to the cell in order to update the row status on changes
 */
private void addCellObserver(List<InternalTableRow> rows) {
    for (InternalTableRow row : rows) {
        for (int i = 0; i < row.getCellCount(); i++) {
            Cell cell = row.getCellForUpdate(i);
            cell.setObserver(row);
        }
    }
}
Also used : InternalTableRow(org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow) Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 3 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractTableRowBuilder method createTableRow.

public ITableRow createTableRow(ILookupRow<T> dataRow) {
    ITableRow tableRow = createEmptyTableRow();
    tableRow.setEnabled(dataRow.isEnabled());
    Cell cell = tableRow.getCellForUpdate(1);
    if (dataRow.getTooltipText() != null) {
        cell.setTooltipText(dataRow.getTooltipText());
    }
    if (dataRow.getIconId() != null) {
        cell.setIconId(dataRow.getIconId());
    }
    if (dataRow.getBackgroundColor() != null) {
        cell.setBackgroundColor(dataRow.getBackgroundColor());
    }
    if (dataRow.getForegroundColor() != null) {
        cell.setForegroundColor(dataRow.getForegroundColor());
    }
    if (dataRow.getFont() != null) {
        cell.setFont(dataRow.getFont());
    }
    tableRow.setStatusNonchanged();
    return tableRow;
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell)

Example 4 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractColumn method initCell.

/**
 * Initialize cell with column defaults.
 */
@Override
public void initCell(ITableRow row) {
    Cell cell = row.getCellForUpdate(this);
    if (getForegroundColor() != null) {
        cell.setForegroundColor(getForegroundColor());
    }
    if (getBackgroundColor() != null) {
        cell.setBackgroundColor(getBackgroundColor());
    }
    if (getFont() != null) {
        cell.setFont(getFont());
    }
    if (getCssClass() != null) {
        cell.setCssClass(getCssClass());
    }
    cell.setHorizontalAlignment(getHorizontalAlignment());
    cell.setEditable(isEditable());
    cell.setHtmlEnabled(isHtmlEnabled());
    cell.setMandatory(isMandatory());
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) IHeaderCell(org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell) HeaderCell(org.eclipse.scout.rt.client.ui.basic.table.HeaderCell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 5 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractContentAssistColumn method applyLookupResult.

protected void applyLookupResult(ITableRow tableRow, List<? extends ILookupRow<?>> result) {
    // disable row changed trigger on row
    try {
        tableRow.setRowChanging(true);
        // 
        Cell cell = tableRow.getCellForUpdate(this);
        String separator = getResultRowSeparator();
        List<String> texts = CollectionUtility.emptyArrayList();
        List<String> tooltipTexts = CollectionUtility.emptyArrayList();
        for (ILookupRow<?> row : result) {
            texts.add(row.getText());
            tooltipTexts.add(row.getTooltipText());
        }
        cell.setText(StringUtility.join(separator, texts));
        cell.setTooltipText(StringUtility.join(separator, tooltipTexts));
    } finally {
        tableRow.setRowPropertiesChanged(false);
        tableRow.setRowChanging(false);
    }
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell)

Aggregations

Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)27 Test (org.junit.Test)10 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)9 HeaderCell (org.eclipse.scout.rt.client.ui.basic.table.HeaderCell)5 IHeaderCell (org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell)5 DecimalFormat (java.text.DecimalFormat)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IValidateContentDescriptor (org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor)4 Locale (java.util.Locale)3 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 NonMandatoryTestColumn (org.eclipse.scout.rt.client.ui.basic.table.ColumnMandatoryTest.MandatoryTestTable.NonMandatoryTestColumn)1 ITableRowCustomValueContributor (org.eclipse.scout.rt.client.ui.basic.table.ITableRowCustomValueContributor)1 InternalTableRow (org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow)1 IValueField (org.eclipse.scout.rt.client.ui.form.fields.IValueField)1 ValidationFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus)1 NumberFormatProvider (org.eclipse.scout.rt.platform.util.NumberFormatProvider)1