/** * Returns the default value of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ public COSBase getDefaultValue() { return getCOSObject().getDictionaryObject(COSName.DV); }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getFieldType() { return getCOSObject().getNameAsString(COSName.FT); }
/** * Returns the COSBase value of the "V" entry. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ public COSBase getValue() { return getCOSObject().getDictionaryObject(COSName.V); }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getValueAsString() { COSBase fieldValue = getCOSObject().getDictionaryObject(COSName.V); return fieldValue != null ? fieldValue.toString() : ""; }
/** * Sets the plain text value of this field. * * @param value Plain text * @throws IOException if the value could not be set */ @Override public void setValue(String value) throws IOException { getCOSObject().setString(COSName.V, value); // todo: propagate change event to children? // todo: construct appearances of children? }
/** * Sets the default of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. * @param value */ public void setDefaultValue(COSBase value) { getCOSObject().setItem(COSName.V, value); }
/** * Sets the value of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. * @param object * @throws java.io.IOException */ public void setValue(COSBase object) throws IOException { getCOSObject().setItem(COSName.V, object); // todo: propagate change event to children? // todo: construct appearances of children? }
@Override public int getFieldFlags() { int retval = 0; COSInteger ff = (COSInteger) getCOSObject().getDictionaryObject(COSName.FF); if (ff != null) { retval = ff.intValue(); } // There is no need to look up the parent hierarchy within a non terminal field return retval; }
/** * Sets the child fields. * * @param children The list of child fields. */ public void setChildren(List<PDField> children) { COSArray kidsArray = COSArrayList.converterToCOSArray(children); getCOSObject().setItem(COSName.KIDS, kidsArray); }
COSArray kids = (COSArray)getCOSObject().getDictionaryObject(COSName.KIDS); for (int i = 0; i < kids.size(); i++) if (kid instanceof COSDictionary) if (kid.getCOSObject() == this.getCOSObject())
private void removeFields(List<PDField> fields) { for (PDField field : fields) { if (field.getParent() == null) { COSArray cosFields = (COSArray) dictionary.getDictionaryObject(COSName.FIELDS); for (int i=0; i<cosFields.size(); i++) { COSDictionary element = (COSDictionary) cosFields.getObject(i); if (field.getCOSObject().equals(element)) { cosFields.remove(i); } } } else { COSArray kids = (COSArray) field.getParent().getCOSObject().getDictionaryObject(COSName.KIDS); for (int i=0; i<kids.size(); i++) { COSDictionary element = (COSDictionary) kids.getObject(i); if (field.getCOSObject().equals(element)) { kids.remove(i); } } } } } }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getFieldType() { return getCOSObject().getNameAsString(COSName.FT); }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getFieldType() { return getCOSObject().getNameAsString(COSName.FT); }
/** * Returns the default value of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ public COSBase getDefaultValue() { return getCOSObject().getDictionaryObject(COSName.DV); }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getValueAsString() { COSBase fieldValue = getCOSObject().getDictionaryObject(COSName.V); return fieldValue != null ? fieldValue.toString() : ""; }
/** * Returns the default value of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ public COSBase getDefaultValue() { return getCOSObject().getDictionaryObject(COSName.DV); }
/** * Sets the default of this field. This may be of any kind which is valid for this field's * children. * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. * @param value */ public void setDefaultValue(COSBase value) { getCOSObject().setItem(COSName.V, value); }
/** * Sets the plain text value of this field. * * @param value Plain text * @throws IOException if the value could not be set */ @Override public void setValue(String value) throws IOException { getCOSObject().setString(COSName.V, value); // todo: propagate change event to children? // todo: construct appearances of children? }
/** * {@inheritDoc} * * <p><b>Note:</b> while non-terminal fields <b>do</b> inherit field values, this method returns * the local value, without inheritance. */ @Override public String getValueAsString() { COSBase fieldValue = getCOSObject().getDictionaryObject(COSName.V); return fieldValue != null ? fieldValue.toString() : ""; }
/** * Sets the child fields. * * @param children The list of child fields. */ public void setChildren(List<PDField> children) { COSArray kidsArray = COSArrayList.converterToCOSArray(children); getCOSObject().setItem(COSName.KIDS, kidsArray); }