/** {@inheritDoc} */
  @Override
  public void bind(final PropertyList pList) throws FOPException {
    this.masterReference = pList.get(PR_MASTER_REFERENCE).getString();
    this.maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);

    if (this.masterReference == null || this.masterReference.equals("")) {
      missingPropertyError("master-reference");
    }
  }
Beispiel #2
0
 /** {@inheritDoc} */
 @Override
 public void bind(final PropertyList pList) throws FOPException {
   super.bind(pList);
   this.commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
   this.commonMarginBlock = pList.getMarginBlockProps();
   this.breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
   this.breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
   this.keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
   this.keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
   this.keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
   // Bind extension properties
   this.widowContentLimit = pList.get(PR_X_WIDOW_CONTENT_LIMIT).getLength();
   this.orphanContentLimit = pList.get(PR_X_ORPHAN_CONTENT_LIMIT).getLength();
 }
Beispiel #3
0
  /** {@inheritDoc} */
  @Override
  public void bind(final PropertyList pList) throws FOPException {
    this.commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
    this.columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric().getValue();
    this.columnWidth = pList.get(PR_COLUMN_WIDTH).getLength();
    this.numberColumnsRepeated = pList.get(PR_NUMBER_COLUMNS_REPEATED).getNumeric().getValue();
    this.numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED).getNumeric().getValue();
    super.bind(pList);

    if (this.numberColumnsRepeated <= 0) {
      final TableEventProducer eventProducer =
          TableEventProducer.Provider.get(getUserAgent().getEventBroadcaster());
      eventProducer.valueMustBeBiggerGtEqOne(
          this, "number-columns-repeated", this.numberColumnsRepeated, getLocator());
    }
    if (this.numberColumnsSpanned <= 0) {
      final TableEventProducer eventProducer =
          TableEventProducer.Provider.get(getUserAgent().getEventBroadcaster());
      eventProducer.valueMustBeBiggerGtEqOne(
          this, "number-columns-spanned", this.numberColumnsSpanned, getLocator());
    }

    /*
     * check for unspecified width and replace with default of
     * proportional-column-width(1), in case of fixed table-layout warn only
     * for explicit columns
     */
    if (this.columnWidth.getEnum() == EN_AUTO) {
      if (!this.implicitColumn && !getTable().isAutoLayout()) {
        final TableEventProducer eventProducer =
            TableEventProducer.Provider.get(getUserAgent().getEventBroadcaster());
        eventProducer.warnImplicitColumns(this, getLocator());
      }
      this.columnWidth = new TableColLength(1.0, this);
    }

    /*
     * in case of explicit columns, from-table-column() can be used on
     * descendants of the table-cells, so we need a reference to the
     * column's property list (cleared in Table.endOfNode())
     */
    if (!this.implicitColumn) {
      this.pList = pList;
    }
  }
Beispiel #4
0
 /** {@inheritDoc} */
 public void bind(PropertyList pList) throws FOPException {
   super.bind(pList);
   commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
   commonMarginBlock = pList.getMarginBlockProps();
   breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
   breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
   keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
   keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
   keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
 }
  /** {@inheritDoc} */
  @Override
  public Property eval(final Property[] args, final PropertyInfo pInfo) throws PropertyException {
    final Number d = args[0].getNumber();
    if (d == null) {
      throw new PropertyException(
          "Non numeric operand to " + "proportional-column-width() function.");
    }
    final PropertyList pList = pInfo.getPropertyList();
    if (!"fo:table-column".equals(pList.getFObj().getName())) {
      throw new PropertyException(
          "proportional-column-width() function " + "may only be used on fo:table-column.");
    }

    final Table t = (Table) pList.getParentFObj();
    if (t.isAutoLayout()) {
      throw new PropertyException(
          "proportional-column-width() function "
              + "may only be used when fo:table has "
              + "table-layout=\"fixed\".");
    }
    return new TableColLength(d.doubleValue(), pInfo.getFO());
  }
Beispiel #6
0
  /**
   * Create a CommonMarginInline object.
   *
   * @param pList The PropertyList with propery values.
   */
  public CommonMarginInline(PropertyList pList) throws PropertyException {
    marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
    marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
    marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
    marginRight = pList.get(Constants.PR_MARGIN_RIGHT).getLength();

    spaceStart = pList.get(Constants.PR_SPACE_START).getSpace();
    spaceEnd = pList.get(Constants.PR_SPACE_END).getSpace();
  }
Beispiel #7
0
  /**
   * Gets the canonical <code>CommonHyphenation</code> instance corresponding to the values of the
   * related properties present on the given <code>PropertyList</code>
   *
   * @param propertyList the <code>PropertyList</code>
   */
  public static CommonHyphenation getInstance(PropertyList propertyList) throws PropertyException {
    StringProperty language = (StringProperty) propertyList.get(Constants.PR_LANGUAGE);
    StringProperty country = (StringProperty) propertyList.get(Constants.PR_COUNTRY);
    StringProperty script = (StringProperty) propertyList.get(Constants.PR_SCRIPT);
    EnumProperty hyphenate = (EnumProperty) propertyList.get(Constants.PR_HYPHENATE);
    CharacterProperty hyphenationCharacter =
        (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER);
    NumberProperty hyphenationPushCharacterCount =
        (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT);
    NumberProperty hyphenationRemainCharacterCount =
        (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT);

    CommonHyphenation instance =
        new CommonHyphenation(
            language,
            country,
            script,
            hyphenate,
            hyphenationCharacter,
            hyphenationPushCharacterCount,
            hyphenationRemainCharacterCount);

    return cache.fetch(instance);
  }
 private void mockSourceDocProperty(final PropertyList mockPList) throws PropertyException {
   final Property mockSourceDocProperty = mock(Property.class);
   when(mockSourceDocProperty.getString()).thenReturn(this.sourceDocument);
   when(mockPList.get(Constants.PR_SOURCE_DOCUMENT)).thenReturn(mockSourceDocProperty);
 }
 private void mockRoleProperty(final PropertyList mockPList) throws PropertyException {
   final Property mockRoleProperty = mock(Property.class);
   when(mockRoleProperty.getString()).thenReturn(this.role);
   when(mockPList.get(Constants.PR_ROLE)).thenReturn(mockRoleProperty);
 }
Beispiel #10
0
 /** {@inheritDoc} */
 public void bind(PropertyList pList) throws FOPException {
   commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
   alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
   alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
   baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
   blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
   // clip = pList.get(PR_CLIP);
   contentHeight = pList.get(PR_CONTENT_HEIGHT).getLength();
   contentWidth = pList.get(PR_CONTENT_WIDTH).getLength();
   displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
   dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
   height = pList.get(PR_HEIGHT).getLength();
   id = pList.get(PR_ID).getString();
   ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
   inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange();
   keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
   keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
   lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
   overflow = pList.get(PR_OVERFLOW).getEnum();
   scaling = pList.get(PR_SCALING).getEnum();
   textAlign = pList.get(PR_TEXT_ALIGN).getEnum();
   width = pList.get(PR_WIDTH).getLength();
   if (getUserAgent().isAccessibilityEnabled()) {
     String altText = pList.get(PR_X_ALT_TEXT).getString();
     if (altText.equals("")) {
       getFOValidationEventProducer().altTextMissing(this, getLocalName(), getLocator());
     }
   }
 }