wt.dndMicroApplet
Class DnDMicroAppletUtil

java.lang.Object
  extended bywt.dndMicroApplet.DnDMicroAppletUtil

public class DnDMicroAppletUtil
extends Object

This class provides utilities to generate various forms of Java Plug-In tags for the drag-and-drop micro-applet, wt.clients.dndMicroApplet.DnDMicroApplet. It's methods are callable from just the HTML template processor or from JSP pages (or whatever other technology one might use to generate HTML, e.g. an XSLT extension function).


Field Summary
private static String ACCEPT_DIR_PARAM_STR
           
private static String BG_COLOR_PARAM_STR
           
private static String DOWNLOAD_CONTENT_PARAM_STR
           
private static String DRAG_DATA_FILE_NAME_PARAM_STR
           
private static String DRAG_DATA_STRING_PARAM_STR
           
private static String DRAG_DATA_URL_PARAM_STR
           
private static String DRAG_ICON_PARAM_STR
           
private static String ENCODING_NEEDED_PARAM_STR
           
private static String FILE_DROP_JS_PARAM_STR
           
private static String FILE_DROP_URL_PARAM_STR
           
private static String GLYPH_PARAM_STR
           
private static String ICON_PARAM_STR
           
private static String ID_PARAM_STR
           
private static int IEBROWSER
           
private static String JS_FILE_DELIM_PARAM_STR
           
private static String LOCALE_PARAM_STR
           
private static int NETSCAPE4BROWSER
           
private static int NETSCAPE6BROWSER
           
private static String STRING_DROP_JS_PARAM_STR
           
private static String STRING_DROP_URL_PARAM_STR
           
 
Constructor Summary
DnDMicroAppletUtil()
           
 
Method Summary
private static void addAppDataContentDragData(ApplicationData appData, ContentHolder holder, String codebase, Properties params)
          Add application data download URL as file drag data params
private static void addCoreDnDMicroAppletParams(Properties params, String codebase)
          Utility to add the core required parameters for specification of DnDMicroApplet's tags (with standard width and height) via PluginTagGenerator.
private static void addCoreDnDMicroAppletParams(Properties params, String codebase, int width, int height)
          Utility to add the core required parameters for specification of DnDMicroApplet's tags (with specified width and height) via PluginTagGenerator.
private static void addObjectLinkDragData(WTObject obj, String codebase, Locale locale, String encodedObjRefStr, Properties params)
          Add object properties URL as file drag data params
private static void addURLDataDragData(URLData urlData, String codebase, Properties params)
          Add URL data URL as file drag data params
static int getBrowserfromUserAgent()
           
static int getBrowserfromUserAgent(String userAgent)
           
private static String getDragOverIcon(WTObject obj, String icon, boolean docDropOk)
          Decide on drag-over icon
private static String getLinkNameForObject(WTObject obj, Locale locale)
          Figure out reasonable name for hyperlink to object properties page
private static String getObjectRefString(WTObject obj)
          Get object reference string for a WTObject.
static boolean isDndObject(WTObject obj)
          Placeholder routine to turn off applet for any given objects.
private static boolean isFileDropSupportedForDoc(Object object)
          Determine whether file drop is supported for the given document.
private static boolean isSupportedDropTarget(WTObject obj)
          Determine whether we have standard drop handlers for the given object
static String makeAppletTag(String codebase, String icon, String dragIcon, String bgColor, String jsMethod, String delim)
          Makes an applet tag for use as a primary or secondary content item specification drop target as used in document creation, update, and check-in pages.
static String makeAppletTag(String codebase, String icon, String dragIcon, String bgColor, String jsMethod, String delim, Properties params)
           
static String makeAppletTag(String codebase, String icon, String dragIcon, String bgColor, String jsMethod, String delim, Properties params, String userAgent)
           
static String makeAppletTag(String codebase, String icon, String dragIcon, String bgColor, String jsMethod, String delim, String userAgent)
          Makes an applet tag for use as a primary or secondary content item specification drop target as used in document creation, update, and check-in pages.
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String bgColor, String link)
           
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String glyphURLString, String bgColor, ContentHolder holder)
          Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String glyphURLString, String bgColor, ContentHolder holder, int width, int height)
          Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String glyphURLString, String bgColor, ContentHolder holder, int width, int height, String userAgent)
          Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String glyphURLString, String bgColor, ContentHolder holder, String userAgent)
          Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.
