Package org.gephi.data.attributes.api

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


    private void createSearchOptions() {
        boolean onlyVisibleElements = Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible();
        searchResult = null;
        columnsToSearchComboBox.removeAllItems();
        AttributeTable table;
        if (mode == Mode.NODES_TABLE) {
            Node[] nodes;
            if (onlyVisibleElements) {
                //Search on visible nodes:
                nodes = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible().getNodesTree().toArray();
            } else {
                nodes = new Node[0];//Search on all nodes
            }
            searchOptions = new SearchOptions(nodes, null);
            table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
        } else {
            Edge[] edges;
            if (onlyVisibleElements) {
                //Search on visible edges:
                edges = Lookup.getDefault().lookup(GraphController.class).getModel().getHierarchicalGraphVisible().getEdges().toArray();
            } else {
                edges = new Edge[0];//Search on all edges
            }
            searchOptions = new SearchOptions(edges, null);
            table = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
        }

        //Fill possible columns to search (first value is all columns):
        columnsToSearchComboBox.addItem(NbBundle.getMessage(SearchReplaceUI.class, "SearchReplaceUI.allColumns"));
        for (AttributeColumn c : table.getColumns()) {
            columnsToSearchComboBox.addItem(new ColumnWrapper(c));
        }
    }
View Full Code Here


    }

    public void weaklyConnected(HierarchicalUndirectedGraph hgraph, AttributeModel attributeModel) {
        isCanceled = false;
        componentCount = 0;
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn componentCol = nodeTable.getColumn(WEAKLY);
        if (componentCol == null) {
            componentCol = nodeTable.addColumn(WEAKLY, "Component ID", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
        }

        List<Integer> sizeList = new ArrayList<Integer>();

        hgraph.readLock();
View Full Code Here

    }

    public void top_tarjans(HierarchicalDirectedGraph hgraph, AttributeModel attributeModel) {
        count = 1;
        stronglyCount = 0;
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn componentCol = nodeTable.getColumn(STRONG);
        if (componentCol == null) {
            componentCol = nodeTable.addColumn(STRONG, "Strongly-Connected ID", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
        }

        hgraph.readLock();

        HashMap<Node, Integer> indicies = new HashMap<Node, Integer>();
View Full Code Here

        execute(graph, attributeModel);
    }

    public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {
        isCanceled = false;
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn eccentricityCol = nodeTable.getColumn(ECCENTRICITY);
        AttributeColumn closenessCol = nodeTable.getColumn(CLOSENESS);
        AttributeColumn betweenessCol = nodeTable.getColumn(BETWEENNESS);
        if (eccentricityCol == null) {
            eccentricityCol = nodeTable.addColumn(ECCENTRICITY, "Eccentricity", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }
        if (closenessCol == null) {
            closenessCol = nodeTable.addColumn(CLOSENESS, "Closeness Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }
        if (betweenessCol == null) {
            betweenessCol = nodeTable.addColumn(BETWEENNESS, "Betweenness Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }

        hgraph.readLock();

        N = hgraph.getNodeCount();
View Full Code Here

        return findNext(result.getSearchOptions());
    }

    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();
            column = table.getColumn(result.getFoundColumnIndex());
        }
        return Lookup.getDefault().lookup(AttributeColumnsController.class).canChangeColumnData(column);
    }
View Full Code Here

    /**
     * Creates the buttons that call the AttributeColumnManipulators.
     */
    private void prepareColumnManipulatorsButtons() {
        AttributeModel attributeModel = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
        AttributeTable table;
        AttributeColumn[] columns;
        if (classDisplayed == ClassDisplayed.NODE) {
            table = attributeModel.getNodeTable();
            columns = nodeAvailableColumnsModel.getAvailableColumns();
        } else {
View Full Code Here

        NbPreferences.forModule(DataTableTopComponent.class).putBoolean(DATA_LABORATORY_TIME_INTERVAL_GRAPHICS, timeIntervalGraphics);
        NbPreferences.forModule(DataTableTopComponent.class).putBoolean(DATA_LABORATORY_EDGES_NODES_LABELS, showEdgesNodesLabels);
    }//GEN-LAST:event_configurationButtonActionPerformed

    private void availableColumnsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_availableColumnsButtonActionPerformed
        AttributeTable table;
        AvailableColumnsModel availableColumnsModel;
        if (classDisplayed == classDisplayed.NODE) {
            table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
        } else {
            table = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
View Full Code Here

        }
        GraphFactory factory = graphModel.factory();

        //Attributes - Manually merge models with new dynamic cols
        attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
        AttributeTable nodeTable = container.getAttributeModel().getNodeTable();
        AttributeTable edgeTable = container.getAttributeModel().getEdgeTable();
        for (AttributeColumn column : nodeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getNodeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), dynamicType, column.getOrigin(), null);
                    } else {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
                    }
                }
            }

        }
        for (AttributeColumn column : edgeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getEdgeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
View Full Code Here

        }

        CsvReader reader = null;
        try {
            //Prepare attribute columns for the column names, creating the not already existing columns:
            AttributeTable nodesTable = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
            String idColumn = null;
            ArrayList<AttributeColumn> columnsList = new ArrayList<AttributeColumn>();
            for (int i = 0; i < columnNames.length; i++) {
                //Separate first id column found from the list to use as id. If more are found later, the will not be in the list and be ignored.
                if (columnNames[i].equalsIgnoreCase("id")) {
                    if (idColumn == null) {
                        idColumn = columnNames[i];
                    }
                } else if (nodesTable.hasColumn(columnNames[i])) {
                    columnsList.add(nodesTable.getColumn(columnNames[i]));
                } else {
                    columnsList.add(addAttributeColumn(nodesTable, columnNames[i], columnTypes[i]));
                }
            }
View Full Code Here

        }

        CsvReader reader = null;
        try {
            //Prepare attribute columns for the column names, creating the not already existing columns:
            AttributeTable edges = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
            String idColumn = null;
            String sourceColumn = null;
            String targetColumn = null;
            String typeColumn = null;
            ArrayList<AttributeColumn> columnsList = new ArrayList<AttributeColumn>();
            for (int i = 0; i < columnNames.length; i++) {
                //Separate first id column found from the list to use as id. If more are found later, the will not be in the list and be ignored.
                if (columnNames[i].equalsIgnoreCase("id")) {
                    if (idColumn == null) {
                        idColumn = columnNames[i];
                    }
                } else if (columnNames[i].equalsIgnoreCase("source") && sourceColumn == null) {//Separate first source column found from the list to use as source node id
                    sourceColumn = columnNames[i];
                } else if (columnNames[i].equalsIgnoreCase("target") && targetColumn == null) {//Separate first target column found from the list to use as target node id
                    targetColumn = columnNames[i];
                } else if (columnNames[i].equalsIgnoreCase("type") && typeColumn == null) {//Separate first type column found from the list to use as edge type (directed/undirected)
                    typeColumn = columnNames[i];
                } else if (edges.hasColumn(columnNames[i])) {
                    columnsList.add(edges.getColumn(columnNames[i]));
                } else {
                    columnsList.add(addAttributeColumn(edges, columnNames[i], columnTypes[i]));
                }
            }
View Full Code Here

TOP

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

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.