Search in sources :

Example 1 with ColumnProperty

use of org.csstudio.display.builder.model.widgets.TableWidget.ColumnProperty in project org.csstudio.display.builder by kasemir.

the class TableRepresentation method updateChanges.

@Override
public void updateChanges() {
    super.updateChanges();
    if (dirty_style.checkAndClear()) {
        jfx_node.setPrefSize(model_widget.propWidth().getValue(), model_widget.propHeight().getValue());
        jfx_node.setBackgroundColor(JFXUtil.convert(model_widget.propBackgroundColor().getValue()));
        jfx_node.setTextColor(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
        jfx_node.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
        jfx_node.showToolbar(model_widget.propToolbar().getValue());
        jfx_node.setRowSelectionMode(model_widget.propRowSelectionMode().getValue());
    }
    if (dirty_columns.checkAndClear()) {
        jfx_node.setHeaders(headers);
        final List<ColumnProperty> columns = model_widget.propColumns().getValue();
        final int num = Math.min(headers.size(), columns.size());
        for (int col = 0; col < num; ++col) {
            final ColumnProperty column = columns.get(col);
            jfx_node.setColumnWidth(col, column.width().getValue());
            jfx_node.setColumnEditable(col, column.editable().getValue());
            final List<WidgetProperty<String>> options_value = column.options().getValue();
            if (options_value.isEmpty()) {
                // See https://github.com/kasemir/org.csstudio.display.builder/issues/245
                jfx_node.setColumnOptions(col, null);
            } else {
                final List<String> options = new ArrayList<>();
                for (WidgetProperty<String> option : options_value) options.add(option.getValue());
                jfx_node.setColumnOptions(col, options);
            }
        }
    }
    if (dirty_data.checkAndClear())
        jfx_node.setData(data);
    if (dirty_cell_colors.checkAndClear())
        jfx_node.setCellColors(cell_colors);
}
Also used : WidgetProperty(org.csstudio.display.builder.model.WidgetProperty) ColumnProperty(org.csstudio.display.builder.model.widgets.TableWidget.ColumnProperty) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 WidgetProperty (org.csstudio.display.builder.model.WidgetProperty)1 ColumnProperty (org.csstudio.display.builder.model.widgets.TableWidget.ColumnProperty)1