public class

ToolConfig

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.config.ToolConfig

Class Overview

Helper class for config tools and tool related customize stuffs

Summary

Nested Classes
interface ToolConfig.PanLongPressSwitchToolCallback A functional interface for pan tool switch tool when long pressing on annotation  
Public Methods
void addQMHideItem(int itemId)
Add quick menu item to no annotation permission list
ToolManager.ToolModeBase getAnnotationHandlerToolMode(int annotType)
get annotation handler tool mode
ArrayList<FontResource> getFontList()
Gets list of font to use for free text annotation
static ToolConfig getInstance()
ToolConfig.PanLongPressSwitchToolCallback getPanLongPressSwitchToolCallback()
Gets Pan tool long press switch tool callback, if no customized callback defined, return the default one.
ToolManager.ToolMode getToolModeByAnnotationToolbarItemId(int itemId)
Gets tool mode by annotation toolbar item id
ToolManager.ToolMode getToolModeByQMItemId(int qmItemId)
Gets tool mode by quick menu item id
boolean isHideQMItem(int itemId)
Check if quick menu item should be hidden by a given item id
void putAnnotationToolModePair(int annotType, ToolManager.ToolModeBase toolMode)
Put annotation type and tool mode into annotation tool mode pair
void putCustomToolAnnotationToolbarItemPair(int itemId, ToolManager.ToolMode mode)
put custom tool mode and annotation toolbar item view id pair
void putCustomToolQMItemPair(int qmItemId, ToolManager.ToolMode mode)
put custom tool mode and quick menu item pair
boolean removeQMHideItem(int itemId)
remove quick menu item from no annotation permission list
void setFontList(ArrayList<FontResource> fonts)
Sets list of font to use for free text annotation
void setPanToolLongPressSwitchToolCallback(ToolConfig.PanLongPressSwitchToolCallback callback)
Sets customized callback for pan tool switch tool when long press
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void addQMHideItem (int itemId)

Add quick menu item to no annotation permission list

Parameters
itemId quick menu item id

public ToolManager.ToolModeBase getAnnotationHandlerToolMode (int annotType)

get annotation handler tool mode

Parameters
annotType annotation type
Returns
  • tool mode

public ArrayList<FontResource> getFontList ()

Gets list of font to use for free text annotation

Returns
  • the list of fonts

public static ToolConfig getInstance ()

public ToolConfig.PanLongPressSwitchToolCallback getPanLongPressSwitchToolCallback ()

Gets Pan tool long press switch tool callback, if no customized callback defined, return the default one. Default callback:

     if (isTextSelect) {
          return ToolMode.TEXT_SELECT;
       
       if (annot == null) {
           return ToolMode.PAN;
       }
       switch (annot.getType()) {
           case Annot.e_Link:
               if(isSelfMade){
                   return ToolMode.ANNOT_EDIT;
              }else{
                   return ToolMode.LINK_ACTION;
               }
           case Annot.e_Widget:
              if (isSelfMade) {
                  return ToolMode.ANNOT_EDIT;
              } else {
                   return ToolMode.FORM_FILL;
               }
           case Annot.e_Line:
 *               return ToolMode.ANNOT_EDIT_LINE;
           default:
               return ToolMode.ANNOT_EDIT;
       }
     }
 

Returns
  • pan tool long press switch tool callback

public ToolManager.ToolMode getToolModeByAnnotationToolbarItemId (int itemId)

Gets tool mode by annotation toolbar item id

Parameters
itemId annotation toolbar item view id
Returns
  • tool mode

public ToolManager.ToolMode getToolModeByQMItemId (int qmItemId)

Gets tool mode by quick menu item id

Parameters
qmItemId quick menu item id
Returns
  • tool mode

public boolean isHideQMItem (int itemId)

Check if quick menu item should be hidden by a given item id

Parameters
itemId quick menu item id
Returns
  • true then hide quick menu item, else otherwise

public void putAnnotationToolModePair (int annotType, ToolManager.ToolModeBase toolMode)

Put annotation type and tool mode into annotation tool mode pair

Parameters
annotType annotation type
toolMode tool mode

public void putCustomToolAnnotationToolbarItemPair (int itemId, ToolManager.ToolMode mode)

put custom tool mode and annotation toolbar item view id pair

Parameters
itemId annotation toolbar item view id
mode tool mode

public void putCustomToolQMItemPair (int qmItemId, ToolManager.ToolMode mode)

put custom tool mode and quick menu item pair

Parameters
qmItemId quick menu item id
mode tool mode

public boolean removeQMHideItem (int itemId)

remove quick menu item from no annotation permission list

Parameters
itemId quick menu item id
Returns
  • true if removed successfully, else otherwise

public void setFontList (ArrayList<FontResource> fonts)

Sets list of font to use for free text annotation

Parameters
fonts the list of fonts

public void setPanToolLongPressSwitchToolCallback (ToolConfig.PanLongPressSwitchToolCallback callback)

Sets customized callback for pan tool switch tool when long press

Parameters
callback pan tool long press switch tool tool callback