Search in sources :

Example 86 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class EdgeStyleAction method setSelected.

@Override
public void setSelected() {
    final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final EdgeModel model = EdgeModel.getModel(node);
    if (model != null) {
        if (mStyle.equals(model.getStyle())) {
            setSelected(true);
            return;
        }
    }
    setSelected(false);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 87 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class EdgeWidthAction method setSelected.

@Override
public void setSelected() {
    final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final EdgeModel model = EdgeModel.getModel(node);
    if (model == null) {
        if (mWidth == EdgeModel.WIDTH_PARENT) {
            setSelected(true);
            return;
        }
    } else if (model.getWidth() == mWidth) {
        setSelected(true);
        return;
    }
    setSelected(false);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 88 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class AddAttributeAction method actionPerformed.

public void actionPerformed(final ActionEvent arg0) {
    final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
    final int selection = UITools.showConfirmDialog(Controller.getCurrentController().getSelection().getSelected(), getPanel(), TextUtils.getText("attributes_AddAttributeAction.text"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    // OK button pressed
    if (selection == JOptionPane.OK_OPTION) {
        if (attributeNames.getSelectedItem() == null) {
            UITools.showAttributeEmptyStringErrorMessage();
            return;
        }
        final String name = attributeNames.getSelectedItem().toString();
        if (name.equals("")) {
            UITools.showAttributeEmptyStringErrorMessage();
            return;
        }
        final Object valueSelectedItem = attributeValues.getSelectedItem();
        final String value = valueSelectedItem != null ? valueSelectedItem.toString() : "";
        // Add attributes to nodes
        for (final NodeModel node : nodes) {
            final NodeAttributeTableModel attributes = attrContr.createAttributeTableModel(node);
            attrContr.performInsertRow(attributes, attributes.getRowCount(), name, value);
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) NodeAttributeTableModel(org.freeplane.features.attribute.NodeAttributeTableModel)

Example 89 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class AttributeBuilder method endElement.

public void endElement(final Object parent, final String tag, final Object userObject, final XMLElement dom) {
    /* attributes */
    if (tag.equals(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME)) {
        final RegisteredAttributeProperties rap = (RegisteredAttributeProperties) userObject;
        if (rap.visible) {
            AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setVisibility(true);
        }
        if (rap.restricted) {
            AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setRestriction(true);
        }
        if (rap.manual) {
            AttributeRegistry.getRegistry(getMap()).getElement(rap.attributeName).setManual(true);
        }
        return;
    }
    if (tag.equals(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE)) {
        final AttributeProperties ap = (AttributeProperties) userObject;
        final RegisteredAttributeProperties rap = (RegisteredAttributeProperties) ap.parent;
        final Attribute attribute = new Attribute(rap.attributeName, ap.getValue());
        final AttributeRegistry r = AttributeRegistry.getRegistry(getMap());
        r.registry(attribute);
    }
    if (parent instanceof NodeModel) {
        final NodeModel node = (NodeModel) parent;
        if (tag.equals(AttributeBuilder.XML_NODE_ATTRIBUTE)) {
            final AttributeProperties ap = (AttributeProperties) userObject;
            final Attribute attribute = new Attribute(ap.attributeName, ap.getValue());
            attributeController.createAttributeTableModel(node);
            final NodeAttributeTableModel model = NodeAttributeTableModel.getModel(node);
            model.addRowNoUndo(attribute);
            return;
        }
        return;
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel)

Example 90 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class AttributeBuilder method registerBy.

/**
 */
public void registerBy(final ReadManager reader, final WriteManager writer) {
    reader.addElementHandler("attribute_registry", this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_ATTRIBUTE, this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME, this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE, this);
    writer.addExtensionElementWriter(NodeAttributeTableModel.class, new IExtensionElementWriter() {

        public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
            final NodeAttributeTableModel attributes = (NodeAttributeTableModel) extension;
            save((NodeModel) node, attributes, writer);
        }
    });
    writer.addExtensionElementWriter(AttributeRegistry.class, new IExtensionElementWriter() {

        public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
            final AttributeRegistry attributes = (AttributeRegistry) extension;
            attributes.write(writer);
        }
    });
    registerAttributeHandlers(reader);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IExtension(org.freeplane.core.extension.IExtension) ITreeWriter(org.freeplane.core.io.ITreeWriter) IOException(java.io.IOException) IExtensionElementWriter(org.freeplane.core.io.IExtensionElementWriter)

Aggregations

NodeModel (org.freeplane.features.map.NodeModel)450 ModeController (org.freeplane.features.mode.ModeController)100 MapModel (org.freeplane.features.map.MapModel)53 Controller (org.freeplane.features.mode.Controller)46 MapStyleModel (org.freeplane.features.styles.MapStyleModel)46 MMapController (org.freeplane.features.map.mindmapmode.MMapController)39 MapController (org.freeplane.features.map.MapController)38 Point (java.awt.Point)37 IStyle (org.freeplane.features.styles.IStyle)36 IActor (org.freeplane.core.undo.IActor)34 IMapSelection (org.freeplane.features.map.IMapSelection)33 ArrayList (java.util.ArrayList)22 NodeView (org.freeplane.view.swing.map.NodeView)20 URI (java.net.URI)19 Color (java.awt.Color)18 Component (java.awt.Component)17 ResourceController (org.freeplane.core.resources.ResourceController)17 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)15