Package org.freeplane.features.map

Examples of org.freeplane.features.map.NodeModel


  }
 
  private int getStyleMinWidth(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for(IStyle styleKey : styleKeys){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeSizeModel sizeModel = NodeSizeModel.getModel(styleNode);
      if (sizeModel == null) {
View Full Code Here


    return ResourceController.getResourceController().getIntProperty("defaultfontsize", 10);
  }

  public Font getDefaultFont(final MapModel map, final IStyle style) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    final NodeModel styleNode = model.getStyleNodeSafe(style);
    return getFont(styleNode);
  }
View Full Code Here

    Boolean bold = null;
        Boolean italic = null;
        String fontFamilyName = null;
        Integer fontSize = null;
    for(IStyle styleKey : collection){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
      if (styleModel == null) {
View Full Code Here

  }

  private String getStyleShape(final MapModel map, final Collection<IStyle> style) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for(IStyle styleKey : style){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
      if (styleModel == null) {
View Full Code Here

  }

  private Color getStyleTextColor(final MapModel map, final Collection<IStyle> collection) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for(IStyle styleKey : collection){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
      if (styleModel == null) {
View Full Code Here

    return null;
  }

  public void endElement(final Object parent, final String tag, final Object userObject, final XMLElement dom) {
    if (parent instanceof NodeModel) {
      final NodeModel node = (NodeModel) parent;
      if (tag.equals("font")) {
        final FontProperties fp = (FontProperties) userObject;
        NodeStyleModel nodeStyleModel = NodeStyleModel.getModel(node);
        if (nodeStyleModel == null) {
          nodeStyleModel = new NodeStyleModel();
          node.addExtension(nodeStyleModel);
        }
        nodeStyleModel.setFontFamilyName(fp.fontName);
        nodeStyleModel.setFontSize(fp.fontSize);
        nodeStyleModel.setItalic(fp.isItalic);
        nodeStyleModel.setBold(fp.isBold);
View Full Code Here

  private void registerAttributeHandlers(final ReadManager reader) {
    final IAttributeHandler colorHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        if (value.length() == 7) {
          final NodeModel node = (NodeModel) userObject;
          NodeStyleModel.setColor(node, ColorUtils.stringToColor(value));
        }
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "COLOR", colorHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "COLOR", colorHandler);
    final IAttributeHandler bgHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        if (value.length() == 7) {
          final NodeModel node = (NodeModel) userObject;
          NodeStyleModel.setBackgroundColor(node, ColorUtils.stringToColor(value));
        }
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "BACKGROUND_COLOR", bgHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "BACKGROUND_COLOR", bgHandler);
    final IAttributeHandler styleHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final NodeModel node = (NodeModel) userObject;
        NodeStyleModel.setShape(node, value);
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "STYLE", styleHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "STYLE", styleHandler);
    reader.addAttributeHandler("font", "SIZE", new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final FontProperties fp = (FontProperties) userObject;
        fp.fontSize = Integer.parseInt(value.toString());
      }
    });
    reader.addAttributeHandler("font", "NAME", new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final FontProperties fp = (FontProperties) userObject;
        fp.fontName = value;
      }
    });
    reader.addAttributeHandler("font", "BOLD", new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final FontProperties fp = (FontProperties) userObject;
        fp.isBold = value.equals("true");
      }
    });
    reader.addAttributeHandler("font", "ITALIC", new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final FontProperties fp = (FontProperties) userObject;
        fp.isItalic = value.equals("true");
      }
    });
    final IAttributeHandler nodenumberingHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final NodeModel node = (NodeModel) userObject;
        NodeStyleModel.setNodeNumbering(node, value.equals("true"));
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "NUMBERED", nodenumberingHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "NUMBERED", nodenumberingHandler);

    final IAttributeHandler formatHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final NodeModel node = (NodeModel) userObject;
        NodeStyleModel.setNodeFormat(node, value);
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "FORMAT", formatHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "FORMAT", formatHandler);
    if (FreeplaneVersion.getVersion().isOlderThan(new FreeplaneVersion(1, 3, 0))) {
      // compatibility for a view 1.2.X preview versions - remove after release 1.3
      reader.addAttributeHandler(NodeBuilder.XML_NODE, "TEMPLATE", formatHandler);
      reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "TEMPLATE", formatHandler);
    }

    final IAttributeHandler nodeMaxNodeWidthHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final NodeModel node = (NodeModel) userObject;
        NodeSizeModel.setNodeMaxNodeWidth(node, Integer.valueOf(value));
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "MAX_WIDTH", nodeMaxNodeWidthHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "MAX_WIDTH", nodeMaxNodeWidthHandler);

    final IAttributeHandler nodeMinWidthHandler = new IAttributeHandler() {
      public void setAttribute(final Object userObject, final String value) {
        final NodeModel node = (NodeModel) userObject;
        NodeSizeModel.setNodeMinWidth(node, Integer.valueOf(value));
      }
    };
    reader.addAttributeHandler(NodeBuilder.XML_NODE, "MIN_WIDTH", nodeMinWidthHandler);
    reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, "MIN_WIDTH", nodeMinWidthHandler);
View Full Code Here

  public void writeAttributes(final ITreeWriter writer, final Object userObject, final String tag) {
    final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
    if (!forceFormatting) {
      return;
    }
    final NodeModel node = (NodeModel) userObject;
    writeAttributes(writer, node, (NodeStyleModel)null, true);
    writeAttributes(writer, node, (NodeSizeModel)null, true);
  }
View Full Code Here

  public void writeContent(final ITreeWriter writer, final Object userObject, final String tag) throws IOException {
    final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
    if (!forceFormatting) {
      return;
    }
    final NodeModel node = (NodeModel) userObject;
    writeContent(writer, node, null, true);
  }
View Full Code Here

  public void actionPerformed(final ActionEvent e) {
    Color selectedColor = null;
    ModeController controller;
    {
      controller = Controller.getCurrentModeController();
      final NodeModel selected = controller.getMapController().getSelectedNode();
      final MCloudController cloudController = (MCloudController) CloudController
          .getController();
      cloudController.setCloud(selected, true);
      selectedColor = cloudController.getColor(selected);
    }
View Full Code Here

TOP

Related Classes of org.freeplane.features.map.NodeModel

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.