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); }
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()); }
/// /// <summary> * Set attribute Range as a IntegerRangeList /// * </summary> /// * <param name="JDFIntegerRangeList"> value - the value to set </param> /// public virtual void setRange(JDFIntegerRangeList @value) { setAttribute(AttributeName.RANGE, @value.ToString(), null); }
public virtual void setPresentValueList(JDFIntegerRangeList @value) { setAttribute(AttributeName.PRESENTVALUELIST, @value.ToString(), null); }
public virtual void setAllowedValueList(JDFIntegerRangeList @value) { setAttribute(AttributeName.ALLOWEDVALUELIST, @value.ToString(), null); }