Examples of AttributeRegistry


Examples of org.freeplane.features.attribute.AttributeRegistry

  }

  @Override
  public void performInsertRow(final NodeAttributeTableModel model, final int row, final String name, Object value) {
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    if (name.equals("")) {
      return;
    }
    try {
      final AttributeRegistryElement element = attributes.getElement(name);
      final int index = element.getValues().getIndexOf(value);
      if (index == -1) {
        if (element.isRestricted()) {
          value = element.getValues().firstElement().toString();
        }
        else {
          final IActor actor = new RegistryAttributeValueActor(element, value, false);
          Controller.getCurrentModeController().execute(actor, map);
        }
      }
    }
    catch (final NoSuchElementException ex) {
      final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
      final IActor nameActor = new RegistryAttributeActor(name, false, false, registry, map);
      Controller.getCurrentModeController().execute(nameActor, map);
      final AttributeRegistryElement element = registry.getElement(name);
      final IActor valueActor = new RegistryAttributeValueActor(element, value, false);
      Controller.getCurrentModeController().execute(valueActor, map);
    }
    final Object newValue = value;
    final IActor actor = new InsertAttributeActor(model, row, name, newValue);
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  public void performRegistryAttribute(final String name) {
    if (name.equals("")) {
      return;
    }
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    try {
      attributeRegistry.getElement(name);
    }
    catch (final NoSuchElementException ex) {
      final IActor actor = new RegistryAttributeActor(name, true, false, attributeRegistry, map);
      Controller.getCurrentModeController().execute(actor, map);
      return;
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  public void performRegistryAttributeValue(final String name, final String value, boolean manual) {
    if (name.equals("")) {
      return;
    }
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    try {
      final AttributeRegistryElement element = attributeRegistry.getElement(name);
      if (element.getValues().contains(value)) {
        return;
      }
      final IActor actor = new RegistryAttributeValueActor(element, value, manual);
      Controller.getCurrentModeController().execute(actor, map);
      return;
    }
    catch (final NoSuchElementException ex) {
      final IActor nameActor = new RegistryAttributeActor(name, true, false, attributeRegistry, map);
      Controller.getCurrentModeController().execute(nameActor, map);
      final AttributeRegistryElement element = attributeRegistry.getElement(name);
      final IActor valueActor = new RegistryAttributeValueActor(element, value, false);
      Controller.getCurrentModeController().execute(valueActor, map);
    }
  }
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

    final Iterator iterator = new Iterator(remover);
    ModeController modeController = Controller.getCurrentModeController();
    final NodeModel root = modeController.getMapController().getRootNode();
    iterator.iterate(root);
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    final IActor actor = new UnregistryAttributeActor(name, attributeRegistry, map);
    Controller.getCurrentModeController().execute(actor, map);
  }
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

    final Iterator iterator = new Iterator(remover);
    ModeController modeController = Controller.getCurrentModeController();
    final NodeModel root = modeController.getMapController().getRootNode();
    iterator.iterate(root);
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    final IActor unregistryActor = new UnregistryAttributeValueActor(attributeRegistry.getElement(name), value);
    Controller.getCurrentModeController().execute(unregistryActor, map);
  }
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  public void performReplaceAtributeName(final String oldName, final String newName) {
    if (oldName.equals("") || newName.equals("") || oldName.equals(newName)) {
      return;
    }
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    final int iOld = registry.getElements().indexOf(oldName);
    final AttributeRegistryElement oldElement = registry.getElement(iOld);
    final SortedComboBoxModel values = oldElement.getValues();
    final IActor registryActor = new RegistryAttributeActor(newName, oldElement.isManual(), oldElement.isVisible(),
        registry, map);
    Controller.getCurrentModeController().execute(registryActor, map);
    final AttributeRegistryElement newElement = registry.getElement(newName);
    for (int i = 0; i < values.getSize(); i++) {
      final IActor registryValueActor = new RegistryAttributeValueActor(newElement, values.getElementAt(i)
          .toString(), false);
      Controller.getCurrentModeController().execute(registryValueActor, map);
    }
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  @Override
  public void performReplaceAttributeValue(final String name, final String oldValue, final String newValue) {
    Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    ModeController modeController = controller.getModeController();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    final IActor actor = new ReplaceAttributeValueActor(registry, name, oldValue, newValue);
    Controller.getCurrentModeController().execute(actor, map);
    final IVisitor replacer = new AttributeChanger(name, oldValue, newValue);
    final Iterator iterator = new Iterator(replacer);
    final NodeModel root = modeController.getMapController().getRootNode();
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

      return;
    }
    final IActor actor = new IActor() {
      public void act() {
        final MapModel map = Controller.getCurrentModeController().getController().getMap();
        final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
        attributeRegistry.setFontSize(size);
      }

      public String getDescription() {
        return "SetAttributeFontSizeActor";
      }

      public void undo() {
        final MapModel map = Controller.getCurrentModeController().getController().getMap();
        final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
        attributeRegistry.setFontSize(oldSize);
      }
    };
    Controller.getCurrentModeController().execute(actor, Controller.getCurrentModeController().getController().getMap());
  }
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  @Override
  public void performSetRestriction(final int index, final boolean isRestricted) {
    boolean currentValue;
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    if (index == AttributeRegistry.GLOBAL) {
      currentValue = registry.isRestricted();
    }
    else {
      currentValue = registry.getElement(index).isRestricted();
    }
    if (currentValue == isRestricted) {
      return;
    }
    final IActor actor = new SetAttributeRestrictedActor(registry, index, isRestricted);
View Full Code Here

Examples of org.freeplane.features.attribute.AttributeRegistry

  @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();
        final AttributeRegistryElement element = registry.getElement(name);
        final int index = element.getValues().getIndexOf(o);
        if (index == -1) {
          final IActor registryActor = new RegistryAttributeValueActor(element, o, false);
          Controller.getCurrentModeController().execute(registryActor, map);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.