public virtual void testIsPresentPartition() { JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.IsPresentEvaluation, true); JDFTest tst = act.getTest(); tst.setContext("//Component"); JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)tst.getTerm(); ipe.setRefTarget(ptState); Assert.AreEqual(ptState.getID(), ipe.getrRef()); JDFDoc doc = new JDFDoc("JDF"); JDFNode node = doc.getJDFRoot(); node.setType("fnarf", false); JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null); comp.setProductType("Cover"); XMLDoc rep = new XMLDoc("root", null); KElement eRep = rep.getRoot(); bool fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF); comp = (JDFComponent)comp.addPartition(EnumPartIDKey.SheetName, "s1"); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF, "also partition leaves "); }
/// /// * <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 testAction() { JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.or, false); JDFTest tst = act.getTest(); tst.setContext("/JDF/ResourcePool/Component"); JDFor or = (JDFor)((JDFnot)tst.getTerm()).getTerm(EnumTerm.or, 0); JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)or.appendTerm(EnumTerm.IsPresentEvaluation); ipe.setRefTarget(ptState); Assert.AreEqual(ptState.getID(), ipe.getrRef()); JDFEnumerationEvaluation enev = (JDFEnumerationEvaluation)or.appendTerm(EnumTerm.EnumerationEvaluation); enev.setRefTarget(compState); enev.setRegExp("(.+ )*FinalProduct( .+)*"); JDFDoc doc = new JDFDoc("JDF"); JDFNode node = doc.getJDFRoot(); node.setType("fnarf", false); JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null); XMLDoc rep = new XMLDoc("root", null); KElement eRep = rep.getRoot(); bool fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF); comp.setProductType("foobar"); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsFalse(fitsJDF, "have pt"); List <ValuedEnum> v = new List <ValuedEnum>(); v.Add(EnumComponentType.FinalProduct); comp.setComponentType(v); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsFalse(fitsJDF, "have both"); comp.removeAttribute("ProductType"); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsFalse(fitsJDF, "have final"); v = new List <ValuedEnum>(); v.Add(EnumComponentType.PartialProduct); comp.setComponentType(v); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF, "have no final"); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFComponent initOutputComponent(JDFNode node, JDFLayoutIntent li, string productType) { JDFComponent outComp = (JDFComponent)node.getCreateResource(ElementName.COMPONENT, EnumUsage.Output, 0); if (productType == null) { outComp.setComponentType(EnumComponentType.FinalProduct, EnumComponentType.Sheet); } else { outComp.setComponentType(EnumComponentType.PartialProduct, EnumComponentType.Sheet); outComp.setProductType(productType); } theNode.getResource(ElementName.LAYOUTINTENT, null, 0); JDFShape s = li.getFinishedDimensions().getActual(); outComp.setDimensions(s); if (theNode != node) { theNode.getResourcePool().moveElement(outComp, null); theNode.linkResource(outComp, EnumUsage.Output, null); } return(outComp); }