Package com.itextpdf.xmp.options

Examples of com.itextpdf.xmp.options.PropertyOptions


        "XML namespace required for all elements and attributes", BADRDF);
    }

   
    // create schema node if not already there
    PropertyOptions childOptions = new PropertyOptions();
    boolean isAlias = false;
    if (isTopLevel)
    {
      // Lookup the schema node, adjust the XMP parent pointer.
      // Incoming parent must be the tree root.
View Full Code Here


    XMPNode schemaNode = tree.findChildByName(namespaceURI);
   
    if (schemaNode == null  &&  createNodes)
    {
      schemaNode = new XMPNode(namespaceURI,
        new PropertyOptions()
          .setSchemaNode(true));
      schemaNode.setImplicit(true);
     
      // only previously registered schema namespaces are allowed in the XMP tree.
      String prefix = XMPMetaFactory.getSchemaRegistry().getNamespacePrefix(namespaceURI);
View Full Code Here

     
    XMPNode childNode = parent.findChildByName(childName);
   
    if (childNode == null  &&  createNodes)
    {
      PropertyOptions options = new PropertyOptions();
      childNode = new XMPNode(childName, options);
      childNode.setImplicit(true);
      parent.addChild(childNode);
    }
   
View Full Code Here

  {
    // create empty and fix existing options
    if (options == null)
    {
      // set default options
      options = new PropertyOptions();
    }
   
    if (options.isArrayAltText())
    {
      options.setArrayAlternate(true);
View Full Code Here

   * Removes one qualifier node and fixes the options.
   * @param qualNode qualifier to remove
   */
  public void removeQualifier(XMPNode qualNode)
  {
    PropertyOptions opts = getOptions();
    if (qualNode.isLanguageNode())
    {
      // if "xml:lang" is removed, remove hasLanguage-flag too
      opts.setHasLanguage(false);
    }
    else if (qualNode.isTypeNode())
    {
      // if "rdf:type" is removed, remove hasType-flag too
      opts.setHasType(false);
    }
   
    getQualifier().remove(qualNode);
    if (qualifier.isEmpty())
    {
      opts.setHasQualifiers(false);
      qualifier = null;
    }
   
  }
View Full Code Here

  /**
   * Removes all qualifiers from the node and sets the options appropriate.
   */
  public void removeQualifiers()
  {
    PropertyOptions opts = getOptions();
    // clear qualifier related options
    opts.setHasQualifiers(false);
    opts.setHasLanguage(false);
    opts.setHasType(false);
    qualifier = null;
  }
View Full Code Here

   *
   * @see java.lang.Object#clone()
   */
  public Object clone()
  {
    PropertyOptions newOptions;
    try
    {
      newOptions = new PropertyOptions(getOptions().getOptions());
    }
    catch (XMPException e)
    {
      // cannot happen
      newOptions = new PropertyOptions();
    }
   
    XMPNode newNode = new XMPNode(name, value, newOptions);
    cloneSubtree(newNode);
   
View Full Code Here

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

  {
    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

  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

TOP

Related Classes of com.itextpdf.xmp.options.PropertyOptions

Copyright © 2018 www.massapicom. 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.