Package org.gephi.data.attributes.api

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


                }
                return;
            }

            //Data attribute value
            AttributeColumn column = container.getAttributeModel().getEdgeTable().getColumn(fore);
            if (column != null) {
                try {
                    Object val = column.getType().parse(value);
                    edge.addAttributeValue(column, val);
                } catch (Exception e) {
                    report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_datavalue", fore, edge, column.getTitle()), Issue.Level.SEVERE));
                }
            }
        }
    }
View Full Code Here


        return model;
    }

    public synchronized void mergeTable(AttributeTable table) {
        for (AttributeColumn column : table.getColumns()) {
            AttributeColumn existingCol = getColumn(column);
            if (existingCol == null) {
                existingCol = getColumn(column.getTitle());
            }
            if (existingCol == null) {
                addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
            } else if (column.getType().isDynamicType() && TypeConvertor.getStaticType(column.getType()).equals(existingCol.getType())) {
                //The column exists but has the underlying static type
                //Change type
                AttributeColumnImpl newCol = new AttributeColumnImpl(this, existingCol.getIndex(), existingCol.getId(), existingCol.getTitle(), column.getType(), existingCol.getOrigin(), column.getDefaultValue(), null);
                replaceColumn(existingCol, newCol);
            }
        }
    }
View Full Code Here

            setValue(attValues[i]);
        }
    }

    public void setValue(int index, Object value) {
        AttributeColumn column = attributeTable.getColumn(index);
        if (column != null) {
            setValue(column, value);
        } else {
            throw new IllegalArgumentException("The column doesn't exist");
        }
View Full Code Here

    public void setValue(String column, Object value) {
        if (column == null) {
            throw new NullPointerException("Column is null");
        }
        AttributeColumn attributeColumn = attributeTable.getColumn(column);
        if (attributeColumn != null) {
            setValue(attributeColumn, value);
        } else {
            //add column
            AttributeType type = AttributeType.parse(value);
View Full Code Here

        AttributeValue attValue = attributeTable.getFactory().newValue(column, value);
        setValue(attValue);
    }

    public void setValue(AttributeValue value) {
        AttributeColumn column = value.getColumn();
        if (attributeTable.getColumn(column.getIndex()) != column) {
            column = attributeTable.getColumn(column);
            if (column == null) {
                throw new IllegalArgumentException("The value column doesn't exist");
            }
            value = attributeTable.getFactory().newValue(column, value.getValue());
        }

        setValue(column.getIndex(), (AttributeValueImpl) value);
    }
View Full Code Here

    }

    public Object getValue(int index) {
        updateColumns();
        if (checkIndexRange(index)) {
            AttributeColumn attributeColumn = attributeTable.getColumn(index);
            return getValue(attributeColumn);
        }
        return null;
    }
View Full Code Here

        return null;
    }

    public Object getValue(String column) {
        updateColumns();
        AttributeColumn attributeColumn = attributeTable.getColumn(column);
        if (attributeColumn != null) {
            return getValue(attributeColumn);
        }
        return null;
    }
View Full Code Here

            //Add AttributeValues manipulators submenu:
            AttributeRow row = (AttributeRow) clickedNode.getNodeData().getAttributes();
            int realColumnIndex = outlineTable.convertColumnIndexToModel(outlineTable.columnAtPoint(p)) - FAKE_COLUMNS_COUNT;//Get real attribute column index not counting fake columns.
            if (realColumnIndex >= 0) {
                AttributeColumn column = showingColumns[realColumnIndex];
                if (column != null) {
                    contextMenu.add(PopupMenuUtils.createSubMenuFromRowColumn(row, column));
                }
            }
            return contextMenu;
View Full Code Here

            return;
        }

        if (!value.isEmpty()) {
            //Data attribute value
            AttributeColumn column = container.getAttributeModel().getNodeTable().getColumn(fore);
            if (column != null) {
                if (!startDate.isEmpty() || !endDate.isEmpty()) {
                    //Dynamic
                    try {
                        node.addAttributeValue(column, value, startDate, endDate);
                    } catch (IllegalArgumentException e) {
                        report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_nodeattribute_timeinterval_parseerror", node), Issue.Level.SEVERE));
                    } catch (Exception e) {
                        report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_datavalue", fore, node, column.getTitle()), Issue.Level.SEVERE));
                    }
                } else {
                    if (column.getType().isDynamicType()) {
                        node.addAttributeValue(column, value);
                    } else {
                        try {
                            Object val = column.getType().parse(value);
                            node.addAttributeValue(column, val);
                        } catch (Exception e) {
                            report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_datavalue", fore, node, column.getTitle()), Issue.Level.SEVERE));
                        }
                    }
                }
            }
        }
View Full Code Here

            return;
        }

        if (!value.isEmpty()) {
            //Data attribute value
            AttributeColumn column = container.getAttributeModel().getEdgeTable().getColumn(fore);
            if (column != null) {
                if (!startDate.isEmpty() || !endDate.isEmpty()) {
                    //Dynamic
                    try {
                        edge.addAttributeValue(column, value, startDate, endDate);
                    } catch (IllegalArgumentException e) {
                        report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_edgeattribute_timeinterval_parseerror", edge), Issue.Level.SEVERE));
                    } catch (Exception e) {
                        report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_datavalue", fore, edge, column.getTitle()), Issue.Level.SEVERE));
                    }
                } else {
                    if (column.getType().isDynamicType()) {
                        edge.addAttributeValue(column, value);
                    } else {
                        try {
                            Object val = column.getType().parse(value);
                            edge.addAttributeValue(column, val);
                        } catch (Exception e) {
                            report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_datavalue", fore, edge, column.getTitle()), Issue.Level.SEVERE));
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

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

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.