Examples of PropertyOptions


Examples of com.itextpdf.xmp.options.PropertyOptions

   */
  public PropertyOptions getOptions()
  {
    if (options == null)
    {
      options = new PropertyOptions();
    }
    return options;
  }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

  {
    for (int i = 1; i <= dcSchema.getChildrenLength(); i++)
    {
      XMPNode currProp = dcSchema.getChild(i);
     
      PropertyOptions arrayForm = (PropertyOptions) dcArrayForms.get(currProp.getName());
      if (arrayForm == null)
      {
        continue;
      }
      else if (currProp.getOptions().isSimple())
      { 
        // create a new array and add the current property as child,
        // if it was formerly simple
        XMPNode newArray = new XMPNode(currProp.getName(), arrayForm);
        currProp.setName(XMPConst.ARRAY_ITEM_NAME);
        newArray.addChild(currProp);
        dcSchema.replaceChild(i, newArray);
 
        // fix language alternatives
        if (arrayForm.isArrayAltText()  &&  !currProp.getOptions().getHasLanguage())
        {
          XMPNode newLang = new XMPNode(XMPConst.XML_LANG, XMPConst.X_DEFAULT, null);
          currProp.addQualifier(newLang);
        }
      }
      else
      {
        // clear array options and add corrected array form if it has been an array before
        currProp.getOptions().setOption(
          PropertyOptions.ARRAY  |
          PropertyOptions.ARRAY_ORDERED  |
          PropertyOptions.ARRAY_ALTERNATE  |
          PropertyOptions.ARRAY_ALT_TEXT, 
          false);
        currProp.getOptions().mergeWith(arrayForm);
       
        if (arrayForm.isArrayAltText())
        {
          // applying for "dc:description", "dc:rights", "dc:title"
          repairAltText(currProp);
        }
      }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

  private static void initDCArrays()
  {
    dcArrayForms = new HashMap();
   
    // Properties supposed to be a "Bag".
    PropertyOptions bagForm = new PropertyOptions();
    bagForm.setArray(true);
    dcArrayForms.put("dc:contributor", bagForm);
    dcArrayForms.put("dc:language", bagForm);
    dcArrayForms.put("dc:publisher", bagForm);
    dcArrayForms.put("dc:relation", bagForm);
    dcArrayForms.put("dc:subject", bagForm);
    dcArrayForms.put("dc:type", bagForm);

    // Properties supposed to be a "Seq".
    PropertyOptions seqForm = new PropertyOptions();
    seqForm.setArray(true);
    seqForm.setArrayOrdered(true);
    dcArrayForms.put("dc:creator", seqForm);
    dcArrayForms.put("dc:date", seqForm);
   
    // Properties supposed to be an "Alt" in alternative-text form.
    PropertyOptions altTextForm = new PropertyOptions();
    altTextForm.setArray(true);
    altTextForm.setArrayOrdered(true);
    altTextForm.setArrayAlternate(true);
    altTextForm.setArrayAltText(true);
    dcArrayForms.put("dc:description", altTextForm);
    dcArrayForms.put("dc:rights", altTextForm);
    dcArrayForms.put("dc:title", altTextForm);
  }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

    XMPNode arrayNode = XMPNodeUtils.findNode(xmp.getRoot(), arrayPath, false, null);
    if (arrayNode != null)
    {
      // The array exists, make sure the form is compatible. Zero
      // arrayForm means take what exists.
      PropertyOptions arrayForm = arrayNode.getOptions();
      if (!arrayForm.isArray() || arrayForm.isArrayAlternate())
      {
        throw new XMPException("Named property must be non-alternate array",
          XMPError.BADXPATH);
      }
      if (arrayOptions.equalArrayTypes(arrayForm))
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

          sourceSchema.getName(), false);
      boolean createdSchema = false;
      if (destSchema == null)
      {
        destSchema = new XMPNode(sourceSchema.getName(), sourceSchema.getValue(),
            new PropertyOptions().setSchemaNode(true));
        dest.getRoot().addChild(destSchema);
        createdSchema = true;
      }

      // Process the source schema's children.     
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

    else
    {
      // The destination exists and is not totally replaced. Structs and
      // arrays are merged.

      PropertyOptions sourceForm = sourceNode.getOptions();
      PropertyOptions destForm = destNode.getOptions();
      if (sourceForm != destForm)
      {
        return;
      }
      if (sourceForm.isStruct())
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

   * @return Returns true if the nodes are equal, false otherwise.
   * @throws XMPException Forwards exceptions to the calling method.
   */
  private static boolean itemValuesMatch(XMPNode leftNode, XMPNode rightNode) throws XMPException
  {
    PropertyOptions leftForm = leftNode.getOptions();
    PropertyOptions rightForm = rightNode.getOptions();

    if (leftForm.equals(rightForm))
    {
      return false;
    }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

     * @param id
     */
    static public void setIdentifiers(XMPMeta xmpMeta, String[] id) throws XMPException {
        XMPUtils.removeProperties(xmpMeta, XMPConst.NS_DC, IDENTIFIER, true, true);
        for (int i = 0; i < id.length; i++) {
            xmpMeta.appendArrayItem(XMPConst.NS_DC, IDENTIFIER, new PropertyOptions(PropertyOptions.ARRAY), id[i], null);
        }
    }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

     *
     * @param xmpMeta
     * @param title
     */
    static public void addTitle(XMPMeta xmpMeta, String title) throws XMPException {
        xmpMeta.appendArrayItem(XMPConst.NS_DC, TITLE, new PropertyOptions(PropertyOptions.ARRAY_ALTERNATE), title, null);
    }
View Full Code Here

Examples of com.itextpdf.xmp.options.PropertyOptions

     *
     * @param xmpMeta
     * @param desc
     */
    static public void addDescription(XMPMeta xmpMeta, String desc) throws XMPException {
        xmpMeta.appendArrayItem(XMPConst.NS_DC, DESCRIPTION, new PropertyOptions(PropertyOptions.ARRAY_ALTERNATE), desc, null);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.