Package org.gephi.data.attributes.api

Examples of org.gephi.data.attributes.api.AttributeUtils


    public String getDescription() {
        return NbBundle.getMessage(BooleanLogicOperations.class, "BooleanLogicOperations.description");
    }

    public boolean canExecute() {
        AttributeUtils attributeUtils=AttributeUtils.getDefault();
        return attributeUtils.areAllColumnsOfType(columns, AttributeType.BOOLEAN);
    }
View Full Code Here


        //Visible interval
        visibleTimeInterval = new TimeInterval(timeIntervalIndex.getMin(), timeIntervalIndex.getMax());

        //AttUtils
        final AttributeUtils attUtils = AttributeUtils.getDefault();

        //Listen columns
        AttributeListener attributeListener = new AttributeListener() {

            @Override
            public void attributesChanged(AttributeEvent event) {
                switch (event.getEventType()) {
                    case ADD_COLUMN:
                        AttributeColumn[] addedColumns = event.getData().getAddedColumns();
                        for (int i = 0; i < addedColumns.length; i++) {
                            AttributeColumn col = addedColumns[i];
                            if (col.getType().isDynamicType() && attUtils.isNodeColumn(col)) {
                                nodeDynamicColumns.add(col);
                            } else if (col.getType().isDynamicType() && attUtils.isEdgeColumn(col)) {
                                edgeDynamicColumns.add(col);
                            }
                        }
                        break;
                    case REMOVE_COLUMN:
                        AttributeColumn[] removedColumns = event.getData().getRemovedColumns();
                        for (int i = 0; i < removedColumns.length; i++) {
                            AttributeColumn col = removedColumns[i];
                            if (col.getType().isDynamicType() && attUtils.isNodeColumn(col)) {
                                nodeDynamicColumns.remove(col);
                            } else if (col.getType().isDynamicType() && attUtils.isEdgeColumn(col)) {
                                edgeDynamicColumns.remove(col);
                            }
                        }
                        break;
                    case SET_VALUE:
View Full Code Here

            return null;
        }
    }

    public void negateBooleanColumn(AttributeTable table, AttributeColumn column) {
        AttributeUtils attributeUtils = AttributeUtils.getDefault();
        if (attributeUtils.isColumnOfType(column, AttributeType.BOOLEAN)) {
            negateColumnBooleanType(table, column);
        } else if (attributeUtils.isColumnOfType(column, AttributeType.LIST_BOOLEAN)) {
            negateColumnListBooleanType(table, column);
        } else {
            throw new IllegalArgumentException();
        }
    }
View Full Code Here

    public boolean canDeleteColumn(AttributeColumn column) {
        return column.getOrigin() != AttributeOrigin.PROPERTY;
    }

    public boolean canChangeColumnData(AttributeColumn column) {
        AttributeUtils au = Lookup.getDefault().lookup(AttributeUtils.class);
        if (au.isNodeColumn(column)) {
            return canChangeGenericColumnData(column) && column.getIndex() != PropertiesColumn.NODE_ID.getIndex();
        } else if (au.isEdgeColumn(column)) {
            return canChangeGenericColumnData(column) && column.getIndex() != PropertiesColumn.EDGE_ID.getIndex();
        } else {
            return canChangeGenericColumnData(column);
        }
    }
View Full Code Here

    private Number[] numbers;
    private AttributeColumn column;

    public void setup(AttributeRow row, AttributeColumn column) {
        this.column = column;
        AttributeUtils attributeUtils = AttributeUtils.getDefault();
        if (attributeUtils.isNumberListColumn(column) || attributeUtils.isDynamicNumberColumn(column)) {
            numbers = Lookup.getDefault().lookup(AttributeColumnsController.class).getRowNumbers(row, new AttributeColumn[]{column});
        }
    }
View Full Code Here

            return canChangeGenericColumnData(column);
        }
    }

    public boolean canClearColumnData(AttributeColumn column) {
        AttributeUtils au = Lookup.getDefault().lookup(AttributeUtils.class);
        if (au.isNodeColumn(column)) {
            return canChangeGenericColumnData(column) && column.getIndex() != PropertiesColumn.NODE_ID.getIndex();
        } else if (au.isEdgeColumn(column)) {
            return canChangeGenericColumnData(column) && column.getIndex() != PropertiesColumn.EDGE_ID.getIndex() && column.getIndex() != PropertiesColumn.EDGE_WEIGHT.getIndex();
        } else {
            return canChangeGenericColumnData(column);
        }
    }
