/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFComponent initOutputComponent() { if (thePreviousNode != null) { JDFResource parentOutComp = thePreviousNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0); if (parentOutComp != null) { theNode.linkResource(parentOutComp, EnumUsage.Input, null); } } JDFComponent outComp = (JDFComponent)(theParentNode != null ? theParentNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0) : null); if (outComp == null) { outComp = (JDFComponent)theNode.getCreateResource(ElementName.COMPONENT, EnumUsage.Output, 0); outComp.setComponentType(EnumComponentType.FinalProduct, EnumComponentType.Sheet); outComp.setProductType("Unknown"); } else { theNode.linkResource(outComp, EnumUsage.Output, null); } JDFResourceLink rl = theNode.getLink(outComp, EnumUsage.Output); if (vParts != null) { VJDFAttributeMap reducedMap = getReducedMap(new VString("Side Separation", " ")); if (reducedMap != null) { int size = reducedMap.Count; for (int i = 0; i < size; i++) { JDFAttributeMap part = reducedMap[i]; JDFResource partComp = outComp.getCreatePartition(part, partIDKeys); partComp.setDescriptiveName("Description for Component part# " + i); JDFAttributeMap newMap = new JDFAttributeMap(part); newMap.put(AttributeName.CONDITION, "Good"); rl.setAmount(good, newMap); } } } else { outComp.setDescriptiveName("MIS-CP output Component"); } // outComp.getCreateLayout(); JDFMedia inMedia = (JDFMedia)theNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0); if (inMedia != null) { outComp.setDimensions(inMedia.getDimension()); } return(outComp); }
public virtual void testApplyResourceCmd() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFCommand c = jmf.appendCommand(); jmf.setSenderID("DeviceSenderID"); c.setType(EnumType.Resource); JDFResourceCmdParams rqp = c.appendResourceCmdParams(); rqp.setJobID("JobID"); rqp.setJobPartID("JobPartID"); rqp.setResourceName("Media"); JDFMedia mediaRQP = (JDFMedia)rqp.appendElement("Media"); mediaRQP.setDimension(new JDFXYPair(20, 30)); JDFDoc docJDF = new JDFDoc(ElementName.JDF); JDFNode jdf = docJDF.getJDFRoot(); jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting); JDFMedia mediaJDF = (JDFMedia)jdf.addResource("Media", null, EnumUsage.Input, null, null, null, null); mediaJDF.setDimension(new JDFXYPair(40, 60)); rqp.setJobID(jdf.getJobID(true)); rqp.setJobPartID(jdf.getJobPartID(true)); rqp.applyResourceCommand(jdf); JDFMedia m2 = (JDFMedia)jdf.getMatchingResource("Media", EnumProcessUsage.AnyInput, null, 0); Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension()); JDFAttributeMap sheetMap = new JDFAttributeMap("SheetName", "S1"); rqp.setPartMap(sheetMap); mediaRQP.setDimension(new JDFXYPair(200, 300)); JDFMedia m2Sheet = (JDFMedia)m2.addPartition(EnumPartIDKey.SheetName, "S1"); rqp.applyResourceCommand(jdf); Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension"); Assert.AreEqual(new JDFXYPair(200, 300), m2Sheet.getDimension(), "overwrote leaf root dimension"); sheetMap.put(EnumPartIDKey.SheetName, "S2"); rqp.setPartMap(sheetMap); mediaRQP.setDimension(new JDFXYPair(300, 400)); rqp.applyResourceCommand(jdf); JDFMedia m2Sheet2 = (JDFMedia)m2.getPartition(sheetMap, null); Assert.IsNotNull(m2Sheet2); Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension"); Assert.AreEqual(new JDFXYPair(300, 400), m2Sheet2.getDimension(), "overwrote leaf root dimension"); JDFMedia mPartRQP = (JDFMedia)mediaRQP.addPartition(EnumPartIDKey.SheetName, "S3"); sheetMap.put(EnumPartIDKey.SheetName, "S3"); rqp.setPartMap(sheetMap); mPartRQP.setDimension(new JDFXYPair(400, 600)); rqp.applyResourceCommand(jdf); JDFMedia m2Sheet3 = (JDFMedia)m2.getPartition(sheetMap, null); Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension"); Assert.AreEqual(new JDFXYPair(400, 600), m2Sheet3.getDimension(), "overwrote leaf root dimension"); Assert.IsFalse(m2Sheet3.hasAttribute_KElement("ID", null, false)); mPartRQP.setAttribute(AttributeName.DIMENSION, ""); mediaRQP.removeAttribute(AttributeName.DIMENSION); rqp.applyResourceCommand(jdf); JDFMedia m2Sheet4 = (JDFMedia)m2.getPartition(sheetMap, null); Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension"); Assert.IsFalse(m2Sheet4.hasAttribute_KElement(AttributeName.DIMENSION, null, false), "removed leaf dimension"); }