GenericPopup
Date: 2019-10-22

org.jmol.popup

## Class GenericPopup

- java.lang.Object
- - org.jmol.popup.GenericPopup

- All Implemented Interfaces:
    GenericMenuInterface
  Direct Known Subclasses:
    JmolGenericPopup

      public abstract class GenericPopup
      extends java.lang.Object
      implements GenericMenuInterface

  The overall parent of all popup classes in Jmol and JSmol. Contains methods and fields common to the "SwingComponent" SC class, which allows for both JavaScript (org.jmol.awtjs.swing) and Java (java.awt) components. This solution predates Jmol-SwingJS by about six years (2012 vs. 2018)

       abstract GenericPopop
       -- abstract JmolGenericPopup
         -- abstract JmolPopup
            -- AwtJmolPopup
            -- JSJmolPopup
         -- abstract ModelKitPopup
            -- AwtModelKitPopup
            -- JSModelKitPopup
       -- abstract JSVGenericPopup
         -- AwtPopup
         -- JsPopup

  Author:
    Bob Hanson

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `allowSignedFeatures`
    `protected java.lang.Object` | `buttonGroup`
    `protected java.lang.String` | `currentMenuItemId`
    `protected PopupHelper` | `helper`
    `protected java.util.Map<java.lang.String,SC>` | `htCheckbox`
    `protected java.util.Map<java.lang.String,SC>` | `htMenus`
    `protected boolean` | `isApplet`
    `protected boolean` | `isJS`
    `protected boolean` | `isSigned`
    `protected boolean` | `isTainted`
    `protected boolean` | `isWebGL`
    `protected java.lang.String` | `menuName`
    `protected SC` | `popupMenu`
    `private javajs.util.Lst<SC>` | `SignedOnly`
    `protected java.lang.String` | `strMenuStructure`
    `protected SC` | `thisPopup`
    `int` | `thisx`
    `int` | `thisy`
    `protected boolean` | `updatingForShow`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericPopup()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static void` | `addItemText(javajs.util.SB sb, char type, int level, java.lang.String name, java.lang.String label, java.lang.String script, java.lang.String flags)`
    `protected SC` | `addMenuItem(SC menuItem, java.lang.String entry)`
    `protected void` | `addMenuItems(java.lang.String parentId, java.lang.String key, SC menu, PopupResource popupResourceBundle)`
    `protected void` | `appCheckItem(java.lang.String item, SC newMenu)` Opportunity to do something special with an item.
    `protected void` | `appCheckSpecialMenu(java.lang.String item, SC subMenu, java.lang.String word)` Opportunity to do something special with a given submenu is created
    `protected abstract java.lang.String` | `appFixLabel(java.lang.String label)`
    `protected abstract boolean` | `appGetBooleanProperty(java.lang.String name)`
    `protected java.lang.String` | `appGetMenuAsString(java.lang.String title)`
    `protected abstract void` | `appRestorePopupMenu()`
    `protected abstract void` | `appRunScript(java.lang.String script)`
    `protected abstract boolean` | `appRunSpecialCheckBox(SC item, java.lang.String basename, java.lang.String what, boolean TF)`
    `protected abstract void` | `appUpdateForShow()`
    `protected abstract void` | `appUpdateSpecialCheckBoxValue(SC source, java.lang.String actionCommand, boolean selected)`
    `private boolean` | `checkKey(java.lang.String key)`
    `protected static int` | `convertToMegabytes(long num)`
    `protected void` | `doMenuCheckBoxCallback(SC source)`
    `protected void` | `doMenuClickCallback(SC source, java.lang.String script)`
    `protected java.lang.Object` | `getEntryIcon(java.lang.String[] ret)`
    `protected abstract java.lang.Object` | `getImageIcon(java.lang.String fileName)`
    `protected abstract java.lang.String` | `getScriptForCallback(SC source, java.lang.String name, java.lang.String script)`
    `protected abstract java.lang.String` | `getUnknownCheckBoxScriptToRun(SC item, java.lang.String name, java.lang.String what, boolean TF)`
    `protected void` | `initSwing(java.lang.String title, PopupResource bundle, java.lang.Object applet, boolean isJS, boolean isSigned, boolean isWebGL)`
    `java.lang.String` | `jpiGetMenuAsString(java.lang.String title)`
    `private void` | `menuAddItem(SC menu, SC item)`
    `protected void` | `menuAddSeparator(SC menu)`
    `protected void` | `menuAddSubMenu(SC menu, SC subMenu)`
    `void` | `menuCheckBoxCallback(SC source)`
    `void` | `menuClickCallback(SC source, java.lang.String script)`
    `protected SC` | `menuCreateCheckboxItem(SC menu, java.lang.String entry, java.lang.String basename, java.lang.String id, boolean state, boolean isRadio)`
    `protected SC` | `menuCreateItem(SC menu, java.lang.String entry, java.lang.String script, java.lang.String id)`
    `protected void` | `menuEnable(SC component, boolean enable)`
    `abstract void` | `menuFocusCallback(java.lang.String name, java.lang.String actionCommand, boolean gained)`
    `private void` | `menuGetAsText(javajs.util.SB sb, int level, SC menu, java.lang.String menuName)`
    `protected java.lang.String` | `menuGetId(SC menu)`
    `protected int` | `menuGetListPosition(SC item)`
    `protected SC` | `menuNewSubMenu(java.lang.String entry, java.lang.String id)`
    `protected void` | `menuRemoveAll(SC menu, int indexFrom)`
    `protected void` | `menuSetAutoscrolls(SC menu)`
    `protected void` | `menuSetLabel(SC m, java.lang.String entry)`
    `protected abstract void` | `menuShowPopup(SC popup, int x, int y)`
    `private SC` | `newMenuItem(SC item, SC menu, java.lang.String text, java.lang.String script, java.lang.String id)`
    `private void` | `rememberCheckbox(java.lang.String key, SC checkboxMenuItem)`
    `private void` | `runCheckBoxScript(SC item, java.lang.String what, boolean TF)`
    `protected SC` | `setText(java.lang.String item, java.lang.String text)`
    `protected void` | `show(int x, int y, boolean doPopup)`
    `protected void` | `updateButton(SC b, java.lang.String entry, java.lang.String script)`
    `private void` | `updateCheckBoxesForShow()`
    `protected void` | `updateSignedAppletItems()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.jmol.api.GenericMenuInterface

      `jpiDispose, jpiGetMenuAsObject, jpiInitialize, jpiShow, jpiUpdateComputedMenus`

