Search in sources :

Example 1 with SearchOptions

use of org.gephi.datalab.api.SearchReplaceController.SearchOptions in project gephi by gephi.

the class SearchReplaceUI method createSearchOptions.

private void createSearchOptions() {
    boolean onlyVisibleElements = Lookup.getDefault().lookup(DataTablesController.class).isShowOnlyVisible();
    searchResult = null;
    columnsToSearchComboBox.removeAllItems();
    Table table;
    if (mode == Mode.NODES_TABLE) {
        Node[] nodes;
        if (onlyVisibleElements) {
            //Search on visible nodes:
            nodes = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getNodes().toArray();
        } else {
            //Search on all nodes
            nodes = new Node[0];
        }
        searchOptions = new SearchOptions(nodes, null);
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getNodeTable();
    } else {
        Edge[] edges;
        if (onlyVisibleElements) {
            //Search on visible edges:
            edges = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraphVisible().getEdges().toArray();
        } else {
            //Search on all edges
            edges = new Edge[0];
        }
        searchOptions = new SearchOptions(edges, null);
        table = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getEdgeTable();
    }
    //Fill possible columns to search (first value is all columns):
    columnsToSearchComboBox.addItem(NbBundle.getMessage(SearchReplaceUI.class, "SearchReplaceUI.allColumns"));
    for (Column c : table) {
        columnsToSearchComboBox.addItem(new ColumnWrapper(c));
    }
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column) Node(org.gephi.graph.api.Node) SearchOptions(org.gephi.datalab.api.SearchReplaceController.SearchOptions) Edge(org.gephi.graph.api.Edge) GraphController(org.gephi.graph.api.GraphController) DataTablesController(org.gephi.datalab.api.datatables.DataTablesController)

Aggregations

SearchOptions (org.gephi.datalab.api.SearchReplaceController.SearchOptions)1 DataTablesController (org.gephi.datalab.api.datatables.DataTablesController)1 Column (org.gephi.graph.api.Column)1 Edge (org.gephi.graph.api.Edge)1 GraphController (org.gephi.graph.api.GraphController)1 Node (org.gephi.graph.api.Node)1 Table (org.gephi.graph.api.Table)1