Package com.lightcrafts.utils.xml

Examples of com.lightcrafts.utils.xml.XmlNode


        // Loop until a unique name is selected or the dialog is cancelled:
        boolean done = false;
        TemplateKey key;
        do {
            XmlDocument xml = new XmlDocument("Template")// See Document()
            XmlNode root = xml.getRoot();
            doc.saveTemplate(root);

            SaveTemplateDialog dialog = new SaveTemplateDialog();
            ImageMetadata meta = doc.getMetadata();
            key = dialog.showDialog(meta, xml, namespace, frame);
View Full Code Here


            return;
        }
        try {
            XmlDocument template = TemplateDatabase.getTemplateDocument(key);
            if (template != null) {
                XmlNode root = template.getRoot();
                doc.applyTemplate(root);
            }
            else {
                showError(
                    LOCALE.get("TemplateNameError", key.toString()), null, frame
View Full Code Here

            if ( lznDoc != null ) {
                final XmlDocument xmlDoc =
                    new XmlDocument( lznDoc.getDocumentElement() );
                // The original image may be in the same file,
                // or referenced through a path pointer:
                final XmlNode root = xmlDoc.getRoot();
                // (tag copied from ui.editor.Document)
                final XmlNode imageNode = root.getChild( "Image" );
                // (tag written in export())
                if ( imageNode.hasAttribute( "self" ) )
                    return MultipageTIFFImageType.INSTANCE;
                else
                    return SidecarTIFFImageType.INSTANCE;
            }
        }
View Full Code Here

        if (bounds.isAngleOnly()) {
            double angle = bounds.getAngle();
            node.setAttribute(AngleTag, Double.toString(angle));
        }
        else {
            XmlNode ulNode = node.addChild(ULtag);
            Point2D ul = bounds.getUpperLeft();
            ulNode.setAttribute(Xtag, Double.toString(ul.getX()));
            ulNode.setAttribute(Ytag, Double.toString(ul.getY()));

            XmlNode urNode = node.addChild(URtag);
            Point2D ur = bounds.getUpperRight();
            urNode.setAttribute(Xtag, Double.toString(ur.getX()));
            urNode.setAttribute(Ytag, Double.toString(ur.getY()));

            XmlNode llNode = node.addChild(LLtag);
            Point2D ll = bounds.getLowerLeft();
            llNode.setAttribute(Xtag, Double.toString(ll.getX()));
            llNode.setAttribute(Ytag, Double.toString(ll.getY()));

            XmlNode lrNode = node.addChild(LRtag);
            Point2D lr = bounds.getLowerRight();
            lrNode.setAttribute(Xtag, Double.toString(lr.getX()));
            lrNode.setAttribute(Ytag, Double.toString(lr.getY()));
        }
    }
View Full Code Here

            double x, y;
            Point2D.Double ul, ur, ll, lr;

            try {
                XmlNode ulNode = node.getChild(ULtag);
                x = Double.parseDouble(ulNode.getAttribute(Xtag));
                y = Double.parseDouble(ulNode.getAttribute(Ytag));
                ul = new Point2D.Double(x, y);

                XmlNode urNode = node.getChild(URtag);
                x = Double.parseDouble(urNode.getAttribute(Xtag));
                y = Double.parseDouble(urNode.getAttribute(Ytag));
                ur = new Point2D.Double(x, y);

                XmlNode llNode = node.getChild(LLtag);
                x = Double.parseDouble(llNode.getAttribute(Xtag));
                y = Double.parseDouble(llNode.getAttribute(Ytag));
                ll = new Point2D.Double(x, y);

                XmlNode lrNode = node.getChild(LRtag);
                x = Double.parseDouble(lrNode.getAttribute(Xtag));
                y = Double.parseDouble(lrNode.getAttribute(Ytag));
                lr = new Point2D.Double(x, y);
            }
            catch (NumberFormatException e) {
                throw new XMLException("Invalid crop coordinates", e);
            }
View Full Code Here

    /**
     * Preserve state under the given XmlNode.
     */
    public void save(XmlNode node) {
        for (OpControl control : opControls) {
            XmlNode child;
            if (control instanceof ZoneControl) {
                child = node.addChild(ZoneTag);
            }
            else if (control instanceof CloneControl) {
                child = node.addChild(CloneTag);
            }
            else if (control instanceof SpotControl) {
                child = node.addChild(SpotTag);
            }
            else if (control instanceof WhitePointControl) {
                // WhitePointOperation is deprecated.
                child = node.addChild(WhitePointTag);
            }
            else {
                child = node.addChild(GenericTag);
                GenericOperation op = (GenericOperation) control.getOperation();
                OperationType opType = op.getType();
                child.setAttribute(OpTypeTag, opType.getName());
            }
            control.save(child);
        }
    }
View Full Code Here

    ) throws IOException {
        // Construct the LZN data that encode the Document's state:
        XmlDocument xml = new XmlDocument(
            Application.LznNamespace, "LightZoneTransform"
        );
        XmlNode root = xml.getRoot();
        doc.save(root);

        // Try/catch XML manipulation errors:
        try {
            // The next steps depend on the SaveOptions:
View Full Code Here

    private static void mangleLznSidecarFile(XmlDocument xml, File file)
        throws XMLException
    {
        // Tags cloned from com.lightcrafts.ui.editor.Document:
        XmlNode root = xml.getRoot();
        XmlNode imageNode = root.getChild("Image");
        imageNode.setAttribute("path", file.getAbsolutePath());
        imageNode.setAttribute("relativePath", file.getName());
    }
View Full Code Here

    private static void mangleLznMultilayerTiff(XmlDocument xml)
        throws XMLException
    {
        // Tags cloned from com.lightcrafts.ui.editor.Document:
        XmlNode root = xml.getRoot();
        XmlNode imageNode = root.getChild("Image");
        imageNode.setAttribute("path", "");
        imageNode.setAttribute("relativePath", "");
        imageNode.setAttribute("self", "true");
    }
View Full Code Here

                    if (lznDoc != null) {
                        xmlDoc = new XmlDocument(lznDoc.getDocumentElement());
                        if (xmlDoc != null) {
                            // The original image may be in the same file,
                            // or referenced through a path pointer:
                            XmlNode root = xmlDoc.getRoot();
                            // (tag copied from ui.editor.Document)
                            XmlNode imageNode = root.getChild("Image");
                            // (tag written in export())
                            if ( imageNode.hasAttribute("self")) {
                                imageFile = file;
                            }
                            else {
                                LightweightDocument lwDoc =
                                    new LightweightDocument(file, xmlDoc);
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.