Examples of AttributeModel


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

        return RANGE;
    }

    public FilterBuilder[] getBuilders() {
        List<FilterBuilder> builders = new ArrayList<FilterBuilder>();
        AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
        for (AttributeColumn c : am.getNodeTable().getColumns()) {
            if (AttributeUtils.getDefault().isNumberColumn(c) || AttributeUtils.getDefault().isDynamicNumberColumn(c)) {
                AttributeRangeFilterBuilder b = new AttributeRangeFilterBuilder(c);
                builders.add(b);
            }
        }
        for (AttributeColumn c : am.getEdgeTable().getColumns()) {
            if (AttributeUtils.getDefault().isNumberColumn(c) || AttributeUtils.getDefault().isDynamicNumberColumn(c)) {
                AttributeRangeFilterBuilder b = new AttributeRangeFilterBuilder(c);
                builders.add(b);
            }
        }
View Full Code Here

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

        return EQUAL;
    }

    public FilterBuilder[] getBuilders() {
        List<FilterBuilder> builders = new ArrayList<FilterBuilder>();
        AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
        for (AttributeColumn c : am.getNodeTable().getColumns()) {
            if (AttributeUtils.getDefault().isStringColumn(c) || c.getType().equals(AttributeType.DYNAMIC_STRING)) {
                EqualStringFilterBuilder b = new EqualStringFilterBuilder(c);
                builders.add(b);
            } else if (AttributeUtils.getDefault().isNumberColumn(c) || AttributeUtils.getDefault().isDynamicNumberColumn(c)) {
                EqualNumberFilterBuilder b = new EqualNumberFilterBuilder(c);
                builders.add(b);
            } else if (c.getType().equals(AttributeType.BOOLEAN) || c.getType().equals(AttributeType.DYNAMIC_BOOLEAN)) {
                EqualBooleanFilterBuilder b = new EqualBooleanFilterBuilder(c);
                builders.add(b);
            }
        }
        for (AttributeColumn c : am.getEdgeTable().getColumns()) {
            if (AttributeUtils.getDefault().isStringColumn(c) || c.getType().equals(AttributeType.DYNAMIC_STRING)) {
                EqualStringFilterBuilder b = new EqualStringFilterBuilder(c);
                builders.add(b);
            } else if (AttributeUtils.getDefault().isNumberColumn(c) || AttributeUtils.getDefault().isDynamicNumberColumn(c)) {
                EqualNumberFilterBuilder b = new EqualNumberFilterBuilder(c);
View Full Code Here

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

        return nodeTextColumns;
    }

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

        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) {
                            AttributeColumn col = attributeModel.getNodeTable().getColumn(id);
                            if (col != null) {
                                nodeCols.add(col);
                            }
                        } else if (edgeColumn && attributeModel != null) {
                            AttributeColumn col = attributeModel.getEdgeTable().getColumn(id);
                            if (col != null) {
                                edgeCols.add(col);
                            }
                        }
                    }
