http://compendium.open.ac.uk/bugzilla/show_bug.cgi?id=986
Miroslav Cimbora 2011-03-14 18:47:32 GMT
Test case to simulate uninitialized node issue:
- create new map - name it for example "upper level map"
- create new map inside "upper level map" and name it "test map"
- create a shortcut to the "test map" inside "upper level map" using context
menu
- cut the shortcut using context menu
- go to top level map and create new map, name it "todo map"
- go inside the "todo map" and paste the shortcut there
- close compendium
- start compendium
- as first step! go in to the "todo map"
- double click the shortcut icon
- you will get following exception:
null
com.compendium.core.datamodel.ModelSessionException: Model is null in
View.initializeMembers
14-March-2011_17-17-41: at
com.compendium.core.datamodel.View.initializeMembers(View.java:581)
14-March-2011_17-17-41: at
com.compendium.ui.ProjectCompendiumFrame.addViewToDesktop(ProjectCompendiumFrame.java:6156)
14-March-2011_17-17-41: at
com.compendium.ui.ProjectCompendiumFrame.addViewToDesktop(ProjectCompendiumFrame.java:6093)
14-March-2011_17-17-41: at
com.compendium.ui.plaf.NodeUI.openNode(NodeUI.java:2352)
14-March-2011_17-17-41: at
com.compendium.ui.plaf.NodeUI.mouseClicked(NodeUI.java:2311)
Why is this caused?
This is caused because ShortCutNodeSummary contains oReferredNode node, which
is not initialized. The method public void initialize(PCSession session, IModel
model) is never called on this node, only on shortcut node.
Possible solution
Add similar logic to the ShortCutNodeSummary as expressed below:
com.compendium.core.datamodel.NodeSummary#initialize(com.compendium.core.datamodel.PCSession,
com.compendium.core.datamodel.IModel)
*/
@OverRide
public void initialize(PCSession session, IModel model) {
super.initialize(session, model);
// initialized referred node
if(oReferredNode != null)
oReferredNode.initialize(session, model);
}
Another issue is, when the shortcut node has image.
After reopening the compendium the image is not displayed
I have checked the database, reference to the image is saved there.
Problem is in compendium, after reading the shortcut node the database is not
queried to load the image reference.
Patch to be applied against the original Beta 1 source code.
Eclipse Workspace Patch 1.0
P compendium-full
Index: src/com/compendium/core/db/DBNode.java
--- src/com/compendium/core/db/DBNode.java (revision 2)
+++ src/com/compendium/core/db/DBNode.java (working copy)
@@ -2763,6 +2763,8 @@
node = ShortCutNodeSummary.getShortCutNodeSummary(sId, nType,
sXNodeType, sOriginalID,
nState, sAuthor, oCDate, oMDate, sLabel, sDetail, null,
sLastModAuthor);
((ShortCutNodeSummary)node).setReferredNode(refNode);
-
DBReferenceNode.getIRIS(dbcon, sId, node);
}
else {
node = NodeSummary.getNodeSummary(sId, nType, sXNodeType,
sOriginalID,
Warning
Please note that I'm not aware of the compendium software architecture. Before
implementing the code changes in this post, impact analysis should take place.
[reply] [-] Comment 1 Michelle Bachler 2011-03-15 09:41:02 GMT
Hi!
Shortcut nodes where never designed to be used like that. You should not be
able to move them to another map. They should live in the same map as the node
they are a shortcut to.
If you want a link a node from one map to another you use the 'Internal
Reference Node'. If you want the same node to appear in two maps you just copy
and paste the original node.
Shortcut nodes are there for when a single map becomes really large and you
want to link to a node that is too far away and it would be messy to link right
across a map. It is a holding position for the original node, in that map.
The real bug is that it let you do it at all.
So few people use shortcut nodes that I guess no one has noticed that it let
you. What should happen is that you should get a message when you try and paste
a shortcut node into another map saying that you can't do that. I will look at
the code and see what is going on.
Thanks for bringing this to our attention.
Michelle
[reply] [-] Comment 2 Miroslav Cimbora 2011-03-16 07:57:15 GMT
Hi,
Internal reference nodes unfortunately do not open the map, but focuses you to
the target node. So you need to double click it and then double click again in
order to open target view.
I wanted to have shortcut to the target map in two different views with
slightly different look. In one view the map node has picture with 500x500 size
and I wanted to have reference to this map's view in todo view, however with
image size 150x150. Todo lists using tags to not work for me, because I like
graphical todo lists.
It was not possible to achive this with internal reference node neither with
copy & paste.
So shortcut is ideal solution for me. And it works :-) except the issue
mentioned above.
Please note
The problem with losing image for shortcut node happens when you use the
shortcut in the same view too.
[reply] [-] Comment 3 Miroslav Cimbora 2011-03-16 08:15:35 GMT
Hi,
I have one more question. :-)
Why shortcut node are visually and in content independent of the original node
in the same view? If I change for example the detail of the original node, the
shortcut node is not updated.
I understand that there are situations where this behavior is OK, however
having option to keeping them in sync would be great too.
Is it possible to have implemented such behavior?
[reply] [-] Comment 4 Michelle Bachler 2011-03-16 10:01:27 GMT
I may have fixed the bug with the reference node image. It sounds familiar so I
will check the latest Beta 2 code and see. If not I will apply your patch.
Thanks for that.
At the moment the datamodel/database structure does not allow exactly the same
node to be in the same view twice. Again we have discussed this a lot. Having
nodes transcluded (copy/paste original node) to the same view would remove the
need for shortcut nodes. We have discussed getting rid of them altogether. But
it would involved some fundamental strucutral changes to the database and a lot
of code changes.
I will explore the synching request. Not sure how easy that would be. Some sort
of event listerner on the parent node at the UINode level would probably work.
Michelle
[reply] [-] Comment 5 Al Selvin 2011-03-17 16:51:00 GMT
An additional response to Miroslav's question --
We have explored many approaches to shortcuts and clones, and had a whole much
clearer design worked out, including some of the ideas you've suggested. It
never rose high enough in priority against many other features and changes in
the queue. But you raise excellent points, if we (or someone else) ever get to
work on this area.