Package org.gephi.data.attributes.api

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


        flushToEdgeAttributes(edgeDraft, edge);
    }

    protected void flushToEdgeAttributes(EdgeDraftGetter edgeDraft, Edge edge) {
        if (edge.getEdgeData().getAttributes() != null) {
            AttributeRow row = (AttributeRow) edge.getEdgeData().getAttributes();
            for (AttributeValue val : edgeDraft.getAttributeRow().getValues()) {
                if (!val.getColumn().getOrigin().equals(AttributeOrigin.PROPERTY) && val.getValue() != null) {
                    row.setValue(val.getColumn(), val.getValue());
                }
            }
        }

        //Dynamic Weight
        AttributeColumn dynamicWeightCol = container.getAttributeModel().getEdgeTable().getColumn(PropertiesColumn.EDGE_WEIGHT.getTitle(), AttributeType.DYNAMIC_FLOAT);
        if (dynamicWeightCol != null) {
            DynamicFloat weight = (DynamicFloat) edgeDraft.getAttributeRow().getValue(dynamicWeightCol.getIndex());
            AttributeRow row = (AttributeRow) edge.getEdgeData().getAttributes();
            if (weight == null) {
                row.setValue(PropertiesColumn.EDGE_WEIGHT.getIndex(), new DynamicFloat(new Interval<Float>(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, edgeDraft.getWeight())));
            } else {
                row.setValue(PropertiesColumn.EDGE_WEIGHT.getIndex(), weight);
            }
        }
    }
