Search in sources :

Example 16 with NodeAttributeTableModel

use of org.freeplane.features.attribute.NodeAttributeTableModel in project freeplane by freeplane.

the class MAttributeController method copyAttributesToNode.

public void copyAttributesToNode(NodeModel source, NodeModel target) {
    if (source == null)
        return;
    final NodeAttributeTableModel model = NodeAttributeTableModel.getModel(source);
    if (model.getRowCount() == 0)
        return;
    final int attributeTableLength = model.getAttributeTableLength();
    for (int i = 0; i < attributeTableLength; i++) {
        final Attribute attribute = model.getAttribute(i);
        addAttribute(target, new Attribute(attribute.getName(), attribute.getValue()));
    }
}
Also used : Attribute(org.freeplane.features.attribute.Attribute) NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel)

Example 17 with NodeAttributeTableModel

use of org.freeplane.features.attribute.NodeAttributeTableModel in project freeplane by freeplane.

the class RemoveFirstAttributeAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e, final NodeModel node) {
    final AttributeUtilities atrUtil = new AttributeUtilities();
    if (atrUtil.hasAttributes(node)) {
        final NodeAttributeTableModel natm = NodeAttributeTableModel.getModel(node);
        AttributeController.getController().performRemoveRow(natm, 0);
    }
}
Also used : NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel)

Example 18 with NodeAttributeTableModel

use of org.freeplane.features.attribute.NodeAttributeTableModel in project freeplane by freeplane.

the class AttributesProxy method getFirst.

public Object getFirst(final String name) {
    final int index = findAttribute(name);
    if (index == -1) {
        return null;
    }
    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    return attributeTableModel.getAttribute(index).getValue();
}
Also used : NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel)

Example 19 with NodeAttributeTableModel

use of org.freeplane.features.attribute.NodeAttributeTableModel in project freeplane by freeplane.

the class AttributesProxy method set.

public void set(final int index, final String name, final Object value) {
    final NodeAttributeTableModel attributeTableModel = getAndCheckNodeAttributeTableModelForIndex(index, "set2:");
    String oldPattern = getOldValueFormatPattern(attributeTableModel, index);
    getAttributeController().setAttribute(getDelegate(), index, new Attribute(name, ProxyUtils.transformObject(value, oldPattern)));
}
Also used : Attribute(org.freeplane.features.attribute.Attribute) NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel)

Example 20 with NodeAttributeTableModel

use of org.freeplane.features.attribute.NodeAttributeTableModel in project freeplane by freeplane.

the class AttributesProxy method getAll.

public List<Object> getAll(final String name) {
    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    if (attributeTableModel == null) {
        return Collections.emptyList();
    }
    final ArrayList<Object> result = new ArrayList<Object>();
    for (final Attribute attribute : attributeTableModel.getAttributes()) {
        if (attribute.getName().equals(name)) {
            result.add(attribute.getValue());
        }
    }
    return result;
}
Also used : Attribute(org.freeplane.features.attribute.Attribute) NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel) ArrayList(java.util.ArrayList) IFormattedObject(org.freeplane.features.format.IFormattedObject)

Aggregations

NodeAttributeTableModel (org.freeplane.features.attribute.NodeAttributeTableModel)25 Attribute (org.freeplane.features.attribute.Attribute)12 ArrayList (java.util.ArrayList)5 IFormattedObject (org.freeplane.features.format.IFormattedObject)5 NodeModel (org.freeplane.features.map.NodeModel)3 LinkedHashMap (java.util.LinkedHashMap)2 MissingMethodException (groovy.lang.MissingMethodException)1 URI (java.net.URI)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1