org.faceless.pdf2
Class JSCoreMethods

java.lang.Object
  extended by org.faceless.pdf2.JSCoreMethods

public class JSCoreMethods
extends Object

This class contains various methods which are called from JavaScript. An instance of this class is bound to the "__bfo" global object in the JavaScript environment and it serves as the interface between the two environments. This implementation has no-ops for many methods (eg appAlert), but a subclass can override them to provide useful implementations, say by bringing up an AWT Dialog.

Since:
2.9

Constructor Summary
JSCoreMethods()
           
 
Method Summary
 void AFDate_Format(JSEvent event, int pdf)
          Implementation of the obsolete AFDate_Format method.
 void AFDate_FormatEx(JSEvent event, String format)
          An implementation of the AFDate_Format JavaScript method
 void AFDate_KeystrokeEx(JSEvent event, String format)
          Implementation of the AFDate_KeystrokeEx JavaScript method
 String AFMergeChange(JSEvent event)
          merges the last change with the uncommitted change
 void AFNumber_Format(JSEvent event, int dec, int sep, int neg, int dummy, String cursym, boolean curfirst)
          An implementation of the AFNumber_Format JavaScript method
 Date AFParseDateEx(String value, String format)
          Attempts to parse a string containing some form of date; returns null on failure or a Date object on success.
 void AFPercent_Format(JSEvent event, int dec, int sep)
          An implementation of the AFPercent_Format JavaScript method
 void AFSpecial_Format(JSEvent event, int psf)
          An implementation of the AFSpecial_Format JavaScript method
 void AFSpecial_Keystroke(JSEvent event, int psf)
           
 int appAlert(String message, int nIcon, int nType, String cTitle, Object oDoc, Object oCheckbox)
          An implementation of the App.alert() JavaScript method
 void appBeep()
          An implementation of the App.beep() JavaScript method
 String appResponse(String message, String cTitle, String cDefault, boolean bPassword, String cLabel)
          An implementation of the App.response() JavaScript method
 String appViewerType()
          An implementation of the App.viewerType JavaScript property
 String appViewerVariation()
          An implementation of the App.viewerVariation JavaScript property
 int appViewerVersion()
          An implementation of the App.viewerVersion JavaScript property
 Object[] colorFromAWT(Paint paint)
          Convert an AWT Color to a PDF color
 Color colorToAWT(Object[] pdfcolor)
          Convert a PDF Color to an AWT color
 void consoleClear()
          An implementation of the Console.clear() JavaScript method.
 void consoleHide()
          An implementation of the Console.hide() JavaScript method.
 void consolePrintln(String s)
          An implementation of the Console.println() JavaScript method.
 void consoleShow()
          /** An implementation of the Console.show() JavaScript method.
 boolean getAppFocusRect()
          An implementation of the App.focusRect JavaScript property (getter)
 boolean getAppRuntimeHighlight()
          An implementation of the App.runtimeHighlight JavaScript property (getter)
 Color getAppRuntimeHighlightColor()
          An implementation of the App.runtimeHighlightColor JavaScript property (getter)
 String getCustomJavaScript(String type, String name)
          Return an additional Script to be run on the App/Init event.
 String getImplementation()
           
 void notifyForRedraw(Object o)
          Called when a PDF object has had it's state changed and needs to be rebuilt
 void reportThrowable(Throwable e)
          Print a Throwable to the Console
 void setAppFocusRect(boolean value)
          An implementation of the App.focusRect JavaScript property (setter)
 void setAppRuntimeHighlight(boolean value)
          An implementation of the App.runtimeHighlight JavaScript property (setter)
 void setAppRuntimeHighlightColor(Color value)
          An implementation of the App.runtimeHighlightColor JavaScript property (setter)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSCoreMethods

public JSCoreMethods()
Method Detail

getImplementation

public String getImplementation()

getCustomJavaScript

public String getCustomJavaScript(String type,
                                  String name)
Return an additional Script to be run on the App/Init event. The default implementation returns null, which means no extra JavaScript is run.


reportThrowable

public void reportThrowable(Throwable e)
Print a Throwable to the Console


AFNumber_Format

public final void AFNumber_Format(JSEvent event,
                                  int dec,
                                  int sep,
                                  int neg,
                                  int dummy,
                                  String cursym,
                                  boolean curfirst)
An implementation of the AFNumber_Format JavaScript method


AFPercent_Format

public final void AFPercent_Format(JSEvent event,
                                   int dec,
                                   int sep)
An implementation of the AFPercent_Format JavaScript method


AFSpecial_Format

public final void AFSpecial_Format(JSEvent event,
                                   int psf)
An implementation of the AFSpecial_Format JavaScript method


AFDate_FormatEx

public final void AFDate_FormatEx(JSEvent event,
                                  String format)
An implementation of the AFDate_Format JavaScript method


AFDate_Format

public final void AFDate_Format(JSEvent event,
                                int pdf)
Implementation of the obsolete AFDate_Format method.


AFDate_KeystrokeEx

public final void AFDate_KeystrokeEx(JSEvent event,
                                     String format)
Implementation of the AFDate_KeystrokeEx JavaScript method


AFSpecial_Keystroke

public final void AFSpecial_Keystroke(JSEvent event,
                                      int psf)

AFMergeChange

public final String AFMergeChange(JSEvent event)
merges the last change with the uncommitted change


AFParseDateEx

public final Date AFParseDateEx(String value,
                                String format)
Attempts to parse a string containing some form of date; returns null on failure or a Date object on success. cFormat should be the format in which the date is entered. ( eg y/m/d, ddmmyy, etc ).


notifyForRedraw

public void notifyForRedraw(Object o)
Called when a PDF object has had it's state changed and needs to be rebuilt


colorFromAWT

public final Object[] colorFromAWT(Paint paint)
Convert an AWT Color to a PDF color


colorToAWT

public final Color colorToAWT(Object[] pdfcolor)
Convert a PDF Color to an AWT color


appBeep

public void appBeep()
An implementation of the App.beep() JavaScript method


appAlert

public int appAlert(String message,
                    int nIcon,
                    int nType,
                    String cTitle,
                    Object oDoc,
                    Object oCheckbox)
An implementation of the App.alert() JavaScript method


appResponse

public String appResponse(String message,
                          String cTitle,
                          String cDefault,
                          boolean bPassword,
                          String cLabel)
An implementation of the App.response() JavaScript method


appViewerType

public String appViewerType()
An implementation of the App.viewerType JavaScript property


appViewerVariation

public String appViewerVariation()
An implementation of the App.viewerVariation JavaScript property


appViewerVersion

public int appViewerVersion()
An implementation of the App.viewerVersion JavaScript property


getAppRuntimeHighlight

public boolean getAppRuntimeHighlight()
An implementation of the App.runtimeHighlight JavaScript property (getter)


setAppRuntimeHighlight

public void setAppRuntimeHighlight(boolean value)
An implementation of the App.runtimeHighlight JavaScript property (setter)


setAppRuntimeHighlightColor

public void setAppRuntimeHighlightColor(Color value)
An implementation of the App.runtimeHighlightColor JavaScript property (setter)


getAppRuntimeHighlightColor

public Color getAppRuntimeHighlightColor()
An implementation of the App.runtimeHighlightColor JavaScript property (getter)


getAppFocusRect

public boolean getAppFocusRect()
An implementation of the App.focusRect JavaScript property (getter)


setAppFocusRect

public void setAppFocusRect(boolean value)
An implementation of the App.focusRect JavaScript property (setter)


consoleShow

public void consoleShow()
/** An implementation of the Console.show() JavaScript method. The default implementation of this method turns on console.println(), so output goes to System.out


consoleHide

public void consoleHide()
An implementation of the Console.hide() JavaScript method. The default implementation of this method turns off console.println();


consoleClear

public void consoleClear()
An implementation of the Console.clear() JavaScript method.


consolePrintln

public void consolePrintln(String s)
An implementation of the Console.println() JavaScript method. The default implementation does nothiing unless console.show() has been called.



Copyright © 2001-2012 Big Faceless Organization