Package org.freeplane.features.attribute

Examples of org.freeplane.features.attribute.AttributeRegistryElement


      this.visible = visible;
      this.map = map;
    }

    public void act() {
      final AttributeRegistryElement attributeRegistryElement = new AttributeRegistryElement(registry, name);
      attributeRegistryElement.setManual(manual);
      attributeRegistryElement.setVisibility(visible);
      final int index = registry.getElements().add(name, attributeRegistryElement);
      registry.getTableModel().fireTableRowsInserted(index, index);
      if (manual || visible) {
        final ModeController modeController = Controller.getCurrentModeController();
        modeController.getMapController().setSaved(map, false);
View Full Code Here


    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

      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

      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

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

  private void selectedAttributeChanged(final Object selectedAttributeName, final JComboBox values) {
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    try {
      final AttributeRegistryElement element = attributes.getElement(selectedAttributeName.toString());
      final ComboBoxModel selectedValues = element.getValues();
      values.setModel(new ClonedComboBoxModel(selectedValues));
      try {
        final Object firstValue = selectedValues.getElementAt(0);
        values.setSelectedItem(firstValue);
      }
      catch (final ArrayIndexOutOfBoundsException ex) {
      }
      values.setEditable(!element.isRestricted());
    }
    catch (final NoSuchElementException ex) {
      values.setEditable(!selectedAttributeName.toString().equals(""));
    }
  }
View Full Code Here

  private void createAttributeSubTrees(final DefaultMutableTreeNode mapInfo, final AttributeRegistry attributes) {
    if (attributes == null) {
      return;
    }
    for (int i = 0; i < attributes.size(); i++) {
      final AttributeRegistryElement element = attributes.getElement(i);
      final TreeNodeInfo treeNodeInfo = new AttributeTreeNodeInfo(element.getKey().toString(), element
          .isRestricted());
      final DefaultMutableTreeNode attributeInfo = new DefaultMutableTreeNode(treeNodeInfo);
      createValueSubTrees(attributeInfo, element, currentAttributes);
      if (attributeInfo.getChildCount() != 0) {
        mapInfo.add(attributeInfo);
View Full Code Here

  protected void selectedAttributeChanged(final Object selectedAttributeName, final JComboBox values) {
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    try {
      final AttributeRegistryElement element = attributes.getElement(selectedAttributeName.toString());
      final ComboBoxModel selectedValues = element.getValues();
      values.setModel(new ClonedComboBoxModel(selectedValues));
      try {
        final Object firstValue = selectedValues.getElementAt(0);
        values.setSelectedItem(firstValue);
      }
      catch (final ArrayIndexOutOfBoundsException ex) {
      }
      values.setEditable(!element.isRestricted());
    }
    catch (final NoSuchElementException ex) {
      values.setEditable(!selectedAttributeName.toString().equals(""));
    }
  }
View Full Code Here

TOP

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

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.