static String makeAppletTag(WTObject obj, String codebase, String iconURLString, String bgColor, String link, String userAgent)
           
private static String makeURLStringRelative(String baseURLString, String urlString)
          Very quick and primitive utility to reduce an absolute URL string, 'urlString', to an URL string relative to 'baseURLString' if an only if 'urlString' begins with 'baseURLString'.
private static String removeNewLines(String str)
          Replace new line and carriage return characters with spaces.
private static String sanitizeFilename(String filename)
          Replaces all unsafe characters in the proposed filename with a safe character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PARAM_STR

private static final String ID_PARAM_STR
See Also:
Constant Field Values

BG_COLOR_PARAM_STR

private static final String BG_COLOR_PARAM_STR
See Also:
Constant Field Values

ICON_PARAM_STR

private static final String ICON_PARAM_STR
See Also:
Constant Field Values

GLYPH_PARAM_STR

private static final String GLYPH_PARAM_STR
See Also:
Constant Field Values

LOCALE_PARAM_STR

private static final String LOCALE_PARAM_STR
See Also:
Constant Field Values

ACCEPT_DIR_PARAM_STR

private static final String ACCEPT_DIR_PARAM_STR
See Also:
Constant Field Values

DRAG_ICON_PARAM_STR

private static final String DRAG_ICON_PARAM_STR
See Also:
Constant Field Values

FILE_DROP_JS_PARAM_STR

private static final String FILE_DROP_JS_PARAM_STR
See Also:
Constant Field Values

JS_FILE_DELIM_PARAM_STR

private static final String JS_FILE_DELIM_PARAM_STR
See Also:
Constant Field Values

FILE_DROP_URL_PARAM_STR

private static final String FILE_DROP_URL_PARAM_STR
See Also:
Constant Field Values

STRING_DROP_URL_PARAM_STR

private static final String STRING_DROP_URL_PARAM_STR
See Also:
Constant Field Values

DOWNLOAD_CONTENT_PARAM_STR

private static final String DOWNLOAD_CONTENT_PARAM_STR
See Also:
Constant Field Values

DRAG_DATA_URL_PARAM_STR

private static final String DRAG_DATA_URL_PARAM_STR
See Also:
Constant Field Values

DRAG_DATA_FILE_NAME_PARAM_STR

private static final String DRAG_DATA_FILE_NAME_PARAM_STR
See Also:
Constant Field Values

STRING_DROP_JS_PARAM_STR

private static final String STRING_DROP_JS_PARAM_STR
See Also:
Constant Field Values

DRAG_DATA_STRING_PARAM_STR

private static final String DRAG_DATA_STRING_PARAM_STR
See Also:
Constant Field Values

ENCODING_NEEDED_PARAM_STR

private static final String ENCODING_NEEDED_PARAM_STR
See Also:
Constant Field Values

IEBROWSER

private static final int IEBROWSER
See Also:
Constant Field Values

NETSCAPE6BROWSER

private static final int NETSCAPE6BROWSER
See Also:
Constant Field Values

NETSCAPE4BROWSER

private static final int NETSCAPE4BROWSER
See Also:
Constant Field Values
Constructor Detail

DnDMicroAppletUtil

public DnDMicroAppletUtil()
Method Detail

isDndObject

public static boolean isDndObject(WTObject obj)
Placeholder routine to turn off applet for any given objects.


getBrowserfromUserAgent

public static int getBrowserfromUserAgent()

getBrowserfromUserAgent

public static int getBrowserfromUserAgent(String userAgent)

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String glyphURLString,
                                   String bgColor,
                                   ContentHolder holder,
                                   String userAgent)
                            throws WTException
Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.

Throws:
WTException

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String glyphURLString,
                                   String bgColor,
                                   ContentHolder holder,
                                   int width,
                                   int height,
                                   String userAgent)
                            throws WTException
Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object. Height and width configurable.

Throws:
WTException

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String glyphURLString,
                                   String bgColor,
                                   ContentHolder holder)
                            throws WTException
Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object.

Throws:
WTException

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String glyphURLString,
                                   String bgColor,
                                   ContentHolder holder,
                                   int width,
                                   int height)
                            throws WTException
Makes a drag-and-drop applet tag with default drag and drop handlers configured for the given object. Height and width configurable.

Throws:
WTException

