Comments (20)
@prmr I have been looking at this problem a bit and I think I may need to implement a means of converting a SelectionList to a Graph. Do you think this will be necessary, or would there be an easier way to copy and paste the contents of a GraphPanel? I'm trying to work from the copy+paste feature of Violet 0.23 right now as a template, but their method is based on a Graph being the object created on a mouse-drag selection, not GraphElements being added to a SelectionList. Any tips or pointers would be appreciated.
from jetuml.
There's only one graph per panel, so you would want to go through the selection list and add the elements in the selection to the existing graph (and remove them from the original one in the case of cut). They are cloneable so that part should not be too hard. However, the more interesting bit here is to carefully specify the behavior of cut and paste. For instance, if should only work for nodes, but copying multiple nodes should include the edges between them, etc.
from jetuml.
Actually the cut part should just work because GraphPanel.removeSelected()
does the right thing. However, implementing the pasting behavior will require a more systematic study. Don't base yourself on the 0.21 behavior because it's highly unsatisfactory. For example, if you cut an edge and paste it, a node appears!
from jetuml.
Final comment for now: why not start a wiki page with the specification of the Copy-and-Paste Behavior?
from jetuml.
@prmr I just wrote a wiki page describing the behaviour as I see it. If you think I am missing anything or if you want anything else added, please feel free to edit it. I will think about this problem some more, but I think some major redesign work may be necessary for the pasting part of the operation (I don't believe copying will be too difficult to implement).
from jetuml.
I'm not sure we need a big redesign. IMO inheriting Clipboard
from Graph
as in 0.23 is overkill for our needs. I've just committed some code to branch 0012 that sketches a solution. Look at class Clipboard
and methods cut
, copy
, and paste
in EditorFrame
. Implementing these, and the required services in GraphPanel
, should get you closer to something quite workable.
from jetuml.
@prmr I've made some progress on the copy, paste and cut features. I'm able to successfully copy/cut and paste nodes on simple diagrams (Class and Object diagrams) without children nodes. I'm going to add in the children node support (for sequence diagrams) later. The only issue I'm running into however, is that I don't think Edges are being selected/added into the SelectionList on mouse drags when in "Select Mode" (they are properly added if you CTRL-Click on them and nodes in "Select Mode" however). Is this the intended design of SelectionList when selecting with Mouse drags?
The next step I hope to do is to get edges to be properly copied/cut and pasted. I have not implemented functionality for pasting or working with these yet as I wanted to make sure I could get Nodes working first. Once I have this in place, I will get children node support in place and then this feature should be ready for testing.
On a side note, I saw your Clipboard class template and unfortunately I had already started implementing my own Clipbard class design. While mine is a little different than yours, I plan on refactoring my code as I currently have a lot of the copy/cut and paste logic in the EditorFrame class which I think would be better put in the Clipboard class. Thank you for all the help with this issue, I will keep you updated with my progress.
from jetuml.
@prmr I have now got copy+paste working on all diagram types, except for sequence type diagrams. For whatever reason, when I try to copy and paste those types of diagrams, I get really buggy behavior (I don't know why). I think there is something going on with the setting of children/parent nodes that I'm not seeing, but I will keep trying a few more things to get it working. I'm going to try to get a working version of cut going, then I will commit what I have so far.
from jetuml.
Good to know, I'll look at the code for this diagram.
from jetuml.
Alright, I just committed what I have been able to do with cutting, copying and pasting. @prmr There are still bugs with pasting onto Sequence Diagrams, but everything else seems to be behaving normally. @EJBQ, I have not implemented any functionality for "undoing" or "redoing" a cut, copy or paste action. You will have to figure out a way to implement this, but I am totally open to you modifying my design in any way if you need to for your part of Milestone 2. If anything I have done is unclear, please let me know and I will try to explain what I did here.
I had to modify a few other things in JetUML too, including how edges are selected (now if you drag over an edge in "Select-Mode" with the "Click-Down-Lasso" and both its endpoints have been selected, it is automatically selected). I also updated how children Arraylists are handled in the AbstractNode class during the clone method(before it was giving me IndexOutOfBounds errors when I tried to clone the children of nodes). Anyways, if either of you can please check out my commit and make sure it works properly, I would appreciate it. Thanks!
from jetuml.
I've noticed some problems with object diagrams, now even unrelated to cut-and-paste. For example, if you have two object nodes linked by an edge and delete one of the nodes, the edge remains. When copying multiple times the same clipboard object, things get really messed up.
from jetuml.
@prmr Yeah, I will look into the object diagram problem a bit. Another bug I found involved Note Nodes on Class Diagrams. Steps to reproduce:
- Create a Note Node in a Class Diagram
- Add a Note Connector with the start end being the Note Node and the End Node being either white space or another Node
- Notice that the edge either ends in white space or does not connect to the End Node desired.
Interestingly, if you try to start a Note Edge in a non-Note Node, it behaves properly. I'm not sure what is going on her either, but I can try to look into it as well.
from jetuml.
@prmr I think I may have remedied the Object Diagram bugs you listed above, but I'm not sure if other bugs still remain with Object Diagrams and their edges. Please let me know if you see anything in the latest commit and I will look at it more. Sequence Diagrams are still quite buggy.
from jetuml.
Alright, I have refactored the code so that the logic is now in the Clipboard class itself. I am still noticing some buggy behavior with Object and Sequence diagrams (I will have to look more into this), but for now, the basic logic is in place and the code is in the class where it belongs. If you guys notice any other mistakes or errors, please let me know. Thanks!
from jetuml.
Parent-Child Relation in Sequence Diagrams
(this comment is also relevant to @EJBQ 's work)
It seems a lot of the friction you are experiencing comes from the fact that in sequence diagrams the parent-child relation is defined to map to the parent-child node in the corresponding call graph. This is not actually what we really need for a diagram editor. Instead, in all diagrams the parent-child node relation should be defined as "child node is semantically a component of the parent) (e.g., field nodes in the object diagram).
I started a wiki page to document the parent-child relations
from jetuml.
@prmr @EJBQ I forgot to tag my recent commits with a #12 (my bad, I will do this again from now on). In my recent two commits, I have fixed two major bugs:
- The duplication/buggy behavior of Field Nodes that lay inside ObjectNodes when they are cloned. Now the copying/cutting and pasting behaves as it should for this diagram.
- The weird bug that prevented diagrams from being translated if an edge was in the SelectionList. I had to modify the SelectionList class to make this work properly, essentially, it needed a getLastNode() method not a getLastSelected() method (as an Edge can be the last element in the SelectionList). Take a look at my additions to the GraphPanel and SelectionList classes if this seems confusing.
Anyways, I encourage you guys to check out my latest commit to this branch and play around with it and make sure both issues have been fixed. I will be working on fixing the Sequence Diagram bugs between now and our next meeting. Thanks!
from jetuml.
I have taken a look into the Sequence Diagram issue a bit, and it is still giving me issues. I think we need to decide as a group if we want to redesign this or not. As you mentioned @prmr, CallNodes can have CallNode children (which to me seems like an odd way to organize things). I would much rather see CallNodes by default be children of ImplicitParameterNodes (unless they are created by a self-call). I don't know what you guys think about this, but I am open to discussing this at our next meeting in further detail.
from jetuml.
While testing I found a new issue with pasting and the undo system, as well as an issue with double pasting. I'm delaying the release by a day while I fix this.
from jetuml.
The undoing issue is solved, just waiting on @JoelChev to look at double pasting.
from jetuml.
@EJBQ @prmr I believe I have solved the double pasting bug, but it involved me modifying the addNode() method of the Graph class. If either of you can please check out #13's latest commit and play around with double pasting nodes with edges (so copy/cut nodes with edges between them, then paste them two or more times in a row), I would appreciate it. Thanks!
from jetuml.
Related Issues (20)
- Node order not preserved during serialization
- Correct middle label placement for straight segmented edges
- Package node loses position when last child node unlinked
- Release 3.6
- Typo in user guide - "Linking Note Elements" HOT 1
- Notification-based Feedback Mechanism
- Deprecated Checkstyle checks in Style.xml
- Feature for underlining and italics? HOT 2
- JavaFX GUI Unit Testing HOT 1
- Files with newlines cannot be opened
- Refactor Notification Mechanism
- Add Dialog to Set Notification Time
- Release 3.7
- Point node does not get deleted when corresponding edge is cascade-deleted
- Migrate to Java 21
- Notification to JetUML icon on Taskbar
- Redesign StringRenderer Class
- Update the documentation
- Font Chooser Feature
- Dark mode feature HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetuml.