Package org.gephi.attribute.api

Examples of org.gephi.attribute.api.AttributeModel


        graphController = Lookup.getDefault().lookup(GraphController.class);
    }

    @Override
    public Ranking[] buildRanking(RankingModel model) {
        AttributeModel attributeModel = graphController.getAttributeModel(model.getWorkspace());
        List<Ranking> rankings = new ArrayList<Ranking>();
        GraphModel graphModel = graphController.getGraphModel(model.getWorkspace());

        //Nodes
        for (Column col : attributeModel.getNodeTable()) {
            if (!col.isProperty() && col.isNumber()) {
                AttributeRanking ranking = new AttributeRanking(Ranking.NODE_ELEMENT, col, graphModel, model);
                rankings.add(ranking);
            }
        }

        //Edges
        for (Column col : attributeModel.getEdgeTable()) {
            if (!col.isProperty() && col.isNumber()) {
                AttributeRanking ranking = new AttributeRanking(Ranking.EDGE_ELEMENT, col, graphModel, model);
                rankings.add(ranking);
            }
        }
View Full Code Here


    }
   
    public void setup(DynamicStatistics dynamicStatistics) {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getGraphModel();
        AttributeModel attributeModel = graphController.getAttributeModel();
        TimeFormat timeFormat = attributeModel.getTimeFormat();

        //Bounds
        bounds = dynamicStatistics.getBounds();
        if (bounds == null) {
            bounds = graphModel.getTimeBoundsVisible();
View Full Code Here

        return nodeTextColumns;
    }

    public void readXML(XMLStreamReader reader, Workspace workspace) throws XMLStreamException {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        AttributeModel attributeModel = graphController != null ? graphController.getAttributeModel(workspace) : null;
        List<Column> nodeCols = new ArrayList<Column>();
        List<Column> edgeCols = new ArrayList<Column>();

        boolean nodeColumn = false;
        boolean edgeColumn = false;
        boolean nodeSizeFac = false;
        boolean edgeSizeFac = false;
        boolean end = false;
        while (reader.hasNext() && !end) {
            int type = reader.next();

            switch (type) {
                case XMLStreamReader.START_ELEMENT:
                    String name = reader.getLocalName();
                    if ("shownodelabels".equalsIgnoreCase(name)) {
                        showNodeLabels = Boolean.parseBoolean(reader.getAttributeValue(null, "enable"));
                    } else if ("showedgelabels".equalsIgnoreCase(name)) {
                        showEdgeLabels = Boolean.parseBoolean(reader.getAttributeValue(null, "enable"));
                    } else if ("selectedOnly".equalsIgnoreCase(name)) {
                        selectedOnly = Boolean.parseBoolean(reader.getAttributeValue(null, "value"));
                    } else if ("nodefont".equalsIgnoreCase(name)) {
                        String nodeFontName = reader.getAttributeValue(null, "name");
                        int nodeFontSize = Integer.parseInt(reader.getAttributeValue(null, "size"));
                        int nodeFontStyle = Integer.parseInt(reader.getAttributeValue(null, "style"));
                        nodeFont = new Font(nodeFontName, nodeFontStyle, nodeFontSize);
                    } else if ("edgefont".equalsIgnoreCase(name)) {
                        String edgeFontName = reader.getAttributeValue(null, "name");
                        int edgeFontSize = Integer.parseInt(reader.getAttributeValue(null, "size"));
                        int edgeFontStyle = Integer.parseInt(reader.getAttributeValue(null, "style"));
                        edgeFont = new Font(edgeFontName, edgeFontStyle, edgeFontSize);
                    } else if ("nodecolor".equalsIgnoreCase(name)) {
                        nodeColor = ColorUtils.decode(reader.getAttributeValue(null, "value")).getRGBComponents(null);
                    } else if ("edgecolor".equalsIgnoreCase(name)) {
                        edgeColor = ColorUtils.decode(reader.getAttributeValue(null, "value")).getRGBComponents(null);
                    } else if ("nodesizefactor".equalsIgnoreCase(name)) {
                        nodeSizeFac = true;
                    } else if ("edgesizefactor".equalsIgnoreCase(name)) {
                        edgeSizeFac = true;
                    } else if ("colormode".equalsIgnoreCase(name)) {
                        String colorModeClass = reader.getAttributeValue(null, "class");
                        if (colorModeClass.equals("UniqueColorMode")) {
                            colorMode = VizController.getInstance().getTextManager().getColorModes()[0];
                        } else if (colorModeClass.equals("ObjectColorMode")) {
                            colorMode = VizController.getInstance().getTextManager().getColorModes()[1];
                        }
                    } else if ("sizemode".equalsIgnoreCase(name)) {
                        String sizeModeClass = reader.getAttributeValue(null, "class");
                        if (sizeModeClass.equals("FixedSizeMode")) {
                            sizeMode = VizController.getInstance().getTextManager().getSizeModes()[0];
                        } else if (sizeModeClass.equals("ProportionalSizeMode")) {
                            sizeMode = VizController.getInstance().getTextManager().getSizeModes()[2];
                        } else if (sizeModeClass.equals("ScaledSizeMode")) {
                            sizeMode = VizController.getInstance().getTextManager().getSizeModes()[1];
                        }
                    } else if ("nodecolumns".equalsIgnoreCase(name)) {
                        nodeColumn = true;
                    } else if ("edgecolumns".equalsIgnoreCase(name)) {
                        edgeColumn = true;
                    } else if ("column".equalsIgnoreCase(name)) {
                        String id = reader.getAttributeValue(null, "id");
                        if (nodeColumn && attributeModel != null) {
                            Column col = attributeModel.getNodeTable().getColumn(id);
                            if (col != null) {
                                nodeCols.add(col);
                            }
                        } else if (edgeColumn && attributeModel != null) {
                            Column col = attributeModel.getEdgeTable().getColumn(id);
                            if (col != null) {
                                edgeCols.add(col);
                            }
                        }
                    }
View Full Code Here

    private Writer writer;

    @Override
    public boolean execute() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        AttributeModel attributeModel = graphController.getAttributeModel(workspace);
        GraphModel graphModel = graphController.getGraphModel(workspace);
        Graph graph = null;
        if (exportVisible) {
            graph = graphModel.getGraphVisible();
        } else {
View Full Code Here

    }

    @Override
    public synchronized void refreshPreview(Workspace workspace) {
        GraphModel graphModel = graphController.getGraphModel(workspace);
        AttributeModel attributeModel = graphController.getAttributeModel(model.getWorkspace());
        PreviewModelImpl previewModel = getModel(workspace);
        previewModel.clear();

        //Directed graph?
        previewModel.getProperties().putValue(PreviewProperty.DIRECTED, graphModel.isDirected() || graphModel.isMixed());
View Full Code Here

        if (statistics instanceof DynamicStatistics) {
            executeDynamic((DynamicStatistics) statistics, null);
        } else {
            GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
            GraphModel graphModel = graphController.getGraphModel();
            AttributeModel attributeModel = graphController.getAttributeModel();
            statistics.execute(graphModel, attributeModel);
            model.addReport(statistics);
        }
    }
View Full Code Here

    }

    private void executeDynamic(DynamicStatistics statistics, DynamicLongTask dynamicLongTask) {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getGraphModel();
        AttributeModel attributeModel = graphController.getAttributeModel();

        double window = statistics.getWindow();
        double tick = statistics.getTick();
        Interval bounds = statistics.getBounds();
        if (bounds == null) {
View Full Code Here

TOP

Related Classes of org.gephi.attribute.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.