Yes, it should ideally do it for all step adds as well as deletions.
Then you only need to have the
((OTrunkStep)newStep).setControllerService(controllerService);
inside of the if (newStep instanceof OTrunkStep) block.
so:
Object newStep = evt.getNewValue();
if (newStep instanceof OTrunkStep) {
((OTrunkStep)newStep).setControllerService(controllerService);
}
OTObject otStep = controllerService.getOTObject(newStep);
otActivity.getStepList().add(otStep);
and for deletions:
Object oldStep = evt.getOldValue();
OTObject otStep = controllerService.getOTObject(oldStep);
otActivity.getStepList().remove(otStep);
-- Aaron
Anthony Perritano wrote:
right now i only have a property change listener do something
when otrunk step is added.
Object newStep = evt.getNewValue();
if (newStep instanceof OTrunkStep) {
((OTrunkStep)newStep).setControllerService(controllerService);
OTObject
otStep = controllerService.getOTObject(newStep);
otActivity.getStepList().add(otStep);
}
rereading
the email, i am a little confused, does this need to happen for all
step adds? all activity adds?
similarly do we need
to do this when an activity or step is removed?
On Mar 20, 2008, at 12:39 PM, Aaron Unger wrote:
It should probably go inside
registerRealObject() and it should do something like:
PasStep newStep = ... get the new step...
newStep.setControllerService(controllerService);
OTObject otStep = controllerService.getOTObject(newStep);
otPasActivity.getStepList().add(otStep);
A similar thing should happen in PasProjectController as well:
PasActivity newActivity = ... get the new activity...
OTObject otActivity = controllerService.getOTObject(newActivity);
otPasProject.getActivityList().add(otActivity);
Ideally in each controller, you'd also set up listeners that (be
careful of endless update loops):
1) listen to the OTObject for changes and update the real object
appropriately
2) listen to the real object for changes and update the OTObject
appropriately
That way the OTrunk world and the Real Object world stay in sync in
real-time, and theoretically negate needed to sync objects in
saveRealObject().
For an example, check out:
https://svn.concord.org/svn/projects/trunk/common/java/simulations/biologica/src/org/concord/biologica/state/OTOrganismController.java
-- Aaron
Anthony Perritano wrote:
ok.
i added property change listeners on the PasProject and PasActivity in
their respect controllers. it listens for an add. what i am not clear
on is:
And when it gets that event it can "save" the new step, by calling
getOTObject with the new step.
heres what i have in the loadReadObject method of the
OTPasActvitiyCOntroller
activity.addPropertyChangeListener(PasActivity.STEPS, new PropertyChangeListener() {
public void
propertyChange(PropertyChangeEvent evt) {
System.out.println("Step added calling from
OTPasActivityCOntroller");
}
});
On Mar 20, 2008, at 10:46 AM, Aaron Unger wrote:
No, I think you can
leave all of the PAS stuff the way it is. All you'll need to do is add
the listeners to the PasProjectController and PasActivityController to
handle creating/adding the otrunk objects for a new PasActivity and
PasStep.
I made changes to the OTrunkStep so that calling setType() will just
store the Class and mark that it needs to be set up, and then when
getComponent() is called it will then do all of its creation work.
-- Aaron
Anthony Perritano wrote:
Aaron
thats correct. the steps get added to the activity before getComponent
is called. getComponent is called only when a user clicks on a bean in
the tree. the authoring tool just gets what ever getComponent gives and
dumps it in the right pane.
so do i need to do a call to getComponent after i create
the newInstance to fire things up?
On Mar 20, 2008, at 6:14 AM, Aaron Unger wrote:
Scott, you were
spot-on with the context, and you brought up a angle of it I hadn't
thought about. I think what you described will work. Tony can correct
me, but it looks to me like the steps are being added to the activity
prior to getComponent being called. Then it's just a matter of making
sure some sort of event gets passed on which the controller can catch.
Thanks!
-- Aaron
Scott Cytacki wrote:
I might have the context wrong, but I think I know what the problem is.
At runtime if the OTrunkStep is running inside of OTrunkCurnit the
OTrunkStep gets its controllerService set by
its own controller OTGenericOTrunkStepController.
At author time I'd guess you are creating the OTrunkStep instance
directly. Which means the code in OTGenericOTrunkStepController
will not get run.
One way to work around that is to make sure to add the OTrunkStep to its
PasActivity before calling getComponent.
Then the OTPasActivityController can be listening to an add event on
PasActivity (you might need to add that event).
And when it gets that event it can "save" the new step, by calling
getOTObject with the new step.
This approach has a few benefits:
- it should fix the problem above
- it brings the controllers more inline with our existing controllers
which save their OTObjects using events from the real objects.
---- futurist thinking ----
Using events to update the OTObjects is good because it means the
OTObjects are updated in realtime instead of at the end. Most of the
benifits from this are still vaporware but hopefully they will
materialize some day soon:
- the OTrunk logging system can give a log of when an author things not
just at end when they saved.
- if we get a better representation of the tree of OTObjects, that can
be a used as an alternative way of visualizing the project.
- if we have searching system then an author can do fulltext searching.
- if we integrate Jackrabbit as an OTDatabase, then the jackrabbit data
for the activity would be updated immediately. Which would make it
possible for collaborative editing like subethaedit
- if we integrate an "edit system" like emf has, then we can add an real
"history" and "undo" functionality, which can go backward and forward
multiple steps.
Many of the things above are not that hard to implement. The one that
is probably the most difficult is the "edit system", because it will
probably require changes to much of the current controllers and views.
------------------
Scott
Aaron Unger wrote:
Hmm, right. I was afraid the controllerService wouldn't get
initialized. I'll see what I can do to change/work around that.
-- Aaron
Anthony Perritano wrote:
The new supportTypes is great, i load it into a quick and dirty
dialog. However, when i try to instantiate a step i get the following:
java.lang.NullPointerException
at org.telscenter.pas.otrunk.OTrunkStep.setType(OTrunkStep.java:335)
at
org.telscenter.pas.authortool.cards.customizer.pas.AddStepAction.addEmptyStep(AddStepAction.java:238)
at
org.telscenter.pas.authortool.cards.customizer.pas.AddStepAction.createNewStep(AddStepAction.java:190)
at
org.telscenter.pas.authortool.cards.customizer.pas.AddStepAction$2.finish(AddStepAction.java:133)
at org.netbeans.spi.wizard.WizardPage$CWPP.finish(WizardPage.java:996)
at
org.netbeans.spi.wizard.SimpleWizardInfo.finish(SimpleWizardInfo.java:145)
at org.netbeans.spi.wizard.SimpleWizard.finish(SimpleWizard.java:177)
at org.netbeans.spi.wizard.Wizard.finish(Wizard.java:222)
at
org.netbeans.api.wizard.displayer.NavButtonManager.processFinishProceed(NavButtonManager.java:453)
at
org.netbeans.api.wizard.displayer.NavButtonManager.processFinish(NavButtonManager.java:437)
at
org.netbeans.api.wizard.displayer.NavButtonManager.actionPerformed(NavButtonManager.java:258)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:180)
at java.awt.Dialog$1.run(Dialog.java:535)
at java.awt.Dialog$2.run(Dialog.java:563)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:561)
at java.awt.Component.show(Component.java:1302)
at java.awt.Component.setVisible(Component.java:1255)
at
org.netbeans.api.wizard.displayer.WizardDisplayerImpl.showInDialog(WizardDisplayerImpl.java:334)
at
org.netbeans.api.wizard.displayer.WizardDisplayerImpl.show(WizardDisplayerImpl.java:250)
at
org.netbeans.api.wizard.WizardDisplayer.showWizard(WizardDisplayer.java:107)
at
org.netbeans.api.wizard.WizardDisplayer.showWizard(WizardDisplayer.java:135)
at
org.telscenter.pas.authortool.cards.customizer.pas.AddStepAction.actionPerformed(AddStepAction.java:152)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
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)
java.lang.NullPointerException
at
org.concord.otrunk.view.OTViewerHelper.loadOTDatabase(OTViewerHelper.java:294)
at org.telscenter.pas.otrunk.OTrunkStep.getComponent(OTrunkStep.java:149)
at
org.telscenter.pas.otrunk.OTrunkStepBeanInfo$OTrunkStepQuickEditorFactory.getQuickEditor(OTrunkStepBeanInfo.java:56)
at
org.telscenter.pas.authortool.cards.customizer.pas.PasCustomizerCardX.findQuickEditor(PasCustomizerCardX.java:671)
its coming from:
public void setType(Class type) throws Exception {
// set the current step type
// get the OTObject which corresponds to this step
// set its target to a new object of the type specified
HERE -> OTGenericOTrunkStep otStep = (OTGenericOTrunkStep)
controllerService.getOTObject(this);
OTObject obj = otStep.getOTObjectService().createObject(type);
otStep.setTarget(obj);
this.setTarget(obj);
}
i have verified that setType is being called before getComponent:
public static class OTrunkStepQuickEditorFactory extends
AbstractQuickEditorFactory {
public JPanel getQuickEditor(Object bean) {
final OTrunkStep otrunkBean = (OTrunkStep) bean;
JPanel p = (JPanel) otrunkBean.getComponent(true);
return p;
}
}
Thanks
-Tony
On Mar 17, 2008, at 1:19 PM, Sam Fentress wrote:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> writes:*
At the same time, we could achieve an "open ended" step easily by
embedding an OTCompoundDoc into the step instead of one of the other
explicit OTObjects. The OTCompoundDoc would then have all of the UDL
style WYSIWYG authoring, unlimited object insertion, etc.
On that note, I've added an example ot otrunk-examples which is a
blank WYSIWYG editing page, with affordances to add almost any type
of object that we currently support (with a few excceptions for the
moment, such as question objects which I need to take out of the UDL
project). You can find the document-edit example at the bottom of
page in
BasicExamples:http://continuum.concord.org/otrunk/examples/BasicExamples/ot-index.html
I left out the ability to switch back-and-forth between author and
student views here so as not to confuse an already-long otml file.
This could easily be added, however.
Sam
--~--~---------~--~----~------------~-------~--~----~
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 -~----------~----~----~----~------~----~------~--~---
|