Package org.freeplane.features.attribute

Examples of org.freeplane.features.attribute.Attribute


  }

  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


  }

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

        final Object value = attributeTableModel.getAttribute(index).getValue();
        return (value instanceof IFormattedObject) ? ((IFormattedObject) value).getPattern() : null;
    }

    public void add(final String name, final Object value) {
    final Attribute attribute = new Attribute(name, ProxyUtils.transformObject(value, null));
    getAttributeController().addAttribute(getDelegate(), attribute);
  }
View Full Code Here

                return iterator.hasNext();
            }

            @Override
            public Map.Entry<String, Object> next() {
                final Attribute attribute = iterator.next();
                return new Map.Entry<String, Object>() {

                    @Override
                    public String getKey() {
                        return attribute.getName();
                    }

                    @Override
                    public Object getValue() {
                        return attribute.getValue();
                    }

                    @Override
                    public Object setValue(Object value) {
                        final Object oldValue = attribute.getValue();
                        attribute.setValue(value);
                        return oldValue;
                    }
                    ;
                };
            }
View Full Code Here

      this.model = model;
      this.value = value;
    }

    public void act() {
      final Attribute newAttribute = new Attribute(name, value);
      model.getAttributes().add(row, newAttribute);
      model.fireTableRowsInserted(row, row);
    }
View Full Code Here

  private class RemoveAttributeActor implements IActor {
    final private InsertAttributeActor insertActor;

    private RemoveAttributeActor(final NodeAttributeTableModel model, final int row) {
      final Attribute attribute = model.getAttribute(row);
      final String name = attribute.getName();
      final Object value = attribute.getValue();
      insertActor = new InsertAttributeActor(model, row, name, value);
    }
View Full Code Here

    modeController.addAction(new SetBooleanMapPropertyAction(SHOW_ICON_FOR_ATTRIBUTES));
  }

  public int editAttribute(final NodeModel pNode, final String pName, final String pNewValue) {
    createAttributeTableModel(pNode);
    final Attribute newAttribute = new Attribute(pName, pNewValue);
    final NodeAttributeTableModel attributes = NodeAttributeTableModel.getModel(pNode);
    for (int i = 0; i < attributes.getRowCount(); i++) {
      if (pName.equals(attributes.getAttribute(i).getName())) {
        if (pNewValue != null) {
          setAttribute(pNode, i, newAttribute);
View Full Code Here

    Controller.getCurrentModeController().execute(actor, map);
  }

  @Override
  public void performSetValueAt(final NodeAttributeTableModel model, final Object o, final int row, final int col) {
    final Attribute attribute = model.getAttribute(row);
    final MapModel map = model.getNode().getMap();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    switch (col) {
      case 0: {
        final String name = o.toString().trim();
        final String oldName = attribute.getName();
        if (oldName.equals(name)) {
          return;
        }
        final IActor nameActor = new SetAttributeNameActor(model, name, oldName, row);
        Controller.getCurrentModeController().execute(nameActor, map);
        try {
          final AttributeRegistryElement element = registry.getElement(name);
          final String value = model.getValueAt(row, 1).toString();
          final int index = element.getValues().getIndexOf(value);
          if (index == -1) {
            final IActor valueActor = new SetAttributeValueActor(model, row, element.getValues().firstElement());
            Controller.getCurrentModeController().execute(valueActor, map);
          }
        }
        catch (final NoSuchElementException ex) {
          final IActor registryActor = new RegistryAttributeActor(name, false, false, registry, map);
          Controller.getCurrentModeController().execute(registryActor, map);
        }
        break;
      }
      case 1: {
        if (attribute.getValue().equals(o)) {
          return;
        }
        final IActor actor = new SetAttributeValueActor(model, row, o);
        Controller.getCurrentModeController().execute(actor, map);
        final String name = model.getValueAt(row, 0).toString();
View Full Code Here

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

    @Override
    protected void performAction(final NodeModel model) {
      final NodeAttributeTableModel attributes = NodeAttributeTableModel.getModel(model);
      for (int i = attributes.getRowCount() - 1; i >= 0; i--) {
        final Attribute attribute = attributes.getAttribute(i);
        if (attribute.getName().equals(name) && attribute.getValue().equals(value)) {
          attributeController.performRemoveRow(attributes, i);
          attributeController.performInsertRow(attributes, i, replacingName, replacingValue);
        }
      }
    }
View Full Code Here

TOP

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

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.