Package org.gephi.data.attributes.api

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


    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

    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

        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

    @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

*/
@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

*/
@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

            }
        }
    }

    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

    public AttributeContollerImpl() {
        projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.addWorkspaceListener(new WorkspaceListener() {

            public void initialize(Workspace workspace) {
                AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
                if (m == null) {
                    workspace.add(new IndexedAttributeModel());
                }
            }

            public void select(Workspace workspace) {
            }

            public void unselect(Workspace workspace) {
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
            }
        });
        if (projectController.getCurrentProject() != null) {
            for (Workspace workspace : projectController.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
                AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
                if (m == null) {
                    workspace.add(new IndexedAttributeModel());
                }
            }
        }
View Full Code Here

    }

    public AttributeModel getModel() {
        Workspace workspace = projectController.getCurrentWorkspace();
        if (workspace != null) {
            AttributeModel model = workspace.getLookup().lookup(AttributeModel.class);
            if (model != null) {
                return model;
            }
            model = new IndexedAttributeModel();
            workspace.add(model);
View Full Code Here

TOP

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

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.