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()));
}
}
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);
}
}
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();
}
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)));
}
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;
}
Aggregations