Package org.jmol.modelkit
Class ModelKitPopup
- java.lang.Object
-
- org.jmol.popup.GenericPopup
-
- org.jmol.popup.JmolGenericPopup
-
- org.jmol.modelkit.ModelKitPopup
-
- All Implemented Interfaces:
GenericMenuInterface
- Direct Known Subclasses:
AwtModelKitPopup,JSModelKitPopup
public abstract class ModelKitPopup extends JmolGenericPopup
An abstract popup class that is instantiated for a given platform and context as one of:-- abstract ModelKitPopup -- AwtModelKitPopup -- JSModelKitPopup
-
-
Field Summary
Fields Modifier and Type Field Description private StringactiveMenuprivate booleanaddXtalHydrogenswhen TRUE, add H atoms to C when added to the modelSet.private booleanalertedNoEditprivate String[]allOperatorsprivate StringatomHoverLabelprivate intatomIndexSphereprivate intbondAtomIndex1private intbondAtomIndex2private StringbondHoverLabelprivate intbondIndexstatic StringBOOLEAN_OPTIONSprivate intbranchAtomIndexprivate javajs.util.BSbsHighlightprivate javajs.util.BSbsRotateBranchprivate static PopupResourcebundleprivate intcenterAtomIndexprivate floatcenterDistanceprivate javajs.util.P3centerPointprivate booleanclickToSetElementExcept for H atoms, do not allow changes to elements just by clicking them.private intcurrentModelIndexprivate StringdrawDataprivate StringdrawScriptprivate booleanhasUnitCellprivate intiatom0private booleanisPickAtomAssignChargeprivate booleanisRotateBondprivate StringlastCenterprivate ModelSetlastModelSetprivate StringlastOffsetprivate static intMAX_LABELprivate Map<String,Object>mkdatastatic StringMODE_OPTIONSprivate StringpickAtomAssignTypeprivate StringpickBondAssignTypeprivate static javajs.util.P3Pt000private floatrotationDegprivate int[]screenXYprivate intsecondAtomIndexstatic StringSET_OPTIONSprivate booleanshowSymopInfoprivate javajs.util.P3spherePointprivate intstatestatic intSTATE_BITS_SYM_EDITstatic intSTATE_BITS_SYM_VIEWstatic intSTATE_BITS_UNITCELLstatic intSTATE_BITS_XTALstatic intSTATE_MOLECULARstatic intSTATE_SYM_APPLYFULLstatic intSTATE_SYM_APPLYLOCALstatic intSTATE_SYM_NONEstatic intSTATE_SYM_RETAINLOCALstatic intSTATE_SYM_SHOWstatic intSTATE_UNITCELL_EXTENDstatic intSTATE_UNITCELL_PACKEDstatic intSTATE_XTALEDITstatic intSTATE_XTALVIEWstatic StringSYMMETRY_OPTIONSprivate Objectsymopstatic StringUNITCELL_OPTIONSprivate javajs.util.P3viewOffsetprivate StringxtalHoverLabel-
Fields inherited from class org.jmol.popup.JmolGenericPopup
frankPopup, menuText, nFrankList, vwr
-
Fields inherited from class org.jmol.popup.GenericPopup
allowSignedFeatures, buttonGroup, currentMenuItemId, helper, htCheckbox, htMenus, isApplet, isJS, isSigned, isTainted, isWebGL, menuName, popupMenu, strMenuStructure, thisPopup, thisx, thisy, updatingForShow
-
-
Constructor Summary
Constructors Constructor Description ModelKitPopup()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionRotateBond(int deltaX, int deltaY, int x, int y, boolean forceFull)Actually rotate the bond.private voidaddAllCheckboxItems(SC menu, String[] labels)private voidaddData(String key, Object value)protected booleanappGetBooleanProperty(String name)protected voidappUpdateForShow()protected voidappUpdateSpecialCheckBoxValue(SC source, String actionCommand, boolean selected)Set the active menu based on updating a value -- usually by the user, but also during setup (ignored).private voidassignAtom(int atomIndex, String type, boolean autoBond, boolean addHsAndBond)Original ModelKitPopup functionality -- assign an atom.private javajs.util.BSassignBond(int bondIndex, int type)Original ModelKit functionality -- assign a bond.private booleancheckUpdateSymmetryInfo()voiddoMenuClickCallbackMK(SC source, String script)StringgetActiveMenu()for FrankRender -- the thin box on the top leftprotected PopupResourcegetBundle(String menu)private ObjectgetData(String key)private StringgetHoverLabel(int atomIndex)Called by Viewer.hoverOn to set the special label if desired.private intgetMKState()ObjectgetProperty(Object data)Get a property of the modelkit.intgetRotateBondIndex()protected StringgetScriptForCallback(SC source, String id, String script)Secondary processing of menu item clickprivate intgetSymEditState()private intgetSymViewState()private intgetUnitCellState()StringgetUnknownCheckBoxScriptToRun(SC item, String name, String what, boolean TF)From JmolGenericPopup.appRunSpecialCheckBox when name starts with "mk" or has "??" in it.private intgetViewState()booleanhandleAssignNew(MouseState pressed, MouseState dragged, MeasurementPending mp, int dragAtomIndex)CbooleanhandleDragAtom(MouseState pressed, MouseState dragged, int[] countPlusIndices)Called from ActionManager for a drag-dropprotected voidinitialize(Viewer vwr, PopupResource bundle, String title)voidinitializeForModel()booleanisPickAtomAssignCharge()private static booleanisTrue(Object value)private booleanisVwrRotateBond()private booleanisXtalState()voidjpiUpdateComputedMenus()voidmenuClickCallback(SC source, String script)voidmenuFocusCallback(String name, String actionCommand, boolean gained)private static voidnotImplemented(String action)private static javajs.util.P3pointFromTriad(String pos)private booleanprocessAtomClick(int atomIndex)An atom has been clicked -- handle it.private voidprocessMKPropertyItem(String name, boolean TF)private voidprocessModeClick(String action)private voidprocessSelClick(String action)private voidprocessSelOpClick(String action)private voidprocessSymClick(String action)private booleanprocessSymop(String id, boolean isFocus)private voidprocessUCClick(String action)private voidprocessXtalClick(String id, String action)private StringpromptUser(String msg, String def)private voidresetBondFields(String where)private StringrunScriptBuffered(String script)StringsetActiveMenu(String name)Set the active menu and request a repaint.private voidsetBondIndex(int index, boolean isRotate)Set the bond for rotation -- called by Sticks.checkObjectHovered via Viewer.highlightBond.private voidsetDefaultState(int mode)private voidsetLabel(String key, String label)private voidsetMKState(int bits)ObjectsetProperty(String name, Object value)Modify the state by setting a property -- primarily from CmdExt.modelkit.private voidsetSymEdit(int bits)private voidsetSymViewState(int bits)private voidsetUnitCell(int bits)private voidshowSymop(Object symop)private voidshowXtalSymmetry()Draw the symmetry elementprivate voidupdateAllXtalMenuOptions()private voidupdateAllXtalMenus()private voidupdateOperatorMenu()-
Methods inherited from class org.jmol.popup.JmolGenericPopup
appFixLabel, appRestorePopupMenu, appRunScript, appRunSpecialCheckBox, jpiDispose, jpiGetMenuAsObject, jpiInitialize, jpiShow, showFrankMenu
-
Methods inherited from class org.jmol.popup.GenericPopup
addMenuItem, addMenuItems, appCheckItem, appCheckSpecialMenu, appGetMenuAsString, convertToMegabytes, doMenuCheckBoxCallback, doMenuClickCallback, getEntryIcon, getImageIcon, initSwing, jpiGetMenuAsString, menuAddSeparator, menuAddSubMenu, menuCheckBoxCallback, menuCreateCheckboxItem, menuCreateItem, menuEnable, menuGetId, menuGetListPosition, menuNewSubMenu, menuRemoveAll, menuSetAutoscrolls, menuSetLabel, menuShowPopup, setText, show, updateButton, updateSignedAppletItems
-
-
-
-
Field Detail
-
hasUnitCell
private boolean hasUnitCell
-
allOperators
private String[] allOperators
-
currentModelIndex
private int currentModelIndex
-
alertedNoEdit
private boolean alertedNoEdit
-
atomHoverLabel
private String atomHoverLabel
-
bondHoverLabel
private String bondHoverLabel
-
xtalHoverLabel
private String xtalHoverLabel
-
activeMenu
private String activeMenu
-
lastModelSet
private ModelSet lastModelSet
-
pickAtomAssignType
private String pickAtomAssignType
-
pickBondAssignType
private String pickBondAssignType
-
isPickAtomAssignCharge
private boolean isPickAtomAssignCharge
-
bsHighlight
private javajs.util.BS bsHighlight
-
bondIndex
private int bondIndex
-
bondAtomIndex1
private int bondAtomIndex1
-
bondAtomIndex2
private int bondAtomIndex2
-
bsRotateBranch
private javajs.util.BS bsRotateBranch
-
branchAtomIndex
private int branchAtomIndex
-
isRotateBond
private boolean isRotateBond
-
screenXY
private int[] screenXY
-
showSymopInfo
private boolean showSymopInfo
-
addXtalHydrogens
private boolean addXtalHydrogens
when TRUE, add H atoms to C when added to the modelSet.
-
clickToSetElement
private boolean clickToSetElement
Except for H atoms, do not allow changes to elements just by clicking them. This protects against doing that inadvertently when editing.
-
centerPoint
private javajs.util.P3 centerPoint
-
spherePoint
private javajs.util.P3 spherePoint
-
viewOffset
private javajs.util.P3 viewOffset
-
centerDistance
private float centerDistance
-
symop
private Object symop
-
centerAtomIndex
private int centerAtomIndex
-
secondAtomIndex
private int secondAtomIndex
-
atomIndexSphere
private int atomIndexSphere
-
drawData
private String drawData
-
drawScript
private String drawScript
-
iatom0
private int iatom0
-
MAX_LABEL
private static final int MAX_LABEL
- See Also:
- Constant Field Values
-
bundle
private static PopupResource bundle
-
STATE_BITS_XTAL
public static final int STATE_BITS_XTAL
- See Also:
- Constant Field Values
-
STATE_MOLECULAR
public static final int STATE_MOLECULAR
- See Also:
- Constant Field Values
-
STATE_XTALVIEW
public static final int STATE_XTALVIEW
- See Also:
- Constant Field Values
-
STATE_XTALEDIT
public static final int STATE_XTALEDIT
- See Also:
- Constant Field Values
-
STATE_BITS_SYM_VIEW
public static final int STATE_BITS_SYM_VIEW
- See Also:
- Constant Field Values
-
STATE_SYM_NONE
public static final int STATE_SYM_NONE
- See Also:
- Constant Field Values
-
STATE_SYM_SHOW
public static final int STATE_SYM_SHOW
- See Also:
- Constant Field Values
-
STATE_BITS_SYM_EDIT
public static final int STATE_BITS_SYM_EDIT
- See Also:
- Constant Field Values
-
STATE_SYM_APPLYLOCAL
public static final int STATE_SYM_APPLYLOCAL
- See Also:
- Constant Field Values
-
STATE_SYM_RETAINLOCAL
public static final int STATE_SYM_RETAINLOCAL
- See Also:
- Constant Field Values
-
STATE_SYM_APPLYFULL
public static final int STATE_SYM_APPLYFULL
- See Also:
- Constant Field Values
-
STATE_BITS_UNITCELL
public static final int STATE_BITS_UNITCELL
- See Also:
- Constant Field Values
-
STATE_UNITCELL_PACKED
public static final int STATE_UNITCELL_PACKED
- See Also:
- Constant Field Values
-
STATE_UNITCELL_EXTEND
public static final int STATE_UNITCELL_EXTEND
- See Also:
- Constant Field Values
-
MODE_OPTIONS
public static final String MODE_OPTIONS
- See Also:
- Constant Field Values
-
SYMMETRY_OPTIONS
public static final String SYMMETRY_OPTIONS
- See Also:
- Constant Field Values
-
UNITCELL_OPTIONS
public static final String UNITCELL_OPTIONS
- See Also:
- Constant Field Values
-
BOOLEAN_OPTIONS
public static final String BOOLEAN_OPTIONS
- See Also:
- Constant Field Values
-
SET_OPTIONS
public static final String SET_OPTIONS
- See Also:
- Constant Field Values
-
Pt000
private static final javajs.util.P3 Pt000
-
state
private int state
-
rotationDeg
private float rotationDeg
-
lastCenter
private String lastCenter
-
lastOffset
private String lastOffset
-
-
Method Detail
-
initialize
protected void initialize(Viewer vwr, PopupResource bundle, String title)
- Overrides:
initializein classJmolGenericPopup
-
getBundle
protected PopupResource getBundle(String menu)
- Specified by:
getBundlein classJmolGenericPopup
-
initializeForModel
public void initializeForModel()
-
jpiUpdateComputedMenus
public void jpiUpdateComputedMenus()
-
appUpdateForShow
protected void appUpdateForShow()
- Specified by:
appUpdateForShowin classGenericPopup
-
checkUpdateSymmetryInfo
private boolean checkUpdateSymmetryInfo()
-
updateAllXtalMenus
private void updateAllXtalMenus()
-
updateOperatorMenu
private void updateOperatorMenu()
-
updateAllXtalMenuOptions
private void updateAllXtalMenuOptions()
-
getActiveMenu
public String getActiveMenu()
for FrankRender -- the thin box on the top left- Returns:
- [ "atomMenu" | "bondMenu" | "xtalMenu" | null ]
-
setActiveMenu
public String setActiveMenu(String name)
Set the active menu and request a repaint.- Parameters:
name-- Returns:
- activeMenu or null
-
appUpdateSpecialCheckBoxValue
protected void appUpdateSpecialCheckBoxValue(SC source, String actionCommand, boolean selected)
Set the active menu based on updating a value -- usually by the user, but also during setup (ignored).- Specified by:
appUpdateSpecialCheckBoxValuein classGenericPopup
-
isXtalState
private boolean isXtalState()
-
setMKState
private void setMKState(int bits)
-
getMKState
private int getMKState()
-
setSymEdit
private void setSymEdit(int bits)
-
getSymEditState
private int getSymEditState()
-
getViewState
private int getViewState()
-
setSymViewState
private void setSymViewState(int bits)
-
getSymViewState
private int getSymViewState()
-
setUnitCell
private void setUnitCell(int bits)
-
getUnitCellState
private int getUnitCellState()
-
isPickAtomAssignCharge
public boolean isPickAtomAssignCharge()
-
getProperty
public Object getProperty(Object data)
Get a property of the modelkit.- Parameters:
data- a name or an array with [name, value]- Returns:
- value
-
setProperty
public Object setProperty(String name, Object value)
Modify the state by setting a property -- primarily from CmdExt.modelkit. Also can be used for "get" purposes.- Parameters:
name-value-- Returns:
- null or "get" value
-
isTrue
private static boolean isTrue(Object value)
-
processAtomClick
private boolean processAtomClick(int atomIndex)
An atom has been clicked -- handle it. Called from CmdExt.assignAtom from the script created in ActionManager.assignNew from Actionmanager.checkReleaseAction- Parameters:
atomIndex-- Returns:
- true if handled
-
getHoverLabel
private String getHoverLabel(int atomIndex)
Called by Viewer.hoverOn to set the special label if desired.- Parameters:
atomIndex-- Returns:
- special label or null
-
setDefaultState
private void setDefaultState(int mode)
-
appGetBooleanProperty
protected boolean appGetBooleanProperty(String name)
- Overrides:
appGetBooleanPropertyin classJmolGenericPopup
-
getUnknownCheckBoxScriptToRun
public String getUnknownCheckBoxScriptToRun(SC item, String name, String what, boolean TF)
From JmolGenericPopup.appRunSpecialCheckBox when name starts with "mk" or has "??" in it.- Specified by:
getUnknownCheckBoxScriptToRunin classGenericPopup
-
processMKPropertyItem
private void processMKPropertyItem(String name, boolean TF)
-
showXtalSymmetry
private void showXtalSymmetry()
Draw the symmetry element
-
assignAtom
private void assignAtom(int atomIndex, String type, boolean autoBond, boolean addHsAndBond)Original ModelKitPopup functionality -- assign an atom.- Parameters:
atomIndex-type-autoBond-addHsAndBond-
-
assignBond
private javajs.util.BS assignBond(int bondIndex, int type)Original ModelKit functionality -- assign a bond.- Parameters:
bondIndex-type-- Returns:
- bit set of atoms to modify
-
isVwrRotateBond
private boolean isVwrRotateBond()
-
getRotateBondIndex
public int getRotateBondIndex()
-
resetBondFields
private void resetBondFields(String where)
-
setBondIndex
private void setBondIndex(int index, boolean isRotate)Set the bond for rotation -- called by Sticks.checkObjectHovered via Viewer.highlightBond.- Parameters:
index-isRotate-
-
actionRotateBond
public void actionRotateBond(int deltaX, int deltaY, int x, int y, boolean forceFull)Actually rotate the bond. Called by ActionManager.checkDragWheelAction.- Parameters:
deltaX-deltaY-x-y-
-
menuFocusCallback
public void menuFocusCallback(String name, String actionCommand, boolean gained)
- Specified by:
menuFocusCallbackin classGenericPopup
-
menuClickCallback
public void menuClickCallback(SC source, String script)
- Overrides:
menuClickCallbackin classGenericPopup
-
getScriptForCallback
protected String getScriptForCallback(SC source, String id, String script)
Secondary processing of menu item click- Specified by:
getScriptForCallbackin classGenericPopup
-
processSelOpClick
private void processSelOpClick(String action)
-
processSymop
private boolean processSymop(String id, boolean isFocus)
-
showSymop
private void showSymop(Object symop)
-
processModeClick
private void processModeClick(String action)
-
processSelClick
private void processSelClick(String action)
-
processSymClick
private void processSymClick(String action)
-
processUCClick
private void processUCClick(String action)
-
handleDragAtom
public boolean handleDragAtom(MouseState pressed, MouseState dragged, int[] countPlusIndices)
Called from ActionManager for a drag-drop- Parameters:
pressed-dragged-countPlusIndices-- Returns:
- true if handled here
-
pointFromTriad
private static javajs.util.P3 pointFromTriad(String pos)
-
notImplemented
private static void notImplemented(String action)
-
handleAssignNew
public boolean handleAssignNew(MouseState pressed, MouseState dragged, MeasurementPending mp, int dragAtomIndex)
C- Parameters:
pressed-dragged-mp-dragAtomIndex-- Returns:
- true if we should do a refresh now
-
-