value = apValue;
Iterator widgetIter = widgets.iterator();
while( widgetIter.hasNext() )
{
Object next = widgetIter.next();
PDAnnotationWidget widget = null;
if( next instanceof PDField )
{
widget = ((PDField)next).getWidget();
}
else
{
widget = (PDAnnotationWidget)next;
}
PDAdditionalActions actions = widget.getActions();
if( actions != null &&
actions.getF() != null &&
widget.getDictionary().getDictionaryObject( "AP" ) ==null)
{
//do nothing because the field will be formatted by acrobat
//when it is opened. See FreedomExpressions.pdf for an example of this.
}
else
{
PDAppearanceDictionary appearance = widget.getAppearance();
if( appearance == null )
{
appearance = new PDAppearanceDictionary();
widget.setAppearance( appearance );
}
Map normalAppearance = appearance.getNormalAppearance();
PDAppearanceStream appearanceStream = (PDAppearanceStream)normalAppearance.get( "default" );
if( appearanceStream == null )
{
COSStream cosStream = new COSStream( acroForm.getDocument().getDocument().getScratchFile() );
appearanceStream = new PDAppearanceStream( cosStream );
appearanceStream.setBoundingBox( widget.getRectangle().createRetranslatedRectangle() );
appearance.setNormalAppearance( appearanceStream );
}
List tokens = getStreamTokens( appearanceStream );
List daTokens = getStreamTokens( getDefaultAppearance() );