# Class GenericPopup

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

All Implemented Interfaces:
  `GenericMenuInterface`

Direct Known Subclasses:
  `JmolGenericPopup, JSVGenericPopup`

public abstract class GenericPopup extends 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
Description
`protected boolean`
`allowSignedFeatures`
`protected Object`
`buttonGroup`
`protected String`
`currentMenuItemId`
`PopupHelper`
`helper`
`protected Map<String,SC>`
`htCheckbox`
`protected Map<String,SC>`
`htMenus`
`protected boolean`
`isApplet`
`protected boolean`
`isJS`
`protected boolean`
`isSigned`
`protected boolean`
`isTainted`
`protected boolean`
`isWebGL`
`protected String`
`menuName`
`protected SC`
`popupMenu`
`protected String`
`strMenuStructure`
`protected SC`
`thisPopup`
`int`
`thisx`
`int`
`thisy`
`protected boolean`
`updatingForShow`

## Constructor Summary

Constructors
Constructor
Description
`GenericPopup()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`addMenu(String id, String item, SC subMenu, String label, PopupResource popupResourceBundle)`
`protected SC`
`addMenuItem(SC menuItem, String entry)`
`void`
`addMenuItems(String parentId, String key, SC menu, PopupResource popupResourceBundle)`
`protected void`
`appCheckItem(String item, SC newMenu)`
Opportunity to do something special with an item.
`void`
`appCheckSpecialMenu(String item, SC subMenu, String word)`
Opportunity to do something special with a given submenu is created
`protected abstract String`
`appFixLabel(String label)`
`protected abstract boolean`
`appGetBooleanProperty(String name)`
`protected String`
`appGetMenuAsString(String title)`
`protected abstract void`
`appRestorePopupMenu()`
`protected abstract void`
`appRunScript(String script)`
`protected abstract boolean`
`appRunSpecialCheckBox(SC item, String basename, String what, boolean TF)`
`protected abstract void`
`appUpdateForShow()`
`protected abstract void`
`appUpdateSpecialCheckBoxValue(SC source, String actionCommand, boolean selected)`
`protected static int`
`convertToMegabytes(long num)`
`protected void`
`doMenuCheckBoxCallback(SC source)`
`protected void`
`doMenuClickCallback(SC source, String script)`
`protected Object`
`getEntryIcon(String[] ret)`
`protected abstract Object`
`getImageIcon(String fileName)`
`protected abstract String`
`getScriptForCallback(SC source, String name, String script)`
`protected abstract String`
`getUnknownCheckBoxScriptToRun(SC item, String name, String what, boolean TF)`
`protected void`
`initSwing(String title, PopupResource bundle, Object applet, boolean isJS, boolean isSigned, boolean isWebGL)`
`void`
`jpiDispose()`
`String`
`jpiGetMenuAsString(String title)`
`protected void`
`menuAddSeparator(SC menu)`
`protected void`
`menuAddSubMenu(SC menu, SC subMenu)`
`void`
`menuCheckBoxCallback(SC source)`
`void`
`menuClickCallback(SC source, String script)`
`protected SC`
`menuCreateCheckboxItem(SC menu, String entry, String basename, String id, boolean state, boolean isRadio)`
`protected SC`
`menuCreateItem(SC menu, String entry, String script, String id)`
`protected void`
`menuEnable(SC component, boolean enable)`
`abstract void`
`menuFocusCallback(String name, String actionCommand, boolean gained)`
//// run time event-driven methods
`protected String`
`menuGetId(SC menu)`
`protected int`
`menuGetListPosition(SC item)`
`protected SC`
`menuNewSubMenu(String entry, String id)`
`protected void`
`menuRemoveAll(SC menu, int indexFrom)`
`protected void`
`menuSetAutoscrolls(SC menu)`
`protected void`
`menuSetLabel(SC m, String entry)`
`protected abstract void`
`menuShowPopup(SC popup, int x, int y)`
`protected SC`
`setText(String item, String text)`
`protected void`
`show(int x, int y, boolean doPopup)`
`protected void`
`updateButton(SC b, String entry, String script)`
`protected void`
`updateSignedAppletItems()`

### Methods inherited from class Object

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

### Methods inherited from interface GenericMenuInterface

`jpiGetMenuAsObject, jpiInitialize, jpiShow, jpiUpdateComputedMenus`

## Field Details

### helper

public PopupHelper helper

### strMenuStructure

protected 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 String menuName

### popupMenu

protected SC popupMenu

### thisPopup

protected SC thisPopup

### htCheckbox

protected Map<String,SC> htCheckbox

### buttonGroup

protected Object buttonGroup

### currentMenuItemId

protected String currentMenuItemId

### htMenus

protected Map<String,SC> htMenus

### updatingForShow

protected boolean updatingForShow

## Constructor Details

### GenericPopup

public GenericPopup()

## Method Details

### getImageIcon

protected abstract Object getImageIcon(String fileName)

### menuShowPopup

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

### getUnknownCheckBoxScriptToRun

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

### appCheckItem

protected void appCheckItem(String item, SC newMenu)
Opportunity to do something special with an item.

Parameters:
  `item` -
  `newMenu` -

### appCheckSpecialMenu

public void appCheckSpecialMenu(String item, SC subMenu, String word)
Opportunity to do something special with a given submenu is created

Parameters:
  `item` -
  `subMenu` -
  `word` -

### appFixLabel

protected abstract String appFixLabel(String label)

### getScriptForCallback

protected abstract String getScriptForCallback(SC source, String name, String script)

### appGetBooleanProperty

protected abstract boolean appGetBooleanProperty(String name)

### appRunSpecialCheckBox

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

### appRestorePopupMenu

protected abstract void appRestorePopupMenu()

### appRunScript

protected abstract void appRunScript(String script)

### appUpdateSpecialCheckBoxValue

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

### appUpdateForShow

protected abstract void appUpdateForShow()

### initSwing

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

### addMenuItems

public void addMenuItems(String parentId, String key, SC menu, PopupResource popupResourceBundle)

### addMenu

protected void addMenu(String id, String item, SC subMenu, String label, PopupResource popupResourceBundle)

### updateSignedAppletItems

protected void updateSignedAppletItems()

### updateButton

protected void updateButton(SC b, String entry, String script)

### getEntryIcon

protected Object getEntryIcon(String[] ret)

### addMenuItem

protected SC addMenuItem(SC menuItem, String entry)

### menuSetLabel

protected void menuSetLabel(SC m, String entry)

### menuFocusCallback

public abstract void menuFocusCallback(String name, String actionCommand, boolean gained)
//// run time event-driven methods

### menuClickCallback

public void menuClickCallback(SC source, String script)

### doMenuClickCallback

protected void doMenuClickCallback(SC source, String script)

### menuCheckBoxCallback

public void menuCheckBoxCallback(SC source)

### doMenuCheckBoxCallback

protected void doMenuCheckBoxCallback(SC source)

### menuCreateItem

protected SC menuCreateItem(SC menu, String entry, String script, String id)

### menuCreateCheckboxItem

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

### menuAddSeparator

protected void menuAddSeparator(SC menu)

### menuNewSubMenu

protected SC menuNewSubMenu(String entry, String id)

### menuRemoveAll

protected void menuRemoveAll(SC menu, int indexFrom)

### setText

protected SC setText(String item, String text)

### menuAddSubMenu

protected void menuAddSubMenu(SC menu, SC subMenu)

### menuEnable

protected void menuEnable(SC component, boolean enable)

### menuGetId

protected 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)

Parameters:
  `x` -
  `y` -
  `doPopup` -

### jpiGetMenuAsString

public String jpiGetMenuAsString(String title)

Specified by:
  `jpiGetMenuAsString` in interface `GenericMenuInterface`

### appGetMenuAsString

protected String appGetMenuAsString(String title)

Parameters:
  `title` -
Returns:
  null

### convertToMegabytes

protected static int convertToMegabytes(long num)

### jpiDispose

public void jpiDispose()

Specified by:
  `jpiDispose` in interface `GenericMenuInterface`