Package org.freeplane.features.attribute

Examples of org.freeplane.features.attribute.NodeAttributeTableModel


  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();
  }
View Full Code Here


    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    return attributeTableModel.getAttribute(index).getValue();
  }

  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;
View Full Code Here

    }
    return result;
  }

  public List<String> getNames() {
    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    if (attributeTableModel == null) {
      return Collections.emptyList();
    }
    final ArrayList<String> result = new ArrayList<String>(attributeTableModel.getRowCount());
    for (final Attribute a : attributeTableModel.getAttributes()) {
      result.add(a.getName());
    }
    return result;
  }
View Full Code Here

  public List<String> getAttributeNames() {
    return getNames();
  }
 
  public List<? extends Convertible> getValues() {
    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    if (attributeTableModel == null) {
      return Collections.emptyList();
    }
    final ArrayList<Convertible> result = new ArrayList<Convertible>(attributeTableModel.getRowCount());
    for (final Attribute a : attributeTableModel.getAttributes()) {
      result.add(ProxyUtils.attributeValueToConvertible(getDelegate(), getScriptContext(), a.getValue()));
    }
    return result;
  }
View Full Code Here

    }
    return result;
  }

  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;
    }
View Full Code Here

    return result;
    }

  public List<? extends Convertible> findValues(Closure<Boolean> closure) {
    try {
      final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
      if (attributeTableModel == null) {
        return Collections.emptyList();
      }
      final ArrayList<Convertible> result = new ArrayList<Convertible>(
          attributeTableModel.getRowCount());
      for (final Attribute a : attributeTableModel.getAttributes()) {
        final Object bool = closure.call(new Object[] { a.getName(), a.getValue() });
        if (result == null) {
          throw new RuntimeException("findValues(): closure returned null instead of boolean/Boolean");
        }
        if ((Boolean) bool)
View Full Code Here

  public Object get(final int index) {
    return getAndCheckNodeAttributeTableModelForIndex(index, "get:").getValue(index);
  }

    private NodeAttributeTableModel getAndCheckNodeAttributeTableModelForIndex(final int index, String errorPrefix) {
        final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    if (attributeTableModel == null) {
      throw new IndexOutOfBoundsException(errorPrefix + index);
    }
        return attributeTableModel;
    }
View Full Code Here

    public String getKey(int index) {
    return getAndCheckNodeAttributeTableModelForIndex(index, "getKey:").getAttribute(index).getName();
    }

  public void set(final int index, final Object value) {
    final NodeAttributeTableModel attributeTableModel = getAndCheckNodeAttributeTableModelForIndex(index, "set1:");
        String oldPattern = getOldValueFormatPattern(attributeTableModel, index);
    getAttributeController().performSetValueAt(attributeTableModel, ProxyUtils.transformObject(value, oldPattern), index, 1);
  }
View Full Code Here

        String oldPattern = getOldValueFormatPattern(attributeTableModel, index);
    getAttributeController().performSetValueAt(attributeTableModel, ProxyUtils.transformObject(value, oldPattern), index, 1);
  }

  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)));
  }
View Full Code Here

    getAttributeController().removeAttribute(getDelegate(), index);
    return true;
  }

  public boolean removeAll(final String name) {
    final NodeAttributeTableModel attributeTableModel = getNodeAttributeTableModel();
    if (attributeTableModel == null) {
      return false;
    }
    final ArrayList<Integer> toRemove = new ArrayList<Integer>();
    final Vector<Attribute> attributes = attributeTableModel.getAttributes();
    for (int i = 0; i < attributes.size(); ++i) {
      if (attributes.get(i).getName().equals(name)) {
        toRemove.add(i);
      }
    }
View Full Code Here

TOP

Related Classes of org.freeplane.features.attribute.NodeAttributeTableModel

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.