Example #1
0
        public virtual void testGetTarget()
        {
            JDFDoc          d     = JDFTestCaseBase.creatXMDoc();
            JDFNode         n     = d.getJDFRoot();
            JDFExposedMedia xm    = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0);
            JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1");

            mPart.put("SignatureName", "S12234");
            mPart.put("SheetName", "S12");
            mPart.put("Side", "Front");
            JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia        m      = xm.getMedia();

            m = (JDFMedia)m.makeRootResource(null, null, true);
            xmPart.refElement(m);
            Assert.AreEqual(xmPart.getMedia(), m);
            mPart.put("Side", "Back");
            xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys());

            xmPart.refElement(medPart);
            Assert.AreEqual(xmPart.getMedia(), medPart);
            JDFRefElement re = (JDFRefElement)xmPart.getElement("MediaRef");

            Assert.AreEqual(re.getPartMap(), mPart);
        }
Example #2
0
        public virtual void testInlineRefelement()
        {
            JDFDoc          d     = JDFTestCaseBase.creatXMDoc();
            JDFNode         n     = d.getJDFRoot();
            JDFExposedMedia xm    = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0);
            JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1");

            mPart.put("SignatureName", "S12234");
            mPart.put("SheetName", "S12");
            mPart.put("Side", "Front");
            JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia        m      = xm.getMedia();

            m = (JDFMedia)m.makeRootResource(null, null, true);
            m.setGrainDirection(EnumGrainDirection.XDirection);
            xmPart.refElement(m);
            Assert.AreEqual(xmPart.getMedia(), m);
            mPart.put("Side", "Back");
            xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys());

            xmPart.refElement(medPart);
            Assert.AreEqual(xmPart.getMedia(), medPart);
            JDFRefElement re          = (JDFRefElement)xmPart.getElement("MediaRef");
            JDFMedia      inlineMedia = (JDFMedia)re.inlineRef();

            Assert.IsNull(xmPart.getElement_KElement("MediaRef", null, 0));
            Assert.AreEqual(EnumGrainDirection.XDirection, inlineMedia.getGrainDirection());
            Assert.AreEqual(xmPart.getMedia(), inlineMedia);
            Assert.IsFalse(inlineMedia.hasAttribute("ID"));
        }
Example #3
0
        protected internal static JDFDoc creatXMDoc()
        {
            JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_3);
            JDFDoc  doc = new JDFDoc("JDF");
            JDFNode n   = doc.getJDFRoot();

            n.setJobPartID("P1");
            n.setJobID("J1");
            n.setType("ConventionalPrinting", true);
            n.appendElement("NS:Foobar", "www.foobar.com");

            n.appendMatchingResource("Layout", JDFNode.EnumProcessUsage.AnyInput, null);
            JDFComponent    comp = (JDFComponent)n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null);
            JDFExposedMedia xm   = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null);
            JDFNodeInfo     ni   = n.appendNodeInfo();
            JDFMedia        m    = xm.appendMedia();

            m.appendElement("NS:FoobarMedia", "www.foobar.com");

            Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass(), "m Class");

            VString vs = new VString();

            vs.Add("SignatureName");
            vs.Add("SheetName");
            vs.Add("Side");

            JDFAttributeMap mPart1 = new JDFAttributeMap("SignatureName", "Sig1");

            mPart1.put("SheetName", "S1");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SheetName", "S2");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SignatureName", "Sig2");
            mPart1.put("SheetName", "S1");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);
            comp.appendElement("foo:bar", "www.foobar.com");

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SheetName", "S2");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);
            return(doc);
        }
Example #4
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal virtual void initPlateXM(EnumUsage usage)
        {
            JDFResourceLink rl = null;

            if (thePreviousNode != null) // either input (for cp, or output for
            // plateset)
            {
                rl = theNode.linkResource(thePreviousNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            if (rl == null && theParentNode != null)
            {
                rl = theNode.ensureLink(theParentNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            JDFExposedMedia xm = (JDFExposedMedia)theNode.getCreateResource(ElementName.EXPOSEDMEDIA, usage, 0);

            xm.setPartUsage(EnumPartUsage.Explicit);
            rl = theNode.getLink(xm, null);

            JDFMedia m = ((JDFExposedMedia)xm.getLeaves(false)[0]).getMedia();

            if (m == null)
            {
                m = initPlateMedia();
            }
            else
            {
                m = (JDFMedia)m.getResourceRoot();
                if (theParentNode != null)
                {
                    theNode.ensureLink(theParentNode.getResource("Media", EnumUsage.Input, 0), EnumUsage.Input, null);
                }
            }
            xm.setResStatus(EnumResStatus.Unavailable, false);
            if (!bPartitionedPlateMedia && xm.getMedia() == null)
            {
                xm.refElement(m);
            }
            if (EnumUsage.Input.Equals(usage))
            {
                rl.setProcessUsage(EnumProcessUsage.Plate);
                JDFResourceLink link = theNode.getLink(m, null);
                if (link != null)
                {
                    link.deleteNode();
                }
            }

            if (vParts != null)
            {
                for (int i = 0; i < vParts.Count; i++)
                {
                    JDFAttributeMap part  = new JDFAttributeMap(vParts[i]);
                    JDFResource     xmp   = xm.getCreatePartition(part, partIDKeys);
                    int             ncols = "Front".Equals(part.get("Side")) ? nCols[0] : nCols[1];

                    for (int j = 0; j < ncols; j++)
                    {
                        part.put(EnumPartIDKey.Separation, cols.stringAt(j));
                        xmp.getCreatePartition(part, partIDKeys);
                    }
                }
                if (bPartitionedPlateMedia)
                {
                    VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null));
                    for (int i = 0; i < vSheets.Count; i++)
                    {
                        JDFAttributeMap part = new JDFAttributeMap(vSheets[i]);
                        JDFExposedMedia xmp  = (JDFExposedMedia)xm.getCreatePartition(part, partIDKeys);
                        if (xmp.getMedia() == null)
                        {
                            xmp.refMedia((JDFMedia)m.getCreatePartition(part, null));
                        }
                    }
                }
            }
        }