View Full Code Here

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

        this.attributeTypeClass = attributeClass;
    }

    protected AttributeColumn[] getColumns() {
        List<AttributeColumn> cols = new ArrayList<AttributeColumn>();
        AttributeModel model = Lookup.getDefault().lookup(AttributeController.class).getModel();
        if (model != null) {
            if (editorClass.equals(EditorClass.NODE) || editorClass.equals(EditorClass.NODEEDGE)) {
                for (AttributeColumn column : model.getNodeTable().getColumns()) {
                    if (attributeTypeClass.equals(AttributeTypeClass.NUMBER) && isNumberColumn(column)) {
                        cols.add(column);
                    } else if (attributeTypeClass.equals(AttributeTypeClass.ALL)) {
                        cols.add(column);
                    } else if (attributeTypeClass.equals(attributeTypeClass.STRING) && isStringColumn(column)) {
                        cols.add(column);
                    }
                }
            }
            if (editorClass.equals(EditorClass.EDGE) || editorClass.equals(EditorClass.NODEEDGE)) {
                for (AttributeColumn column : model.getEdgeTable().getColumns()) {
                    if (attributeTypeClass.equals(AttributeTypeClass.NUMBER) && isNumberColumn(column)) {
                        cols.add(column);
                    } else if (attributeTypeClass.equals(AttributeTypeClass.ALL)) {
                        cols.add(column);
                    } else if (attributeTypeClass.equals(attributeTypeClass.STRING) && isStringColumn(column)) {
View Full Code Here

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

                    //Initialize columns if needed
                    if (model.getNodeTextColumns() == null || model.getNodeTextColumns().length == 0) {
                        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
                        if (attributeController != null && attributeController.getModel() != null) {
                            AttributeModel attributeModel = attributeController.getModel();
                            AttributeColumn[] nodeCols = new AttributeColumn[]{attributeModel.getNodeTable().getColumn(PropertiesColumn.NODE_LABEL.getIndex())};
                            AttributeColumn[] edgeCols = new AttributeColumn[]{attributeModel.getEdgeTable().getColumn(PropertiesColumn.EDGE_LABEL.getIndex())};
                            model.setTextColumns(nodeCols, edgeCols);
                        }
                    }

                    DynamicModel dynamicModel = dynamicController.getModel();
View Full Code Here

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

        ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
        Workspace workspace = pc.getCurrentWorkspace();
        if (workspace == null) {
            clearAll();
        } else {
            AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();

            dataTablesModel = workspace.getLookup().lookup(DataTablesModel.class);
            if (dataTablesModel == null) {
                workspace.add(dataTablesModel = new DataTablesModel(attributeModel.getNodeTable(), attributeModel.getEdgeTable()));
            }
            nodeAvailableColumnsModel = dataTablesModel.getNodeAvailableColumnsModel();
            edgeAvailableColumnsModel = dataTablesModel.getEdgeAvailableColumnsModel();
            refreshAllOnce();
        }
View Full Code Here

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

            }

            public void select(Workspace workspace) {
                //Prepare DataTablesEvent listener
                Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
                AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();

                dataTablesModel = workspace.getLookup().lookup(DataTablesModel.class);
                if (dataTablesModel == null) {
                    workspace.add(dataTablesModel = new DataTablesModel(attributeModel.getNodeTable(), attributeModel.getEdgeTable()));
                }
                nodeAvailableColumnsModel = dataTablesModel.getNodeAvailableColumnsModel();
                edgeAvailableColumnsModel = dataTablesModel.getEdgeAvailableColumnsModel();
                hideTable();
                enableTableControls();

                attributeModel.addAttributeListener(DataTableTopComponent.this);

                graphModel = gc.getModel();
                graphModel.addGraphListener(DataTableTopComponent.this);

                refreshAllOnce();
            }

            public void unselect(Workspace workspace) {
                graphModel.removeGraphListener(DataTableTopComponent.this);

                AttributeModel attributeModel = workspace.getLookup().lookup(AttributeModel.class);
                attributeModel.removeAttributeListener(DataTableTopComponent.this);
                graphModel = null;
                dataTablesModel = null;
                nodeAvailableColumnsModel = null;
                edgeAvailableColumnsModel = null;
                clearAll();
            }

            public void close(Workspace workspace) {
            }

            public void disable() {
                clearAll();
                //No more workspaces active, disable the DataTablesEvent listener
                Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(null);
            }
        });
        if (pc.getCurrentWorkspace() != null) {
            //Prepare DataTablesEvent listener
            Lookup.getDefault().lookup(DataTablesController.class).setDataTablesEventListener(DataTableTopComponent.this);
            dataTablesModel = pc.getCurrentWorkspace().getLookup().lookup(DataTablesModel.class);
            graphModel = gc.getModel();
            graphModel.addGraphListener(DataTableTopComponent.this);

            AttributeModel attributeModel = pc.getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
            attributeModel.addAttributeListener(DataTableTopComponent.this);
        }

        //Filter
        if (dynamicFiltering) {
            filterTextField.getDocument().addDocumentListener(new DocumentListener() {
View Full Code Here

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

    /**
     * Creates the buttons that call the AttributeColumnManipulators.
     */
    private void prepareColumnManipulatorsButtons() {
        AttributeModel attributeModel = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(AttributeModel.class);
        AttributeTable table;
        AttributeColumn[] columns;
        if (classDisplayed == ClassDisplayed.NODE) {
            table = attributeModel.getNodeTable();
            columns = nodeAvailableColumnsModel.getAvailableColumns();
        } else {
            table = attributeModel.getEdgeTable();
            columns = edgeAvailableColumnsModel.getAvailableColumns();
        }

        DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
        AttributeColumnsManipulator[] manipulators = dlh.getAttributeColumnsManipulators();
View Full Code Here

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

        } else {
            FilterProcessor processor = new FilterProcessor();
            GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
            result = (HierarchicalGraph) processor.process((AbstractQueryImpl) query, graphModel);
        }
        AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
        AttributeColumn nodeCol = am.getNodeTable().getColumn("filter_" + title);
        if (nodeCol == null) {
            nodeCol = am.getNodeTable().addColumn("filter_" + title, title, AttributeType.BOOLEAN, AttributeOrigin.COMPUTED, Boolean.FALSE);
        }
        AttributeColumn edgeCol = am.getEdgeTable().getColumn("filter_" + title);
        if (edgeCol == null) {
            edgeCol = am.getEdgeTable().addColumn("filter_" + title, title, AttributeType.BOOLEAN, AttributeOrigin.COMPUTED, Boolean.FALSE);
        }
        result.readLock();
        for (Node n : result.getNodes()) {
            n.getNodeData().getAttributes().setValue(nodeCol.getIndex(), Boolean.TRUE);
        }
View Full Code Here

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

        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);

        Workspace currentWorkspace = projectController.getCurrentWorkspace();
        AttributeModel sourceAttributeModel = attributeController.getModel(currentWorkspace);
        AttributeModel destAttributeModel = attributeController.getModel(workspace);
        destAttributeModel.mergeModel(sourceAttributeModel);

        GraphModel sourceModel = graphController.getModel(currentWorkspace);
        GraphModel destModel = graphController.getModel(workspace);
        Graph destGraph = destModel.getHierarchicalGraphVisible();
        Graph sourceGraph = sourceModel.getHierarchicalGraphVisible();
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.