Package org.gephi.data.attributes.api

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


        FileOutputStream out = new FileOutputStream(file);
        if (separator == null) {
            separator = DEFAULT_SEPARATOR;
        }

        AttributeColumn columns[] = table.getColumns();

        if (columnsToExport == null) {
            columnsToExport = new Integer[columns.length];
            for (int i = 0; i < columnsToExport.length; i++) {
                columnsToExport[i] = columns[i].getIndex();
View Full Code Here


        return model;
    }

    public synchronized void mergeTable(AttributeTable table) {
        for (AttributeColumn column : table.getColumns()) {
            AttributeColumn existingCol = getColumn(column);
            if (existingCol == null) {
                existingCol = getColumn(column.getTitle());
            }
            if (existingCol == null) {
                addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
            } else if (column.getType().isDynamicType() && TypeConvertor.getStaticType(column.getType()).equals(existingCol.getType())) {
                //The column exists but has the underlying static type
                //Change type
                AttributeColumnImpl newCol = new AttributeColumnImpl(this, existingCol.getIndex(), existingCol.getId(), existingCol.getTitle(), column.getType(), existingCol.getOrigin(), column.getDefaultValue(), null);
                replaceColumn(existingCol, newCol);
            }
        }
    }
View Full Code Here

            setValue(attValues[i]);
        }
    }

    public void setValue(int index, Object value) {
        AttributeColumn column = attributeTable.getColumn(index);
        if (column != null) {
            setValue(column, value);
        } else {
            throw new IllegalArgumentException("The column doesn't exist");
        }
View Full Code Here

    public void setValue(String column, Object value) {
        if (column == null) {
            throw new NullPointerException("Column is null");
        }
        AttributeColumn attributeColumn = attributeTable.getColumn(column);
        if (attributeColumn != null) {
            setValue(attributeColumn, value);
        } else {
            //add column
            AttributeType type = AttributeType.parse(value);
View Full Code Here

        AttributeValue attValue = attributeTable.getFactory().newValue(column, value);
        setValue(attValue);
    }

    public void setValue(AttributeValue value) {
        AttributeColumn column = value.getColumn();
        if (attributeTable.getColumn(column.getIndex()) != column) {
            column = attributeTable.getColumn(column);
            if (column == null) {
                throw new IllegalArgumentException("The " + attributeTable.getName() + " value column " + value.getColumn().getId() + " with index " + value.getColumn().getIndex() + " doesn't exist");
            }
            value = attributeTable.getFactory().newValue(column, value.getValue());
        }

        setValue(column.getIndex(), (AttributeValueImpl) value, true);
    }
View Full Code Here

            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 REPLACE_COLUMN:
                        AttributeColumn[] replacedColumns = event.getData().getRemovedColumns();
                        for (int i = 0; i < replacedColumns.length; i++) {
                            AttributeColumn removedCol = replacedColumns[i];
                            if (removedCol.getType().isDynamicType() && attUtils.isNodeColumn(removedCol)) {
                                nodeDynamicColumns.remove(removedCol);
                            } else if (removedCol.getType().isDynamicType() && attUtils.isEdgeColumn(removedCol)) {
                                edgeDynamicColumns.remove(removedCol);
                            }

                            AttributeTable table = event.getSource();
                            AttributeColumn addedCol = table.getColumn(removedCol.getIndex());
                            if (addedCol.getType().isDynamicType() && attUtils.isNodeColumn(addedCol)) {
                                nodeDynamicColumns.add(addedCol);
                            } else if (addedCol.getType().isDynamicType() && attUtils.isEdgeColumn(addedCol)) {
                                edgeDynamicColumns.add(addedCol);
                            }
                        }
                        break;
                    case SET_VALUE:
                    case UNSET_VALUE:
                        AttributeValue[] values = event.getData().getTouchedValues();
                        for (int i = 0; i < values.length; i++) {
                            AttributeValue val = values[i];
                            if (val.getValue() != null) {
                                AttributeColumn col = values[i].getColumn();
                                if (col.getType().isDynamicType()) {
                                    DynamicType<?> dynamicType = (DynamicType) val.getValue();
                                    if (dynamicType != null) {
                                        for (Interval interval : dynamicType.getIntervals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
                                            if (event.getEventType() == AttributeEvent.EventType.UNSET_VALUE) {
                                                timeIntervalIndex.remove(interval);
View Full Code Here

    }

    public boolean canReplace(SearchResult result) {
        AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
        AttributeTable table;
        AttributeColumn column;
        if (result.getFoundNode() != null) {
            table = ac.getModel().getNodeTable();
            column = table.getColumn(result.getFoundColumnIndex());
        } else {
            table = ac.getModel().getEdgeTable();
View Full Code Here

        }
        AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
        Object value;
        String str;
        Attributes attributes;
        AttributeColumn column;

        if (!result.getSearchOptions().isUseRegexReplaceMode()) {
            replacement = Matcher.quoteReplacement(replacement);//Avoid using groups and other regex aspects in the replacement
        }
View Full Code Here

            container.addNode(gephiNode);
            report.log(NbBundle.getMessage(GraphDbImporter.class, "Report_NodeAdded",
                    vertexId.toString()));           
            for (final String propertyKey : vertex.getPropertyKeys()) {
                final Object propertyValue = vertex.getProperty(propertyKey);
                AttributeColumn attributeColumn;
                if (attributeModel.getNodeTable().hasColumn(propertyKey)) {
                    attributeColumn = attributeModel.getNodeTable().getColumn(propertyKey);
                } else {
                    final AttributeType attributeType = AttributeTypeMapper.map(propertyValue);
                    attributeColumn = attributeModel.getNodeTable().addColumn(propertyKey, attributeType);
View Full Code Here

                gephiEdge.setSource(startNode);
                gephiEdge.setTarget(endNode);
                container.addEdge(gephiEdge);
                for (final String propertyKey : edge.getPropertyKeys()) {
                    final Object propertyValue = edge.getProperty(propertyKey);
                    AttributeColumn attributeColumn;
                    if (attributeModel.getEdgeTable().hasColumn(propertyKey)) {
                        attributeColumn = attributeModel.getEdgeTable().getColumn(propertyKey);
                    } else {
                        final AttributeType attributeType = AttributeTypeMapper.map(propertyValue);
                        attributeColumn = attributeModel.getEdgeTable().addColumn(propertyKey, attributeType);
View Full Code Here

TOP

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

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.