public virtual void testRemoveChild() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFExposedMedia xmpl = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Plate, null); JDFExposedMedia xmpr = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Proof, null); JDFMedia m = xmpr.appendMedia(); Assert.IsNotNull(xmpr.getMedia()); m.setID("id1"); KElement t1 = n.getTarget("id1", "ID"); m = (JDFMedia)m.makeRootResource(null, null, true); Assert.AreEqual(m, t1); Assert.IsNotNull(xmpr.getMedia()); xmpl.refElement(m); Assert.IsNotNull(xmpl.getMedia()); JDFResourcePool rp = n.getResourcePool(); Assert.IsNotNull(rp.getElement("Media")); xmpl.removeChild("Media", null, 0); Assert.IsNull(xmpl.getMedia()); Assert.IsNotNull(rp.getElement("Media")); xmpr.removeChildren("Media", null, null); Assert.IsNull(xmpr.getMedia()); Assert.IsNotNull(rp.getElement("Media")); }
public virtual void testGetMedia() { JDFLayout lo = (JDFLayout) new JDFDoc("JDF").getRoot().appendElement(ElementName.RESOURCEPOOL).appendElement(ElementName.LAYOUT); JDFLayout s1 = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "s1"); JDFMedia media = lo.appendMedia(); media.setMediaType(EnumMediaType.Plate); Assert.IsNull(lo.getMedia(EnumMediaType.Paper)); Assert.IsNull(s1.getMedia(EnumMediaType.Paper)); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media); Assert.AreEqual(lo.getMedia(EnumMediaType.Plate), media); JDFMedia media2 = s1.appendMedia(); media2.setMediaType(EnumMediaType.Paper); Assert.IsNull(s1.getMedia(EnumMediaType.Plate)); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); JDFMedia media3 = s1.appendMedia(); media3.setMediaType(EnumMediaType.Plate); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3); media3.makeRootResource(null, null, true); Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2); Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3); }
/// /// * <param name="xm"> /// * @return </param> /// protected internal virtual JDFMedia initPlateMedia() { if (theParentNode != null) { theNode.ensureLink(theParentNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0), EnumUsage.Input, null); } JDFMedia m = (JDFMedia)theNode.getCreateResource(ElementName.MEDIA, EnumUsage.Input, 0); if (EnumMediaType.Paper.Equals(m.getMediaType())) { m = (JDFMedia)theNode.getCreateResource(ElementName.MEDIA, EnumUsage.Input, 1); } m.setResStatus(EnumResStatus.Available, false); m.makeRootResource(null, theNode.getJDFRoot(), true); theNode.getJDFRoot().getCreateResourcePool().moveElement(m, null); m.setDescriptiveName("the plates to use"); m.setMediaType(EnumMediaType.Plate); m.setPartUsage(EnumPartUsage.Implicit); if (bPartitionedPlateMedia && vParts != null) { VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null)); for (int i = 0; i < vSheets.Count; i++) { JDFAttributeMap part = new JDFAttributeMap(vSheets[i]); // JDFResource mm= m.getCreatePartition(part, partIDKeys); } } else { m.setDimensionCM(new JDFXYPair(70, 102)); } return(m); }
public virtual void testGetChildElementVector_KElement() { JDFDoc d = new JDFDoc("JDF"); JDFNode root = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)root.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia m = xm.appendMedia(); m.makeRootResource(null, null, true); Assert.AreEqual(0, xm.getChildElementVector_KElement("Media", null, null, true, -1).Count); Assert.AreEqual(1, xm.getChildElementVector_JDFElement("Media", null, null, true, -1, true).Count); }
public virtual void testGetElement_KElement() { JDFDoc d = new JDFDoc("JDF"); JDFNode root = d.getJDFRoot(); JDFExposedMedia xm = (JDFExposedMedia)root.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia m = xm.appendMedia(); m.makeRootResource(null, null, true); Assert.IsNull(xm.getElement_KElement("Media", null, 0)); Assert.IsNotNull(xm.getElement_JDFElement("Media", null, 0)); }
public virtual void testGetHRefs() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType("ConventionalPrinting", true); JDFExposedMedia xmpl = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Plate, null); JDFExposedMedia xmpr = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Proof, null); JDFMedia m = xmpr.appendMedia(); Assert.IsNotNull(xmpr.getMedia()); m.setID("id1"); KElement t1 = n.getTarget("id1", "ID"); m = (JDFMedia)m.makeRootResource(null, null, true); Assert.AreEqual(t1, m); Assert.IsTrue(n.getHRefs(null, true, false).Contains("id1")); Assert.IsTrue(xmpr.getHRefs(null, true, false).Contains("id1")); Assert.IsFalse(xmpl.getHRefs(null, true, false).Contains("id1")); Assert.IsTrue(n.getHRefs(null, true, true).Contains("id1")); Assert.IsTrue(xmpr.getHRefs(null, true, true).Contains("id1")); Assert.IsFalse(xmpl.getHRefs(null, true, true).Contains("id1")); }