Examples of IElementHandler


Examples of com.mxgraph.reader.mxSaxOutputHandler.IElementHandler

    while (node != null)
    {
      if (node instanceof Element)
      {
        Element elt = (Element) node;
        IElementHandler handler = handlers.get(elt.getNodeName());

        if (handler != null)
        {
          handler.parseElement(elt);
        }
      }

      node = node.getNextSibling();
    }
View Full Code Here

Examples of com.mxgraph.reader.mxSaxOutputHandler.IElementHandler

  /**
   *
   */
  protected void initHandlers()
  {
    handlers.put("save", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.save();
      }
    });

    handlers.put("restore", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.restore();
      }
    });

    handlers.put("scale", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.scale(Double.parseDouble(elt.getAttribute("scale")));
      }
    });

    handlers.put("translate", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.translate(Double.parseDouble(elt.getAttribute("dx")),
            Double.parseDouble(elt.getAttribute("dy")));
      }
    });

    handlers.put("rotate", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.rotate(Double.parseDouble(elt.getAttribute("theta")),
            elt.getAttribute("flipH").equals("1"), elt
                .getAttribute("flipV").equals("1"), Double
                .parseDouble(elt.getAttribute("cx")), Double
                .parseDouble(elt.getAttribute("cy")));
      }
    });

    handlers.put("strokewidth", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setStrokeWidth(Double.parseDouble(elt
            .getAttribute("width")));
      }
    });

    handlers.put("strokecolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setStrokeColor(elt.getAttribute("color"));
      }
    });

    handlers.put("dashed", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setDashed(elt.getAttribute("dashed").equals("1"));
      }
    });

    handlers.put("dashpattern", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setDashPattern(elt.getAttribute("pattern"));
      }
    });

    handlers.put("linecap", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setLineCap(elt.getAttribute("cap"));
      }
    });

    handlers.put("linejoin", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setLineJoin(elt.getAttribute("join"));
      }
    });

    handlers.put("miterlimit", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setMiterLimit(Double.parseDouble(elt
            .getAttribute("limit")));
      }
    });

    handlers.put("fontsize", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontSize(Double.parseDouble(elt.getAttribute("size")));
      }
    });

    handlers.put("fontcolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontColor(elt.getAttribute("color"));
      }
    });

    handlers.put("fontbackgroundcolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontBackgroundColor(elt.getAttribute("color"));
      }
    });

    handlers.put("fontbordercolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontBorderColor(elt.getAttribute("color"));
      }
    });

    handlers.put("fontfamily", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontFamily(elt.getAttribute("family"));
      }
    });

    handlers.put("fontstyle", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFontStyle(Integer.parseInt(elt.getAttribute("style")));
      }
    });

    handlers.put("alpha", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setAlpha(Double.parseDouble(elt.getAttribute("alpha")));
      }
    });

    handlers.put("fillcolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setFillColor(elt.getAttribute("color"));
      }
    });
   
    handlers.put("shadowcolor", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setShadowColor(elt.getAttribute("color"));
      }
    });
   
    handlers.put("shadowalpha", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setShadowAlpha(Double.parseDouble(elt.getAttribute("alpha")));
      }
    });
   
    handlers.put("shadowoffset", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setShadowOffset(Double.parseDouble(elt.getAttribute("dx")),
            Double.parseDouble(elt.getAttribute("dy")));
      }
    });

    handlers.put("shadow", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setShadow(elt.getAttribute("enabled").equals("1"));
      }
    });
   
    handlers.put("gradient", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.setGradient(elt.getAttribute("c1"),
            elt.getAttribute("c2"),
            Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")),
            Double.parseDouble(elt.getAttribute("w")),
            Double.parseDouble(elt.getAttribute("h")),
            elt.getAttribute("direction"),
            Double.parseDouble(getValue(elt, "alpha1", "1")),
            Double.parseDouble(getValue(elt, "alpha2", "1")));
      }
    });

    handlers.put("rect", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.rect(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")),
            Double.parseDouble(elt.getAttribute("w")),
            Double.parseDouble(elt.getAttribute("h")));
      }
    });

    handlers.put("roundrect", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.roundrect(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")),
            Double.parseDouble(elt.getAttribute("w")),
            Double.parseDouble(elt.getAttribute("h")),
            Double.parseDouble(elt.getAttribute("dx")),
            Double.parseDouble(elt.getAttribute("dy")));
      }
    });

    handlers.put("ellipse", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.ellipse(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")),
            Double.parseDouble(elt.getAttribute("w")),
            Double.parseDouble(elt.getAttribute("h")));
      }
    });

    handlers.put("image", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.image(Double.parseDouble(elt.getAttribute("x")), Double
            .parseDouble(elt.getAttribute("y")), Double
            .parseDouble(elt.getAttribute("w")), Double
            .parseDouble(elt.getAttribute("h")), elt
            .getAttribute("src"), elt.getAttribute("aspect")
            .equals("1"), elt.getAttribute("flipH").equals("1"),
            elt.getAttribute("flipV").equals("1"));
      }
    });

    handlers.put("text", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.text(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")),
            Double.parseDouble(elt.getAttribute("w")),
            Double.parseDouble(elt.getAttribute("h")),
            elt.getAttribute("str"),
            elt.getAttribute("align"),
            elt.getAttribute("valign"),
            getValue(elt, "wrap", "").equals("1"),
            elt.getAttribute("format"),
            elt.getAttribute("overflow"),
            getValue(elt, "clip", "").equals("1"),
            Double.parseDouble(getValue(elt, "rotation", "0")));
      }
    });

    handlers.put("begin", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.begin();
      }
    });

    handlers.put("move", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.moveTo(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")));
      }
    });

    handlers.put("line", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.lineTo(Double.parseDouble(elt.getAttribute("x")),
            Double.parseDouble(elt.getAttribute("y")));
      }
    });

    handlers.put("quad", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.quadTo(Double.parseDouble(elt.getAttribute("x1")),
            Double.parseDouble(elt.getAttribute("y1")),
            Double.parseDouble(elt.getAttribute("x2")),
            Double.parseDouble(elt.getAttribute("y2")));
      }
    });

    handlers.put("curve", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.curveTo(Double.parseDouble(elt.getAttribute("x1")),
            Double.parseDouble(elt.getAttribute("y1")),
            Double.parseDouble(elt.getAttribute("x2")),
            Double.parseDouble(elt.getAttribute("y2")),
            Double.parseDouble(elt.getAttribute("x3")),
            Double.parseDouble(elt.getAttribute("y3")));
      }
    });

    handlers.put("close", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.close();
      }
    });

    handlers.put("stroke", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.stroke();
      }
    });

    handlers.put("fill", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.fill();
      }
    });

    handlers.put("fillstroke", new IElementHandler()
    {
      public void parseElement(Element elt)
      {
        canvas.fillAndStroke();
      }
View Full Code Here

Examples of org.freeplane.core.io.IElementHandler

          public void setAttribute(final Object userObject, final String value) {
            final AttributeProperties ap = (AttributeProperties) userObject;
            ap.attributeObject = value;
          }
        });
    reader.addElementHandler(XML_NODE_ATTRIBUTE_LAYOUT, new IElementHandler() {
      public Object createElement(final Object parent, final String tag, final XMLElement attributes) {
        return parent;
      }
    });
    reader.addAttributeHandler(AttributeBuilder.XML_NODE_ATTRIBUTE_LAYOUT, "NAME_WIDTH", new IAttributeHandler() {
View Full Code Here

Examples of org.rssowl.core.interpreter.IElementHandler

    String name = element.getName().toLowerCase();
    String namespaceURI = element.getNamespaceURI();

    /* First check for contributed Element Handlers */
    if (getDefaultNamespaceUri().equals(namespaceURI)) {
      IElementHandler elementHandler = Owl.getInterpreter().getElementHandler(name, getRootElementName());
      if (elementHandler != null) {
        elementHandler.processElement(element, parent);
        return true;
      }
    }

    /* Second check for contributed Namespace Handlers */
 
View Full Code Here

Examples of org.rssowl.core.interpreter.IElementHandler

    String name = element.getName().toLowerCase();
    String namespaceURI = element.getNamespaceURI();

    /* First check for contributed Element Handlers */
    if (getDefaultNamespaceUri().equals(namespaceURI)) {
      IElementHandler elementHandler = Owl.getInterpreter().getElementHandler(name, getRootElementName());
      if (elementHandler != null) {
        elementHandler.processElement(element, parent);
        return true;
      }
    }

    /* Second check for contributed Namespace Handlers */
 
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.