示例#1
0
        ///
        ///	 <summary> * inline this refElement by replacing it with a copy of its target
        ///	 *  </summary>
        ///	 * <returns> JDFElement - the newly created element </returns>
        ///
        public virtual JDFElement inlineRef()
        {
            int         i;
            JDFResource targetRes = getTarget();

            if (targetRes == null)
            {
                throw new JDFException("inlineRef: inlining null refElement rRef=" + getrRef());
            }
            JDFResource newInline = (JDFResource)appendElement(targetRes.Name, null);

            // copy elements and attributes
            newInline.setAttributes(targetRes);
            VElement v = targetRes.getChildElementVector(null, null, null, true, 0, false);

            for (i = 0; i < v.Count; i++)
            {
                newInline.copyElement(v.item(i), null);
            }

            newInline.cleanResourceAttributes();
            VString partNames = targetRes.getPartIDKeys();

            for (i = 0; i < partNames.Count; i++)
            {
                newInline.removeAttribute(partNames[i], null);
            }

            // replace this (the refElement) with newInline.
            // This effectively repositions newInline from the back to the original
            // position of this
            replaceElement(newInline);

            targetRes.deleteUnLinked();
            return(newInline);
        }