Package org.gephi.io.importer.api.PropertiesAssociations

Examples of org.gephi.io.importer.api.PropertiesAssociations.NodeProperties


        int count = 0;
        while (rs.next()) {
            NodeDraft node = factory.newNodeDraft();
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p != null) {
                    injectNodeProperty(p, rs, i + 1, node);
                } else {
                    //Inject node attributes
                    AttributeColumn col = nodeClass.getColumn(columnName);
View Full Code Here


        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        AttributeTable nodeClass = container.getAttributeModel().getNodeTable();
        for (int i = 0; i < columnsCount; i++) {
            String columnName = metaData.getColumnLabel(i + 1);
            NodeProperties p = database.getPropertiesAssociations().getNodeProperty(columnName);
            if (p == null) {
                //No property associated to this column is found, so we append it as an attribute

                AttributeType type = AttributeType.STRING;
                switch (metaData.getColumnType(i + 1)) {
View Full Code Here

            }
        }

        if (!value.isEmpty()) {
            //Property
            NodeProperties prop = nodePropertiesAttributes.get(fore);
            if (prop != null) {
                try {
                    switch (prop) {
                        case X:
                            node.setX(parseFloat(value));
                            break;
                        case Y:
                            node.setY(parseFloat(value));
                            break;
                        case Z:
                            node.setZ(parseFloat(value));
                            break;
                        case SIZE:
                            node.setSize(parseFloat(value));
                            break;
                        case LABEL:
                            node.setLabel(value);
                            break;
                        case R:
                            if (node.getColor() == null) {
                                node.setColor(Integer.parseInt(value), 0, 0);
                            } else {
                                node.setColor(Integer.parseInt(value), node.getColor().getGreen(), node.getColor().getBlue());
                            }
                            break;
                        case G:
                            if (node.getColor() == null) {
                                node.setColor(0, Integer.parseInt(value), 0);
                            } else {
                                node.setColor(node.getColor().getRed(), Integer.parseInt(value), node.getColor().getBlue());
                            }
                            break;
                        case B:
                            if (node.getColor() == null) {
                                node.setColor(0, 0, Integer.parseInt(value));
                            } else {
                                node.setColor(node.getColor().getRed(), node.getColor().getGreen(), Integer.parseInt(value));
                            }
                            break;
                    }
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, node, prop.toString()), Issue.Level.SEVERE));
                }
                return;
            }

            //Data attribute value
View Full Code Here

        boolean property = false;
        if (!id.isEmpty()) {
            //Properties
            if (forStr.equalsIgnoreCase("node")) {
                NodeProperties prop = properties.getNodeProperty(id) == null ? properties.getNodeProperty(title) : properties.getNodeProperty(id);
                if (prop != null) {
                    nodePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_nodeproperty", title));
                    property = true;
                }
View Full Code Here

            }
        }

        if (!value.isEmpty()) {
            //Property
            NodeProperties prop = nodePropertiesAttributes.get(fore);
            if (prop != null) {
                try {
                    switch (prop) {
                        case X:
                            node.setX(parseFloat(value));
                            break;
                        case Y:
                            node.setY(parseFloat(value));
                            break;
                        case Z:
                            node.setZ(parseFloat(value));
                            break;
                        case SIZE:
                            node.setSize(parseFloat(value));
                            break;
                        case LABEL:
                            node.setLabel(value);
                            break;
                        case R:
                            if (node.getColor() == null) {
                                node.setColor(Integer.parseInt(value), 0, 0);
                            } else {
                                node.setColor(Integer.parseInt(value), node.getColor().getGreen(), node.getColor().getBlue());
                            }
                            break;
                        case G:
                            if (node.getColor() == null) {
                                node.setColor(0, Integer.parseInt(value), 0);
                            } else {
                                node.setColor(node.getColor().getRed(), Integer.parseInt(value), node.getColor().getBlue());
                            }
                            break;
                        case B:
                            if (node.getColor() == null) {
                                node.setColor(0, 0, Integer.parseInt(value));
                            } else {
                                node.setColor(node.getColor().getRed(), node.getColor().getGreen(), Integer.parseInt(value));
                            }
                            break;
                    }
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, node, prop.toString()), Issue.Level.SEVERE));
                }
                return;
            }

            //Data attribute value
View Full Code Here

        boolean property = false;
        if (!id.isEmpty()) {
            //Properties
            if (forStr.equalsIgnoreCase("node")) {
                NodeProperties prop = properties.getNodeProperty(id) == null ? properties.getNodeProperty(title) : properties.getNodeProperty(id);
                if (prop != null) {
                    nodePropertiesAttributes.put(id, prop);
                    report.log(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_log_nodeproperty", title));
                    property = true;
                }
View Full Code Here

        int count = 0;
        while (rs.next()) {
            String id = null;
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p.equals(NodeProperties.ID)) {
                    String ide = rs.getString(i + 1);
                    if (ide != null) {
                        id = ide;
                    }
                }
            }
            NodeDraft node;
            if (id != null) {
                node = factory.newNodeDraft(id);
            } else {
                node = factory.newNodeDraft();
            }

            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p != null) {
                    injectNodeProperty(p, rs, i + 1, node);
                } else {
                    //Inject node attributes
                    ColumnDraft col = container.getNodeColumn(columnName);
View Full Code Here

    private void findNodeAttributesColumns(ResultSet rs) throws SQLException {
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        for (int i = 0; i < columnsCount; i++) {
            String columnName = metaData.getColumnLabel(i + 1);
            NodeProperties p = database.getPropertiesAssociations().getNodeProperty(columnName);
            if (p == null) {
                //No property associated to this column is found, so we append it as an attribute
                Class typeClass = findTypeClass(metaData, i);
                container.addNodeColumn(columnName, typeClass);
            }
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.PropertiesAssociations.NodeProperties

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.