|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.JythonManager
public class JythonManager
Manages jython related functionality:
DerivedDataDescriptor
and are held in DescriptorDataSource
| Nested Class Summary | |
|---|---|
static class |
JythonManager.LibHolder
Class LibHolder holds all things for a single lib |
| Field Summary | |
|---|---|
static String |
PROP_JYTHON_EDITOR
The path to the editor executable |
| Fields inherited from class ucar.unidata.ui.WindowHolder |
|---|
contents, dialog, frame, window |
| Constructor Summary | |
|---|---|
JythonManager(IntegratedDataViewer idv)
Create the manager and call initPython. |
|
| Method Summary | |
|---|---|
void |
addFormula(DerivedDataDescriptor ddd)
Add a formula to the IDV. |
void |
appendJython(String jython)
APpend jython to main editable lib |
void |
appendJythonFromBundle(String jython)
Append the given jython to that is from a bundle to the users jython |
void |
appendTmpJython(String jython)
Append the given jython to the temp jython |
protected void |
applicationClosing()
Gets called when the IDV is quitting. |
protected static boolean |
checkUntrustedJython(String jython)
Make sure the given jython code matches the pattern (after removing whitespace): idv.procedure_name ('arg1', arg2, ..., argn) where if an arg is not in single quotes it cannot contain a procedure call. |
org.python.util.PythonInterpreter |
createInterpreter()
Factory method to create and interpreter. |
JythonShell |
createShell()
Create a jython shell |
void |
dataGroupsChanged()
Update derived needs when the DataGroups change |
void |
deleteKeyPressed(DataChoice dataChoice)
Delete the data choice if it is a user formula |
void |
descriptorChanged(DerivedDataDescriptor ddd)
Called when a formula data choice has changed (i.e., added, removed or edited. |
protected JComponent |
doMakeContents()
Create the jython editor. |
void |
doMakeDataChoiceMenuItems(DataChoice dataChoice,
List items)
Create the list of menu items for editing a data choice that represents an end user formula. |
List |
doMakeEditMenuItems()
make the edit menu items for the formula data source |
List |
doMakeEditMenuItems(DescriptorDataSource dds)
make the edit menu items for the given formula data source |
List |
doMakeFormulaDataSourceMenuItems(DataSource dataSource)
Return the list of menu items to use when the user has clicked on a formula DataSource. |
void |
doSearch()
_more_ |
void |
doSearchPrevious()
_more_ |
void |
editInExternalEditor()
Edit the jython in the external editor |
void |
editInExternalEditorInner(JythonManager.LibHolder holder)
Edit the jython in the external editor |
void |
evaluateDataChoice(DataChoice dataChoice)
This simply clones the given data choice and calls getData on it. |
void |
evaluateTrusted(String code)
Interpret the given jython code. |
void |
evaluateTrusted(String code,
Hashtable properties)
Interpret the given jython code. |
void |
evaluateUntrusted(String jythonCode)
Evaluate the given jython code. |
void |
evaluateUntrusted(String jythonCode,
Hashtable properties)
Evaluate the given jython code. |
void |
exportFormulas()
Export user formulas |
void |
exportFormulasToPlugin()
Export selected formulas to plugin |
void |
exportSelectedToPlugin()
Export selcted text of current tab to plugin |
void |
exportToPlugin()
Export to plugin |
List |
findJythonMethods(boolean justList)
find methods |
List |
findJythonMethods(boolean justList,
List holders)
find methods |
List |
getDefaultDescriptors()
Get all end user formulas |
org.python.util.PythonInterpreter |
getDerivedDataInterpreter()
Create a (singleton) jython interpreter and initialize it with the set of classes defined in the xml |
org.python.util.PythonInterpreter |
getDerivedDataInterpreter(String methodName)
Create a (singleton) jython interpreter and initialize it with the set of classes defined in the xml and (if needed) with the class path represented by the methodName argument (if methodName is of the form: some.package.path.SomeClass.someMethod). |
DescriptorDataSource |
getDescriptorDataSource()
Get the descriptor data source |
List |
getDescriptors()
get formula descriptors |
List |
getEndUserDescriptors()
Get all end user formulas |
boolean |
getInError()
Any errors |
List |
getLibHolders()
the libs |
List |
getLocalDescriptors()
Get all local descriptors |
String |
getUsersJythonText()
Get the end user edited text from the jython editor. |
String |
getWindowTitle()
Get the window titlexxx |
void |
importFormulas()
Import user formulas |
protected void |
initUserFormulas(IdvResourceManager newIrm)
Initialize the DerivedDataDescriptors
that are defined in the RSC_DERIVED resource collection
from the given resource manager. |
static void |
main(String[] args)
main |
void |
makeFileMenu(JMenu fileMenu)
make men |
void |
makeFormula(org.python.core.PyFunction func)
Make a formula |
void |
makeNewLibrary()
make new library |
List |
makeProcedureMenu(Object object,
String method,
String prefix)
Make menu |
void |
removeFormula(DerivedDataChoice dataChoice)
Remove a formula from the IDV. |
void |
removeFormula(DerivedDataDescriptor ddd)
remove formula |
void |
removeInterpreter(org.python.util.PythonInterpreter interp)
Remove the interpreter from the list of interpreters. |
void |
removeLibrary(JythonManager.LibHolder holder)
remove lib |
boolean |
saveOnExit()
Save on exit if anything is changed |
void |
searchFor()
_more_ |
protected List |
selectFormulas()
Popup dialog to select formulas |
void |
showFormulaDialog()
Show the formula dialog with no initial state. |
void |
showFormulaDialog(DerivedDataDescriptor descriptor)
Show formula dialog with the given initial DDD. |
void |
showFormulaDialog(DerivedDataDescriptor descriptor,
boolean isNew)
|
void |
showHelp()
SHow help |
void |
showHelp(String help)
_more_ |
void |
showJythonEditor()
Create, if needed, and show the jython editor. |
boolean |
writeJythonLib(JythonManager.LibHolder holder)
Save the end user jython code from the jython editor into the user's .metapps area. |
protected void |
writeUserFormulas()
Save the user created formulas. |
| Methods inherited from class ucar.unidata.ui.WindowHolder |
|---|
actionPerformed, close, getContents, getDialog, getFrame, getWindow, isShowing, removeAll, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.awt.event.ActionListener |
|---|
actionPerformed |
| Field Detail |
|---|
public static final String PROP_JYTHON_EDITOR
| Constructor Detail |
|---|
public JythonManager(IntegratedDataViewer idv)
idv - The IDV| Method Detail |
|---|
public void showJythonEditor()
public void exportSelectedToPlugin()
public void exportToPlugin()
public void searchFor()
public void doSearch()
public void doSearchPrevious()
protected JComponent doMakeContents()
doMakeContents in class WindowHolderpublic boolean saveOnExit()
public void makeFormula(org.python.core.PyFunction func)
func - functionpublic void makeNewLibrary()
public List getLibHolders()
public void removeLibrary(JythonManager.LibHolder holder)
holder - libpublic void makeFileMenu(JMenu fileMenu)
fileMenu - menuprotected void applicationClosing()
public void editInExternalEditor()
public void editInExternalEditorInner(JythonManager.LibHolder holder)
holder - libpublic String getWindowTitle()
getWindowTitle in class WindowHolderpublic void showHelp()
public void showHelp(String help)
help - _more_public org.python.util.PythonInterpreter createInterpreter()
public JythonShell createShell()
public void removeInterpreter(org.python.util.PythonInterpreter interp)
interp - The interpreter to removepublic boolean getInError()
public String getUsersJythonText()
public void appendTmpJython(String jython)
jython - The jython from the bundlepublic void appendJythonFromBundle(String jython)
jython - The jython from the bundlepublic void appendJython(String jython)
jython - jythonpublic boolean writeJythonLib(JythonManager.LibHolder holder)
holder - lib
protected static boolean checkUntrustedJython(String jython)
We have this here so (hopefully) a user won't inadvertently execute rogue jython code on their machine.
jython - The code
public void evaluateUntrusted(String jythonCode)
jythonCode - The code to execute
public void evaluateUntrusted(String jythonCode,
Hashtable properties)
jythonCode - The code to executeproperties - If non-null then populate the interpreter with the name/value pairspublic void evaluateTrusted(String code)
code - The code toe evaluate
public void evaluateTrusted(String code,
Hashtable properties)
code - The code toe evaluateproperties - If non-null then populate the interpreter with the name/value pairspublic void dataGroupsChanged()
protected void initUserFormulas(IdvResourceManager newIrm)
DerivedDataDescriptors
that are defined in the RSC_DERIVED resource collection
from the given resource manager.
newIrm - The resource manager to get the derived resources fromprotected List selectFormulas()
public void exportFormulasToPlugin()
public void exportFormulas()
public void importFormulas()
protected void writeUserFormulas()
public void doMakeDataChoiceMenuItems(DataChoice dataChoice,
List items)
dataChoice - The end user formula data choiceitems - List of menu items to add topublic void deleteKeyPressed(DataChoice dataChoice)
dataChoice - The data choice to deletepublic void evaluateDataChoice(DataChoice dataChoice)
dataChoice - The data chocie to evaluatepublic void removeFormula(DerivedDataChoice dataChoice)
dataChoice - formula data choicepublic void removeFormula(DerivedDataDescriptor ddd)
ddd - dddpublic void descriptorChanged(DerivedDataDescriptor ddd)
ddd - descriptor for the formula.public void addFormula(DerivedDataDescriptor ddd)
ddd - formula descriptorpublic List doMakeFormulaDataSourceMenuItems(DataSource dataSource)
dataSource - The data source clicked on
public List doMakeEditMenuItems()
public List doMakeEditMenuItems(DescriptorDataSource dds)
dds - The formula data source
public void showFormulaDialog()
public List getDescriptors()
public List getEndUserDescriptors()
public List getLocalDescriptors()
public List getDefaultDescriptors()
public void showFormulaDialog(DerivedDataDescriptor descriptor)
descriptor - The descriptor for the formula.
public void showFormulaDialog(DerivedDataDescriptor descriptor,
boolean isNew)
public DescriptorDataSource getDescriptorDataSource()
public org.python.util.PythonInterpreter getDerivedDataInterpreter()
public org.python.util.PythonInterpreter getDerivedDataInterpreter(String methodName)
methodName - Used to initialize the interpreter (if non -null)
public List makeProcedureMenu(Object object,
String method,
String prefix)
object - object to callmethod - method to callprefix - prefic
public List findJythonMethods(boolean justList)
justList - If true just the functions
public List findJythonMethods(boolean justList,
List holders)
justList - If true just the functionholders - libs
public static void main(String[] args)
throws Exception
args - args
Exception - on badness
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||