Issue #1
The <null/> is probably because your don't have the OTModelerPage in
your runtime classpath when you do the copy. There should have been an
error printed about that. In that case when the otml file is loaded in
the system doesn't know how to handle OTModelerPage so loads it in as
null instead. Then when it is copied the null is copied.
Issue #2
The context object is provided to the script automatically when the
script is run. So I'd guess it isn't null. Probably the
getComponentForObject("meiosisView") is returning null. The context is
this class:
org.concord.otrunk.script.ui.OTScriptObjectContext
the getComponentForObject is essentially looking up an object in the
referenceObjects list. So it is getting null because the OTModelerPage
isn't in that list.
Scott
If the context is null
Geoffrey Kwan wrote:
> Issue #1
> When I copy the root of the OTrunk step, the root object is missing
> some objects and content. Please see below. In this example there are
> two objects that show up as <null /> in my generated otml. Also the
> reference to ${mw_model} is no longer valid in my generated otml
> because all the ids are converted to number ids. Perhaps this problem
> is releated to the <null /> objects since the actual declaration of
> the mw_model id shows up as <null /> in my generated otml file.
>
>
> concord otml
> <OTCompoundDoc>
> <bodyText>
> *<object editable="true" refid="${mw_model}" />*
> <br/><br/>
> <object refid="${script_object}" />
> </bodyText>
> <documentRefs>
> *<OTModelerPage local_id="mw_model"
>
> authoredDataURL="http://svn.concord.org/svn/projects/trunk/tels/chemical-reactions/hydrogen-explosion/water3.cml"
>
> />*
> <OTScriptObject local_id="script_object">
> <referenceObjects>
> * <object refid="${mw_model}" />*
> </referenceObjects>
> <script>
> <OTJavascript>
> <script>...</script>
> </OTJavascript>
> </script>
> </OTScriptObject>
> </documentRefs>
> </OTCompoundDoc>
>
>
> my generated otml
> <OTCompoundDoc>
> <documentRefs>
> *<null />*
> <OTScriptObject id="7b00a7af-38d6-11dd-9c72-6d1aa65f41ae">
> <referenceObjects>
> *<null />*
> </referenceObjects>
> <script>
> <OTJavascript>
> <script>...</script>
> </OTJavascript>
> </script>
> </OTScriptObject>
> </documentRefs>
> <bodyText>
> *<object editable="true" refid="${mw_model}" />*
> <br />
> <br />
> <object refid="7b00a7af-38d6-11dd-9c72-6d1aa65f41ae" />
> </bodyText>
> </OTCompoundDoc>
>
>
>
> Issue #2
> I also get this other issue when I click on an OTrunk step in the VLE.
> I receive many of these "Cannot call method "xxx" of null or
> undefined" errors.
>
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "getText" of null
> (http://svn.concord.org/svn/projects/tags/tels/otrunk-scripts/biologica-20071126.133236/biologica-static-organism-screen.js#84)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
>
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "setEndTime" of undefined
> (http://svn.concord.org/svn/projects/tags/tels/otrunk-scripts/biologica-20071126.133236/biologica-static-organism-screen.js#258)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
>
> Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal
> Error: org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "getComponent" of null
> (http://svn.concord.org/svn/projects/tags/tels/otrunk-scripts/biologica-20071126.133236/biologica-meiosis-screen.js#9)
>
>
> Looking at the last error as an example, I checked the js file
> http://svn.concord.org/svn/projects/tags/tels/otrunk-scripts/biologica-20071126.133236/biologica-meiosis-screen.js
>
> and looked at line #9 to find that the variable context is probably
> null (please see below). Perhaps context is supposed to be defined by
> the importPackage or importClass statements but are not performing so
> properly.
>
> first 9 lines of the js file
> importPackage(Packages.org.concord.biologica);
> importPackage(Packages.org.concord.biologica.ui);
> importPackage(Packages.org.concord.biologica.engine);
> importPackage(Packages.java.lang);
> importPackage(Packages.java.beans);
> importClass(Packages.org.concord.otrunk.view.OTFolderObject);
> importClass(Packages.org.concord.otrunk.ui.OTText);
>
> var meiosisView =
> context.getComponentForObject("meiosisView").getComponent(0);
>
>
> How can I get rid of all these "Cannot call method "xxx" of null or
> undefined" errors?
>
>
> Thanks,
> Geoff
>
>
> On Wed, Jun 11, 2008 at 9:34 AM, Scott Cytacki <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> The script service is configured in the otml file. So if you are
> getting this error, it is probably because the script service bundle
> didn't get copied over from the original otml file.
>
> If you look in the bundles or services property of the OTSystem object
> in the original otml file, you should see the script service being
> setup.
>
> Scott
>
> Geoffrey Kwan wrote:
> > The fixes to Otrunk worked. Now I have a problem with a
> > NullPointerException I can't figure out how to resolve. I open
> up the
> > authoring tool with my generated otml, and then click on the preview
> > button to open up the project with the VLE. Then I click on the
> dragon
> > model step. The dragon model step has a "Click here to begin"
> link so
> > then I click that and then I get this exception.
> >
> > java.lang.NullPointerException
> > at
> >
>
> org.concord.otrunk.script.ui.OTScriptObjectView.getComponent(OTScriptObjectView.java:51)
> > at
> >
>
> org.concord.otrunk.view.OTJComponentServiceImpl.getComponent(OTJComponentServiceImpl.java:57)
> > at
> >
>
> org.concord.otrunk.view.OTViewContainerPanel.createJComponent(OTViewContainerPanel.java:360)
> > at
> >
>
> org.concord.otrunk.view.OTViewContainerPanel$CreateComponentTask.run(OTViewContainerPanel.java:460)
> > at
> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> > at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
> > at
> >
>
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
> > at
> >
>
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
> > at
> >
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
> > at
> >
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
> > at
> java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> >
> >
> > In my otml file I have all 3 of these view entries. I thought maybe
> > having multiple view entries loaded might cause the problem but I
> > tried running the otml file with each of the 3 entries, one at a
> time
> > and I still received the null pointer.
> >
> > <OTViewEntry local_id="script-view"
> > objectClass="org.concord.otrunk.script.ui.OTScriptObject"
> > viewClass="org.concord.otrunk.script.ui.OTScriptObjectView" />
> > <OTViewEntry
> objectClass="org.concord.otrunk.script.ui.OTScriptObject"
> > viewClass="org.concord.otrunk.script.ui.OTScriptObjectView" />
> > <OTViewEntry
> objectClass="org.concord.otrunk.script.ui.OTScriptObject"
> > viewClass="org.concord.otrunk.script.ui.OTScriptObjectView" />
> >
> >
> > The code that is throwing the null pointer is from
> > OTScriptObjectView.java when the code below is executed
> (scriptManager
> > is null after getViewService() is called).
> >
> > OTScriptManager scriptManager = (OTScriptManager)
> > getViewService(OTScriptManager.class);
> > scriptInstance = (OTScriptObjectInterface)
> > scriptManager.instantiate(script, contextMap,
> > OTScriptObjectInterface.class);
> >
> > here are the values of the arguments to
> scriptManager.instantiate() if
> > it helps
> >
> > value of script
> >
>
> org.concord.otrunk.script.js.OTJavascript#%f645bbfd-371c-11dd-a1ea-6fba59f6d3e0/[EMAIL
> PROTECTED]
> >
> > value of contextMap
> > {destination=OTFolderObject Static Organisms
> > [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> >
> [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> >
> [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> >
> [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> > [EMAIL PROTECTED],
> >
>
> button=javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,[EMAIL
>
> PROTECTED],flags=16777504,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Back
> > to Meiosis,defaultCapable=true],
> >
> [EMAIL PROTECTED]
> >
> > I have also attached my otml file.
> >
> > Thanks,
> > Geoff
> >
> > On Thu, Jun 5, 2008 at 10:31 AM, Scott Cytacki
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
> >
> >
> > Ok now it should be fully fixed if you update the otrunk
> project. The
> > copying code was not handling the refid or href attributes
> inside of
> > compound documents correctly.
> >
> > The "%" infront of the id is put there on purpose. If you
> use the
> > toString method of the OTID you will get a string starting
> with a %.
> > This is because you should not use the toString method to
> get string
> > version of the id. Instead you should use the toExternalForm()
> > method. The toExternalForm verifies that this ID actually
> has a
> > valid
> > String representation. Some IDs are temporary so
> toExternalForm
> > throws
> > an exception in this case.
> >
> > So if you are seeing "%" infront of ids it means there is
> some code
> > calling toString on the id when it shouldn't be. In this
> > particular it
> > was a problem in the OTrunk project itself using the
> toString method.
> >
> > Scott
> >
> > Scott Cytacki wrote:
> > > Ok, if you update the otrunk project, the refid part of this
> > should be
> > > fixed.
> > >
> > > I still need to fix the href part.
> > >
> > > Scott
> > >
> > > Scott Cytacki wrote:
> > >
> > >> This looks like a bug in the copy code. I created this issue
> > to track
> > >> my work on it:
> > >> http://jira.concord.org/browse/OTK-54
> > >>
> > >> Scott
> > >>
> >
> >
> >
> >
> >
> > >
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SAIL-Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/SAIL-Dev?hl=en
-~----------~----~----~----~------~----~------~--~---