use of org.freeplane.features.attribute.Attribute 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()));
}
}
use of org.freeplane.features.attribute.Attribute in project freeplane by freeplane.
the class AttributesProxy method set.
public void set(final String name, final Object value) {
final int index = findFirst(name);
if (index == -1) {
final Attribute attribute = new Attribute(name, ProxyUtils.transformObject(value, null));
getAttributeController().addAttribute(getDelegate(), attribute);
} else {
final String oldPattern = getOldValueFormatPattern(getNodeAttributeTableModel(), index);
final Attribute attribute = new Attribute(name, ProxyUtils.transformObject(value, oldPattern));
getAttributeController().setAttribute(getDelegate(), index, attribute);
}
}
use of org.freeplane.features.attribute.Attribute 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)));
}
use of org.freeplane.features.attribute.Attribute 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;
}
use of org.freeplane.features.attribute.Attribute in project freeplane by freeplane.
the class AttributesProxy method getMap.
public Map<String, Object> getMap() {
final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
if (attributeTableModel == null) {
return Collections.emptyMap();
}
final LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>(attributeTableModel.getRowCount());
for (final Attribute a : attributeTableModel.getAttributes()) {
result.put(a.getName(), a.getValue());
}
return result;
}
Aggregations