public static PDAction createAction(COSDictionary action) {
PDAction retval = null;
if( action != null )
{
String type = action.getNameAsString( "S" );
if( PDActionJavaScript.SUB_TYPE.equals( type ) )
{
retval = new PDActionJavaScript( action );
}
else if( PDActionGoTo.SUB_TYPE.equals( type ) )
{
retval = new PDActionGoTo( action );
}
else if( PDActionLaunch.SUB_TYPE.equals( type ) )
{
retval = new PDActionLaunch( action );
}
else if( PDActionRemoteGoTo.SUB_TYPE.equals( type ) )
{
retval = new PDActionRemoteGoTo( action );
}
else if( PDActionURI.SUB_TYPE.equals( type ) )
{
retval = new PDActionURI( action );
}
}
return retval;
}
This will create the correct type of action based on the type specified
in the dictionary. |