User 247c00dc1d
07-08-2015 08:54:54
Hello!
Script does not work after last update (15.7.27.0 (build: 201507300913-14fe6a047b1d))
import com.im.commons.progress.*
import com.im.df.api.dml.*
import com.im.df.api.support.SelectionDescription
import org.openide.awt.HtmlBrowser.URLDisplayer
import com.im.ijc.widgets.deprecated.DirectDataFetcher
import java.net.URL
import java.net.URLEncoder
// evaluate is called when the button is clicked to perform action
//
// widget is IJCWidget instance
evaluate = { widget ->
// here is an example of interesting objects accessible through passed parameters
def dataTree = widget.form.resultSet.dataTree
def parent = dataTree.rootVertex.entity
def rs = parent.schema.dataProvider.getDefaultResultSet(dataTree, false, DFEnvironmentRO.DEV_NULL)
def parentVS = rs.getVertexState(dataTree.rootVertex)
// print "hello\n"
// do the work here
field = null
for(f in parent.fields.items) {
if (f.name.equals("IDN")) {
field = f
}
}
//print field
iupac = DirectDataFetcher.getDataForFirstSelectedRow(parentVS, [field]).values()[0]
//print iupac + "\n"
Runtime r = Runtime.getRuntime();
Process p = null;
print 'D:\\tool1.exe smUI "' + iupac + '"\n'
p = r.exec('D:\\tool1.exe smUI "' + iupac + '"\n');
//url = "http://www.google.com/search?q=" + URLEncoder.encode(iupac)
//URLDisplayer.getDefault().showURL(new URL(url))
}
error is in string "import com.im.ijc.widgets.deprecated.DirectDataFetcher"
Help please to solve the problem.
Thanks,
Igor
ChemAxon d449bc1993
07-08-2015 09:52:31
Hi Igor,
use com.im.df.api.ddl.DFDataTrees instead of DirectDataFetcher. Just change imports and one line:
import com.im.df.api.ddl.DFDataTrees;
iupac = DFDataTrees.getDataForFirstSelectedRow(dataTree, [field]).values()[0]
Hope that helped,
Jan
User 247c00dc1d
07-08-2015 10:26:33
Thank you Jan
it's helped! it really work, but with error report:
groovy.lang.MissingPropertyException: No such property: DirectDataFetcher for class: script14389369121301854022965
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at script14389369121301854022965$_run_closure1.doCall(script14389369121301854022965.groovy:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at groovy.lang.Closure.call(Closure.java:411)
at com.im.ijc.groovy.GroovyScriptHandler$3$1.call(GroovyScriptHandler.java:191)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:121)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:260)
at com.im.ijc.groovy.GroovyScriptHandler$3.call(GroovyScriptHandler.java:194)
at com.im.commons.base.ThreadContext$1.call(ThreadContext.java:139)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.im.ijc.groovy.GroovyScriptHandler$4.run(GroovyScriptHandler.java:213)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at com.im.commons.base.ThreadContext.callInContext(ThreadContext.java:88)
at com.im.commons.base.ThreadContext.runInContext(ThreadContext.java:63)
at com.im.ijc.groovy.GroovyScriptHandler.callClosure(GroovyScriptHandler.java:207)
at com.im.ijc.groovy.GroovyScriptHandler.callClosureByName(GroovyScriptHandler.java:173)
at com.im.ijc.scripting.api.Script.callClosureByName(Script.java:89)
at com.im.ijc.widgets.button.ParsedButtonScript$2.run(ParsedButtonScript.java:121)
at com.im.commons.ui.UIUtilities.invokeInAwtOrLater(UIUtilities.java:71)
at com.im.ijc.widgets.button.ParsedButtonScript.callClosure(ParsedButtonScript.java:128)
at com.im.ijc.widgets.button.GroovyButtonAdapter$2.run(GroovyButtonAdapter.java:90)
at com.im.ijc.widgets.button.GroovyButtonAdapter$4.run(GroovyButtonAdapter.java:114)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
at com.google.common.util.concurrent.Futures$ImmediateFuture.addListener(Futures.java:102)
at com.im.ijc.widgets.button.GroovyButtonAdapter.callIfValid(GroovyButtonAdapter.java:109)
at com.im.ijc.widgets.button.GroovyButtonAdapter.callOnActionPerfomed(GroovyButtonAdapter.java:86)
at com.im.ijc.widgets.button.GroovyButtonAdapter.access$000(GroovyButtonAdapter.java:40)
at com.im.ijc.widgets.button.GroovyButtonAdapter$1.actionPerformed(GroovyButtonAdapter.java:65)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
ChemAxon d449bc1993
10-08-2015 06:55:22
Igor,
get rid of the DirectDataFetcher in your code.
Thanks,
Jan