achuanle / umlet

Automatically exported from code.google.com/p/umlet
0 stars 0 forks source link

Migrate remaining OldGridElements to NewGridElements; remove old ones; offer converter #233

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently UMLet supports the old grid elements (<v13) and the new grid elements 
(since v13)

________________________________________________

Step 1: the remaining old ones must be migrated:
1. both all-in-one diagrams
2. the custom element

@1: this should be quite simple. for both aio elements:
a. create a NewGridElement subclass which use a single 
(Sequence|Activity)AllInOne specific Facet
b. create this facet which doesn't draw anything immediately, but instead 
parses every line and creates an abstract model of the diagram which is stored 
in the ParserState
c. after all lines are parsed, analyze the full model and create the 
appropriate draw-calls

@2: this is more complex as the design of CustomElements currently is based on 
the approach that you fill in the single paint() method body which is filled 
into a java-class template. the full java class is then  compiled with a javac 
compiler and the output is an OldGridElement instance with the user code inside 
the paint() method body

As the new grid elemen structure with Parser+Facets doesn't really support the 
user-writes-single-method-body approach, there are 2 ways to implement future 
custom elements:
a. similar to the current one, just ignore parser+facet and implement the own 
print logic (like the old custom element)
b. avoid on the fly compilation of the class and simply offer facets which 
parse user commands (e.g. drawLine(0, width) could be analyzed by a 
CustomDrawLineFacet and resolved appropriately). if, for and other concepts 
would be harder to reimplement and the final approach would be of course more 
restricting then the current custom elements, but it would also have the 
advantage that no real compilation happens at runtime which is good for 
security and portability of Umlet (this approach would also work on 
www.umletino.com)

________________________________________________

Step 2 would be a converter program which converts old grid elements to new 
grid elements.
Just compare the XML of the old and new palette entry and write a parser which 
transforms the old XML style to the new one (in most of the cases only the <id> 
and <type> elements are different)
The new syntax for centering text, ... has been streamlined so perhaps the 
converter could also convert such things (e.g. if (oldpackage -> newpackage) 
then convert "left:" to "halign=left")
________________________________________________

Step 3: remove any reference to the old elements from the code
- the whole "com.baselet.element.old.* package
- any special if(element instanceof old.Relation) treatment
- the com.baselet.gui.command.Old* commands
- the OldRelationListener

Original issue reported on code.google.com by AFDiaX on 11 Feb 2015 at 8:18

GoogleCodeExporter commented 9 years ago
after Step 3 many parts of the code could be refactored and simplified 
(especially the Swing Listeners!!!)

Original comment by AFDiaX on 11 Feb 2015 at 8:19