Search in sources :

Example 1 with AttributeDataColumn

use of org.gephi.desktop.datalab.tables.columns.AttributeDataColumn in project gephi by gephi.

the class AbstractElementsDataTable method refreshModel.

public void refreshModel(T[] elements, Column[] cols, GraphModel graphModel, DataTablesModel dataTablesModel) {
    this.graphModel = graphModel;
    showingColumns = cols;
    Interval timeBounds = graphModel.getTimeBounds();
    double min = timeBounds != null ? timeBounds.getLow() : 0;
    double max = timeBounds != null ? timeBounds.getHigh() : 0;
    refreshCellRenderersConfiguration(graphModel, min, max);
    refreshingTable = true;
    if (selectedElements == null) {
        selectedElements = getElementsFromSelectedRows();
    }
    ArrayList<ElementDataColumn<T>> columns = new ArrayList<>();
    columns.addAll(getFakeDataColumns(graphModel, dataTablesModel));
    for (Column c : cols) {
        columns.add(new AttributeDataColumn<T>(attributeColumnsController, c));
    }
    if (model == null) {
        model = new ElementsDataTableModel<>(elements, columns.toArray(new ElementDataColumn[0]));
        table.setModel(model);
    } else {
        model.configure(elements, columns.toArray(new ElementDataColumn[0]));
    }
    //Keep row selection before refreshing.
    setElementsSelection(selectedElements);
    selectedElements = null;
    refreshingTable = false;
}
Also used : AttributeDataColumn(org.gephi.desktop.datalab.tables.columns.AttributeDataColumn) ElementDataColumn(org.gephi.desktop.datalab.tables.columns.ElementDataColumn) Column(org.gephi.graph.api.Column) ArrayList(java.util.ArrayList) ElementDataColumn(org.gephi.desktop.datalab.tables.columns.ElementDataColumn) Interval(org.gephi.graph.api.Interval)

Aggregations

ArrayList (java.util.ArrayList)1 AttributeDataColumn (org.gephi.desktop.datalab.tables.columns.AttributeDataColumn)1 ElementDataColumn (org.gephi.desktop.datalab.tables.columns.ElementDataColumn)1 Column (org.gephi.graph.api.Column)1 Interval (org.gephi.graph.api.Interval)1