Package com.lightcrafts.utils.xml

Examples of com.lightcrafts.utils.xml.XmlNode


        printer.println("batch name: " + name);
        printer.println("output folder: " + directory.getAbsolutePath());
        printer.println("export options:");
        printer.flush();
        XmlDocument doc = new XmlDocument("Export");
        XmlNode root = doc.getRoot();
        export.write(root);
        try {
            doc.write(out);
        }
        catch (IOException e) {
View Full Code Here


            try {
                InputStream in = new ByteArrayInputStream(
                    text.getBytes("UTF-8")
                );
                XmlDocument doc = new XmlDocument(in);
                XmlNode root = doc.getRoot();
                export = (ImageFileExportOptions) ImageExportOptions.read(root);
            }
            catch (IOException e) {
                System.err.print(
                    "Error reading BatchConfig preferences: "
View Full Code Here

    /**
     * Construct a LightweightDocument from the XML content already extracted.
     */
    public LightweightDocument(File file, XmlDocument doc) throws XMLException {
        XmlNode root = doc.getRoot();
        XmlNode imageNode = root.getChild("Image");
        String path = imageNode.getAttribute("path");
        imageFile = new File(path);
        if (! imageFile.isFile()) {
            if (imageNode.hasAttribute("relativePath")) {
                String relativepath = imageNode.getAttribute("relativePath");
                File relativeFile =
                    RelativePathUtility.getRelativeFile(file, relativepath);
                if (relativeFile.isFile()) {
                    imageFile = relativeFile;
                }
View Full Code Here

                // iteration.
                export.resizeWidth.setValue(exportWidth);
                export.resizeHeight.setValue(exportHeight);

                if (template != null) {
                    XmlNode root = template.getRoot();

                    doc.applyTemplate(root);

                    SaveOptions save = doc.getSaveOptions();
                    if (save == null) {
View Full Code Here

    private final static String ColorTag = "Color";

    public void save(XmlNode node) {
        super.save(node);
        Color color = getColor();
        XmlNode colorNode = node.addChild(ColorTag);
        colorNode.setAttribute("r", Integer.toString(color.getRed()));
        colorNode.setAttribute("g", Integer.toString(color.getGreen()));
        colorNode.setAttribute("b", Integer.toString(color.getBlue()));
    }
View Full Code Here

        colorNode.setAttribute("b", Integer.toString(color.getBlue()));
    }

    public void restore(XmlNode node) throws XMLException {
        super.restore(node);
        XmlNode whiteNode = node.getChild(ColorTag);
        int r = Integer.parseInt(whiteNode.getAttribute("r"));
        int g = Integer.parseInt(whiteNode.getAttribute("g"));
        int b = Integer.parseInt(whiteNode.getAttribute("b"));
        Color color = new Color(r, g, b);
        undoSupport.restoreStart();
        setColor(color, false);
        undoSupport.restoreEnd();
    }
View Full Code Here

    }

    void save( XmlNode node ) {
        final RGBColorSelection cs = m_op.getColorSelection();

        final XmlNode colorNode = node.addChild( ColorSelectionKey );

        colorNode.setAttribute(
            HueRedKey, Float.toString( cs.red )
        );
        colorNode.setAttribute(
            HueGreenKey, Float.toString( cs.green )
        );
        colorNode.setAttribute(
            HueBlueKey, Float.toString( cs.blue )
        );
        colorNode.setAttribute(
            HueRadiusKey, Float.toString( cs.radius )
        );
        colorNode.setAttribute(
            HueEnabledKey, Boolean.toString( cs.isColorEnabled )
        );
        colorNode.setAttribute(
            LuminosityLowerKey,
            Float.toString( cs.luminosityLower )
        );
        colorNode.setAttribute(
            LuminosityLowerFeatherKey,
            Float.toString( cs.luminosityLowerFeather )
        );
        colorNode.setAttribute(
            LuminosityUpperKey,
            Float.toString( cs.luminosityUpper )
        );
        colorNode.setAttribute(
            LuminosityUpperFeatherKey,
            Float.toString( cs.luminosityUpperFeather )
        );
        colorNode.setAttribute(
            LuminosityEnabledKey,
            Boolean.toString( cs.isLuminosityEnabled )
        );
        colorNode.setAttribute(
            InvertedKey,
            Boolean.toString( cs.isInverted )
        );
    }
View Full Code Here

    }

    private void validate() throws XMLException {
        // Explore the structure of the XmlDocument enough to make sure the
        // other methods of this class will not encounter XMLExceptions.
        XmlNode controls = getControlNode();
        if (controls == null) {
            throw new XMLException("No Control node");
        }
        XmlNode[] tools = getToolNodes();
        XmlNode[] regions = getRegionNodes();
View Full Code Here

        }
        return names.toArray(new String[0]);
    }

    void removeTool(int index) {
        XmlNode controls = getControlNode();
        XmlNode tool = getToolNode(index);
        XmlNode region = getRegionNode(index);
        controls.removeChild(tool);
        controls.removeChild(region);
    }
View Full Code Here

    private XmlNode getRegionNode(int index) {
        return getRegionNodes()[index];
    }

    private XmlNode[] getToolNodes() {
        XmlNode controls = getControlNode();
        XmlNode[] nodes = controls.getChildren();
        ArrayList<XmlNode> tools = new ArrayList<XmlNode>();
        for (XmlNode node : nodes) {
            if (isToolNode(node)) {
                tools.add(node);
            }
View Full Code Here

TOP

Related Classes of com.lightcrafts.utils.xml.XmlNode

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.