View Full Code Here


        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        SearchResult result = null;
        Set<Integer> columnsToSearch = searchOptions.getColumnsToSearch();
        boolean searchAllColumns = columnsToSearch.isEmpty();
        Node[] nodes = searchOptions.getNodesToSearch();
        AttributeRow row;
        Object value;
        for (; rowIndex < nodes.length; rowIndex++) {
            if (!gec.isNodeInGraph(nodes[rowIndex])) {
                continue;//Make sure node is still in graph when continuing a search
            }
            row = (AttributeRow) nodes[rowIndex].getNodeData().getAttributes();
            for (; columnIndex < row.countValues(); columnIndex++) {
                if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
                    value = row.getValue(columnIndex);
                    result = matchRegex(value, searchOptions, rowIndex, columnIndex);
                    if (result != null) {
                        result.setFoundNode(nodes[rowIndex]);
                        return result;
                    }
View Full Code Here

        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        SearchResult result = null;
        Set<Integer> columnsToSearch = searchOptions.getColumnsToSearch();
        boolean searchAllColumns = columnsToSearch.isEmpty();
        Edge[] edges = searchOptions.getEdgesToSearch();
        AttributeRow row;
        Object value;
        for (; rowIndex < edges.length; rowIndex++) {
            if (!gec.isEdgeInGraph(edges[rowIndex])) {
                continue;//Make sure edge is still in graph when continuing a search
            }
            row = (AttributeRow) edges[rowIndex].getEdgeData().getAttributes();
            for (; columnIndex < row.countValues(); columnIndex++) {
                if (searchAllColumns || columnsToSearch.contains(columnIndex)) {
                    value = row.getValue(columnIndex);
                    result = matchRegex(value, searchOptions, rowIndex, columnIndex);
                    if (result != null) {
                        result.setFoundEdge(edges[rowIndex]);
                        return result;
                    }
View Full Code Here

    }

    @Override
    protected void flushToNodeAttributes(NodeDraftGetter nodeDraft, Node node) {
        if (node.getNodeData().getAttributes() != null) {
            AttributeRow row = (AttributeRow) node.getNodeData().getAttributes();
            for (int i = 0; i < row.countValues(); i++) {
                Object val = row.getValue(i);
                AttributeColumn col = row.getColumnAt(i);
                Object draftValue = nodeDraft.getAttributeRow().getValue(col.getId());
                if (col.getType().isDynamicType()) {
                    if (draftValue == null && val != null) {
                        removePoint(col.getType(), (DynamicType) val, point);
                    } else if (draftValue != null) {
                        DynamicType dynamicValue = addPoint(col.getType(), (DynamicType) val, draftValue, point);
                        row.setValue(col.getIndex(), dynamicValue);
                    }
                } else if (draftValue != null && !col.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    row.setValue(col.getIndex(), draftValue);
                }
            }
        }
    }
View Full Code Here

    }

    @Override
    protected void flushToEdgeAttributes(EdgeDraftGetter edgeDraft, Edge edge) {
        if (edge.getEdgeData().getAttributes() != null) {
            AttributeRow row = (AttributeRow) edge.getEdgeData().getAttributes();
            for (int i = 0; i < row.countValues(); i++) {
                Object val = row.getValue(i);
                AttributeColumn col = row.getColumnAt(i);
                Object draftValue = edgeDraft.getAttributeRow().getValue(col);
                if (col.getId().equals(PropertiesColumn.EDGE_WEIGHT.getId())) {
                    draftValue = new Float(edgeDraft.getWeight());
                }
                if (col.getType().isDynamicType()) {
                    if (draftValue == null && val != null) {
                        removePoint(col.getType(), (DynamicType) val, point);
                    } else if (draftValue != null) {
                        DynamicType dynamicValue = addPoint(col.getType(), (DynamicType) val, draftValue, point);
                        row.setValue(col.getIndex(), dynamicValue);
                    }
                } else if (draftValue != null && !col.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    row.setValue(col.getIndex(), draftValue);
                }
            }
        }
    }
View Full Code Here

            clearEdgeData(e, columnsToClear);
        }
    }

    public void clearRowData(Attributes row, AttributeColumn[] columnsToClear) {
        AttributeRow attributeRow = (AttributeRow) row;
        if (columnsToClear != null) {
            for (AttributeColumn column : columnsToClear) {
                //Clear all except id and computed attributes:
                if (canClearColumnData(column)) {
                    row.setValue(column.getIndex(), null);
                }
            }
        } else {
            AttributeValue[] values = attributeRow.getValues();
            for (int i = 0; i < values.length; i++) {
                //Clear all except id and computed attributes:
                if (canClearColumnData(values[i].getColumn())) {
                    row.setValue(i, null);
                }
View Full Code Here

        copyRowDataToOtherRows(row, otherRows, columnsToCopy);
    }

    public void copyRowDataToOtherRows(Attributes row, Attributes[] otherRows, AttributeColumn[] columnsToCopy) {
        AttributeRow attributeRow = (AttributeRow) row;
        if (columnsToCopy != null) {
            for (AttributeColumn column : columnsToCopy) {
                //Copy all except id and computed attributes:
                if (canChangeColumnData(column)) {
                    for (Attributes otherRow : otherRows) {
                        otherRow.setValue(column.getIndex(), row.getValue(column.getIndex()));
                    }
                }
            }
        } else {
            AttributeColumn column;
            AttributeValue[] values = attributeRow.getValues();
            for (int i = 0; i < values.length; i++) {
                column = values[i].getColumn();
                //Copy all except id and computed attributes:
                if (canChangeColumnData(column)) {
                    for (Attributes otherRow : otherRows) {
View Full Code Here

                    contextMenu.add(PopupMenuUtils.createMenuItemFromEdgesManipulator(em, clickedEdge, selectedEdges));
                }
            }

            //Add AttributeValues manipulators submenu:
            AttributeRow row = (AttributeRow) clickedEdge.getEdgeData().getAttributes();
            int realColumnIndex = table.convertColumnIndexToModel(table.columnAtPoint(p)) - FAKE_COLUMNS_COUNT;//Get real attribute column index not counting fake columns.
            if (realColumnIndex >= 0) {
                AttributeColumn column = showingColumns[realColumnIndex];
                if (column != null) {
                    contextMenu.add(PopupMenuUtils.createSubMenuFromRowColumn(row, column));
View Full Code Here

        copyData.setSize(nodeData.getSize());
        copyData.setColor(nodeData.r(), nodeData.g(), nodeData.b());
        copyData.setAlpha(nodeData.alpha());

        //Copy attributes:
        AttributeRow row = (AttributeRow) nodeData.getAttributes();
        for (int i = 0; i < row.countValues(); i++) {
            if (row.getValues()[i].getColumn().getOrigin() == AttributeOrigin.DATA) {
                copyData.getAttributes().setValue(i, row.getValue(i));
            }
        }

        if (parent != null) {
            hg.addNode(copy, parent);
View Full Code Here

        double res = 0;
        double[] internal = new double[degrees.length];
        for (Node n : hgraph.getNodes()) {
            int n_index = structure.map.get(n);
            AttributeRow row = (AttributeRow) n.getNodeData().getAttributes();
            row.setValue(modCol, struct[n_index]);
            for (Node neighbor : hgraph.getNeighbors(n)) {
                if (n == neighbor) {
                    continue;
                }
                int neigh_index = structure.map.get(neighbor);
View Full Code Here

TOP

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

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.