View Full Code Here

    public BigDecimal[] getNumberOrNumberListColumnStatistics(AttributeTable table, AttributeColumn column) {
        return StatisticsUtils.getAllStatistics(getColumnNumbers(table, column));
    }

    public Number[] getColumnNumbers(AttributeTable table, AttributeColumn column) {
        AttributeUtils attributeUtils = AttributeUtils.getDefault();
        if (!attributeUtils.isNumberOrNumberListColumn(column)) {
            throw new IllegalArgumentException("The column has to be a number or number list column");
        }

        ArrayList<Number> numbers = new ArrayList<Number>();
        final int columnIndex = column.getIndex();
        Number number;
        if (attributeUtils.isNumberColumn(column)) {//Number column
            for (Attributes row : getTableAttributeRows(table)) {
                number = (Number) row.getValue(columnIndex);
                if (number != null) {
                    numbers.add(number);
                }
View Full Code Here

        return numbers.toArray(new Number[0]);
    }

    public Number[] getRowNumbers(Attributes row, AttributeColumn[] columns) {
        AttributeUtils attributeUtils = AttributeUtils.getDefault();
        checkColumnsAreNumberOrNumberList(columns);

        ArrayList<Number> numbers = new ArrayList<Number>();
        Number number;
        for (AttributeColumn column : columns) {
            if (attributeUtils.isNumberColumn(column)) {//Single number column:
                number = (Number) row.getValue(column.getIndex());
                if (number != null) {
                    numbers.add(number);
                }
            } else if (attributeUtils.isNumberListColumn(column)) {//Number list column:
                numbers.addAll(getNumberListColumnNumbers(row, column));
            } else if (attributeUtils.isDynamicNumberColumn(column)) {//Dynamic number column
                numbers.addAll(getDynamicNumberColumnNumbers(row, column));
            }
        }

        return numbers.toArray(new Number[0]);
View Full Code Here

        return newColumn;
    }

    public AttributeColumn booleanLogicOperationsMerge(AttributeTable table, AttributeColumn[] columnsToMerge, BooleanOperations[] booleanOperations, String newColumnTitle) {
        AttributeUtils attributeUtils = AttributeUtils.getDefault();
        AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
        if (table == null || columnsToMerge == null || !attributeUtils.areAllColumnsOfType(columnsToMerge, AttributeType.BOOLEAN) || booleanOperations == null || booleanOperations.length != columnsToMerge.length - 1) {
            throw new IllegalArgumentException("All columns have to be boolean columns, table, columns or operations can't be null and operations length must be columns length -1");
        }

        AttributeColumn newColumn;
        newColumn = ac.addAttributeColumn(table, newColumnTitle, AttributeType.BOOLEAN);
View Full Code Here

        comboBoxModel.addElement(NO_SELECTION);

        //Get the current attribute columns in the current workspace
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        AttributeModel attributeModel = attributeController.getModel();
        AttributeUtils utils = AttributeUtils.getDefault();
        for (AttributeColumn col : attributeModel.getNodeTable().getColumns()) {
            if (utils.isNumberColumn(col)) {
                comboBoxModel.addElement(col);
            }
        }
        return comboBoxModel;
    }
View Full Code Here

TOP

Related Classes of org.gephi.data.attributes.api.AttributeUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.