Search in sources :

Example 21 with Query

use of org.gephi.filters.api.Query in project gephi by gephi.

the class FilterModelPersistenceProvider method writeQuery.

private void writeQuery(String code, XMLStreamWriter writer, FilterModelImpl model, Query query, int parentId) throws XMLStreamException {
    Serialization serialization = new Serialization(model.getGraphModel());
    writer.writeStartElement(code);
    int id = queryId++;
    writer.writeAttribute("id", String.valueOf(id));
    if (parentId != -1) {
        writer.writeAttribute("parent", String.valueOf(parentId));
    }
    Filter filter = query.getFilter();
    FilterBuilder builder = model.getLibrary().getBuilder(filter);
    writer.writeAttribute("builder", builder.getClass().getName());
    writer.writeAttribute("filter", filter.getClass().getName());
    if (query.getName() != null) {
        writer.writeAttribute("name", query.getName());
    }
    // Params
    for (int i = 0; i < query.getPropertiesCount(); i++) {
        FilterProperty prop = query.getFilter().getProperties()[i];
        writeParameter(writer, i, prop, serialization);
    }
    writer.writeEndElement();
    for (Query child : query.getChildren()) {
        writeQuery(code, writer, model, child, id);
    }
}
Also used : Serialization(org.gephi.utils.Serialization) Query(org.gephi.filters.api.Query)

Aggregations

Query (org.gephi.filters.api.Query)21 FilterBuilder (org.gephi.filters.spi.FilterBuilder)6 FilterController (org.gephi.filters.api.FilterController)4 LinkedList (java.util.LinkedList)3 AbstractNode (org.openide.nodes.AbstractNode)3 Node (org.openide.nodes.Node)3 Transferable (java.awt.datatransfer.Transferable)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)2 IOException (java.io.IOException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 FilterBuilderNode (org.gephi.desktop.filters.library.FilterBuilderNode)2 Graph (org.gephi.graph.api.Graph)2 GraphController (org.gephi.graph.api.GraphController)2 GraphModel (org.gephi.graph.api.GraphModel)2 Serialization (org.gephi.utils.Serialization)2 PasteType (org.openide.util.datatransfer.PasteType)2 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 PropertyEditor (java.beans.PropertyEditor)1 ArrayList (java.util.ArrayList)1