public void testFitsListType_IntegerState() { JDFIntegerRangeList list = new JDFIntegerRangeList(); list.Append(1); list.Append(8); list.Append(12); // System.out.println(state.fitsCompleteList(value, list)); // System.out.println(state.fitsCompleteOrderedList(value, list)); // System.out.println(state.fitsContainedList(value, list)); // state.setListType(EnumListType.List); // System.out.println(state.fitsListType(list.toString())); // System.out.println(state.getListType()); }
public virtual void testContentData() { d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.setType(EnumType.Approval); JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, EnumUsage.Input); pl = rl.appendPageList(); pl.makeRootResource("PageList", null, true); cl = pl.appendContentList(); cl.makeRootResource("ContentList", null, true); JDFContentData cd0 = cl.appendContentData(); cd0.setAttribute(AttributeName.CONTENTLISTINDEX, "1 2 3"); KElement book = cd0.appendElement("ContentMetaData"); book.setAttribute("ISBN", "0123456789"); JDFComment abstrakt = (JDFComment)book.appendElement("Comment"); abstrakt.setName("Abstract"); abstrakt.setText("Abstract of the book\nin english"); JDFEmployee editor = (JDFEmployee)book.appendElement(ElementName.EMPLOYEE); editor.appendPerson().setFamilyName("authorName"); editor.setRoles(new VString("Editor", null)); book.setAttribute("Title", "book thing"); int p = 1; for (int i = 1; i < 4; i++) { JDFContentData cd = cl.appendContentData(); cd.setAttribute("ID", "CD_" + i); KElement chap = cd.appendElement("ContentMetaData"); chap.setAttribute("Title", "Chapter " + i); JDFEmployee author = (JDFEmployee)chap.appendElement(ElementName.EMPLOYEE); author.appendPerson().setFamilyName("authorName" + i); author.setRoles(new VString("Author", null)); JDFPageData pd = pl.appendPageData(); JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList(); integerRangeList.Append(p, p + i); p += i + 1; pd.setAttribute("PageIndex", integerRangeList.ToString()); JDFPageElement pe = pd.appendPageElement(); pe.setAttribute("ContentDataRefs", cd.getID()); } pl.setXMLComment("Note that multiple page elements may but need not be specified\nit is also possible to reference only on pageEleemnt that spans the entire book"); d.write2File(sm_dirTestDataTemp + "ContentMetaData.jdf", 2, false); }
/// /// <summary> * insert pageSet into PageSet. /// * </summary> /// * <param name="pageSet"> </param> /// public virtual void insertPageSet(int pageSet) { JDFIntegerRangeList irl = getPageSet(); if (irl == null) { setPageSet(new JDFIntegerRangeList(new JDFIntegerRange(pageSet))); } else if (!irl.inRange(pageSet)) { irl.Append(pageSet); irl.normalize(true); setPageSet(irl); } }
public void testFitsValue() { JDFParser p = new JDFParser(); string strNode = "<IntegerState Name=\"BitDepth\" DefaultValue=\"1\" AllowedValueList=\"1 8 12\"/>"; JDFDoc jdfDoc = p.parseString(strNode); JDFIntegerState state = (JDFIntegerState)jdfDoc.getRoot(); JDFIntegerRangeList list = new JDFIntegerRangeList(); list.Append(new JDFIntegerRange(1, 12)); // 1~12 // list.append(12); state.setListType(EnumListType.RangeList); Assert.IsFalse(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=RangeList"); JDFIntegerRangeList list2 = new JDFIntegerRangeList(); list2.Append(new JDFIntegerRange(1, -2)); // 1~-2 JDFIntegerRangeList allowedVL = new JDFIntegerRangeList(); allowedVL.Append(new JDFIntegerRange(1, 32)); // 1~32 state.setAllowedValueList(allowedVL); // new AllowedVlaueList Assert.IsTrue(state.fitsValue(list2.ToString(), EnumFitsValue.Allowed), "xDef is wrong"); list.erase(list.Count - 1); // erase "1~12" list.Append(2); list.Append(12); list.Append(22); state.setListType(EnumListType.List); state.setAllowedValueMod(new JDFXYPair(10, 2)); Assert.IsTrue(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=List, ValueMod=" + state.getAllowedValueMod()); }
public virtual void testAutomateLayout_PlateSet() { for (int loop = 0; loop < 3; loop++) { n.getAuditPool().appendXMLComment("This is a simple example of an automated layout used for conventional prepress\n" + "The structure is aligned as closely as possible with a static Layout", null); JDFRunList run = rl.addRun("file://host/data/test.pdf", 0, -1); run.setNPage(128); rl.setResStatus(EnumResStatus.Available, true); rl.setDescriptiveName("This is a RunList specifiying 128 pages each in a pdf file."); lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.setResStatus(EnumResStatus.Available, true); lo.setMaxOrd(4); lo.setAutomated(true); const string format = "Sheet%02i"; lo.setAttribute("NameFormat", format); lo.setAttribute("NameTemplate", "SheetNum"); lo.appendXMLComment("Simple automated Layout with exactly one sheet\n", null); JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Sheet"); sheet.setDescriptiveName("two sided 2 up sheet"); JDFLayout sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front); JDFContentObject co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); co.setDescriptiveName("Front 1st, 5th, 9th... Page"); co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(1); co.setDescriptiveName("Front 2nd, 6th, 10th... page"); JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back); co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(2); co.setDescriptiveName("Back 3rd, 7th, 11th... Page"); co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(3); co.setDescriptiveName("Back 4th, 8th, 12th... page"); JDFRunList rlSheet = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyOutput, null); rlSheet.setDirectory("file://host/out/"); if (loop == 0) // instantiate individually { PrintfFormat fmt = new PrintfFormat(format); for (int i = 0; i < 128; i += 4) { string sheetName = fmt.tostr(1 + i / 4); JDFRunList rlp = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName); JDFRunList rlF = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front); rlF.appendLayoutElement().setMimeURL(sheetName + "Front.pdf"); JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back); rlB.appendLayoutElement().setMimeURL(sheetName + "Back.pdf"); } } if (loop == 1) // instantiate individually { rlSheet.appendLayoutElement().setMimeURL("AllSheets.pdf"); PrintfFormat fmt = new PrintfFormat(format); JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList(); for (int i = 0; i < 128; i += 4) { string sheetName = fmt.tostr(1 + i / 4); JDFRunList rlp = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName); JDFRunList rlF = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front); integerRangeList.Clear(); integerRangeList.Append(i / 2); rlF.setPages(integerRangeList); JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back); integerRangeList.Clear(); integerRangeList.Append(1 + i / 2); rlB.setPages(integerRangeList); } } else // instantiate by template { JDFFileSpec fs = rlSheet.appendLayoutElement().appendFileSpec(); fs.setMimeType("application/pdf"); fs.setFileFormat(format + "%s_%s.pdf"); fs.setFileTemplate("SheetNum,Surface,Separation"); } doc.write2File(sm_dirTestDataTemp + "AutomatedLayout_Plateset" + loop + ".jdf", 2, false); n.getResourceLinkPool().deleteNode(); n.getResourcePool().deleteNode(); } }