Search in sources :

Example 1 with AttributeRegistry

use of org.freeplane.features.attribute.AttributeRegistry in project freeplane by freeplane.

the class MAttributeController method performReplaceAttributeValue.

@Override
public void performReplaceAttributeValue(final String name, final Object oldValue, final Object 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();
    iterator.iterate(root);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController) AttributeController(org.freeplane.features.attribute.AttributeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 2 with AttributeRegistry

use of org.freeplane.features.attribute.AttributeRegistry in project freeplane by freeplane.

the class MAttributeController method performSetVisibility.

@Override
public void performSetVisibility(final int index, final boolean isVisible) {
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    if (attributeRegistry.getElement(index).isVisible() == isVisible) {
        return;
    }
    final IActor actor = new SetAttributeVisibleActor(attributeRegistry, index, isVisible);
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel)

Example 3 with AttributeRegistry

use of org.freeplane.features.attribute.AttributeRegistry in project freeplane by freeplane.

the class MAttributeController method performRemoveAttribute.

@Override
public void performRemoveAttribute(final String name) {
    final IVisitor remover = new AttributeRemover(name);
    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);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel)

Example 4 with AttributeRegistry

use of org.freeplane.features.attribute.AttributeRegistry in project freeplane by freeplane.

the class MAttributeController method performRegistryAttributeValue.

@Override
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);
    }
}
Also used : AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) AttributeRegistryElement(org.freeplane.features.attribute.AttributeRegistryElement) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) NoSuchElementException(java.util.NoSuchElementException)

Example 5 with AttributeRegistry

use of org.freeplane.features.attribute.AttributeRegistry in project freeplane by freeplane.

the class MAttributeController method performRegistryAttribute.

@Override
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;
    }
}
Also used : AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)19 MapModel (org.freeplane.features.map.MapModel)17 IActor (org.freeplane.core.undo.IActor)13 NodeModel (org.freeplane.features.map.NodeModel)7 NoSuchElementException (java.util.NoSuchElementException)6 AttributeRegistryElement (org.freeplane.features.attribute.AttributeRegistryElement)6 ModeController (org.freeplane.features.mode.ModeController)6 ComboBoxModel (javax.swing.ComboBoxModel)5 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)3 JComboBox (javax.swing.JComboBox)2 AttributeController (org.freeplane.features.attribute.AttributeController)2 ClonedComboBoxModel (org.freeplane.features.attribute.mindmapmode.AssignAttributeDialog.ClonedComboBoxModel)2 Controller (org.freeplane.features.mode.Controller)2 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 HierarchyEvent (java.awt.event.HierarchyEvent)1 HierarchyListener (java.awt.event.HierarchyListener)1