Package org.gephi.data.attributes.api

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


                if (multipleEdges) {
                    wrap = new MultipleEdgesAttributeValueWrapper(edges, value.getColumn());
                } else {
                    wrap = new SingleEdgeAttributeValueWrapper(row, value.getColumn());
                }
                AttributeType type = value.getColumn().getType();
                Property p;
                if (ac.canChangeColumnData(value.getColumn())) {
                    //Editable column, provide "set" method:
                    if (!NotSupportedTypes.contains(type)) {//The AttributeType can be edited by default:
                        p = new PropertySupport.Reflection(wrap, type.getType(), "getValue" + type.getType().getSimpleName(), "setValue" + type.getType().getSimpleName());
                    } else {//Use the AttributeType as String:
                        p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", "setValueAsString");
                    }
                } else {
                    //Not editable column, do not provide "set" method:
                    if (!NotSupportedTypes.contains(type)) {//The AttributeType can be edited by default:
                        p = new PropertySupport.Reflection(wrap, type.getType(), "getValue" + type.getType().getSimpleName(), null);
                    } else {//Use the AttributeType as String:
                        p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", null);
                    }
                }
                p.setDisplayName(value.getColumn().getTitle());
View Full Code Here


*/
@ServiceProvider(service = AttributeColumnsController.class)
public class AttributeColumnsControllerImpl implements AttributeColumnsController {

    public boolean setAttributeValue(Object value, Attributes row, AttributeColumn column) {
        AttributeType targetType = column.getType();
        if (value != null && !value.getClass().equals(targetType.getType())) {
            try {
                value = targetType.parse(value.toString());//Try to convert to target type
            } catch (Exception ex) {
                value = null;//Could not parse
            }
        }

View Full Code Here

            throw new IllegalArgumentException("Source and target columns can't be equal");
        }

        final int sourceColumnIndex = sourceColumn.getIndex();
        final int targetColumnIndex = targetColumn.getIndex();
        AttributeType targetType = targetColumn.getType();
        if (targetType != sourceColumn.getType()) {
            Object value;
            for (Attributes row : getTableAttributeRows(table)) {
                value = row.getValue(sourceColumnIndex);
                setAttributeValue(value, row, targetColumn);
View Full Code Here

            }
        }
    }

    public boolean isNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.DOUBLE
                || type == AttributeType.FLOAT
                || type == AttributeType.INT
                || type == AttributeType.LONG) {
            return true;
View Full Code Here

        }
        return false;
    }

    public boolean isStringColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.STRING) {
            return true;
        }
        return false;
    }
View Full Code Here

        AttributeTable edgeTable = container.getAttributeModel().getEdgeTable();
        for (AttributeColumn column : nodeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getNodeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), dynamicType, column.getOrigin(), null);
                    } else {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
                    }
                }
            }

        }
        for (AttributeColumn column : edgeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getEdgeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
                        attributeModel.getEdgeTable().addColumn(column.getId(), column.getTitle(), dynamicType, column.getOrigin(), null);
                    } else {
                        attributeModel.getEdgeTable().addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
                    }
View Full Code Here

        setMinMax(ranking, graph);
        return ranking.hash != hash;
    }

    public static boolean isNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.DOUBLE
                || type == AttributeType.FLOAT
                || type == AttributeType.INT
                || type == AttributeType.LONG
                || type == AttributeType.BYTE
View Full Code Here

        }
        return false;
    }

    public static boolean isDynamicNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        AttributeUtils.getDefault().isDynamicNumberColumn(column);
        if (type == AttributeType.DYNAMIC_BIGDECIMAL
                || type == AttributeType.DYNAMIC_BIGINTEGER
                || type == AttributeType.DYNAMIC_BYTE
                || type == AttributeType.DYNAMIC_DOUBLE
View Full Code Here

                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, "listchar");
                        } else {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, col.getType().getTypeString().toLowerCase().replace("_", ""));
                        }
                    } else if (col.getType().isDynamicType()) {
                        AttributeType staticType = TypeConvertor.getStaticType(col.getType());
                        if (staticType.equals(AttributeType.INT)) {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, "integer");
                        } else {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, staticType.getTypeString().toLowerCase());
                        }
                    } else {
                        xmlWriter.writeAttribute(ATTRIBUTE_TYPE, col.getType().getTypeString().toLowerCase());
                    }
                    if (col.getDefaultValue() != null) {
View Full Code Here

        xmlWriter.writeStartElement(ATTVALUES);
        for (AttributeValue val : row.getValues()) {
            AttributeColumn col = val.getColumn();
            if (!col.getOrigin().equals(AttributeOrigin.PROPERTY)
                    || (exportDynamic && col.getOrigin().equals(AttributeOrigin.PROPERTY) && col.getIndex() == PropertiesColumn.EDGE_WEIGHT.getIndex())) {
                AttributeType type = col.getType();
                if (type.isDynamicType()) {
                    DynamicType dynamicValue = (DynamicType) val.getValue();
                    if (dynamicValue != null && visibleInterval != null && exportDynamic) {
                        List<Interval<?>> intervals = dynamicValue.getIntervals(visibleInterval.getLow(), visibleInterval.getHigh());
                        for (Interval<?> interval : intervals) {
                            Object value = interval.getValue();
View Full Code Here

TOP

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

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.