addCoreDnDMicroAppletParams

private static void addCoreDnDMicroAppletParams(Properties params,
                                                String codebase)
Utility to add the core required parameters for specification of DnDMicroApplet's tags (with standard width and height) via PluginTagGenerator.


addCoreDnDMicroAppletParams

private static void addCoreDnDMicroAppletParams(Properties params,
                                                String codebase,
                                                int width,
                                                int height)
Utility to add the core required parameters for specification of DnDMicroApplet's tags (with specified width and height) via PluginTagGenerator.


removeNewLines

private static String removeNewLines(String str)
Replace new line and carriage return characters with spaces. This is done purely as a workaroudn for workflow pages which stick
tags in wherever they find a new line (we do carriage returns as well to be safe).


makeAppletTag

public static String makeAppletTag(String codebase,
                                   String icon,
                                   String dragIcon,
                                   String bgColor,
                                   String jsMethod,
                                   String delim)
                            throws WTException,
                                   IOException
Makes an applet tag for use as a primary or secondary content item specification drop target as used in document creation, update, and check-in pages.

Throws:
WTException
IOException

makeAppletTag

public static String makeAppletTag(String codebase,
                                   String icon,
                                   String dragIcon,
                                   String bgColor,
                                   String jsMethod,
                                   String delim,
                                   String userAgent)
                            throws WTException,
                                   IOException
Makes an applet tag for use as a primary or secondary content item specification drop target as used in document creation, update, and check-in pages.

Throws:
WTException
IOException

makeAppletTag

public static String makeAppletTag(String codebase,
                                   String icon,
                                   String dragIcon,
                                   String bgColor,
                                   String jsMethod,
                                   String delim,
                                   Properties params)
                            throws WTException,
                                   IOException
Throws:
WTException
IOException

makeAppletTag

public static String makeAppletTag(String codebase,
                                   String icon,
                                   String dragIcon,
                                   String bgColor,
                                   String jsMethod,
                                   String delim,
                                   Properties params,
                                   String userAgent)
                            throws WTException,
                                   IOException
Throws:
WTException
IOException

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String bgColor,
                                   String link)
                            throws WTException
Throws:
WTException

makeAppletTag

public static String makeAppletTag(WTObject obj,
                                   String codebase,
                                   String iconURLString,
                                   String bgColor,
                                   String link,
                                   String userAgent)
                            throws WTException
Throws:
WTException

isFileDropSupportedForDoc

private static boolean isFileDropSupportedForDoc(Object object)
Determine whether file drop is supported for the given document.


addAppDataContentDragData

private static void addAppDataContentDragData(ApplicationData appData,
                                              ContentHolder holder,
                                              String codebase,
                                              Properties params)
                                       throws WTException
Add application data download URL as file drag data params

Throws:
WTException

addURLDataDragData

private static void addURLDataDragData(URLData urlData,
                                       String codebase,
                                       Properties params)
Add URL data URL as file drag data params


addObjectLinkDragData

private static void addObjectLinkDragData(WTObject obj,
                                          String codebase,
                                          Locale locale,
                                          String encodedObjRefStr,
                                          Properties params)
                                   throws WTException
Add object properties URL as file drag data params

Throws:
WTException

getLinkNameForObject

private static String getLinkNameForObject(WTObject obj,
                                           Locale locale)
Figure out reasonable name for hyperlink to object properties page


sanitizeFilename

private static String sanitizeFilename(String filename)
Replaces all unsafe characters in the proposed filename with a safe character. Returns null if the supplied filename is null.


getDragOverIcon

private static String getDragOverIcon(WTObject obj,
                                      String icon,
                                      boolean docDropOk)
Decide on drag-over icon


isSupportedDropTarget

private static boolean isSupportedDropTarget(WTObject obj)
                                      throws WTException
Determine whether we have standard drop handlers for the given object

Throws:
WTException

makeURLStringRelative

private static String makeURLStringRelative(String baseURLString,
                                            String urlString)
Very quick and primitive utility to reduce an absolute URL string, 'urlString', to an URL string relative to 'baseURLString' if an only if 'urlString' begins with 'baseURLString'.


getObjectRefString

private static String getObjectRefString(WTObject obj)
                                  throws WTException
Get object reference string for a WTObject.

There is probably a nice, standard utility to do this, but I couldn't find it quickly when I needed it.

Throws:
WTException