- - ### Field Detail

    - #### helper

          protected PopupHelper helper

    - #### strMenuStructure

          protected java.lang.String strMenuStructure

    - #### allowSignedFeatures

          protected boolean allowSignedFeatures

    - #### isJS

          protected boolean isJS

    - #### isApplet

          protected boolean isApplet

    - #### isSigned

          protected boolean isSigned

    - #### isWebGL

          protected boolean isWebGL

    - #### thisx

          public int thisx

    - #### thisy

          public int thisy

    - #### isTainted

          protected boolean isTainted

    - #### menuName

          protected java.lang.String menuName

    - #### popupMenu

          protected SC popupMenu

    - #### thisPopup

          protected SC thisPopup

    - #### htCheckbox

          protected java.util.Map<java.lang.String,SC> htCheckbox

    - #### buttonGroup

          protected java.lang.Object buttonGroup

    - #### currentMenuItemId

          protected java.lang.String currentMenuItemId

    - #### htMenus

          protected java.util.Map<java.lang.String,SC> htMenus

    - #### SignedOnly

          private javajs.util.Lst<SC> SignedOnly

    - #### updatingForShow

          protected boolean updatingForShow

  - ### Constructor Detail

    - #### GenericPopup

          public GenericPopup()

  - ### Method Detail

    - #### getImageIcon

          protected abstract java.lang.Object getImageIcon(java.lang.String fileName)

    - #### menuShowPopup

          protected abstract void menuShowPopup(SC popup,
                                                int x,
                                                int y)

    - #### getUnknownCheckBoxScriptToRun

          protected abstract java.lang.String getUnknownCheckBoxScriptToRun(SC item,
                                                                            java.lang.String name,
                                                                            java.lang.String what,
                                                                            boolean TF)

    - #### appCheckItem

          protected void appCheckItem(java.lang.String item,
                                      SC newMenu)

      Opportunity to do something special with an item.
      Parameters:
        `item` -
        `newMenu` -

    - #### appCheckSpecialMenu

          protected void appCheckSpecialMenu(java.lang.String item,
                                             SC subMenu,
                                             java.lang.String word)

      Opportunity to do something special with a given submenu is created
      Parameters:
        `item` -
        `subMenu` -
        `word` -

    - #### appFixLabel

          protected abstract java.lang.String appFixLabel(java.lang.String label)

    - #### getScriptForCallback

          protected abstract java.lang.String getScriptForCallback(SC source,
                                                                   java.lang.String name,
                                                                   java.lang.String script)

    - #### appGetBooleanProperty

          protected abstract boolean appGetBooleanProperty(java.lang.String name)

    - #### appRunSpecialCheckBox

          protected abstract boolean appRunSpecialCheckBox(SC item,
                                                           java.lang.String basename,
                                                           java.lang.String what,
                                                           boolean TF)

    - #### appRestorePopupMenu

          protected abstract void appRestorePopupMenu()

    - #### appRunScript

          protected abstract void appRunScript(java.lang.String script)

    - #### appUpdateSpecialCheckBoxValue

          protected abstract void appUpdateSpecialCheckBoxValue(SC source,
                                                                java.lang.String actionCommand,
                                                                boolean selected)

    - #### appUpdateForShow

          protected abstract void appUpdateForShow()

    - #### initSwing

          protected void initSwing(java.lang.String title,
                                   PopupResource bundle,
                                   java.lang.Object applet,
                                   boolean isJS,
                                   boolean isSigned,
                                   boolean isWebGL)

    - #### addMenuItems

          protected void addMenuItems(java.lang.String parentId,
                                      java.lang.String key,
                                      SC menu,
                                      PopupResource popupResourceBundle)

    - #### updateSignedAppletItems

          protected void updateSignedAppletItems()

    - #### checkKey

          private boolean checkKey(java.lang.String key)

      Parameters:
        `key` -
      Returns:
        true unless a JAVA-only key in JavaScript

    - #### rememberCheckbox

          private void rememberCheckbox(java.lang.String key,
                                        SC checkboxMenuItem)

    - #### updateButton

          protected void updateButton(SC b,
                                      java.lang.String entry,
                                      java.lang.String script)

    - #### getEntryIcon

          protected java.lang.Object getEntryIcon(java.lang.String[] ret)

    - #### addMenuItem

          protected SC addMenuItem(SC menuItem,
                                   java.lang.String entry)

    - #### menuSetLabel

          protected void menuSetLabel(SC m,
                                      java.lang.String entry)

    - #### menuFocusCallback

          public abstract void menuFocusCallback(java.lang.String name,
                                                 java.lang.String actionCommand,
                                                 boolean gained)

    - #### menuClickCallback

          public void menuClickCallback(SC source,
                                        java.lang.String script)

    - #### doMenuClickCallback

          protected void doMenuClickCallback(SC source,
                                             java.lang.String script)

    - #### menuCheckBoxCallback

          public void menuCheckBoxCallback(SC source)

    - #### doMenuCheckBoxCallback

          protected void doMenuCheckBoxCallback(SC source)

    - #### runCheckBoxScript

          private void runCheckBoxScript(SC item,
                                         java.lang.String what,
                                         boolean TF)

    - #### menuCreateItem

          protected SC menuCreateItem(SC menu,
                                      java.lang.String entry,
                                      java.lang.String script,
                                      java.lang.String id)

    - #### menuCreateCheckboxItem

          protected SC menuCreateCheckboxItem(SC menu,
                                              java.lang.String entry,
                                              java.lang.String basename,
                                              java.lang.String id,
                                              boolean state,
                                              boolean isRadio)

    - #### menuAddSeparator

          protected void menuAddSeparator(SC menu)

    - #### menuNewSubMenu

          protected SC menuNewSubMenu(java.lang.String entry,
                                      java.lang.String id)

    - #### menuRemoveAll

          protected void menuRemoveAll(SC menu,
                                       int indexFrom)

    - #### newMenuItem

          private SC newMenuItem(SC item,
                                 SC menu,
                                 java.lang.String text,
                                 java.lang.String script,
                                 java.lang.String id)

    - #### setText

          protected SC setText(java.lang.String item,
                               java.lang.String text)

    - #### menuAddItem

          private void menuAddItem(SC menu,
                                   SC item)

    - #### menuAddSubMenu

          protected void menuAddSubMenu(SC menu,
                                        SC subMenu)

    - #### menuEnable

          protected void menuEnable(SC component,
                                    boolean enable)

    - #### menuGetId

          protected java.lang.String menuGetId(SC menu)

    - #### menuSetAutoscrolls

          protected void menuSetAutoscrolls(SC menu)

    - #### menuGetListPosition

          protected int menuGetListPosition(SC item)

    - #### show

          protected void show(int x,
                              int y,
                              boolean doPopup)

    - #### updateCheckBoxesForShow

          private void updateCheckBoxesForShow()

    - #### jpiGetMenuAsString

          public java.lang.String jpiGetMenuAsString(java.lang.String title)

      Specified by:
        `jpiGetMenuAsString` in interface `GenericMenuInterface`

    - #### appGetMenuAsString

          protected java.lang.String appGetMenuAsString(java.lang.String title)

    - #### menuGetAsText

          private void menuGetAsText(javajs.util.SB sb,
                                     int level,
                                     SC menu,
                                     java.lang.String menuName)

    - #### addItemText

          private static void addItemText(javajs.util.SB sb,
                                          char type,
                                          int level,
                                          java.lang.String name,
                                          java.lang.String label,
                                          java.lang.String script,
                                          java.lang.String flags)

    - #### convertToMegabytes

          protected static int convertToMegabytes(long num)