Examples of AttributeModel


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

            public void initialize(Workspace workspace) {
            }

            public void select(Workspace workspace) {
                AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
                attributeModel.addAttributeListener(RankingModelImpl.this);
            }

            public void unselect(Workspace workspace) {
                AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
                attributeModel.removeAttributeListener(RankingModelImpl.this);
                dynamicModel = null;
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
                dynamicModel = null;
            }
        });
        if (pc.getCurrentWorkspace() != null) {
            AttributeModel attributeModel = pc.getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
            attributeModel.addAttributeListener(RankingModelImpl.this);
        }
    }
View Full Code Here

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

    public void setUp() {
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.newProject();
        Workspace workspace = projectController.getCurrentWorkspace();
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        AttributeModel attributeModel = attributeController.getModel();
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getModel();
        HierarchicalDirectedGraph graph = graphModel.getHierarchicalDirectedGraph();

        Node n1 = graphModel.factory().newNode("n1");
        graph.addNode(n1);
        Node n2 = graphModel.factory().newNode("n2");
        graph.addNode(n2);
        Node n3 = graphModel.factory().newNode("n3");
        graph.addNode(n3);
        Node n4 = graphModel.factory().newNode("n4");
        graph.addNode(n4, n3);

        Edge e1 = graphModel.factory().newEdge(n1, n2, 1f, true);
        graph.addEdge(e1);
        Edge e2 = graphModel.factory().newEdge(n2, n4, 3f, true);
        graph.addEdge(e2);
        Edge e3 = graphModel.factory().newEdge(n2, n1, 1f, true);
        graph.addEdge(e3);

        AttributeColumn nodeCol1 = attributeModel.getNodeTable().addColumn("col1", "Column 1", AttributeType.STRING, AttributeOrigin.DATA, "default value col1");
        AttributeColumn nodeCol2 = attributeModel.getNodeTable().addColumn("col2 listint", AttributeType.LIST_INTEGER);
        attributeModel.getNodeTable().addColumn("col3 listchar", AttributeType.LIST_CHARACTER);
        attributeModel.getNodeTable().addColumn("col4 int", AttributeType.INT);
        attributeModel.getNodeTable().addColumn("col5 liststring", AttributeType.LIST_STRING);
        AttributeColumn nodeTimeCol = attributeModel.getNodeTable().addColumn(DynamicModel.TIMEINTERVAL_COLUMN, AttributeType.TIME_INTERVAL, AttributeOrigin.PROPERTY);

        AttributeColumn edgeCol1 = attributeModel.getEdgeTable().addColumn("col1", AttributeType.DYNAMIC_INT);
        AttributeColumn edgeCol2 = attributeModel.getEdgeTable().addColumn("col2", AttributeType.DYNAMIC_STRING);

        n1.getNodeData().getAttributes().setValue(nodeCol1.getIndex(), "test");
        n1.getNodeData().getAttributes().setValue(nodeCol2.getIndex(), new IntegerList(new int[]{1, 2, 3, 4}));

        n1.getNodeData().getAttributes().setValue(nodeTimeCol.getIndex(), new TimeInterval(1, 5));
View Full Code Here

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

                    workspace.add(model);
                }
                refreshPartitions = true;
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                trachViewChange(gm);
                AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
                attributeModel.addAttributeListener(PartitionControllerImpl.this);
            }

            public void unselect(Workspace workspace) {
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                untrackViewChange(gm);
                model = null;
                AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
                attributeModel.removeAttributeListener(PartitionControllerImpl.this);
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
                untrackViewChange(null);
            }
        });
        if (pc.getCurrentWorkspace() != null) {
            refreshPartitions = true;
            model = pc.getCurrentWorkspace().getLookup().lookup(PartitionModelImpl.class);
            if (model == null) {
                model = new PartitionModelImpl();
                Workspace workspace = pc.getCurrentWorkspace();
                pc.getCurrentWorkspace().add(model);
                GraphModel gm = Lookup.getDefault().lookup(GraphController.class).getModel(workspace);
                trachViewChange(gm);

                AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
                attributeModel.addAttributeListener(PartitionControllerImpl.this);
            }
        }
    }
View Full Code Here

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

    private void writeColumns(Clusterer clusterer) {
        Cluster[] clusters = clusterer.getClusters();
        if (clusters != null && clusters.length > 0) {
            ClustererBuilder builder = getBuilder(clusterer);
            AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
            String id = "clustering_" + builder.getName();
            String title = "Clustering (" + builder.getName() + ")";
            AttributeColumn col = am.getNodeTable().getColumn(id);
            if (col == null) {
                col = am.getNodeTable().addColumn(id, title, AttributeType.INT, AttributeOrigin.COMPUTED, null);
                StatusDisplayer.getDefault().setStatusText("A new column \"" + title + "\" has been created");
            }
            for (int i = 0; i < clusters.length; i++) {
                Integer clusterId = new Integer(i);
                for (Node n : clusters[i].getNodes()) {
View Full Code Here

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

    private Writer writer;
    //Dynamic
    private TimeInterval visibleInterval;

    public boolean execute() {
        AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
        GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
        Graph graph = null;
        if (exportVisible) {
            graph = graphModel.getGraphVisible();
        } else {
View Full Code Here

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

        eventManager.start();

        //AttributeFactory
        AttributeRowFactory attributeRowFactory = null;
        if (workspace != null) {
            AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
            if (attributeModel != null) {
                attributeRowFactory = attributeModel.rowFactory();
            }
        }
        factory = new GraphFactoryImpl(controller.getIDGen(), attributeRowFactory);

        init();
View Full Code Here

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

    @Test
    public void testSerialization() {
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.newProject();
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        AttributeModel attributeModel = attributeController.getModel();
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getModel();

        StatisticsModelImpl model = new StatisticsModelImpl();
View Full Code Here

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

*/
@ServiceProvider(service = WorkspacePersistenceProvider.class, position = 10)
public class AttributeModelPersistenceProvider implements WorkspacePersistenceProvider {

    public void writeXML(XMLStreamWriter writer, Workspace workspace) {
        AttributeModel model = workspace.getLookup().lookup(AttributeModel.class);
        AttributeModelSerializer serializer = new AttributeModelSerializer();
        if (model instanceof AbstractAttributeModel) {
            try {
                serializer.writeModel(writer, (AbstractAttributeModel) model);
            } catch (XMLStreamException ex) {
View Full Code Here

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

*/
@ServiceProvider(service = WorkspacePersistenceProvider.class, position = 15000)
public class AttributeRowPersistenceProvider implements WorkspacePersistenceProvider {

    public void writeXML(XMLStreamWriter writer, Workspace workspace) {
        AttributeModel model = workspace.getLookup().lookup(AttributeModel.class);
        GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
        AttributeRowSerializer serializer = new AttributeRowSerializer();
        if (model != null && graphModel != null && model instanceof AbstractAttributeModel) {
            try {
                serializer.writeRows(writer, graphModel);
View Full Code Here

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

            }
        }
    }

    public void readXML(XMLStreamReader reader, Workspace workspace) {
        AttributeModel model = workspace.getLookup().lookup(AttributeModel.class);
        GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
        AttributeRowSerializer serializer = new AttributeRowSerializer();
        if (model != null && graphModel != null && model instanceof AbstractAttributeModel) {
            try {
                serializer.readRows(reader, graphModel, (AbstractAttributeModel) model);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.