umlet-11.3.orig/0000755000175000001440000000000011606274116012212 5ustar benusersumlet-11.3.orig/img/0000755000175000001440000000000011576116036012770 5ustar benusersumlet-11.3.orig/img/umlet_eclipse.gif0000644000175000001440000000054411576116034016312 0ustar benusersGIF89a1{tO꤮zL{sPwM@{tP즯FtN}JEHBzsOڽ|CԲh{sOȏղi>Բi=!1,pH,a$(P9bYѴXy̆Qt\ !ME--E/ Eu/E))E (( E.E  LCA;umlet-11.3.orig/img/umlet_logo.png0000644000175000001440000002566111576116034015654 0ustar benusersPNG  IHDRrD*sRGBbKGD pHYs  tIME 7\ IDATxy]e}sι$ Y1AJ VKYDQj]Ъ*J-XYXVEd X"$$!{f~s;sΝ;$^u=g<}0`Piz}"RjK߁wW_#8Z<ǘ&&C]}=jz)ی(mU0M1=16Ҥ cPb@B0~/f=X̞ P^*ؿOJv1B4j& TRJ>e`زvo^k?H|W7(P^&ZӸpj\ V,/t#*УlMJX^|~w!i.I~?ʦcT v\X0 &:'-V\]p!,Zh?dzst=uX,_?NЃҐˑ AHn"5Ք햴\IXUs.8LH!(n| L[!?~ӷBᩧdIy"qY|yǡ3-YN~eB*i@G{d6˚ndǵQx9iKTP[L0Xjs=qk֨>ixA: ^|Lm@fmb!o/_duW7 #Mتso#˭qmb ?^ohO_"fB1Ц ŒK"?ɔL <+H<,fHbGpGg"Nn:{K eKeh Yd?Mq 5FkL/'hG@kBUS]´?V+qrfuW:B2}Mdy&KJq2X_d`*Ig"IzJZלZAe`46X}ٴZЎm"}۷Z(2TBTy7\c!J@a^>ǁoa~ωFM~9M)5i-'72 eGwqyy7F6WZ5{.0~KH G^9YY!%}u0<?΍H:#$zBR1-r? Ea8,dW,̩D~=syd֨o VBR3 }}Pm/3A:#<: ݗٯd (i̍J*bYxqs+;+h,d\T?C̜F^wp".)] Hxxl$y&r]H_G°a9>b/ }HGkffy k~V(>7./?cs>3/BPBvSO=܉>ϓ=ٴpUEvs'v"_O-Y,{Ry+=?NZR!l;.0QAUWܹw>ϓ4W< Oڀc8߷Bz'y=ۚ$:R#n6_Oߣ(8^JƮ,8b!7Mi&Pl qgU)YLkУshm}Į/HmHs~[Dl BOxq4hí.|Eݽ*Vd(:éy_) )W8=X 7NCe;" "?FBpmqF۠|-?BL%Uvyq/Y5J8B(Z v-5g.>9.S]8 Tz71-wT٨I?KݔmHKCc`~I>0仼"Ѻ FFG2 V5*ʚ yqNa2Ndd?jf2)Z-VB\V_';EUyxa|=Xf*_J< &]Xh*GIGI}- @'>Aaw=6F5倥K%vlxXlhY qp陙0'~@XT l58݊%KDj|^ӞLRGĆڿ\cH!no/jcU}ϡ rybDqLZ[I\r8̊?X*^Hʕdcd7QQDPw 늄\E5c9A?{.qcadq,EĎ8o{/4$@0r{gu_$!o%;`mAP,ǔ\VhVxPG?ʟE?U 4‹~C?- pױ\G=?jIt ui矼쒥*y%ըMjpFH%&LP-Qq1Z)Mg"3PTL_bՊn+gV*j6Mt ftҋy6!nX&4 h! z҂ Ai~ \>xȠ=u(%1BpJgQ*V94#K(˔NP!F҈$U(ۊfN{dT VJ)u(U_ĩijwƁϼyyyrCn}?A,JєA6eޛww"ڏY\g7xn#@衔D+NuAo}t77beܓa/Jo7q:OZD;d\ɫN@>'A=)ߨp0T ,ާ5C+xq5T_phц +C߇4Bۋ6qމX3DFl@*tƞ*,_‘>̇>_ 1|!3}_Q  m%\]n~gN~YUA k΂۾Qt0HhU$ٷq8{px9>VVN?]%uwTȆ/m=@錕E+>͊"3ȿ]wLhEo|G+?;(dU[#2T UզQYͧqm|Gwn/; 䗥Qn":!@uػ' }OJ(/94 5jʠTW*s!kOo*pE9K_M" _{Ѻ۲`mww__7`T*I!`A,0-ydWົ-9/v.s>Nd[ 1 )~s8L+Pf(LT9Gn%uЇ42vVjܺERA稦%%:N-AI=BZJ@v]ߜEAvDecPqM{<Şի/(&o+VSQyk|iJ4I6Y'Кޝ|M-Y,.SOj>B.ev_ oLwc :s" 4c:~p!g27C$Ūb}z+0$K7AohE5‰SCH+73~0&"Qw\ )lfcpx+ /N\0Pbk5|6֭P*Z GM`{Kk!?)cKgƖ *^0W`7M&Yu9j0ec ;d_bEGm\nup$_; 00ʔEI+INx)^Pʿ‚0AM'Yx[z1[vNki!z{Lolnmr$9@@1y]=$sKAFj*+:.IbgKV_XLv^2uR ->TRWMW x0/_&(5;눶/av?ˊ *j{X= Cpqp;u4Q6) ^罕éIx;:yKTp0sKEby"8pϝ)Lk=uO.p ^|,+\?B[|8QclN~c(s~M 6p*I%sN 2@ jneR{.,]\8_]jUC24)m|Tگz grS7þ/~% `dВVN$YGoS,]^ X %IDATh#Pٍmq ȼ.#7wʹ&Ht Cerh%:PCw7w|HӚ2e[>!SW>o)۠RV/w]ʡd5hx,f9\i-#TCmy#aw>J>.j;jXw;ǯ7v$#ETغAjh-,,n /rx;h$dRvgˉ?p,爇jAYVi7bf" =-UW\ Ct5prYO?-Op]k'wdcsY'e X{$ʓwRi^q饰d.3׌lSH3b_:%9יݢԠϾҒqiK%}%O"]WSqӃlDeEڒ#oѭe_:%y} Gy/s~xL'z8wҒ\ ?^C!=H6Kv7Bbɾ9F𵯲q*55IDZxMD$TD39{Tuթ.,Y *j3Agƍlxem!C~F/-7"3Jź2 񵋯! `{Dw1#ĂWB9G4RnjS-}54!T^`+) A2\yQ2yϥ#u +W+Î P)lPQ}ǭ`Ϳ~'C$%׭| GlGvN'DO+/Sx/_NoUhf c )?O~_|thprMBNTfޙH^7ʕC),զ?^EYy $HG [oUUg.A>%h8J;ՉXrdN  E8AȮPr4%afj*^˸wng.ӆ@9y1%,9|5`50egF`&~\<Çi-fzԱ@c3> \~E@5lB16hpߡNX(J9;2(hJ"t&+Wp9nLaQu lX?d]hNYT*( 6hQF_uunj`[SK<̷DASrk& ?gv=ށ2X$ê+q$-TJSu-Y۲ o 9 J9'CW[n[nӒ3ŘiXБH<5Ly{)VD`2l1a%h0ya;}R}ҾO2 uԠ̙[\q{]8K^:5㟀u 9Pئ,lb-% ?"_p{=[dOs*&S2k(Pt^DÉ֪W]z)-6ekW Knn͛%V>\cpBC( 2O![j Q X hV.'XnZ9k.e7o١m`{pKZe}Slz,_ǭ5k`"+<+dJm3 A}MĮj U9BEW\XeKk[|yl_`;"H1;c>!8vL#&5IENDB`umlet-11.3.orig/img/ok.gif0000644000175000001440000000010411576116034014061 0ustar benusersGIF89a!,^QymuYP#b$*;umlet-11.3.orig/lib/0000755000175000001440000000000011606274116012760 5ustar benusersumlet-11.3.orig/lib/libinfo.txt0000644000175000001440000000216511576116034015147 0ustar benusers-------------------------------------------- BASELET -------------------------------------------- batik* Licence: Apache License 2.0 Used for: Export to "eps" and "svg" jlibeps Licence: GPL2+ Used for: Export to "eps" and "svg" iText Licence: AGPL Used for: Export to "pdf" JavaMail (mailapi.jar, smtp.jar) Licence: GPLv2 with "GPL linking exception" Used for: Sending mails from Umlet/Plotlet log4j Licence: Apache License 2.0 Used for: Logging JSyntaxpane: Licence: Apache License 2.0 Used for: Editor and Text Panes Changes: META-INF/services/jsyntaxpane/defaultsyntaxkit/config.properties -> adapted default settings jsyntaxpane/actions/ComboCompletionAction.java setItems method changed to the following code "public void setItems(String items) {this.items = Arrays.asList(items.split(";"));}" to allow a semikolon-separated list as items argument for combocompletion -------------------------------------------- UMLET -------------------------------------------- Eclipse JDT Core Compiler (org.eclipse.jdt.core_3.5.1.v_972_R35x.jar) Licence: Eclipse Public Licence Used for: Compiling custom elements in Umletumlet-11.3.orig/umlet.sh0000644000175000001440000000066511576116034013703 0ustar benusers#!/bin/sh # Shell script for running umlet from the command prompt in linux # If you want to put umlet.sh in your home bin directory ($HOME/bin/) to start it from anywhere with # $ umlet.sh myDiagram.uxf # you must specify the programDir directly instead #programDir=/path/to/umlet programDir=$(cd $(dirname $0);pwd) if [ $# -gt 0 ] then java -jar ${programDir}/umlet.jar -filename="$1" else java -jar ${programDir}/umlet.jar fi umlet-11.3.orig/html/0000755000175000001440000000000011576116036013160 5ustar benusersumlet-11.3.orig/html/about.html0000644000175000001440000000132411576116034015156 0ustar benusers

*******************************************

Umlet version 11.3
June 2011

Released under the terms of the
GNU General Public License

Web: http://www.umlet.com
Contact: info@umlet.com

*******************************************


umlet-11.3.orig/html/startuphelp.html0000644000175000001440000000163111576116034016420 0ustar benusers

Umlet 11.3 -- check for new versions -- read the FAQ

Double-click on a element to add it to the diagram

Lasso with Ctrl+Mouse -- zoom with Ctrl+MouseWheel


Advanced: "Custom Elements > New..." lets you create entirely new element types


If you like Umlet, please "star" it at Eclipse Marketplace. Thanks!

umlet-11.3.orig/custom_elements/0000755000175000001440000000000011576116036015422 5ustar benusersumlet-11.3.orig/custom_elements/WordWrap.java0000644000175000001440000000136111576116032020027 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is an element with activated wordwrap //If a line would exceed the elements border, instead //the exceeding part is written into the next line int y=textHeight(); drawRectangle(0,0,width,height); setWordWrap(true); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } } umlet-11.3.orig/custom_elements/RectangleRound.java0000644000175000001440000000111311576116032021171 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ int y=textHeight(); drawRectangleRound(0,0,width,height,20,20); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } }umlet-11.3.orig/custom_elements/Default.java0000644000175000001440000000142011576116032017642 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //Modify the code below to define the element's behavior. // //Example: Change the line // y += printCenter(textline,y); //to // y += 2*printCenter(textline,y); //and observe the element preview. int y=textHeight(); drawRectangle(0,0,width,height); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } }umlet-11.3.orig/custom_elements/AutoResize1.java0000644000175000001440000000143211576116032020434 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is a tutorial for a self resizing component //In addition you are able to resize at manually //As soon as it is resized manually a new text is //added to the property panel allowResize(false); setAutoresize(30,40,10); drawCircle(width/2,15,10); int y=45; for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } } umlet-11.3.orig/custom_elements/AutoResize2.java0000644000175000001440000000215511576116032020440 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is a tutorial for a self resizing component //In addition you are able to resize at manually //As soon as it is resized manually a new text is //added to the property panel setAutoresize(20,20,10); int y=textHeight(); boolean center = true; for(int i = 0; i < textlines.size(); i++) { String textline = textlines.get(i); if(textline.equals("--")) { drawLineHorizontal((int) (y-textHeight()*0.7)); center = false; if (!isManualResized()) height -= (int) (textHeight()*0.75); y += textHeight()*0.3; } else { if (center) y += printCenter(textline,y); else y += printLeft(textline,y); } } drawRectangle(0,0,onGrid(width),onGrid(height)); /****CUSTOM_CODE END****/ } }umlet-11.3.orig/palettes/0000755000175000001440000000000011576116036014035 5ustar benusersumlet-11.3.orig/palettes/Structure and Deployment.uxf0000644000175000001440000000747711576116034021422 0ustar benusers 8 com.umlet.element.custom.Node 16 8 88 40 center:Node com.umlet.element.custom.Node 128 8 88 40 center:<<device>> center:Name com.umlet.element.Relation 0 24 224 56 lt=- _Link_ 24;40;208;40 com.umlet.element.custom.Node 16 80 200 64 center:<<execution environment>> center:Name com.umlet.element.custom.Node 16 152 200 64 center:<<Deployment Descriptor>> center:Name com.umlet.element.custom.Component 16 224 104 64 Component com.umlet.element.custom.Artefact 128 224 88 64 Artefact com.umlet.element.Class 16 296 104 32 <<component>> Name com.umlet.element.Class 128 296 88 32 <<artefact>> Name com.umlet.element.custom.SimpleComponent 16 336 152 56 Component com.umlet.element.custom.Database 16 480 88 32 Database com.umlet.element.Class 72 424 88 40 <<artefact>> Name com.umlet.element.custom.Node 16 400 200 72 center:Deployment umlet-11.3.orig/palettes/EER.uxf0000644000175000001440000001324311576116034015175 0ustar benusers 8 com.umlet.element.custom.EER_Entity 232 248 80 72 department -- _prid_ name address bg=black com.umlet.element.custom.EER_Entity 160 160 80 40 ##employee department bg=orange com.umlet.element.custom.EER_Entity 304 160 80 40 ##member department bg=yellow com.umlet.element.Relation 288 176 72 96 lt=<EER 24;80;56;80;56;24 com.umlet.element.custom.EER_Entity 304 80 104 72 member -- id contribution date bg=green com.umlet.element.custom.EER_Entity 160 80 80 72 employee -- id responsibility salary bg=blue com.umlet.element.custom.EER_Entity 240 16 80 56 person -- first name family name bg=gray com.umlet.element.Relation 0 216 160 40 lt=<EER> 24;24;144;24 com.umlet.element.Relation 0 176 160 40 lt=<EER 144;24;24;24 com.umlet.element.Relation 0 136 160 40 lt=EER> 144;24;24;24 com.umlet.element.custom.EER_Entity 16 16 80 40 entity -- attribute com.umlet.element.custom.EER_Entity 16 64 80 24 entity com.umlet.element.custom.EER_Entity 16 96 80 24 ##weak entity com.umlet.element.Relation 360 64 80 128 lt=EER> 24;112;64;112;64;24;48;24 com.umlet.element.Relation 216 72 56 120 lt=EER> 24;104;40;104;40;24;24;24 com.umlet.element.Relation 176 176 72 96 lt=<EER 56;80;24;80;24;24 com.umlet.element.Relation 176 0 80 96 lt=EER 24;80;24;24;64;24 com.umlet.element.Relation 296 0 80 96 lt=EER 64;80;64;24;24;24 com.umlet.element.custom.EER_Rel_Diamond 40 264 80 40 relation umlet-11.3.orig/palettes/Composite Structure.uxf0000644000175000001440000000620411576116034020504 0ustar benusers 8 com.umlet.element.Relation 152 40 72 200 lt=<[>] - [>]> 24;24;56;24;56;184;24;184 com.umlet.element.Relation 72 240 114 160 lt=<[]<.)- <<delegate>> 32;24;64;64;64;144 com.umlet.element.Relation 88 72 40 120 lt=<[v]-(()-[^]> 24;24;24;104 com.umlet.element.Relation 64 72 40 120 lt=<[^][v]> 24;24;24;104 com.umlet.element.Relation 40 72 40 120 lt=<[=][<]> 24;24;24;104 com.umlet.element.Relation 16 72 40 120 lt=<[SQL][GUI]> 24;104;24;24 com.umlet.element.custom.Component 16 176 160 88 'Component com.umlet.element.Relation 0 240 120 160 lt=<[].>()- <<delegate>> 104;24;64;64;64;144 com.umlet.element.custom.Component 16 384 160 48 'Component com.umlet.element.custom.Component 16 16 160 80 'Component umlet-11.3.orig/palettes/Activity.uxf0000644000175000001440000002310311576116034016352 0ustar benusers 8 com.umlet.element.custom.FinalState 216 440 16 16 i com.umlet.element.Relation 200 400 40 56 lt=<- 24;40;24;24 com.umlet.element.custom.State 168 392 96 32 leave for airport bg=green com.umlet.element.custom.SynchBarHorizontal 192 360 64 16 com.umlet.element.Relation 216 304 56 80 lt=<- 24;64;24;32;40;32;40;24 com.umlet.element.Relation 144 280 80 104 lt=<- 64;88;64;56;24;56;24;24 com.umlet.element.custom.SendSignal 216 248 80 32 call taxi bg=yellow com.umlet.element.custom.ReceiveSignal 216 296 80 32 taxi arrived bg=yellow com.umlet.element.custom.State 128 272 80 32 grab bags bg=blue com.umlet.element.Relation 144 184 80 104 lt=<- 24;88;24;64;64;64;64;24 com.umlet.element.custom.SynchBarHorizontal 120 160 144 96 {joinSpec= date is on or after July 1st and the exam is passed} com.umlet.element.Relation 216 184 56 80 lt=<- 40;64;40;48;24;48;24;24 com.umlet.element.Relation 144 112 72 112 lt=<- 56;96;56;24;24;24 com.umlet.element.Relation 200 136 88 88 lt=<- m2=[exam passed] 48;72;48;24 com.umlet.element.custom.Decision 232 128 32 32 bg=green com.umlet.element.Relation 224 80 40 64 lt=<- 24;48;24;24 com.umlet.element.custom.State 208 72 80 32 study bg=red com.umlet.element.Relation 224 24 40 64 lt=<- 24;48;24;24 com.umlet.element.custom.InitialState 240 32 16 16 i com.umlet.element.custom.Systemborder 112 8 248 456 topcenter:System com.umlet.element.Relation 0 112 112 40 lt=<- 24;24;96;24 com.umlet.element.custom.Decision 16 72 32 32 com.umlet.element.custom.ReceiveSignal 16 160 80 32 receive signal com.umlet.element.custom.SendSignal 16 216 80 32 send signal com.umlet.element.custom.State 16 16 80 32 state com.umlet.element.custom.Systemborder 16 328 80 32 center:DataObject com.umlet.element.custom.InitialState 64 72 16 16 i com.umlet.element.custom.FinalState 64 96 16 16 i com.umlet.element.custom.TimeSignal 24 264 64 48 time signal com.umlet.element.custom.SynchBarVertical 88 64 16 56 com.umlet.element.custom.SynchBarHorizontal 24 48 64 16 com.umlet.element.custom.TimeSignal 136 120 64 48 July 1st bg=black com.umlet.element.Relation 200 344 40 64 lt=<- 24;48;24;24 com.umlet.element.Relation 208 120 152 344 lt=<- m2=[exam missed] 24;328;136;328;136;24;56;24 umlet-11.3.orig/palettes/Class.uxf0000644000175000001440000002013211576116034015622 0ustar benusers 8 com.umlet.element.Relation 0 424 152 40 lt=()) 24;24;136;24 com.umlet.element.Relation 0 400 136 40 lt=<() r1=provide 120;24;24;24 com.umlet.element.Relation 8 376 144 40 lt=<( r1=require 24;24;128;24 com.umlet.element.Relation 0 352 152 40 lt=- m1=0..n q1=key m2=0..1 24;24;136;24 com.umlet.element.Relation 0 336 152 40 lt=<x 24;24;136;24 com.umlet.element.Relation 0 320 152 40 lt=<<<- 24;24;136;24 com.umlet.element.Relation 0 304 152 40 lt=<<<<- 24;24;136;24 com.umlet.element.Relation 0 280 152 40 lt=<- m1=0..n r1=Role 24;24;136;24 com.umlet.element.Relation 0 240 152 56 lt=- m1=0..n m2=0..1 teaches to> 24;40;136;40 com.umlet.element.Relation 0 240 152 40 lt=<. 24;24;136;24 com.umlet.element.Relation 0 224 152 40 lt=<- 24;24;136;24 com.umlet.element.Relation 0 208 152 40 lt=<<. 24;24;136;24 com.umlet.element.Relation 0 192 152 40 lt=<<- 24;24;136;24 com.umlet.element.Note 160 272 112 56 Note.. com.umlet.element.UseCase 168 336 96 32 lt=. Collaboration com.umlet.element.Class 160 208 128 56 template=0: Object TemplateClass -- com.umlet.element.Class 160 408 48 16 Rose com.umlet.element.Class 288 16 136 104 OuterClass {innerclass InnerClass innerclass} {innerclass InnerClass {innerclass InnerInnerClass -- field innerclass} innerclass} com.umlet.element.Interface 288 128 64 72 Interface -- Operation1 Operation2 com.umlet.element.custom.ThreeWayRelation 216 160 48 32 com.umlet.element.Relation 168 352 138 80 lt=>> a rose is a rose is a rose 24;56;24;32;80;40;80;64;40;64 com.umlet.element.Class 192 16 88 32 {active} ActiveClass com.umlet.element.Class 104 16 80 24 /AbstractClass/ com.umlet.element.Class 16 48 168 152 <<Stereotype>> Package::FatClass {Some Properties} -- -id: Long {composite} _-ClassAttribute: Long_ -- #Operation(i: int): int /+AbstractOperation()/ -- Responsibilities -- Resp1 -- Resp2 com.umlet.element.Class 16 16 80 24 SimpleClass com.umlet.element.Class 192 64 88 32 bt=* ActiveClass com.umlet.element.Class 192 112 88 32 bt=. Class with dashed border umlet-11.3.orig/palettes/Activity - All in one.uxf0000644000175000001440000000205511576116034020314 0ustar benusers 8 com.umlet.element.ActivityDiagramText 8 8 64 84 title:start Start End com.umlet.element.ActivityDiagramText 104 8 561 656 title:Example Hotline Start Telephone\ rings While[open\calls] [free] Fork If [responsible] take call help caller [not responsible] forward call\(with subactions).. EndIf | | | document call~id1 Sync [busy] record\call wait until\ free> >free playback\recorded cal->id1 [no open calls] End umlet-11.3.orig/palettes/Sequence.uxf0000644000175000001440000002027211576116034016332 0ustar benusers 8 com.umlet.element.custom.SeqObjectActive 208 64 16 80 bg=yellow com.umlet.element.Relation 192 120 40 96 lt=. 24;24;24;80 com.umlet.element.custom.SeqObjectActive 208 200 16 24 bg=yellow com.umlet.element.custom.InteractionFrame 184 160 184 80 optional com.umlet.element.Relation 200 168 144 56 lt=< async. destroy 128;40;24;40 com.umlet.element.custom.InteractionFrame 16 184 144 56 interaction frame com.umlet.element.custom.SeqDestroyMark 320 200 16 16 com.umlet.element.Relation 192 200 40 48 lt=. 24;24;24;32 com.umlet.element.custom.SeqObjectActive 320 80 16 48 bg=red com.umlet.element.Class 288 16 80 24 _:O2_ bg=red com.umlet.element.Class 176 16 80 24 _:O1_ bg=orange com.umlet.element.Note 16 456 240 64 This is a preliminary version of UMLet's sequence diagrams; we are currently working on a more efficient, text-based way of creating them. com.umlet.element.Class 16 16 80 24 _:Instance_ com.umlet.element.Relation 304 16 40 80 lt=. 24;24;24;64 com.umlet.element.Relation 192 16 40 64 lt=. 24;24;24;48 com.umlet.element.Relation 200 40 136 56 lt=<<- sync. call 120;40;24;40 com.umlet.element.Relation 200 88 136 56 lt=< async. return 24;40;120;40 com.umlet.element.Relation 0 104 128 56 lt=< asyncMsg 24;40;112;40 com.umlet.element.Relation 0 72 128 40 lt=< 24;24;112;24 com.umlet.element.custom.SeqDestroyMark 136 88 16 16 com.umlet.element.custom.SeqObjectActive 136 16 16 48 com.umlet.element.Relation 0 128 128 56 lt=<<- syncMsg 24;40;112;40 com.umlet.element.Relation 0 96 128 40 lt=<<<<<- 24;24;112;24 com.umlet.element.Relation 32 16 40 72 lt=. 24;24;24;56 com.umlet.element.Relation 304 104 40 120 lt=. 24;24;24;104 com.umlet.element.custom.InteractionFrame 16 248 360 200 interaction frame -- with inner frames -. -. com.umlet.element.custom.InteractionFrame 48 304 312 40 interaction frame com.umlet.element.custom.InteractionFrame 48 368 312 72 interaction frame -- inner umlet-11.3.orig/palettes/Colors.uxf0000644000175000001440000000747511576116034016035 0ustar benusers 8 com.umlet.element.UseCase 8 8 88 32 red bg=red com.umlet.element.UseCase 8 48 88 32 green bg=green com.umlet.element.UseCase 8 88 88 32 blue bg=blue com.umlet.element.UseCase 8 128 88 32 yellow bg=yellow com.umlet.element.UseCase 112 8 88 32 white bg=white com.umlet.element.UseCase 112 168 88 32 black bg=black fg=white com.umlet.element.UseCase 112 88 88 32 gray bg=gray com.umlet.element.UseCase 112 48 88 32 light_gray bg=light_gray com.umlet.element.UseCase 112 128 88 32 dark_gray bg=dark_gray com.umlet.element.UseCase 8 168 88 32 orange bg=orange com.umlet.element.UseCase 112 208 88 32 pink bg=pink com.umlet.element.UseCase 8 208 88 32 magenta bg=magenta com.umlet.element.UseCase 8 248 88 32 cyan bg=cyan com.umlet.element.UseCase 112 248 88 32 #3c7a00 bg=#3c7a00 umlet-11.3.orig/palettes/State Machine.uxf0000644000175000001440000000641411576116034017171 0ustar benusers 8 com.umlet.element.custom.StateSubDiagram 32 304 96 32 state with substates com.umlet.element.Relation 0 224 120 80 lt=<- self 64;24;32;24;32;64;104;64;104;40 com.umlet.element.custom.State 64 232 80 32 state com.umlet.element.custom.State 24 120 144 88 complex state -- some more... -. com.umlet.element.custom.Decision 120 72 32 32 com.umlet.element.custom.State 24 72 72 32 state com.umlet.element.Relation 0 32 168 40 lt=<- 152;24;24;24 com.umlet.element.custom.SeqDestroyMark 128 16 16 16 com.umlet.element.custom.FinalState 104 16 16 16 com.umlet.element.custom.InitialState 80 16 16 16 com.umlet.element.custom.RegionEndState 56 16 16 16 com.umlet.element.custom.HistoryState 32 16 16 16 umlet-11.3.orig/palettes/Sequence - All in one.uxf0000644000175000001440000000123211576116034020264 0ustar benusers 8 com.umlet.element.SequenceDiagram 16 16 304 280 title: sample _alpha:A~id1_|_beta:B~id2_|_gamma:G~id3_ id1->>id2:id1,id2 id2-/>id1:async Msg. id3->>>id1:id1,id3 id1.>id3:id1,id3:async return Msg id1->id1:id1:self iframe{:interaction frame id2->id3:id1,id3:async Msg. iframe} umlet-11.3.orig/palettes/Package.uxf0000644000175000001440000000701711576116034016117 0ustar benusers 8 com.umlet.element.Package 152 128 80 56 -- Name bg=green com.umlet.element.Package 152 16 80 56 -- Name bg=blue com.umlet.element.custom.PackageAggregationHierarchy 152 200 136 184 root name name name name root name com.umlet.element.Package 16 80 80 56 -- Name com.umlet.element.Relation 168 48 40 112 lt=<(+)- 24;24;24;96 com.umlet.element.Package 16 144 80 56 Name -- left:Text Text com.umlet.element.Relation 0 336 144 56 lt=<. <<merge>> 128;40;24;40 com.umlet.element.Relation 0 312 144 56 lt=<. <<import>> 128;40;24;40 com.umlet.element.Relation 0 288 144 56 lt=<. <<access>> 128;40;24;40 com.umlet.element.Package 16 16 80 56 Name com.umlet.element.Package 16 208 120 88 com.umlet.element.Package 40 232 80 56 umlet-11.3.orig/palettes/Default.uxf0000644000175000001440000002270011576116034016144 0ustar benusers 8 com.umlet.element.Relation 176 128 168 40 lt=<. 24;24;152;24 com.umlet.element.Relation 176 112 168 40 lt=<- 24;24;152;24 com.umlet.element.Relation 176 96 168 40 lt=<<. 24;24;152;24 com.umlet.element.Note 208 336 112 56 Note.. bg=blue com.umlet.element.Relation 176 128 168 56 lt=- m1=0..n m2=0..1 teaches to> 24;40;152;40 com.umlet.element.Package 208 464 112 56 Package 1 -- -Content 1 +Content 2 bg=gray fg=red com.umlet.element.Relation 176 152 172 56 lt=<.> <<someStereotype>> 24;40;152;40 com.umlet.element.Relation 176 184 168 40 lt=<- m1=0..n r1=Role 24;24;152;24 com.umlet.element.Actor 120 408 80 96 Actor com.umlet.element.UseCase 104 328 96 32 *Use case 3* com.umlet.element.Package 208 400 112 56 EmptyPackage bg=orange com.umlet.element.UseCase 16 448 96 32 lt=. Collaboration fg=red bg=yellow com.umlet.element.UseCase 16 304 96 32 Use case 1 com.umlet.element.UseCase 16 376 96 32 Use case 2 bg=blue com.umlet.element.Relation 176 248 168 40 lt=<- q1=Qualification m1=1..5,6,7 24;24;152;24 com.umlet.element.Relation 176 224 168 40 lt=<<<<- 24;24;152;24 com.umlet.element.Relation 176 208 168 40 lt=<<<- 24;24;152;24 com.umlet.element.Class 288 56 48 16 Rose bg=red com.umlet.element.Interface 200 16 64 72 Interface -- Operation1 Operation2 com.umlet.element.Relation 64 336 126 72 lt=<. <<extends>> 48;56;80;24 com.umlet.element.Relation 296 0 130 80 lt=>> a rose is a rose is a rose 24;56;24;40;72;40;72;64;40;64 com.umlet.element.Class 16 240 168 56 _object: Class_ -- id: Long="36548" [waiting for message] com.umlet.element.Relation 24 176 140 80 lt=<. <<instanceOf>> 72;24;72;64 com.umlet.element.Class 104 16 80 24 /AbstractClass/ com.umlet.element.Relation 72 384 80 64 24;24;64;48 com.umlet.element.Class 16 48 168 152 <<Stereotype>> Package::FatClass {Some Properties} -- -id: Long _-ClassAttribute: Long_ -- #Operation(i: int): int /+AbstractOperation()/ -- Responsibilities -- Resp1 *-- Resp2* com.umlet.element.Class 16 16 80 24 SimpleClass com.umlet.element.Relation 40 384 40 80 lt=<<. 24;24;24;64 com.umlet.element.Relation 0 312 122 80 lt=<. <<include>> 64;24;64;64 com.umlet.element.Relation 176 80 168 40 lt=<<- 24;24;152;24 com.umlet.element.custom.Text 336 168 80 80 This is a text element to place text anywhere. com.umlet.element.Relation 184 280 160 40 lt== 24;24;144;24 com.umlet.element.Relation 184 296 160 40 lt=: 24;24;144;24 umlet-11.3.orig/palettes/Use Case.uxf0000644000175000001440000001071311576116034016151 0ustar benusers 8 com.umlet.element.Note 152 176 104 56 Note.. bg=blue com.umlet.element.custom.Taxonomy_of_Workprocesses 8 320 360 216 Workprocess1 Workprocess2 Workprocess3 Workprocess4 Workprocess5 com.umlet.element.Relation 0 112 112 40 lt=<(). 96;24;24;24 com.umlet.element.Relation 0 96 128 40 112;24;24;24 com.umlet.element.Relation 0 80 128 40 lt=<<. 112;24;24;24 com.umlet.element.Relation 0 48 128 56 lt=<. <<extends>> 112;40;24;40 com.umlet.element.Relation 0 24 128 56 lt=<. <<includes>> 112;40;24;40 com.umlet.element.custom.Systemborder 152 120 104 32 center:Neighboursystem com.umlet.element.custom.AlternativeUseCase 128 256 128 56 Alt. Use Case -- extension points com.umlet.element.UseCase 8 176 128 72 Use Case -- extension points com.umlet.element.custom.Taxonomy_of_Actors 264 16 160 296 Actor1 Actor2 Actor3 Actor4 Actor5 Actor6 com.umlet.element.custom.Systemborder 176 16 80 80 System com.umlet.element.Actor 112 16 64 96 Actor com.umlet.element.UseCase 16 16 96 32 Use case 1 com.umlet.element.Relation 0 136 128 40 lt=<<- 112;24;24;24 umlet-11.3.orig/sourcefiles/0000755000175000001440000000000011576116036014537 5ustar benusersumlet-11.3.orig/sourcefiles/exe/0000755000175000001440000000000011576116036015320 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Umlet/0000755000175000001440000000000011576116036016406 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Umlet/umlet.sh0000644000175000001440000000066511576116034020075 0ustar benusers#!/bin/sh # Shell script for running umlet from the command prompt in linux # If you want to put umlet.sh in your home bin directory ($HOME/bin/) to start it from anywhere with # $ umlet.sh myDiagram.uxf # you must specify the programDir directly instead #programDir=/path/to/umlet programDir=$(cd $(dirname $0);pwd) if [ $# -gt 0 ] then java -jar ${programDir}/umlet.jar -filename="$1" else java -jar ${programDir}/umlet.jar fi umlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/0000755000175000001440000000000011576116036020375 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Properties/0000755000175000001440000000000011576116036022531 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Properties/AssemblyInfo.cs0000644000175000001440000000243011576116034025450 0ustar benusersusing System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UMLet")] [assembly: AssemblyDescription("UMLet a free UML Sketching Tool")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TU Wien")] [assembly: AssemblyProduct("UMLet")] [assembly: AssemblyCopyright("GNU General Public License")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c2679a87-30e6-492d-8fff-6dea974bdca1")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] umlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Umlet.ico0000644000175000001440000000623611576116034022164 0ustar benusers  ( 0 *+<t`, G *  4zE =  B   fj !%% ^'& #   UE%F/          4ȉ%    ҿ>879п?8<=` PMuq8500BAIHUT EE 21POIH:775 XXbbFFYW^\҂ kjqqWVzyMN RS__MMpnۍ cb dc??hhLK **`qol5uqtqrooooooooooo ;ussrwnos:  F  &/  | ]h0"# : D  K  o/.* [a ^ <  P y2 )'   ??????umlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Umlet.sln0000644000175000001440000000160711576116034022203 0ustar benusers Microsoft Visual Studio Solution File, Format Version 10.00 # Visual C# Express 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umlet", "Umlet.csproj", "{34761AF7-8C96-47F0-B973-DD3DF83B7346}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Debug|Any CPU.Build.0 = Debug|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Release|Any CPU.ActiveCfg = Release|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal umlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Umlet.cs0000644000175000001440000000433611576116034022016 0ustar benusersusing System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Windows.Forms; using Microsoft.Win32; using System.IO; namespace Umlet { class Umlet { public static void Main(String[] args) { Process proc = new Process(); String arguments = ""; if (args.Length == 1) arguments = " \"-filename=" + args[0] + "\""; else if (args.Length > 1) { for (int i = 0; i < args.Length; i++) arguments += " \"" + args[i] + "\""; } try { setPathToJavaw(proc); proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WorkingDirectory = Application.StartupPath; proc.StartInfo.Arguments = "-jar \"" + Application.StartupPath + "\\umlet.jar\"" + arguments; proc.Start(); } catch (Exception) { MessageBox.Show("You have to install Java (www.java.com) to run UMLet!", "Java not Found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private static void setPathToJavaw(Process proc) { try { RegistryKey regkey = Registry.ClassesRoot; regkey = regkey.OpenSubKey("Applications\\javaw.exe\\shell\\open\\command"); if (regkey != null) { String javawReg = regkey.GetValue("").ToString(); String javawPath = javawReg.Substring(1, javawReg.IndexOf("javaw.exe") + 8); if (File.Exists(javawPath)) { proc.StartInfo.FileName = javawPath; // If the installation dir of java can be found and it exists, it will be used return; } } } catch (Exception) { } // If any of the previous steps to locate the path from the registry fails, the environment variable will be used proc.StartInfo.FileName = "javaw.exe"; } } } umlet-11.3.orig/sourcefiles/exe/Umlet/umlet_exe/Umlet.csproj0000644000175000001440000001136211576116034022706 0ustar benusers Debug AnyCPU 9.0.30729 2.0 {34761AF7-8C96-47F0-B973-DD3DF83B7346} WinExe Properties Umlet UMLet Umlet.ico 2.0 v3.5 false 70DEB7C61A23AC7F42D5014D1D0FF93EBC928642 Umlet_TemporaryKey.pfx true true D:\temp\123\ true Disk false Foreground 7 Days false false true 1 1.0.0.%2a false true true true full false bin\Debug\ DEBUG;TRACE prompt 4 pdbonly true bin\Release\ TRACE prompt 4 False .NET Framework Client Profile false False .NET Framework 2.0 %28x86%29 false False .NET Framework 3.0 %28x86%29 false False .NET Framework 3.5 false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true umlet-11.3.orig/sourcefiles/exe/Umlet/Umlet.exe0000644000175000001440000002200011576116034020167 0ustar benusersMZ@ !L!This program cannot be run in DOS mode. $PELM , @@ @+W@` 4+  H.text  `.rsrc@@@.reloc `"@B+H! 0s rp i3rprp( +(i1" +r!prp( X i2(o o o ( o o r'p( r5p( o o &&rMprp( &*OK0g~ rpo ,<rpo o r+po Xo ( ,o o! &o r+po! *SS(" *BSJB v2.0.50727l#~(#Strings@#US$#GUID4T#BlobG 3"  *# I6pppppp"p=puVVpp6?0T# b6,#F6O6P 1  !Q!`fk`!`)`1`9`A`I`Q`Y`a`i`q`y`$`*``[/[6s>CG'K[]garg {lpu{ `. ...#.+.3.;.K.S.c.k!.s*.{3VN#UMLet.exeUmletmscorlibSystemObjectMainSystem.DiagnosticsProcesssetPathToJavaw.ctorargsprocSystem.ReflectionAssemblyTitleAttributeAssemblyDescriptionAttributeAssemblyConfigurationAttributeAssemblyCompanyAttributeAssemblyProductAttributeAssemblyCopyrightAttributeAssemblyTrademarkAttributeAssemblyCultureAttributeSystem.Runtime.InteropServicesComVisibleAttributeGuidAttributeAssemblyVersionAttributeAssemblyFileVersionAttributeDebuggableAttributeDebuggingModesSystem.Runtime.CompilerServicesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeUMLetStringConcatProcessStartInfoget_StartInfoset_CreateNoWindowSystem.Windows.FormsApplicationget_StartupPathset_WorkingDirectoryset_ArgumentsStartMessageBoxDialogResultMessageBoxButtonsMessageBoxIconShowExceptionMicrosoft.Win32RegistryRegistryKeyClassesRootOpenSubKeyGetValueToStringIndexOfSubstringSystem.IOFileExistsset_FileName "-filename=" " -jar "\umlet.jar"kYou have to install Java (www.java.com) to run UMLet!Java not FoundSApplications\javaw.exe\shell\open\commandjavaw.exeDG%“,z\V4     A  Q  ]ae q q    q UMLet$UMLet a free UML Sketching Tool TU WienGNU General Public License)$c2679a87-30e6-492d-8fff-6dea974bdca1 1.0.0.0TWrapNonExceptionThrowsMcP+P RSDS Ɩ5JMQɂE:\Programmieren\Eclipse\Baselet\exe\Umlet\umlet_exe\obj\Release\UMLet.pdb++ +_CorExeMainmscoree.dll% @(@XpD P@,,4VS_VERSION_INFO?DVarFileInfo$TranslationStringFileInfoh000004b0X CommentsUMLet a free UML Sketching Tool0CompanyNameTU Wien4FileDescriptionUMLet0FileVersion1.0.0.04 InternalNameUMLet.exe\LegalCopyrightGNU General Public License< OriginalFilenameUMLet.exe,ProductNameUMLet4ProductVersion1.0.0.08Assembly Version1.0.0.0( 0 *+<t`, G *  4zE =  B   fj !%% ^'& #   UE%F/          4ȉ%    ҿ>879п?8<=` PMuq8500BAIHUT EE 21POIH:775 XXbbFFYW^\҂ kjqqWVzyMN RS__MMpnۍ cb dc??hhLK **`qol5uqtqrooooooooooo ;ussrwnos:  F  &/  | ]h0"# : D  K  o/.* [a ^ <  P y2 )'   ??????   <umlet-11.3.orig/sourcefiles/exe/Plotlet/0000755000175000001440000000000011576116036016743 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Plotlet/Plotlet.exe0000644000175000001440000002300011576116034021062 0ustar benusersMZ@ !L!This program cannot be run in DOS mode. $PELKM , @@ @+W@x` <+  H.text$  `.rsrcx@@@.reloc `$@B,H! 0s rp i3rprp( +(i1" +r!prp( X i2(o o o ( o o r'p( r5p( o o &&rQprp( &*OK0g~ rpo ,<rpo o r3po Xo ( ,o o! &o r3po! *SS(" *BSJB v2.0.50727l#~(#StringsH#US(#GUID8X#BlobG 3"  .' M:ttttt t&tAtyZZtt:?4R' `:*'D4M4P 5  !U!djod!d)d1d9dAdIdQdYdadidqdyd$d*ddY/Y6q>CG%KY]eapg ylpu{ d. ...#.+.3.;.K.S.c.k'.s0.{9V'Plotlet.exePlotletmscorlibSystemObjectMainSystem.DiagnosticsProcesssetPathToJavaw.ctorargsprocSystem.ReflectionAssemblyTitleAttributeAssemblyDescriptionAttributeAssemblyConfigurationAttributeAssemblyCompanyAttributeAssemblyProductAttributeAssemblyCopyrightAttributeAssemblyTrademarkAttributeAssemblyCultureAttributeSystem.Runtime.InteropServicesComVisibleAttributeGuidAttributeAssemblyVersionAttributeAssemblyFileVersionAttributeDebuggableAttributeDebuggingModesSystem.Runtime.CompilerServicesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeStringConcatProcessStartInfoget_StartInfoset_CreateNoWindowSystem.Windows.FormsApplicationget_StartupPathset_WorkingDirectoryset_ArgumentsStartMessageBoxDialogResultMessageBoxButtonsMessageBoxIconShowExceptionMicrosoft.Win32RegistryRegistryKeyClassesRootOpenSubKeyGetValueToStringIndexOfSubstringSystem.IOFileExistsset_FileName "-filename=" " -jar "\plotlet.jar"oYou have to install Java (www.java.com) to run Plotlet!Java not FoundSApplications\javaw.exe\shell\open\commandjavaw.exe;Mhz\V4     A  Q  ]ae q q    q Plotlet(#Plotlet a free tool to create plots TU WienGNU General Public License)$c2679a87-30e6-492d-8fff-6dea974bdca1 1.0.0.0TWrapNonExceptionThrowsKMiX+X RSDSEcO(wE:\Programmieren\Eclipse\Baselet\exe\Plotlet\plotlet_exe\obj\Release\Plotlet.pdb+, ,_CorExeMainmscoree.dll% @(@Xp0D,`S@DD4VS_VERSION_INFO?DVarFileInfo$TranslationStringFileInfo000004b0`$CommentsPlotlet a free tool to create plots0CompanyNameTU Wien8FileDescriptionPlotlet0FileVersion1.0.0.08 InternalNamePlotlet.exe\LegalCopyrightGNU General Public License@ OriginalFilenamePlotlet.exe0ProductNamePlotlet4ProductVersion1.0.0.08Assembly Version1.0.0.0(> @@$__]] ۪xwttר bdJJEFޟ՟0/+*͟.-)(ޒRNMJJR턃Р ̠ ihdd ՞ ͞P99::0նxꮮ⡡22LL IHLLLLRRFF+*LK22FEIIDC,,**盛@?닋mm鏏GFXWqp**JIꊊ}|ba``43vv||hh;:11ppef!!*)kjut䊉]\ts~~''ih;;YYddST2265jjAA((BC|{@?\[苋ZZWVpopqXW瑐ccjjhh돏럟22LLDD IH77SRGF##MMLLML:9!!ᛙ쾽]ҡ˕˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖ҡ?iikj@8744@"MNCC[[ggddVV::99VVcdgg\[CDHI$bx@@$0@K񲧧K@0$@@xf?||<  <| , <umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet.sh0000644000175000001440000000070111576116034020756 0ustar benusers#!/bin/sh # Shell script for running plotlet from the command prompt in linux # If you want to put plotlet.sh in your home bin directory ($HOME/bin/) to start it from anywhere with # $ plotlet.sh myDiagram.uxf # you must specify the programDir directly instead #programDir=/path/to/plotlet programDir=$(cd $(dirname $0);pwd) if [ $# -gt 0 ] then java -jar ${programDir}/plotlet.jar -filename="$1" else java -jar ${programDir}/plotlet.jar fi umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/0000755000175000001440000000000011576116036021267 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Properties/0000755000175000001440000000000011576116036023423 5ustar benusersumlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Properties/AssemblyInfo.cs0000644000175000001440000000244011576116034026343 0ustar benusersusing System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Plotlet")] [assembly: AssemblyDescription("Plotlet a free tool to create plots")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TU Wien")] [assembly: AssemblyProduct("Plotlet")] [assembly: AssemblyCopyright("GNU General Public License")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c2679a87-30e6-492d-8fff-6dea974bdca1")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Plotlet.ico0000644000175000001440000000750211576116034023410 0ustar benusers ,(> @@$__]] ۪xwttר bdJJEFޟ՟0/+*͟.-)(ޒRNMJJR턃Р ̠ ihdd ՞ ͞P99::0նxꮮ⡡22LL IHLLLLRRFF+*LK22FEIIDC,,**盛@?닋mm鏏GFXWqp**JIꊊ}|ba``43vv||hh;:11ppef!!*)kjut䊉]\ts~~''ih;;YYddST2265jjAA((BC|{@?\[苋ZZWVpopqXW瑐ccjjhh돏럟22LLDD IH77SRGF##MMLLML:9!!ᛙ쾽]ҡ˕˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖˖ҡ?iikj@8744@"MNCC[[ggddVV::99VVcdgg\[CDHI$bx@@$0@K񲧧K@0$@@xf?||<  <|umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Plotlet.sln0000644000175000001440000000161311576116034023427 0ustar benusers Microsoft Visual Studio Solution File, Format Version 10.00 # Visual C# Express 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plotlet", "Plotlet.csproj", "{34761AF7-8C96-47F0-B973-DD3DF83B7346}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Debug|Any CPU.Build.0 = Debug|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Release|Any CPU.ActiveCfg = Release|Any CPU {34761AF7-8C96-47F0-B973-DD3DF83B7346}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Plotlet.cs0000644000175000001440000000434611576116034023246 0ustar benusersusing System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Windows.Forms; using Microsoft.Win32; using System.IO; namespace Plotlet { class Plotlet { public static void Main(String[] args) { Process proc = new Process(); String arguments = ""; if (args.Length == 1) arguments = " \"-filename=" + args[0] + "\""; else if (args.Length > 1) { for (int i = 0; i < args.Length; i++) arguments += " \"" + args[i] + "\""; } try { setPathToJavaw(proc); proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WorkingDirectory = Application.StartupPath; proc.StartInfo.Arguments = "-jar \"" + Application.StartupPath + "\\plotlet.jar\"" + arguments; proc.Start(); } catch (Exception) { MessageBox.Show("You have to install Java (www.java.com) to run Plotlet!", "Java not Found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private static void setPathToJavaw(Process proc) { try { RegistryKey regkey = Registry.ClassesRoot; regkey = regkey.OpenSubKey("Applications\\javaw.exe\\shell\\open\\command"); if (regkey != null) { String javawReg = regkey.GetValue("").ToString(); String javawPath = javawReg.Substring(1, javawReg.IndexOf("javaw.exe") + 8); if (File.Exists(javawPath)) { proc.StartInfo.FileName = javawPath; // If the installation dir of java can be found and it exists, it will be used return; } } } catch (Exception) { } // If any of the previous steps to locate the path from the registry fails, the environment variable will be used proc.StartInfo.FileName = "javaw.exe"; } } } umlet-11.3.orig/sourcefiles/exe/Plotlet/plotlet_exe/Plotlet.csproj0000644000175000001440000001125611576116034024137 0ustar benusers Debug AnyCPU 9.0.30729 2.0 {34761AF7-8C96-47F0-B973-DD3DF83B7346} WinExe Properties Plotlet Plotlet Plotlet.ico 2.0 v3.5 false 70DEB7C61A23AC7F42D5014D1D0FF93EBC928642 Umlet_TemporaryKey.pfx true true D:\temp\123\ true Disk false Foreground 7 Days false false true 1 1.0.0.%2a false true true true full false bin\Debug\ DEBUG;TRACE prompt 4 pdbonly true bin\Release\ TRACE prompt 4 False .NET Framework Client Profile false False .NET Framework 2.0 %28x86%29 false False .NET Framework 3.0 %28x86%29 false False .NET Framework 3.5 false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true umlet-11.3.orig/sourcefiles/img/0000755000175000001440000000000011576116036015313 5ustar benusersumlet-11.3.orig/sourcefiles/img/umlet_eclipse.gif0000644000175000001440000000054411576116034020635 0ustar benusersGIF89a1{tO꤮zL{sPwM@{tP즯FtN}JEHBzsOڽ|CԲh{sOȏղi>Բi=!1,pH,a$(P9bYѴXy̆Qt\ !ME--E/ Eu/E))E (( E.E  LCA;umlet-11.3.orig/sourcefiles/img/umlet_logo.png0000644000175000001440000002566111576116034020177 0ustar benusersPNG  IHDRrD*sRGBbKGD pHYs  tIME 7\ IDATxy]e}sι$ Y1AJ VKYDQj]Ъ*J-XYXVEd X"$$!{f~s;sΝ;$^u=g<}0`Piz}"RjK߁wW_#8Z<ǘ&&C]}=jz)ی(mU0M1=16Ҥ cPb@B0~/f=X̞ P^*ؿOJv1B4j& TRJ>e`زvo^k?H|W7(P^&ZӸpj\ V,/t#*УlMJX^|~w!i.I~?ʦcT v\X0 &:'-V\]p!,Zh?dzst=uX,_?NЃҐˑ AHn"5Ք햴\IXUs.8LH!(n| L[!?~ӷBᩧdIy"qY|yǡ3-YN~eB*i@G{d6˚ndǵQx9iKTP[L0Xjs=qk֨>ixA: ^|Lm@fmb!o/_duW7 #Mتso#˭qmb ?^ohO_"fB1Ц ŒK"?ɔL <+H<,fHbGpGg"Nn:{K eKeh Yd?Mq 5FkL/'hG@kBUS]´?V+qrfuW:B2}Mdy&KJq2X_d`*Ig"IzJZלZAe`46X}ٴZЎm"}۷Z(2TBTy7\c!J@a^>ǁoa~ωFM~9M)5i-'72 eGwqyy7F6WZ5{.0~KH G^9YY!%}u0<?΍H:#$zBR1-r? Ea8,dW,̩D~=syd֨o VBR3 }}Pm/3A:#<: ݗٯd (i̍J*bYxqs+;+h,d\T?C̜F^wp".)] Hxxl$y&r]H_G°a9>b/ }HGkffy k~V(>7./?cs>3/BPBvSO=܉>ϓ=ٴpUEvs'v"_O-Y,{Ry+=?NZR!l;.0QAUWܹw>ϓ4W< Oڀc8߷Bz'y=ۚ$:R#n6_Oߣ(8^JƮ,8b!7Mi&Pl qgU)YLkУshm}Į/HmHs~[Dl BOxq4hí.|Eݽ*Vd(:éy_) )W8=X 7NCe;" "?FBpmqF۠|-?BL%Uvyq/Y5J8B(Z v-5g.>9.S]8 Tz71-wT٨I?KݔmHKCc`~I>0仼"Ѻ FFG2 V5*ʚ yqNa2Ndd?jf2)Z-VB\V_';EUyxa|=Xf*_J< &]Xh*GIGI}- @'>Aaw=6F5倥K%vlxXlhY qp陙0'~@XT l58݊%KDj|^ӞLRGĆڿ\cH!no/jcU}ϡ rybDqLZ[I\r8̊?X*^Hʕdcd7QQDPw 늄\E5c9A?{.qcadq,EĎ8o{/4$@0r{gu_$!o%;`mAP,ǔ\VhVxPG?ʟE?U 4‹~C?- pױ\G=?jIt ui矼쒥*y%ըMjpFH%&LP-Qq1Z)Mg"3PTL_bՊn+gV*j6Mt ftҋy6!nX&4 h! z҂ Ai~ \>xȠ=u(%1BpJgQ*V94#K(˔NP!F҈$U(ۊfN{dT VJ)u(U_ĩijwƁϼyyyrCn}?A,JєA6eޛww"ڏY\g7xn#@衔D+NuAo}t77beܓa/Jo7q:OZD;d\ɫN@>'A=)ߨp0T ,ާ5C+xq5T_phц +C߇4Bۋ6qމX3DFl@*tƞ*,_‘>̇>_ 1|!3}_Q  m%\]n~gN~YUA k΂۾Qt0HhU$ٷq8{px9>VVN?]%uwTȆ/m=@錕E+>͊"3ȿ]wLhEo|G+?;(dU[#2T UզQYͧqm|Gwn/; 䗥Qn":!@uػ' }OJ(/94 5jʠTW*s!kOo*pE9K_M" _{Ѻ۲`mww__7`T*I!`A,0-ydWົ-9/v.s>Nd[ 1 )~s8L+Pf(LT9Gn%uЇ42vVjܺERA稦%%:N-AI=BZJ@v]ߜEAvDecPqM{<Şի/(&o+VSQyk|iJ4I6Y'Кޝ|M-Y,.SOj>B.ev_ oLwc :s" 4c:~p!g27C$Ūb}z+0$K7AohE5‰SCH+73~0&"Qw\ )lfcpx+ /N\0Pbk5|6֭P*Z GM`{Kk!?)cKgƖ *^0W`7M&Yu9j0ec ;d_bEGm\nup$_; 00ʔEI+INx)^Pʿ‚0AM'Yx[z1[vNki!z{Lolnmr$9@@1y]=$sKAFj*+:.IbgKV_XLv^2uR ->TRWMW x0/_&(5;눶/av?ˊ *j{X= Cpqp;u4Q6) ^罕éIx;:yKTp0sKEby"8pϝ)Lk=uO.p ^|,+\?B[|8QclN~c(s~M 6p*I%sN 2@ jneR{.,]\8_]jUC24)m|Tگz grS7þ/~% `dВVN$YGoS,]^ X %IDATh#Pٍmq ȼ.#7wʹ&Ht Cerh%:PCw7w|HӚ2e[>!SW>o)۠RV/w]ʡd5hx,f9\i-#TCmy#aw>J>.j;jXw;ǯ7v$#ETغAjh-,,n /rx;h$dRvgˉ?p,爇jAYVi7bf" =-UW\ Ct5prYO?-Op]k'wdcsY'e X{$ʓwRi^q饰d.3׌lSH3b_:%9יݢԠϾҒqiK%}%O"]WSqӃlDeEڒ#oѭe_:%y} Gy/s~xL'z8wҒ\ ?^C!=H6Kv7Bbɾ9F𵯲q*55IDZxMD$TD39{Tuթ.,Y *j3Agƍlxem!C~F/-7"3Jź2 񵋯! `{Dw1#ĂWB9G4RnjS-}54!T^`+) A2\yQ2yϥ#u +W+Î P)lPQ}ǭ`Ϳ~'C$%׭| GlGvN'DO+/Sx/_NoUhf c )?O~_|thprMBNTfޙH^7ʕC),զ?^EYy $HG [oUUg.A>%h8J;ՉXrdN  E8AȮPr4%afj*^˸wng.ӆ@9y1%,9|5`50egF`&~\<Çi-fzԱ@c3> \~E@5lB16hpߡNX(J9;2(hJ"t&+Wp9nLaQu lX?d]hNYT*( 6hQF_uunj`[SK<̷DASrk& ?gv=ށ2X$ê+q$-TJSu-Y۲ o 9 J9'CW[n[nӒ3ŘiXБH<5Ly{)VD`2l1a%h0ya;}R}ҾO2 uԠ̙[\q{]8K^:5㟀u 9Pئ,lb-% ?"_p{=[dOs*&S2k(Pt^DÉ֪W]z)-6ekW Knn͛%V>\cpBC( 2O![j Q X hV.'XnZ9k.e7o١m`{pKZe}Slz,_ǭ5k`"+<+dJm3 A}MĮj U9BEW\XeKk[|yl_`;"H1;c>!8vL#&5IENDB`umlet-11.3.orig/sourcefiles/img/plotlet_logo.png0000644000175000001440000003105411576116034020525 0ustar benusersPNG  IHDRy}k_sRGBbKGD pHYs  tIME 6 IDATxy\WuAݭ%[-K6fȵ  aetr!H !/ %<3& 106ْeRRj]9gǩA,۷s>U}{5k+aYmvŲt(u}Nݚ"Yy?37? xg@)δtϧ`B,('w3 m\lLaJSr=8\%¼s3sΤ?-3')gooIcIWwݍeYTTSSSCc*˩ZY3ًhqH$bxxC3QWWG,# q<cxszӸ.6u9$8a,TA@ee%V"P iz{zTT*E?b<kۚkk;U5` -wxھ{`6D""hq`&!8NbrrKiR47wDj د~{k#RKmU8q*+!Zxe$'>9=F5(hh4JY$@0`{G<GD0SSSSY1ԸD"V55# SSY F tະ};[B$N$J],=P R(*,kEd2I6 NH$/=pc oUliu!8Ї' x.:׷ƍl`U=z_m?Kmzjo0296K) 4"e$@t8Db#RSM0ZN0#+hE_41,HǧdqRc$FȎC" JsDt]4Ubq,EʲIm,t8TV! BՄkT. SVQ"RQ 0xg| uYғR$ @&SD,Q#e6_+ |>5ܹ|Fc||av\y#tǬdĠ "Vm e.d8FkcI+H)=c׊Q9hr,PbTaО`1Xbr`Y(Vs|Ҹ4$RxJ# 9}4l%mI,ƍ+YIs.S)y4/p1'1_-֮ncȞ  t4&],qVKE@lB9Qjq/EŦMͷ18X5U/F~"x-?~-NC*ON$|@yZ8`3o#`bN ~:xc#`wbCSǃS~񁲨Ʉ?DE[` A64X{ 䫀ℕYFXZe,=NSyo`|2;#Z4"!}Fqvv! D$4ǨW?~o>{ʍ7n%??O<1*DrlOdFx_ow&=W3[Iܤ|颔e m]MY2ۏaN N\E5r;.dˡ&j⟾,Yg5g7wAGAny+M30PmאPx< .bl9X۷?% O_&::<y4m>|#`p!]_ʼn1&xlp5ضE"rb$)E&>F^~R ),Vv)hs<?]vӋ[׶m5J&'RTGh@醙Ũu3|'J9T01'[oi\ LǹF޷cowo~Tl5A;6g\!.}CcT ֬ cLϵr+MZ <ƥR)r5UU] 5t } !1581]w 7ɮ+8m49UÉg{18=F"hQ4ePzP?Kԧ塚/ mo?8\믇`76n  R LX<:cIO|"AkShu'Ak?XI^&.s+;03Vm5X_?)(~]'53cxN5*^">=*:(,~̺|K(-8nFH2lnh// 'ǹ`So. ̿>!\Q# d&탧L\ÔB?yKC0hωN- V֛j.-@C~m01gc0cs|v{i^ o}f35PkP#q ёeEN22%l7}{(rK?vڠUk)O&AL1z+H(%}![֊:R`魄LMBu5\vYՋsg_ V\4)Qk]灂Udb | Gy4B$?UfT85&_RW :;ox#8B!d{Z ܔ9m reb`L("Zhˮ Du\Yv+7@(J]4z-YS0̐_dFPYkb9R`קжP,=,9|aAbo[AMMcb @8 0c,3,dVbdvW{Dcp52N~K$Oΐ'_5k裰Sy,'/) .= 1x/ŸnF5T x J•dmQ R*)HTtjjjk7B 2h+m!w muB1:[$eNLz\c lI i{o~3|˯@² }M3FoL:_rP*e ⺽31Q`Y#h=$}b(Rl+c~¢e(=֓8nO?!,"@H!G>;a˖yơ-BYCXJeJ)+[ĺ8JHL,x~+ǑSWrUMZ[&r&&witE5As壔W$*Ba`S1"ʧ3U8+_ߨ >1!O\֭ KٱӟD4O<xuyC%i8K֯"O308qQB)jjTWǩ`&p9?~RAd;7>zN6nzuM8N$')|~Df\Γ[b1"aկ~H6dDh՗EzDD&'E&DE{D^m R)#*w\N!+2<$2>!22"rW[KO?(e I(.J$S"HHg)}*SPph5) gf<(G]9tظEzzD~#pCD]w:7aom;.WiߗDRC7y'D DBxᣢ퓂@|GN<(R^>$(7F5,cU$;,`YPQEǝxqd·?ޡ,(8&}q A[ W@8 r`^ MPY͟vO M7u@]']`lA(ljU⎕>bC,`"e|0(VnO<&|/@CLc p˭pM2:ތx5(4WO~2k9k¶#P[w)N. 4,TBh@3?%W/?=L @J0Krn:.'̜-S`i&'*G aa3y-Y.lN &ٷop6ĬR F͡{H5ccunx3<ĝwϤ? USA)u[8vlO۶EyIz<}!rK"*BPE10-: CM.sn/[Z'c.ḯȃdV"D2Dgq)hZ~zP~!*g2 J \;Řq -eP$͒Tjձ3ύRkwNMz"WVV2<<|m6 --hg¢%7H,κpeQPMҼW& ϻbahpm5dΈx2frަEБN<악a=Z5NX,Vpl~;@r 3Kf% d K!ϭ#FL KKB؎<uKL(sݼ^=wc WvDw݋ +$ zjP &bB<'uʊtLKCP*M(8G?Jc:Tss3R}ΘlB'F_e,WF [ruٵ0f˖-z^ c@UtSO~,@MM/XD%\spv(u^mCG1ԼdQݎx}x5meV 6)AY#=R_te˦e?N.ͫWѣ*`'?QN ep1sVvfb/?n㪹@ 3lNe-[M*~|3۰.TZJ[dzHgJLS?lf˦4\NהXSeJV. ZOcyJm|a.cN%5]~=pԆp>g;(+@ќ-+\|MkG {/< :Nן91Y]&wmf3=66wIgD/EBDa/wkI+1,ϺΈxwѱ4X꥗*>l U iU*[>rPUQYU|#P8U]|e|4<fMev]d@(=Ncco|c 0>pI.~s|e8]d3"W< Tfbr ׬\rEm HYكs"wq'cccϙ>R%6ʫ* 6ē*˂7KWzg+|IѺO}zo=ST멪Z♒gO.6nl ǻTn|C۱nbed)=N𖷮 _ƶG9Nf9"&"ڵvFG'mWuh EEG~*xqw01~v횭P4Z:ud7cڏOrwqK>]%b['eݲw$~Ei=lr-FgE_f}#D+pU>[~3'#b=DWWY9!pQx\O$VD'}>~$IE+Oo߾sBsFdaϞ=~j&G~"k Q?ϵRhOʢo|G ]OSO3:S"?09:-򳟋^dNGO%Ld=QzJ}R**~_9x=s,W"3*O9ܛ#-yصypzCg'pL_\fl*N8rX6:B jkM ym%uO=\+8y P,z=d2>?9%Ϟp>Q*"4ĦAhkP¡GCӧDܬyGٳg93Λu]:~8w}7IqsI7,ua ϛGNBQnC)JdV~{9ty볦 IWqowu}\G~:E>> G5&yw@ipAy˾}9\s]pK>=D9Ns=o~J뿊\i|.b?Pc)րe'Uq=0::zֈuS|s"y޽T*%B**Bx{~JVyVL ^+#NV>ltZxꩇU `k׮3KZԷ7[OOGaݺul޼Eַo{z<ɝҦ'"_+B85O7mAGG蠭 .`IFR 2<8IEe1P?<¡V玩_l/f^P'MhiO?p۶`d,{ ;w$BjꅸvVZŶmDq<[7|&Z1Eg$N 䲇&),=Jk[w+xo lU###l޼y^n !<(-m:$g'p5xn-L\@CumY{/ooOsiW=Yv-[lY]!rIСC$IZ[[ֺOE yz?؈ƣ,wWE#Vi8829}@$._ュ7?<`˹袋(>U+D^jäI[tV0IWuϓHzT䌴RӧZ4`?7n濾!˶?~!yfjkk_<9/8N^dOLqs$RO7 {½A20blT.0CNeS-^+vA0WkH?~\>} 6o޼`]"e'I=Hի[eF/,<v?aS=ԲhԲiղi飯ڽ|ȏ! ,..I0.-H41,G54/,+E72F+*D)C*(B  B('A  A'&?@&%>98>%$==6 3$#<<;#":" } >x`pP ;umlet-11.3.orig/sourcefiles/src/0000755000175000001440000000000011576116036015326 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/0000755000175000001440000000000011576116036016104 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/0000755000175000001440000000000011576116036017232 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/gui/0000755000175000001440000000000011576116036020016 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/gui/CustomCodePanelListener.java0000644000175000001440000000140411576116034025411 0ustar benuserspackage com.umlet.gui; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import com.baselet.control.Main; import com.baselet.diagram.command.CustomCodePanelChanged; import com.baselet.element.GridElement; public class CustomCodePanelListener implements UndoableEditListener { @Override public void undoableEditHappened(UndoableEditEvent e) { // CustomElementHandler customHandler = Main.getInstance().getGUI().getCurrentCustomHandler(); GridElement gridElement = Main.getInstance().getEditedGridElement(); if (gridElement != null) { //only create command if changes were made gridElement.getHandler().getController().executeCommand(new CustomCodePanelChanged(e.getEdit())); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/gui/CustomElementPanel.java0000644000175000001440000001142211576116034024423 0ustar benuserspackage com.umlet.gui; import java.awt.Color; import java.awt.Component; import java.awt.Font; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.gui.listener.DividerListener; import com.baselet.gui.standalone.MenuListener; import com.umlet.custom.CustomElementHandler; @SuppressWarnings("serial") public class CustomElementPanel extends JPanel { private JSplitPane custompanelsplitleft; private JSplitPane custompanelsplitright; private JLabel savelabel; private CustomElementHandler customhandler; private JEditorPane customcodepane; public CustomElementPanel(CustomElementHandler customhandler) { this.customhandler = customhandler; this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); JPanel custompanel2 = new JPanel(); custompanel2.setLayout(new BoxLayout(custompanel2, BoxLayout.Y_AXIS)); customcodepane = customhandler.getCodePane(); JScrollPane scr = new JScrollPane(customcodepane); scr.setBorder(null); scr.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel codelabel = new JLabel(" Code"); codelabel.setFont(new Font("SansSerif", Font.BOLD, 11)); codelabel.setAlignmentX(Component.LEFT_ALIGNMENT); custompanel2.add(codelabel); custompanel2.add(scr); JPanel custompanel3 = new JPanel(); custompanel3.setLayout(new BoxLayout(custompanel3, BoxLayout.Y_AXIS)); DiagramHandler d = customhandler.getPreviewHandler(); DrawPanel custompreviewpanel = d.getDrawPanel(); custompreviewpanel.getScrollPane().setAlignmentX(Component.LEFT_ALIGNMENT); JLabel previewlabel = new JLabel(" Preview"); previewlabel.setFont(new Font("SansSerif", Font.BOLD, 11)); previewlabel.setAlignmentX(Component.LEFT_ALIGNMENT); JPanel labelpanel = new JPanel(); labelpanel.setLayout(new BoxLayout(labelpanel, BoxLayout.Y_AXIS)); labelpanel.setAlignmentX(Component.LEFT_ALIGNMENT); savelabel = new JLabel(" Add to diagram and close editor") { private boolean enabled = false; @Override public void setEnabled(boolean en) { if (!enabled && en) { this.enabled = en; this.addMouseListener(MenuListener.getInstance()); this.addMouseMotionListener(MenuListener.getInstance()); } else if (enabled && !en) { this.enabled = en; this.removeMouseListener(MenuListener.getInstance()); this.removeMouseMotionListener(MenuListener.getInstance()); } } }; savelabel.setFont(new Font("SansSerif", Font.BOLD, 11)); savelabel.setAlignmentX(Component.RIGHT_ALIGNMENT); savelabel.setEnabled(true); JLabel discardlabel = new JLabel("Discard and close editor"); discardlabel.setFont(new Font("SansSerif", Font.BOLD, 11)); discardlabel.setAlignmentX(Component.RIGHT_ALIGNMENT); discardlabel.addMouseListener(MenuListener.getInstance()); discardlabel.addMouseMotionListener(MenuListener.getInstance()); custompanel3.add(previewlabel); custompanel3.add(custompreviewpanel.getScrollPane()); custompanel3.add(labelpanel); custompanel3.addComponentListener(new DividerListener()); labelpanel.add(Box.createHorizontalGlue()); labelpanel.add(savelabel); labelpanel.add(discardlabel); custompanelsplitleft = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, null, custompanel2); custompanelsplitleft.setDividerSize(5); custompanelsplitleft.setResizeWeight(0); custompanelsplitleft.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); custompanelsplitright = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, custompanelsplitleft, custompanel3); custompanelsplitright.setDividerSize(5); custompanelsplitright.setResizeWeight(1); custompanelsplitright.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); this.add(custompanelsplitright); } public void setCustomElementSaveable(boolean enable) { this.customhandler.getPreviewHandler().getDrawPanel().setEnabled(enable); this.savelabel.setEnabled(enable); if (enable) this.savelabel.setForeground(Color.black); else this.savelabel.setForeground(Color.gray); } // specifies if the custom element is opened as new element or as edited element public void setCustomElementIsNew(boolean isnew) { if (isnew) this.savelabel.setText("Add to diagram and close editor"); else this.savelabel.setText("Update in diagram and close editor"); } public JSplitPane getLeftSplit() { return this.custompanelsplitleft; } public JSplitPane getRightSplit() { return this.custompanelsplitright; } public JEditorPane getTextPane() { return customcodepane; } } umlet-11.3.orig/sourcefiles/src/com/umlet/gui/CustomCodeSyntaxPane.java0000644000175000001440000000215211576116034024737 0ustar benuserspackage com.umlet.gui; import javax.swing.JPanel; import javax.swing.JToolTip; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.util.Configuration; import com.baselet.gui.JMultiLineToolTip; import com.baselet.gui.OwnSyntaxPane; @SuppressWarnings("serial") public class CustomCodeSyntaxPane extends OwnSyntaxPane { private JToolTip tooltip; private CustomCodePanelListener listener; public CustomCodeSyntaxPane(JPanel panel) { super(panel); } @Override public JToolTip createToolTip() { tooltip = new JMultiLineToolTip(); return tooltip; } public JToolTip getToolTip() { return this.tooltip; } @Override public void initJSyntaxPane() { DefaultSyntaxKit.initKit(); //removes the line numbering Configuration conf = DefaultSyntaxKit.getConfig(DefaultSyntaxKit.class); conf.remove("Components"); this.setContentType("text/java"); this.validate(); } public void initCodePanelListener() { if (listener == null) { listener = new CustomCodePanelListener(); this.getDocument().addUndoableEditListener(listener); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/gui/UmletSyntaxKit.java0000644000175000001440000000623311576116034023630 0ustar benuserspackage com.umlet.gui; import java.lang.reflect.Field; import java.util.HashMap; import java.util.regex.Pattern; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.lexers.SimpleRegexLexer; import org.apache.log4j.Logger; import com.baselet.control.Utils; import com.plotlet.parser.PlotConstants; @SuppressWarnings("serial") public class UmletSyntaxKit extends DefaultSyntaxKit { protected final static Logger log = Logger.getLogger(Utils.getClassName()); private static final HashMap regExMap = new HashMap(); static { // The regex are matched anywhere in the whole text (not only at the beginning of a line) // If more than 1 RegEx match, the longest has the priority (eg: "plot" overrules "plo") //regExMap.put("KEYWORD", Pattern.compile(PlotConstants.PLOT)); // regExMap.put("KEYWORD2", Pattern.compile(PlotConstants.REGEX_COLOR_BASE)); regExMap.put("COMMENT", Pattern.compile(PlotConstants.REGEX_COMMENT)); regExMap.put("TYPE", Pattern.compile(PlotConstants.REGEX_VALUE_ASSIGNMENT)); } public UmletSyntaxKit() { super(new SimpleRegexLexer(regExMap)); } public static String createAutocompletionList(String listSep) { String outString = "fg=" + listSep + "bg=" + listSep; String fieldName = "", fieldContent = "", keyName = "", keyContent = "", keyType = ""; try { Field[] fs = PlotConstants.class.getFields(); for (Field f : fs) { fieldName = f.getName(); fieldContent = String.valueOf(f.get(String.class)); if (fieldName.startsWith("KEY_")) { if (keyType.equals("LIST")) { if (outString.lastIndexOf(PlotConstants.VALUE_LIST_SEPARATOR) != outString.length()-1) { // If no list values are listed outString += /*"" + PlotConstants.VALUE_LIST_SEPARATOR + "" + PlotConstants.VALUE_LIST_SEPARATOR + "..." + */listSep; } else { outString = outString.substring(0, outString.length()-PlotConstants.VALUE_LIST_SEPARATOR.length()) + listSep; } } String[] keySplit = fieldName.split("_"); keyType = keySplit[1]; keyName = keySplit[2]; keyContent = fieldContent; if (keyType.equals("BOOL")) { outString += keyContent + "=" + "true" + listSep; outString += keyContent + "=" + "false" + listSep; } else if (keyType.equals("INT")) { outString += keyContent + "=" + /*"" + */listSep; } else if (keyType.equals("LIST")) { outString += keyContent + "="; } } else if (!keyName.isEmpty() && fieldName.startsWith(keyName) && !fieldName.endsWith("DEFAULT") && !fieldContent.isEmpty()) { if (keyType.equals("LIST")) outString += fieldContent + PlotConstants.VALUE_LIST_SEPARATOR; else outString += keyContent + "=" + fieldContent + listSep; } } if (outString.lastIndexOf(PlotConstants.VALUE_LIST_SEPARATOR) == outString.length()-1) { outString = outString.substring(0, outString.length()-PlotConstants.VALUE_LIST_SEPARATOR.length()) + listSep; } } catch (Exception e) { log.error("Error at creating keyValueMap", e); } return outString; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/0000755000175000001440000000000011576116036020663 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/element/Relation.java0000644000175000001440000020060711576116034023306 0ustar benuserspackage com.umlet.element; import java.awt.Color; import java.awt.Composite; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.Area; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; import com.umlet.element.relation.Arrow; import com.umlet.element.relation.EmptyShape; import com.umlet.element.relation.Multiplicity; import com.umlet.element.relation.NoShape; import com.umlet.element.relation.Port; import com.umlet.element.relation.Qualifier; import com.umlet.element.relation.Role; @SuppressWarnings("serial") public class Relation extends GridElement { String beginQualifier; String endQualifier; String beginArrow; String endArrow; String beginMultiplicity; String endMultiplicity; String beginRole; String endRole; String lineType; String eerRelDir; Vector _strings; // A.Mueller start String clientServer; // A.Mueller end // G.Mueller start String beginPort; String endPort; String middleArrow; String csdStartText; // Arrow-Text for composite structure diagram String csdEndText; // G.Mueller end private final float SELECTBOXSIZE = 12; private final float SELECTCIRCLESIZE = 15; private Vector getStrings() { if (_strings == null) { _strings = new Vector(); } return _strings; } private void setStrings(Vector v) { _strings = v; } private Point getCenterOfLine() { Point ret = new Point(); if (this.getLinePoints().size() % 2 == 1) ret = this.getLinePoints().elementAt(this.getLinePoints().size() / 2); else { Point p1 = this.getLinePoints().elementAt(this.getLinePoints().size() / 2); Point p2 = this.getLinePoints().elementAt(this.getLinePoints().size() / 2 - 1); ret.x = (p1.x + p2.x) / 2; ret.y = (p1.y + p2.y) / 2; } return ret; } @Override public String getAdditionalAttributes() { Vector tmp = new Vector(); // tmp.add(beginQualifier); // tmp.add(endQualifier); // tmp.add(beginArrow); // tmp.add(endArrow); // tmp.add(beginMultiplicity); // tmp.add(endMultiplicity); // tmp.add(beginRole); // tmp.add(endRole); // tmp.add(lineType); /* * tmp.add(""+this.getX()); tmp.add(""+this.getY()); * tmp.add(""+this.getWidth()); tmp.add(""+this.getHeight()); */ for (int i = 0; i < this.getLinePoints().size(); i++) { Point p = this.getLinePoints().elementAt(i); String s1 = "" + p.x; String s2 = "" + p.y; tmp.add(s1); tmp.add(s2); } String ret = Utils.composeStrings(tmp, Constants.DELIMITER_ADDITIONAL_ATTRIBUTES); return ret; } @Override public void setAdditionalAttributes(String s) { Vector tmp = Utils.decomposeStringsIncludingEmptyStrings(s, Constants.DELIMITER_ADDITIONAL_ATTRIBUTES); // 9 attributes, 4 for start/end point, 4 for x,y,w,h /* * if (tmp.size()<17) throw new RuntimeException("Error in * Relation.setHiddenState(), state value = "+s); * beginQualifier=(String)tmp.elementAt(0); * endQualifier=(String)tmp.elementAt(1); * beginArrow=(String)tmp.elementAt(2); * endArrow=(String)tmp.elementAt(3); * beginMultiplicity=(String)tmp.elementAt(4); * endMultiplicity=(String)tmp.elementAt(5); * beginRole=(String)tmp.elementAt(6); endRole=(String)tmp.elementAt(7); * lineType=(String)tmp.elementAt(8); * int x=Integer.parseInt((String)tmp.elementAt(9)); int * y=Integer.parseInt((String)tmp.elementAt(10)); int * w=Integer.parseInt((String)tmp.elementAt(11)); int * h=Integer.parseInt((String)tmp.elementAt(12)); * this.setBounds(x,y,w,h); */ for (int i = 0; i < tmp.size(); i = i + 2) { int x = Integer.parseInt(tmp.elementAt(i)); int y = Integer.parseInt(tmp.elementAt(i + 1)); this.getLinePoints().add(new Point(x, y)); } } @Override public void setPanelAttributes(String state) { beginQualifier = ""; endQualifier = ""; beginArrow = ""; endArrow = ""; beginMultiplicity = ""; endMultiplicity = ""; beginRole = ""; endRole = ""; lineType = "-"; eerRelDir = ""; // G.Mueller.Start middleArrow = ""; beginPort = ""; endPort = ""; // G.Mueller. End this.setStrings(null); panelAttributes = state; Vector tmp = Utils.decomposeStrings(state); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.startsWith("q1=") & (s.length() > 3)) { beginQualifier = s.substring(3, s.length()); } else if (s.startsWith("q2=") & (s.length() > 3)) { endQualifier = s.substring(3, s.length()); } else if (s.startsWith("m1=") & (s.length() > 3)) { beginMultiplicity = s.substring(3, s.length()); } else if (s.startsWith("m2=") & (s.length() > 3)) { endMultiplicity = s.substring(3, s.length()); } else if (s.startsWith("r1=") & (s.length() > 3)) { beginRole = s.substring(3, s.length()); } else if (s.startsWith("r2=") & (s.length() > 3)) { endRole = s.substring(3, s.length()); } else if (s.startsWith("p1=") & (s.length() > 3)) { beginPort = s.substring(3, s.length()); } else if (s.startsWith("p2=") & (s.length() > 3)) { endPort = s.substring(3, s.length()); } else if (s.startsWith("lt=") & (s.length() > 3)) { csdStartText = ""; csdEndText = ""; // *** if (s.indexOf("<[") >= 0) { beginArrow = "compStart"; if (s.length() > 6) { csdStartText = getCSDText(s)[0]; s = s.replace("<[" + csdStartText + "]", "<[]"); } } if (s.indexOf("]>") >= 0) { endArrow = "compEnd"; if (s.length() > 6) { csdEndText = getCSDText(s)[1]; s = s.replace("[" + csdEndText + "]>", "[]>"); } } if (s.indexOf("]<") >= 0) { beginArrow = beginArrow + "del"; } if (s.indexOf(">[") >= 0) { endArrow = endArrow + "del"; } if (s.indexOf(">>>>>") >= 0) { endArrow = "<<<"; } else if (s.indexOf(">>>>") >= 0) { endArrow = "X"; } else if (s.indexOf(">>>") >= 0) { endArrow = "x"; } else if (s.indexOf(">>") >= 0) { endArrow = "<<"; } // else if (s.indexOf("m>") >= 0) { // endArrow = "crowsFoot"; // } else if (s.indexOf(">") >= 0) { if (endArrow.equals("")) endArrow = "<"; } if (s.indexOf("<<<<<") >= 0) { beginArrow = "<<<"; } else if (s.indexOf("<<<<") >= 0) { beginArrow = "X"; } else if (s.indexOf("<<<") >= 0) { beginArrow = "x"; } else if (s.indexOf("<<") >= 0) { beginArrow = "<<"; } // else if (s.indexOf("= 0) { // beginArrow = "crowsFoot"; // } else if (s.indexOf("<") >= 0) { if (beginArrow.equals("")) beginArrow = "<"; } if (s.indexOf("") >= 0) { beginArrow = ""; endArrow = ""; eerRelDir = "EER1"; } else if (s.indexOf("= 0) { beginArrow = ""; endArrow = ""; eerRelDir = "EER2"; } else if (s.indexOf("EER>") >= 0) { beginArrow = ""; endArrow = ""; eerRelDir = "EER3"; } else if (s.indexOf("EER") >= 0) { beginArrow = ""; endArrow = ""; eerRelDir = "EER_SUBCLASS"; } // A.Mueller Beginn clientServer = ""; // *** if (s.indexOf("(()") >= 0) { // beginArrow = ""; G.Mueller clientServer = "provideRequire"; } else if (s.indexOf("())") >= 0) { // endArrow = ""; G.Mueller clientServer = "requireProvide"; } if (s.indexOf("<(+)") >= 0) { beginArrow = "packageStart"; clientServer = " "; } else if (s.indexOf("<()") >= 0) { clientServer = "start"; // used for setting the startpoint // nonstickable beginArrow = "require"; } else if (s.indexOf("<(") >= 0) { clientServer = "start"; // used for setting the // startpoint // not stickable beginArrow = "provide"; } else if (s.indexOf("= 0) { beginArrow = "n"; } if (s.indexOf("(+)>") >= 0) { endArrow = "packageEnd"; clientServer = " "; } else if (s.indexOf("()>") >= 0) { clientServer = "end"; // used for setting the endpoint // nonstickable endArrow = "require"; } else if (s.indexOf(")>") >= 0) { clientServer = "end"; // used for setting the endpoint // nonstickable endArrow = "provide"; } else if (s.indexOf("x>") >= 0) { endArrow = "n"; } // A.Mueller End // Mueller G. End // Mueller G. Start if ((s.indexOf(">()") >= 0) && clientServer.equals("")) { middleArrow = "delegationArrowRight"; if (endArrow.equals("<")) endArrow = ""; } else if ((s.indexOf("()<") >= 0) && clientServer.equals("")) { middleArrow = "delegationArrowLeft"; if (beginArrow.equals("<")) beginArrow = ""; } else if ((s.indexOf("()") >= 0) && clientServer.equals("")) { middleArrow = "delegation"; } else if ((s.indexOf("(") >= 0) && clientServer.equals("")) { middleArrow = "delegationStart"; lineType = "-."; } else if ((s.indexOf(")") >= 0) && clientServer.equals("")) { middleArrow = "delegationEnd"; lineType = ".-"; } // G.Mueller: LineTyp check here: if ((s.indexOf(".") >= 0) & (s.indexOf("-") >= s.indexOf("."))) { lineType = ".-"; } else if ((s.indexOf("-") >= 0) & (s.indexOf(".") >= s.indexOf("-"))) { lineType = "-."; } else if (s.indexOf(".") >= 0) { lineType = "."; } else if (s.indexOf("-") >= 0) { lineType = "-"; } else if(s.substring(3, s.length()).indexOf("=") >= 0) { lineType = "="; } else if(s.indexOf("::") >= 0) { lineType = "::"; } else if(s.indexOf(":") >= 0) { lineType = ":"; } } else { this.getStrings().add(s); } } } // Created objects have no sideeffects // Only exception: no point is outside shape // At least 2 points must be provided public static Vector getIntersectingLineSegment(Area r, Vector points) { Vector ret = new Vector(); // If no segment found, take last two points Point pp_end = points.elementAt(points.size() - 1); Point pp_start = points.elementAt(points.size() - 2); for (int i = 1; i < points.size(); i++) { pp_end = points.elementAt(i); if (!r.contains(pp_end)) { // End point of intersecting line found pp_start = points.elementAt(i - 1); ret.add(pp_start); ret.add(pp_end); return ret; } } ret.add(pp_start); ret.add(pp_end); return ret; } public static Point moveNextTo(Area rFixed, Rectangle rMovable, Point pStart, Point pEnd) { // These ints can simply be added to line int centerDiffX = (int) -rMovable.getWidth() / 2; int centerDiffY = (int) -rMovable.getHeight() / 2; int vectorX = pEnd.x - pStart.x; int vectorY = pEnd.y - pStart.y; int startx = pStart.x; int starty = pStart.y; int endx = pEnd.x; int endy = pEnd.y; for (int i = 0;; i++) { endx += vectorX; endy += vectorY; rMovable.setLocation(endx + centerDiffX, endy + centerDiffY); if (!rFixed.intersects(rMovable)) break; } int newx = 0; int newy = 0; for (int i = 0; i < 10; i++) { newx = (endx + startx) / 2; newy = (endy + starty) / 2; rMovable.setLocation(newx + centerDiffX, newy + centerDiffY); if (rFixed.intersects(rMovable)) { startx = newx; starty = newy; } else { endx = newx; endy = newy; } } Point ret = new Point(newx + centerDiffX, newy + centerDiffY); return ret; } public boolean lineUp(Vector shapes, Vector points, int hotspotx, int hotspoty) { float zoom = getHandler().getZoomFactor(); // Remove point with the same coordinates for (int i = points.size() - 1; i > 0; i--) { Point p1 = points.elementAt(i); Point p2 = points.elementAt(i - 1); if ((p1.x == p2.x) & (p1.y == p2.y)) points.removeElementAt(i); } if (points.size() <= 1) return false; if (shapes.size() <= 1) return true; // Vector ret=new Vector(); // Rectangle rFixed; Rectangle rMovable; Area tmpArea = new Area(); for (int i = 0; i < shapes.size() - 1; i++) { Rectangle r = shapes.elementAt(i); if (i == 0) { // The hotspot of the first element is set Point p = points.elementAt(0); r.setLocation(p.x - hotspotx, p.y - hotspoty); } Area a = new Area(r); tmpArea.add(a); // rFixed=(Rectangle)shapes.elementAt(i); rMovable = shapes.elementAt(i + 1); /* * if (i==0) { // The hotspot of the first element is set Point * p=(Point)points.elementAt(0); * rFixed.setLocation(p.x-hotspotx,p.y-hotspoty); } */ Vector tmp = getIntersectingLineSegment(tmpArea, points); Point startIntersectingLine = tmp.elementAt(0); Point endIntersectingLine = tmp.elementAt(1); Point res = moveNextTo(tmpArea, rMovable, startIntersectingLine, endIntersectingLine); // ret.add(res); if (rMovable instanceof Arrow) { Arrow arrow = (Arrow) rMovable; Point diffA = new Point(-startIntersectingLine.x + endIntersectingLine.x, -startIntersectingLine.y + endIntersectingLine.y); Point diffB1 = new Point(diffA.y, -diffA.x); Point diffB2 = new Point(-diffB1.x, -diffB1.y); Point a1 = new Point(2 * diffA.x + diffB1.x, 2 * diffA.y + diffB1.y); Point a2 = new Point(2 * diffA.x + diffB2.x, 2 * diffA.y + diffB2.y); a1 = Utils.normalize(a1, (int) this.getHandler().getFontHandler().getFontSize()); a2 = Utils.normalize(a2, (int) this.getHandler().getFontHandler().getFontSize()); arrow.setArrowEndA(a1); arrow.setArrowEndB(a2); // A.Mueller start if (arrow.getString().equals("n")) { // this is pretty much the same as above, but it // was hard to work out what it does so here it // is repeated with better names and some // comments. I only made the original vector longer and // increased the pixelsize(fontsize) // to get the point further towards the center. Point start = startIntersectingLine; Point end = endIntersectingLine; // vectorA is the vector between the two points which is the // line between the points... Point vectorA = new Point(-start.x + end.x, -start.y + end.y); // vector down is a vector standing 90 degrees on the line, // vector up is the same in the opposite direction.. Point vectorDown = new Point(vectorA.y, -vectorA.x); Point vectorUp = new Point(-vectorDown.x, -vectorDown.y); Point newA1 = new Point(4 * vectorA.x + vectorDown.x, 4 * vectorA.y + vectorDown.y); Point newA2 = new Point(4 * vectorA.x + vectorUp.x, 4 * vectorA.y + diffB2.y); // this calculates the proportion of the two dimensions of // the point compared to each other // (which means propX + propY = 1) and multiplies it with // the second parameter... newA1 = Utils.normalize(newA1, (int) this.getHandler().getFontHandler().getFontSize() * 2); newA2 = Utils.normalize(newA2, (int) this.getHandler().getFontHandler().getFontSize() * 2); arrow.setCrossEndA(newA1); arrow.setCrossEndB(newA2); } else if (arrow.getString().equals("require")) { int size = (int) (20 * zoom); Point start = startIntersectingLine; Point end = endIntersectingLine; Point upperLeft = new Point(); Point bottomDown = new Point(); if (start.getX() > end.getX()) { upperLeft = new Point(0, -size / 2); bottomDown = new Point(size, size / 2); } else if (start.getX() < end.getX()) { upperLeft = new Point(-size, -size / 2); bottomDown = new Point(0, size / 2); } else if (start.getX() == end.getX()) { if (start.getY() < end.getY()) { upperLeft = new Point(-size / 2, -size); bottomDown = new Point(size / 2, 0); } else if (start.getY() > end.getY()) { upperLeft = new Point(-size / 2, 0); bottomDown = new Point(size / 2, size); } } arrow.setCrossEndA(upperLeft); arrow.setCrossEndB(bottomDown); } else if (arrow.getString().equals("provide")) { int size = (int) (30 * zoom); Point start = startIntersectingLine; Point end = endIntersectingLine; Point upperLeft = new Point(); Point bottomDown = new Point(); if (start.getX() > end.getX()) { upperLeft = new Point(0, -size / 2); bottomDown = new Point(size, size / 2); arrow.setArcStart(90); arrow.setArcEnd(180); } else if (start.getX() < end.getX()) { upperLeft = new Point(-size, -size / 2); bottomDown = new Point(0, size / 2); arrow.setArcStart(90); arrow.setArcEnd(-180); } else if (start.getX() == end.getX()) { if (start.getY() < end.getY()) { upperLeft = new Point(-size / 2, -size); bottomDown = new Point(size / 2, 0); arrow.setArcStart(0); arrow.setArcEnd(-180); } else if (start.getY() > end.getY()) { upperLeft = new Point(-size / 2, 0); bottomDown = new Point(size / 2, size); arrow.setArcStart(0); arrow.setArcEnd(180); } } arrow.setCrossEndA(upperLeft); arrow.setCrossEndB(bottomDown); // A.Mueller end } } // ATTENTION: this Recangle will become the rFixed in the next loop rMovable.setLocation(res); } return true; } /** * A relation is only in range (= in the selection frame) if every relation point is in the selection frame */ @Override public boolean isInRange(Point upperLeft, Dimension size) { Rectangle2D rect1 = new Rectangle2D.Double(upperLeft.getX(), upperLeft.getY(), size.getWidth(), size.getHeight()); // Assume that the rect contains all relation points for (Point p : getLinePoints()) { // We must add the displacement from the top left corner of the drawpanel to the point coordinates Point realPoint = new Point((int) (p.getX() + this.getX()), (int) (p.getY() + this.getY())); // If only one point is not in the selection rectangle, the method returns false if (!rect1.contains(realPoint)) return false; } return true; } public boolean isOnLine(int i) { if ((i - 1 >= 0) & (i + 1 < getLinePoints().size())) { Point x1 = getLinePoints().elementAt(i - 1); Point x2 = getLinePoints().elementAt(i + 1); Point p = getLinePoints().elementAt(i); if (pyth(p, x1) + pyth(p, x2) < pyth(x1, x2) + 5) return true; } return false; } public int getWhereToInsert(Point p) { for (int i = 0; i < getLinePoints().size() - 1; i++) { Point x1 = getLinePoints().elementAt(i); Point x2 = getLinePoints().elementAt(i + 1); if (pyth(p, x1) + pyth(p, x2) < pyth(x1, x2) + 5) return i + 1; } return -1; } public int getLinePoint(Point p) { float zoom = getHandler().getZoomFactor(); for (int i = 0; i < getLinePoints().size(); i++) { Point x = getLinePoints().elementAt(i); if (pyth(p, x) < SELECTCIRCLESIZE * zoom) return i; } return -1; } private int pyth(Point x1, Point x2) { int a = x1.x - x2.x; int b = x1.y - x2.y; return (int) Math.sqrt(a * a + b * b); } private Vector flipVector(Vector v) { Vector ret = new Vector(); for (int i = v.size() - 1; i >= 0; i--) { ret.add(v.elementAt(i)); } return ret; } @Override public boolean contains(Point p) { float zoom = getHandler().getZoomFactor(); for (int i = 0; i < getLinePoints().size(); i++) { Point x = getLinePoints().elementAt(i); if (pyth(p, x) < SELECTCIRCLESIZE * zoom) return true; } for (int i = 0; i < getLinePoints().size() - 1; i++) { Point x1 = getLinePoints().elementAt(i); Point x2 = getLinePoints().elementAt(i + 1); if (pyth(p, x1) + pyth(p, x2) > pyth(x1, x2) + 5) continue; // system origin translated to x1 double p1x = x2.getX() - x1.getX(); double p1y = x2.getY() - x1.getY(); double p2x = p.getX() - x1.getX(); double p2y = p.getY() - x1.getY(); // constant - calculated constant by rotating line + calculation intersection point double c = (p1x * p2x + p1y * p2y) / (p1x * p1x + p1y * p1y); // intersection point double i1x = p1x * c; double i1y = p1y * c; // abstand double ax = i1x - p2x; double ay = i1y - p2y; double a = Math.sqrt(ax * ax + ay * ay); if (a < 5) return true; } return false; } @Override public boolean contains(int x, int y) { return contains(new Point(x, y)); } private Vector _points; public Vector getLinePoints() { if (_points == null) { _points = new Vector(); } return _points; } public void setLinePoints(Vector v) { _points = v; } @Override public GridElement CloneFromMe() { Relation c = new Relation(); c.setPanelAttributes(this.getPanelAttributes()); c.setAdditionalAttributes(this.getAdditionalAttributes()); c.setVisible(true); c.setBounds(this.getBounds()); c.setHandler(this.getHandler()); return c; } public Relation() { super(); } // Polygon to draw the move whole line rectangle + check if it contains the mouse public Polygon getWholeLinePolygon() { float zoom = getHandler().getZoomFactor(); Polygon p = new Polygon(); Point mid; int s = this.getLinePoints().size(); if ((s % 2 == 0) && (s > 0)) mid = this.getCenterOfLine(); else if (s > 2) { Point p1 = this.getLinePoints().elementAt(this.getLinePoints().size() / 2); Point p2 = this.getLinePoints().elementAt(this.getLinePoints().size() / 2 + 1); mid = new Point((p1.x + p2.x) / 2, (p1.y + p2.y) / 2); } else return null; int size = (int) (SELECTBOXSIZE * zoom); size = size / 2; p.addPoint(mid.x - size, mid.y - size); p.addPoint(mid.x + size, mid.y - size); p.addPoint(mid.x + size, mid.y + size); p.addPoint(mid.x - size, mid.y + size); return p; } // checks if the point is contained in the polygon above public boolean isWholeLine(int x, int y) { Polygon p = this.getWholeLinePolygon(); if (p == null) return false; if (p.contains(x, y)) return true; return false; } /* * (non-Javadoc) * @see main.element.base.Entity#paintEntity(java.awt.Graphics) */ /* * (non-Javadoc) * @see main.element.base.Entity#paintEntity(java.awt.Graphics) */ @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); // Just to set anti-aliasing, even if no text // operations occur // g2.setColor(Color.MAGENTA); // g2.drawLine(0,0,0,2); // g2.drawLine(0,0,2,0); // g2.drawLine(this.getWidth()-1-2,this.getHeight()-1, this.getWidth()-1,this.getHeight()-1); // g2.drawLine(this.getWidth()-1,this.getHeight()-1-2, this.getWidth()-1,this.getHeight()-1); // g2.setColor(activeColor); Vector startShapes = new Vector(); Vector endShapes = new Vector(); startShapes.add(new NoShape()); endShapes.add(new NoShape()); if ((beginQualifier != null) && (beginQualifier.length() > 0)) { TextLayout tl = new TextLayout(beginQualifier, this.getHandler().getFontHandler().getFont(), Constants.FRC); Qualifier q = new Qualifier(beginQualifier, 0, 0, (int) tl.getBounds().getWidth() + (int) this.getHandler().getFontHandler().getFontSize() * 2, (int) tl.getBounds().getHeight() + (int) this.getHandler().getFontHandler().getFontSize() / 2); startShapes.add(q); } if ((endQualifier != null) && (endQualifier.length() > 0)) { TextLayout tl = new TextLayout(endQualifier, this.getHandler().getFontHandler().getFont(), Constants.FRC); Qualifier q = new Qualifier(endQualifier, 0, 0, (int) tl.getBounds().getWidth() + (int) this.getHandler().getFontHandler().getFontSize() * 2, (int) tl.getBounds().getHeight() + (int) this.getHandler().getFontHandler().getFontSize() / 2); endShapes.add(q); } if ((beginArrow != null) && (beginArrow.length() > 0)) { Arrow a = new Arrow(beginArrow); startShapes.add(a); } if ((endArrow != null) && (endArrow.length() > 0)) { Arrow a = new Arrow(endArrow); endShapes.add(a); } if ((beginMultiplicity != null) && (beginMultiplicity.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); startShapes.add(e); TextLayout tl = new TextLayout(beginMultiplicity, this.getHandler().getFontHandler().getFont(), Constants.FRC); Multiplicity m = new Multiplicity(beginMultiplicity, 0, 0, (int) tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); startShapes.add(m); } if ((endMultiplicity != null) && (endMultiplicity.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); endShapes.add(e); TextLayout tl = new TextLayout(endMultiplicity, this.getHandler().getFontHandler().getFont(), Constants.FRC); Multiplicity m = new Multiplicity(endMultiplicity, 0, 0, (int) tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); endShapes.add(m); } if ((beginRole != null) && (beginRole.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); startShapes.add(e); // A.Mueller start // calculating the width if we break lines... int position = 0; int lineBreaks = 0; double broadestText = this.getHandler().getFontHandler().getTextWidth(beginRole); while (position != 1) { int positionNew = beginRole.indexOf("\\\\", position); if ((position == 0) && (positionNew != -1)) broadestText = 0; if (positionNew != -1) { broadestText = Math.max(broadestText, this.getHandler().getFontHandler() .getTextWidth(beginRole.substring(position, positionNew))); if (beginRole.lastIndexOf("\\\\") + 2 != beginRole.length()) broadestText = Math.max(broadestText, this.getHandler().getFontHandler().getTextWidth(beginRole.substring(beginRole.lastIndexOf("\\\\") + 2, beginRole.length()))); lineBreaks++; } position = positionNew + 2; } Role r = new Role(beginRole, 0, 0, (int) broadestText, lineBreaks * (int) this.getHandler().getFontHandler().getFontSize() + (lineBreaks + 2) * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts()); // /* * TextLayout tl = new TextLayout(beginRole, this.getHandler().getFont(), * Constants.getFRC(g2)); Role r = new Role(beginRole, 0, 0, (int) * tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); */ // // A.Mueller end startShapes.add(r); } if ((endRole != null) && (endRole.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); endShapes.add(e); // A.Mueller start // calculating the width if we break lines... int position = 0; int lineBreaks = 0; double broadestText = this.getHandler().getFontHandler().getTextWidth(endRole); while (position != 1) { int positionNew = endRole.indexOf("\\\\", position); if ((position == 0) && (positionNew != -1)) broadestText = 0; if (positionNew != -1) { broadestText = Math.max(broadestText, this.getHandler().getFontHandler().getTextWidth(endRole.substring(position, positionNew))); if (endRole.lastIndexOf("\\\\") + 2 != endRole.length()) broadestText = Math.max(broadestText, this.getHandler().getFontHandler().getTextWidth(endRole.substring(endRole.lastIndexOf("\\\\") + 2, endRole.length()))); lineBreaks++; } position = positionNew + 2; } Role r = new Role(endRole, 0, 0, (int) broadestText, lineBreaks * (int) this.getHandler().getFontHandler().getFontSize() + (lineBreaks + 2) * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts()); // /* * TextLayout tl = new TextLayout(endRole, this.getHandler().getFont(), * Constants.getFRC(g2)); Role r = new Role(endRole, 0, 0, (int) * tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); */ // // A.Mueller end endShapes.add(r); } // G.Mueller start if ((beginPort != null) && (beginPort.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); startShapes.add(e); TextLayout tl = new TextLayout(beginPort, this.getHandler().getFontHandler().getFont(), Constants.FRC); Port p = new Port(beginPort, 0, 0, (int) tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); startShapes.add(p); } if ((endPort != null) && (endPort.length() > 0)) { EmptyShape e = new EmptyShape((int) this.getHandler().getFontHandler().getFontSize()); endShapes.add(e); TextLayout tl = new TextLayout(endPort, this.getHandler().getFontHandler().getFont(), Constants.FRC); Port p = new Port(endPort, 0, 0, (int) tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); endShapes.add(p); } // G.Mueller end // ****************************************************************** Vector startPoints = new Vector(this.getLinePoints()); Vector endPoints = flipVector(startPoints); boolean a = lineUp(startShapes, startPoints, 0, 0); boolean b = lineUp(endShapes, endPoints, 0, 0); if ((a == false) || (b == false)) { return; } // G.Mueller change begin if (lineType.equals("-.")) g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); else if (lineType.equals(".-")) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); else if (lineType.equals("-")) g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); else if (lineType.equals(".")) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); else if (lineType.equals("=")) g2.setStroke(Utils.getStroke(LineType.DOUBLE, 1)); else if (lineType.equals(":")) g2.setStroke(Utils.getStroke(LineType.DOUBLE_DASHED, 1)); else if (lineType.equals("::")) g2.setStroke(Utils.getStroke(LineType.DOUBLE_DOTTED, 1)); for (int i = 0; i < getLinePoints().size() - 1; i++) { if (i == Math.floor((getLinePoints().size() - 1) / 2)) { Point p1 = getLinePoints().elementAt(i); Point p2 = getLinePoints().elementAt(i + 1); // G.Mueller start Point pm = new Point(p1.x - (p1.x - p2.x) / 2, p1.y - (p1.y - p2.y) / 2); g2.drawLine(p1.x, p1.y, pm.x, pm.y); if (lineType.equals("-.")) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); if (lineType.equals(".-")) g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.drawLine(pm.x, pm.y, p2.x, p2.y); // g2.drawLine(p1.x, p1.y, p2.x, p2.y); // G. Mueller end // ########################################################################################## // ########################################################################################## if (eerRelDir.indexOf("EER_SUBCLASS") >= 0) { Point px1 = getLinePoints().elementAt(i); Point px2 = getLinePoints().elementAt(i + 1); Point mitte = new Point(px1.x - (px1.x - px2.x) / 2, px1.y - (px1.y - px2.y) / 2); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = mitte.x; int cy = mitte.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 2)); g2.drawArc(mitte.x, mitte.y - (int) (10 * zoom), (int) (20 * zoom), (int) (20 * zoom), 90, 180); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.setTransform(at); } else if (eerRelDir.indexOf("EER") >= 0) { Point px1 = getLinePoints().elementAt(i); Point px2 = getLinePoints().elementAt(i + 1); Point mitte = new Point(px1.x - (px1.x - px2.x) / 2, px1.y - (px1.y - px2.y) / 2); int recSize = (int) (20 * zoom); Point r1 = new Point(mitte.x, mitte.y - recSize); Point r2 = new Point(mitte.x + recSize, mitte.y); Point r3 = new Point(mitte.x, mitte.y + recSize); Point r4 = new Point(mitte.x - recSize, mitte.y); Polygon po1 = new Polygon(); po1.addPoint(r1.x, r1.y); po1.addPoint(r2.x, r2.y); po1.addPoint(r3.x, r3.y); Polygon po2 = new Polygon(); po2.addPoint(r1.x, r1.y); po2.addPoint(r3.x, r3.y); po2.addPoint(r4.x, r4.y); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = mitte.x; int cy = mitte.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); if (eerRelDir.equals("EER1")) { g2.setColor(fgColor); g2.fillPolygon(po1); g2.fillPolygon(po2); } else if (eerRelDir.equals("EER2")) { g2.setColor(bgColor); g2.fillPolygon(po2); g2.setColor(fgColor); g2.fillPolygon(po1); } else if (eerRelDir.equals("EER3")) { g2.setColor(bgColor); g2.fillPolygon(po1); g2.setColor(fgColor); g2.fillPolygon(po2); } g2.setColor(fgColor); g2.draw(po1); g2.draw(po2); g2.setTransform(at); } // A.Mueller start else if ((clientServer != null) && (clientServer.indexOf("rovide") >= 0)) { Point px1 = getLinePoints().elementAt(i); Point px2 = getLinePoints().elementAt(i + 1); Point mitte = new Point(px1.x - (px1.x - px2.x) / 2, px1.y - (px1.y - px2.y) / 2); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = mitte.x; int cy = mitte.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); Point outerArc = new Point(mitte.x - (int) (15 * zoom), mitte.y - (int) (15 * zoom)); Point innerCircle = new Point(); g2.setColor(Color.white); g2.fillOval(outerArc.x, outerArc.y, (int) (30 * zoom), (int) (30 * zoom)); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); if (clientServer.equals("provideRequire")) { g2.drawArc(outerArc.x, outerArc.y, (int) (30 * zoom), (int) (30 * zoom), 90, 180); innerCircle = new Point(mitte.x - (int) (5 * zoom), mitte.y - (int) (10 * zoom)); } else if (clientServer.equals("requireProvide")) { g2.drawArc(outerArc.x, outerArc.y, (int) (30 * zoom), (int) (30 * zoom), 90, -180); innerCircle = new Point(mitte.x - (int) (15 * zoom), mitte.y - (int) (10 * zoom)); } g2.drawOval(innerCircle.x, innerCircle.y, (int) (20 * zoom), (int) (20 * zoom)); g2.setTransform(at); } // A.Mueller end // G.Mueller start else if (middleArrow.startsWith("delegation")) { Point px1 = getLinePoints().elementAt(i); Point px2 = getLinePoints().elementAt(i + 1); Point mitte = new Point(px1.x - (px1.x - px2.x) / 2, px1.y - (px1.y - px2.y) / 2); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = mitte.x; int cy = mitte.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); Point circle = new Point(mitte.x - (int) (15 * zoom), mitte.y - (int) (15 * zoom)); if (middleArrow.equals("delegation")) { g2.setColor(Color.white); g2.fillOval(circle.x + (int) (5 * zoom), circle.y + (int) (5 * zoom), (int) (20 * zoom), (int) (20 * zoom)); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.drawOval(circle.x + (int) (5 * zoom), circle.y + (int) (5 * zoom), (int) (20 * zoom), (int) (20 * zoom)); } if (middleArrow.startsWith("delegationArrow")) { g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); if (middleArrow.equals("delegationArrowRight")) { g2.drawLine(circle.x + (int) (5 * zoom), circle.y + (int) (15 * zoom), circle.x - (int) (5 * zoom), circle.y + (int) (9 * zoom)); g2.drawLine(circle.x + (int) (5 * zoom), circle.y + (int) (15 * zoom), circle.x - (int) (5 * zoom), circle.y + (int) (20 * zoom)); } if (middleArrow.equals("delegationArrowLeft")) { g2.drawLine(circle.x + (int) (25 * zoom), circle.y + (int) (15 * zoom), circle.x + (int) (35 * zoom), circle.y + (int) (9 * zoom)); g2.drawLine(circle.x + (int) (25 * zoom), circle.y + (int) (15 * zoom), circle.x + (int) (35 * zoom), circle.y + (int) (20 * zoom)); } g2.setColor(Color.white); g2.fillOval(circle.x + (int) (5 * zoom), circle.y + (int) (5 * zoom), (int) (20 * zoom), (int) (20 * zoom)); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.drawOval(circle.x + (int) (5 * zoom), circle.y + (int) (5 * zoom), (int) (20 * zoom), (int) (20 * zoom)); } if (middleArrow.equals("delegationStart")) { g2.setColor(Color.white); g2.fillArc(circle.x, circle.y, (int) (30 * zoom), (int) (30 * zoom), 90, 180); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.drawArc(circle.x, circle.y, (int) (30 * zoom), (int) (30 * zoom), 90, 180); } if (middleArrow.equals("delegationEnd")) { g2.setColor(Color.white); g2.fillArc(circle.x, circle.y, (int) (30 * zoom), (int) (30 * zoom), 90, -180); g2.setColor(fgColor); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); g2.drawArc(circle.x, circle.y, (int) (30 * zoom), (int) (30 * zoom), 90, -180); } g2.setTransform(at); } // G.Mueller end // ########################################################################################## // ########################################################################################## if (lineType.equals("-.")) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); if (lineType.equals(".-")) g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } else { Point p1 = getLinePoints().elementAt(i); Point p2 = getLinePoints().elementAt(i + 1); g2.drawLine(p1.x, p1.y, p2.x, p2.y); } } g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); if (isSelected && !this.isPartOfGroup()) { for (int i = 0; i < getLinePoints().size(); i++) { Point p = getLinePoints().elementAt(i); int start = (int) ((SELECTCIRCLESIZE / 15 * 10) * zoom); int width = (int) ((SELECTCIRCLESIZE / 15 * 20) * zoom); g2.drawOval(p.x - start, p.y - start, width, width); } // DRAW Moveall Rect Polygon poly = this.getWholeLinePolygon(); if (poly != null) g2.drawPolygon(poly); } Vector tmp = new Vector(startShapes); tmp.addAll(endShapes); for (int i = 0; i < tmp.size(); i++) { Rectangle r = tmp.elementAt(i); if (r instanceof Qualifier) { Qualifier q = (Qualifier) r; // begin B. Buckl g.setColor(bgColor); g.fillRect((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); g.setColor(fgColor); // end g.drawRect((int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); this.getHandler().getFontHandler().writeText(g2, q.getString(), (int) r.getX() + (int) this.getHandler().getFontHandler().getFontSize(), (int) r.getY() + (int) this.getHandler().getFontHandler().getFontSize(), false); } else if (r instanceof Arrow) { Arrow arrow = (Arrow) r; if (arrow.getString().equals("crowsFoot")) { g2.drawLine((int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndA().y, (int) arrow.getX() + arrow.getArrowEndA().x, (int) arrow.getY()); g2.drawLine((int) arrow.getX(), (int) arrow.getY() + arrow.getArrowEndB().y, (int) arrow.getX() + arrow.getArrowEndB().x, (int) arrow.getY()); // A.Mueller Start } else if (!arrow.getString().equals("n") && !arrow.getString().equals("require") && !arrow.getString().equals("provide") && !arrow.getString().startsWith("package") && !arrow.getString().startsWith("comp")) { // A.Mueller end g2.drawLine((int) arrow.getX(), (int) arrow.getY(), (int) arrow.getX() + arrow.getArrowEndA().x, (int) arrow.getY() + arrow.getArrowEndA().y); g2.drawLine((int) arrow.getX(), (int) arrow.getY(), (int) arrow.getX() + arrow.getArrowEndB().x, (int) arrow.getY() + arrow.getArrowEndB().y); // A.Mueller start } // A.Mueller end // System.out.println(arrow.getString()); if (arrow.getString().equals("<<<")) { // LME // filled arrow head int[] ax = new int[3]; int[] ay = new int[3]; ax[0] = (int) arrow.getX(); ax[1] = (int) arrow.getX() + arrow.getArrowEndA().x; ax[2] = (int) arrow.getX() + arrow.getArrowEndB().x; ay[0] = (int) arrow.getY(); ay[1] = (int) arrow.getY() + arrow.getArrowEndA().y; ay[2] = (int) arrow.getY() + arrow.getArrowEndB().y; Polygon myPg = new Polygon(ax, ay, 3); g2.fill(myPg); g2.draw(myPg); } else if (arrow.getString().equals("<<")) { // begin B. Buckl int[] ax = new int[3]; int[] ay = new int[3]; ax[0] = (int) arrow.getX(); ax[1] = (int) arrow.getX() + arrow.getArrowEndA().x; ax[2] = (int) arrow.getX() + arrow.getArrowEndB().x; ay[0] = (int) arrow.getY(); ay[1] = (int) arrow.getY() + arrow.getArrowEndA().y; ay[2] = (int) arrow.getY() + arrow.getArrowEndB().y; Polygon myPg = new Polygon(ax, ay, 3); g2.setColor(bgColor); g2.fill(myPg); g2.setColor(fgColor); g2.draw(myPg); // g2.drawLine((int)arrow.getX()+(int)arrow.getArrowEndA().x, // (int)arrow.getY()+(int)arrow.getArrowEndA().y, // (int)arrow.getX()+(int)arrow.getArrowEndB().x, // (int)arrow.getY()+(int)arrow.getArrowEndB().y); } // end B. Buckl else if (arrow.getString().equals("x")) { int[] ax = new int[4]; int[] ay = new int[4]; ax[0] = (int) arrow.getX(); ay[0] = (int) arrow.getY(); ax[1] = (int) arrow.getX() + arrow.getArrowEndA().x; ay[1] = (int) arrow.getY() + arrow.getArrowEndA().y; ax[3] = (int) arrow.getX() + arrow.getArrowEndB().x; ay[3] = (int) arrow.getY() + arrow.getArrowEndB().y; ax[2] = -(int) arrow.getX() + ax[1] + ax[3]; ay[2] = -(int) arrow.getY() + ay[1] + ay[3]; // begin B. Buckl Polygon myPg = new Polygon(ax, ay, 4); g2.setColor(bgColor); g2.fill(myPg); g2.setColor(fgColor); g2.draw(myPg); // end B. Buckl } else if (arrow.getString().equals("X")) { int[] ax = new int[4]; int[] ay = new int[4]; ax[0] = (int) arrow.getX(); ay[0] = (int) arrow.getY(); ax[1] = (int) arrow.getX() + arrow.getArrowEndA().x; ay[1] = (int) arrow.getY() + arrow.getArrowEndA().y; ax[3] = (int) arrow.getX() + arrow.getArrowEndB().x; ay[3] = (int) arrow.getY() + arrow.getArrowEndB().y; ax[2] = -(int) arrow.getX() + ax[1] + ax[3]; ay[2] = -(int) arrow.getY() + ay[1] + ay[3]; g2.fill(new Polygon(ax, ay, 4)); } // A.Mueller Begin else if (arrow.getString().equals("n")) { Point a1 = arrow.getCrossEndA(); Point a2 = arrow.getCrossEndB(); g2.drawLine((int) (arrow.getX() + arrow.getArrowEndA().x), (int) (arrow.getY() + arrow.getArrowEndA().y), (int) (arrow.getX() + a2.x), (int) (arrow.getY() + a2.y)); g2.drawLine((int) (arrow.getX() + arrow.getArrowEndB().x), (int) (arrow.getY() + arrow.getArrowEndB().y), (int) (arrow.getX() + a1.x), (int) (arrow.getY() + a1.y)); } else if (arrow.getString().equals("require")) { int width = arrow.getCrossEndB().x - arrow.getCrossEndA().x; int height = arrow.getCrossEndB().y - arrow.getCrossEndA().y; g2.drawOval((int) arrow.getX() + arrow.getCrossEndA().x, (int) arrow.getY() + arrow.getCrossEndA().y, width, height); } else if (arrow.getString().equals("provide")) { int width = arrow.getCrossEndB().x - arrow.getCrossEndA().x; int height = arrow.getCrossEndB().y - arrow.getCrossEndA().y; g2.drawArc((int) arrow.getX() + arrow.getCrossEndA().x, (int) arrow.getY() + arrow.getCrossEndA().y, width, height, arrow.getArcStart(), arrow.getArcEnd()); // A.Mueller End // G.Mueller Start } else if (arrow.getString().startsWith("package")) { Point px1; Point px2; if (arrow.getString().equals("packageStart")) { px1 = getStartPoint(); px2 = getLinePoints().elementAt(1); } else { px1 = getEndPoint(); px2 = getLinePoints().elementAt( getLinePoints().size() - 2); } AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = px1.x; int cy = px1.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); g2.setColor(bgColor); g2.fillOval(px1.x, px1.y - (int) (10 * zoom), (int) (20 * zoom), (int) (20 * zoom)); g2.setColor(fgColor); g2.drawOval(px1.x, px1.y - (int) (10 * zoom), (int) (20 * zoom), (int) (20 * zoom)); g2.drawLine(px1.x + (int) (10 * zoom), px1.y - (int) (5 * zoom), px1.x + (int) (10 * zoom), px1.y + (int) (5 * zoom)); g2.drawLine(px1.x + (int) (15 * zoom), px1.y, px1.x + (int) (5 * zoom), px1.y); g2.setTransform(at); // *** // Wirrer G. Start } else if (arrow.getString().startsWith("fill_poly")) { Point px1; Point px2; if (beginArrow.startsWith("fill_poly_start")) { px1 = getStartPoint(); px2 = getLinePoints().elementAt(1); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, px1.x, px1.y); g2.setTransform(at2); int[] x_cord = { px1.x, px1.x + (int) (13 * zoom), px1.x + (int) (13 * zoom) }; int[] y_cord = { px1.y, px1.y - (int) (7 * zoom), px1.y + (int) (7 * zoom) }; Polygon x = new Polygon(x_cord, y_cord, 3); g2.fillPolygon(x); g2.setTransform(at); } if (endArrow.startsWith("fill_poly_end")) { px1 = getEndPoint(); px2 = getLinePoints().elementAt(getLinePoints().size() - 2); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); double winkel = Utils.getAngle(px2.x, px2.y, px1.x, px1.y); at2.rotate(winkel, px1.x, px1.y); g2.setTransform(at2); int[] x_cord = { px1.x, px1.x - (int) (13 * zoom), px1.x - (int) (13 * zoom) }; int[] y_cord = { px1.y, px1.y - (int) (7 * zoom), px1.y + (int) (7 * zoom) }; Polygon x = new Polygon(x_cord, y_cord, 3); g2.fillPolygon(x); g2.setTransform(at); } // Wirrer G. End } else if (arrow.getString().startsWith("comp")) { Point px1; Point px2; int s; int boxSize = (int) (20 * zoom); // we use 5.9 and 6.9 instead of 6 and 7 to get bigger arrows if we zoom out but smaller if gridsize is 10 int arrowOneSize = (int) (5.9 * zoom); int arrowTwoSize = (int) (6.9 * zoom); int arrowTwoSeparator = (int) (2.4 * zoom); int arrowThreeSize = (int) (6 * zoom); int arrowThreeLength = (int) (12 * zoom); // if (beginCSDArrow.equals("compStart")) { if (beginArrow.startsWith("compStart")) { getHandler().getFontHandler().setFontSize(10); s = boxSize; if (!csdStartText.equals("")) s = this.getHandler().getFontHandler().getTextWidth(csdStartText); if (s < boxSize) s = boxSize; px1 = getStartPoint(); px2 = getLinePoints().elementAt(1); g2.setColor(bgColor); g2.fillRect(px1.x - s / 2, px1.y - s / 2, s, s); g2.setColor(fgColor); g2.drawRect(px1.x - s / 2, px1.y - s / 2, s, s); if (csdStartText.equals(">")) { int[] tmpX = { px1.x - arrowOneSize, px1.x + arrowOneSize, px1.x - arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdStartText.equals("<")) { int[] tmpX = { px1.x + arrowOneSize, px1.x - arrowOneSize, px1.x + arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdStartText.equals("v")) { int[] tmpX = { px1.x - arrowOneSize, px1.x, px1.x + arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y + arrowOneSize, px1.y - arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdStartText.equals("^")) { int[] tmpX = { px1.x - arrowOneSize, px1.x, px1.x + arrowOneSize }; int[] tmpY = { px1.y + arrowOneSize, px1.y - arrowOneSize, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdStartText.equals("=")) { g2.drawLine(px1.x - arrowTwoSize, px1.y - arrowTwoSeparator, px1.x + arrowTwoSize, px1.y - arrowTwoSeparator); g2.drawLine(px1.x + arrowTwoSize, px1.y - arrowTwoSeparator, px1.x + 1, px1.y - arrowTwoSize); g2.drawLine(px1.x - arrowTwoSize, px1.y + arrowTwoSeparator, px1.x + arrowTwoSize, px1.y + arrowTwoSeparator); g2.drawLine(px1.x - arrowTwoSize, px1.y + arrowTwoSeparator, px1.x - 1, px1.y + arrowTwoSize); } else { if (!csdStartText.equals("")) { this.getHandler().getFontHandler().writeText(g2, csdStartText, px1.x, px1.y + (int) (6 * zoom), true); } } if (beginArrow.equals("compStartdel")) { AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = px1.x; int cy = px1.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); g2.drawLine((int) (px1.x + s / 2 + 2 * zoom), px1.y, px1.x + s / 2 + arrowThreeLength, px1.y - arrowThreeSize); g2.drawLine((int) (px1.x + s / 2 + 2 * zoom), px1.y, px1.x + s / 2 + arrowThreeLength, px1.y + arrowThreeSize); g2.setTransform(at); } getHandler().getFontHandler().resetFontSize(); } // if (endCSDArrow.equals("compEnd")) { if (endArrow.startsWith("compEnd")) { getHandler().getFontHandler().setFontSize(10); s = boxSize; if (!csdEndText.equals("")) s = this.getHandler().getFontHandler().getTextWidth(csdEndText); if (s < boxSize) s = boxSize; px1 = getEndPoint(); px2 = getLinePoints().elementAt( getLinePoints().size() - 2); g2.setColor(bgColor); g2.fillRect(px1.x - s / 2, px1.y - s / 2, s, s); g2.setColor(fgColor); g2.drawRect(px1.x - s / 2, px1.y - s / 2, s, s); if (csdEndText.equals(">")) { int[] tmpX = { px1.x - arrowOneSize, px1.x + arrowOneSize, px1.x - arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdEndText.equals("<")) { int[] tmpX = { px1.x + arrowOneSize, px1.x - arrowOneSize, px1.x + arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdEndText.equals("v")) { int[] tmpX = { px1.x - arrowOneSize, px1.x, px1.x + arrowOneSize }; int[] tmpY = { px1.y - arrowOneSize, px1.y + arrowOneSize, px1.y - arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdEndText.equals("^")) { int[] tmpX = { px1.x - arrowOneSize, px1.x, px1.x + arrowOneSize }; int[] tmpY = { px1.y + arrowOneSize, px1.y - arrowOneSize, px1.y + arrowOneSize }; g2.fillPolygon(tmpX, tmpY, 3); } else if (csdEndText.equals("=")) { g2.drawLine(px1.x - arrowTwoSize, px1.y - arrowTwoSeparator, px1.x + arrowTwoSize, px1.y - arrowTwoSeparator); g2.drawLine(px1.x + arrowTwoSize, px1.y - arrowTwoSeparator, px1.x + 1, px1.y - arrowTwoSize); g2.drawLine(px1.x - arrowTwoSize, px1.y + arrowTwoSeparator, px1.x + arrowTwoSize, px1.y + arrowTwoSeparator); g2.drawLine(px1.x - arrowTwoSize, px1.y + arrowTwoSeparator, px1.x - 1, px1.y + arrowTwoSize); } else { if (!csdEndText.equals("")) { this.getHandler().getFontHandler().writeText(g2, csdEndText, px1.x, px1.y + (int) (6 * zoom), true); } } if (endArrow.equals("compEnddel")) { AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); int cx = px1.x; int cy = px1.y; double winkel = Utils.getAngle(px1.x, px1.y, px2.x, px2.y); at2.rotate(winkel, cx, cy); g2.setTransform(at2); g2.drawLine((int) (px1.x + s / 2 + 2 * zoom), px1.y, px1.x + s / 2 + arrowThreeLength, px1.y - arrowThreeSize); g2.drawLine((int) (px1.x + s / 2 + 2 * zoom), px1.y, px1.x + s / 2 + arrowThreeLength, px1.y + arrowThreeSize); g2.setTransform(at); } getHandler().getFontHandler().resetFontSize(); } } // G.Mueller End } else if (r instanceof Multiplicity) { Multiplicity m = (Multiplicity) r; // g.drawRect((int)r.getX(), (int)r.getY(), (int)r.getWidth(), // (int)r.getHeight()); this.getHandler().getFontHandler().writeText(g2, m.getString(), (int) r.getX(), (int) r.getY() + (int) this.getHandler().getFontHandler().getFontSize() + 2 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), false); // B. Buckl // added // +2*this.getHandler().getDistTextToText() } else if (r instanceof Role) { Role role = (Role) r; String str = role.getString(); int position = 0; int y = 4 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); while (position != -1) { position = str.indexOf("\\\\"); if (position != -1) { String s = str.substring(0, position); this.getHandler().getFontHandler().writeText(g2, s, (int) r.getX(), (int) r.getY() + y, false); y = y + (int) this.getHandler().getFontHandler().getFontSize(); str = str.substring(position + 2, str.length()); } else { this.getHandler().getFontHandler().writeText(g2, str, (int) r.getX(), (int) r.getY() + y, false); } } // /* * this.getHandler().write(g2, role.getString(), (int) r.getX(), (int) r * .getY() + this.getHandler().getFontHandler().getFontsize() + 2 * this.getHandler().getDistTextToText(), false); // B. Buckl // added // * +2*this.getHandler().getDistTextToText() */ // // A.Mueller end // G.Mueller Start } else if (r instanceof Port) { Port p = (Port) r; this.getHandler().getFontHandler().writeText(g2, p.getString(), (int) (r.getX()), (int) (r.getY()), false); } // G.Mueller end } if (this.getStrings() != null) { if (this.getStrings().size() > 0) { Point start = this.getCenterOfLine(); int yPos = start.y - (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); // B. Buckl // added // -this.getHandler().getDistTextToText() int xPos = start.x; for (int i = 0; i < getStrings().size(); i++) { String s = this.getStrings().elementAt(i); // A.Mueller Begin... if (s.startsWith(">") || s.endsWith(">") || s.startsWith("<") || s.endsWith("<")) { // starts or ends with an arrow, check if it is the only // one.. if (((s.indexOf(">") == s.lastIndexOf(">")) && (s.indexOf(">") != -1)) || ((s.indexOf("<") == s.lastIndexOf("<")) && (s.indexOf("<") != -1))) { // decide where and what to draw... int fontHeight = g2.getFontMetrics( this.getHandler().getFontHandler().getFont()).getHeight() - g2.getFontMetrics(this.getHandler().getFontHandler().getFont()).getDescent() - g2.getFontMetrics(this.getHandler().getFontHandler().getFont()).getLeading(); fontHeight = fontHeight / 3 * 2; if (s.endsWith(">")) { s = s.substring(0, s.length() - 1); int fontWidth = this.getHandler().getFontHandler().getTextWidth(s); xPos = xPos - (fontHeight + 4) / 2; int startDrawX = xPos + fontWidth / 2 + 4; Polygon temp = new Polygon(); temp.addPoint(startDrawX, yPos); temp.addPoint(startDrawX, yPos - fontHeight); temp.addPoint(startDrawX + fontHeight - 1, yPos - fontHeight / 2); g2.fillPolygon(temp); } else if (s.endsWith("<")) { s = s.substring(0, s.length() - 1); int fontWidth = this.getHandler().getFontHandler().getTextWidth(s); xPos = xPos - (fontHeight + 4) / 2; int startDrawX = xPos + fontWidth / 2 + 4; Polygon temp = new Polygon(); temp.addPoint(startDrawX + fontHeight - 1, yPos); temp.addPoint(startDrawX + fontHeight - 1, yPos - fontHeight); temp.addPoint(startDrawX, yPos - fontHeight / 2); g2.fillPolygon(temp); } else if (s.startsWith(">")) { s = s.substring(1, s.length()); int fontWidth = this.getHandler().getFontHandler().getTextWidth(s); xPos = xPos + (fontHeight + 4) / 2; int startDrawX = xPos - fontWidth / 2 - 4; Polygon temp = new Polygon(); temp.addPoint(startDrawX - fontHeight + 1, yPos); temp.addPoint(startDrawX - fontHeight + 1, yPos - fontHeight); temp.addPoint(startDrawX, yPos - fontHeight / 2); g2.fillPolygon(temp); } else if (s.startsWith("<")) { s = s.substring(1, s.length()); int fontWidth = this.getHandler().getFontHandler().getTextWidth(s); xPos = xPos + (fontHeight + 4) / 2; int startDrawX = xPos - fontWidth / 2 - 4; Polygon temp = new Polygon(); temp.addPoint(startDrawX, yPos); temp.addPoint(startDrawX, yPos - fontHeight); temp.addPoint(startDrawX - fontHeight + 1, yPos - fontHeight / 2); g2.fillPolygon(temp); } } } // A.Mueller end... this.getHandler().getFontHandler().writeText(g2, s, xPos, yPos, true); yPos += (int) this.getHandler().getFontHandler().getFontSize(); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } } // The criticalPoints must be calculated to expand the relations size by the associated relation-text Vector criticalPoints = new Vector(); for (int i = 1; i < startShapes.size(); i++) { Rectangle r = startShapes.elementAt(i); Point p1 = new Point((int) r.getX() - (int) (2 * zoom), (int) r.getY() - (int) (2 * zoom)); Point p2 = new Point((int) r.getX() + (int) r.getWidth() + (int) (2 * zoom), (int) r.getY() + (int) r.getHeight() + (int) (2 * zoom)); criticalPoints.add(p1); criticalPoints.add(p2); } for (int i = 1; i < endShapes.size(); i++) { Rectangle r = endShapes.elementAt(i); Point p1 = new Point((int) r.getX() - (int) (2 * zoom), (int) r.getY() - (int) (2 * zoom)); Point p2 = new Point((int) r.getX() + (int) r.getWidth() + (int) (2 * zoom), (int) r.getY() + (int) r.getHeight() + (int) (2 * zoom)); criticalPoints.add(p1); criticalPoints.add(p2); } if (this.getStrings() != null) { if (this.getStrings().size() > 0) { Point start = this.getCenterOfLine(); int yPos = start.y; int xPos = start.x; for (int i = 0; i < getStrings().size(); i++) { String s = this.getStrings().elementAt(i); int width = this.getHandler().getFontHandler().getTextWidth(s); criticalPoints.add(new Point(xPos - width / 2 - (int) (20 * zoom), yPos - (int) this.getHandler().getFontHandler().getFontSize() - (int) (20 * zoom))); criticalPoints.add(new Point(xPos + width / 2 + (int) (20 * zoom), yPos + (int) (20 * zoom))); yPos += (int) this.getHandler().getFontHandler().getFontSize(); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } } /** * Change Size of relation to fit the relations size * Must be made to resize the relation automatically during draging an endpoint */ // (minx,miny) is the upper left end and (maxx,maxy) is the lower right end of the relation int minx = Integer.MAX_VALUE; int miny = Integer.MAX_VALUE; int maxx = Integer.MIN_VALUE; int maxy = Integer.MIN_VALUE; for (int i = 0; i < getLinePoints().size(); i++) { Point p = getLinePoints().elementAt(i); minx = Math.min(minx, p.x); miny = Math.min(miny, p.y); maxx = Math.max(maxx, p.x); maxy = Math.max(maxy, p.y); // Subtract or add the SELECTCIRCLESIZE to avoid cutting the circles at the end of the relation minx = (int) Math.min(minx, p.x - SELECTCIRCLESIZE * zoom); miny = (int) Math.min(miny, p.y - SELECTCIRCLESIZE * zoom); maxx = (int) Math.max(maxx, p.x + SELECTCIRCLESIZE * zoom); maxy = (int) Math.max(maxy, p.y + SELECTCIRCLESIZE * zoom); } for (int i = 0; i < criticalPoints.size(); i++) { Point p = criticalPoints.elementAt(i); minx = Math.min(minx, p.x); miny = Math.min(miny, p.y); maxx = Math.max(maxx, p.x); maxy = Math.max(maxy, p.y); } // BUGFIX ZOOM: We must consider the gridsize for the min and max value to avoid rounding errors // Therefore we subtract or add the difference to the next possible value int gridSize = this.getHandler().getGridSize(); minx -= (minx % gridSize); miny -= (miny % gridSize); // Subtract gridSize another time to avoid a too small selection area for the relation-selection circle minx -= gridSize; miny -= gridSize; maxx += (maxx % gridSize); maxy += (maxy % gridSize); if ((maxx != 0) || (maxy != 0)) { this.changeSize(maxx - getWidth(), maxy - getHeight()); } if ((minx != 0) | (miny != 0)) { this.changeLocation(minx, miny); this.changeSize(-minx, -miny); for (int i = 0; i < getLinePoints().size(); i++) { Point p = getLinePoints().elementAt(i); p.x += -minx; p.y += -miny; } } } private Point getStartPoint() { Point ret = this.getLinePoints().elementAt(0); return ret; } private Point getEndPoint() { Point ret = this.getLinePoints().elementAt( this.getLinePoints().size() - 1); return ret; } public Point getAbsoluteCoorStart() { Point ret = new Point(); ret.x = this.getX() + this.getStartPoint().x; ret.y = this.getY() + this.getStartPoint().y; return ret; } public Point getAbsoluteCoorEnd() { Point ret = new Point(); ret.x = this.getX() + this.getEndPoint().x; ret.y = this.getY() + this.getEndPoint().y; return ret; } // G.Mueller start public String[] getCSDText(String str) { // for the Composite Structure Diagram Text String tmp[] = new String[4]; int to = 0; int from = 0; tmp[0] = " "; tmp[1] = " "; tmp[2] = " "; tmp[3] = " "; if (str.length() > 3) { // if (str.indexOf("<[") >=3) tmp[2] = // str.substring(3,str.indexOf("<[")); // if (str.lastIndexOf("[") >=3 && str.lastIndexOf("[")-1 != // str.lastIndexOf("<[")) tmp[3] = str.substring(str.indexOf("[", // str.length())); from = str.indexOf("<[") + 2; if (from >= 2) to = str.indexOf("]"); if ((from >= 2) && (to >= 0) && (from < to)) tmp[0] = str.substring(from, to); from = str.indexOf("[", to) + 1; if (from >= 1) to = str.indexOf("]>", to); if ((from >= 1) && (to >= 0) && (from < to)) tmp[1] = str.substring(from, to); } return tmp; } // G.Mueller end public StickingPolygon generateStickingBorder() { // LME return null; } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { return null; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/Actor.java0000644000175000001440000001076611576116034022606 0ustar benuserspackage com.umlet.element; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Actor extends GridElement { public Actor() { super(); } private Vector getStringVector() { Vector ret = Utils.decomposeStrings(this.getPanelAttributes()); return ret; } @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); g2.setColor(fgColor); boolean ADAPT_SIZE = false; Vector tmp = getStringVector(); int yPos = 6 * (int) this.getHandler().getFontHandler().getFontSize(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.drawLine(this.getWidth() / 2 - (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos, this.getWidth() / 2 + (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); TextLayout l = new TextLayout(s, this.getHandler().getFontHandler().getFont(), Constants.FRC); Rectangle2D r2d = l.getBounds(); int width = (int) r2d.getWidth(); int xPos = this.getWidth() / 2 - width / 2; if (xPos < 0) { ADAPT_SIZE = true; break; } this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } if (ADAPT_SIZE) { (new Resize(this, -this.getHandler().getGridSize(), 0, 0, 0)).execute(this.getHandler()); (new Resize(this, 0, 0, this.getHandler().getGridSize(), 0)).execute(this.getHandler()); return; } if (yPos > this.getHeight()) { (new Resize(this, 0, 0, 0, 20)).execute(this.getHandler()); return; } int startx = this.getWidth() / 2; g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillOval(startx - (int) this.getHandler().getFontHandler().getFontSize() / 2, 0, (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize()); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawOval(startx - (int) this.getHandler().getFontHandler().getFontSize() / 2, 0, (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize()); g2.drawLine(startx, (int) this.getHandler().getFontHandler().getFontSize(), startx, (int) ((int) this.getHandler().getFontHandler().getFontSize() * 2.5)); g2.drawLine(startx - 2 * (int) this.getHandler().getFontHandler().getFontSize(), (int) ((int) this.getHandler().getFontHandler().getFontSize() * 1.3), startx + 2 * (int) this.getHandler().getFontHandler().getFontSize(), (int) ((int) this.getHandler().getFontHandler().getFontSize() * 1.3)); // Feet g2.drawLine(startx, (int) ((int) this.getHandler().getFontHandler().getFontSize() * 2.5), startx - (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize() * 5); g2.drawLine(startx, (int) ((int) this.getHandler().getFontHandler().getFontSize() * 2.5), startx + (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize() * 5); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { float zoom = getHandler().getZoomFactor(); int links = getHandler().realignToGrid(false, x + width / 2 - (int) (25 * zoom)); int rechts = getHandler().realignToGrid(false, x + width / 2 + (int) (35 * zoom)); int oben = getHandler().realignToGrid(false, y); int unten = getHandler().realignToGrid(false, y + (int) (75 * zoom)); StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(links, oben)); p.addPoint(new Point(rechts, oben)); p.addPoint(new Point(rechts, unten)); p.addPoint(new Point(links, unten), true); return p; } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/0000755000175000001440000000000011576116036022500 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/DoubleStroke.java0000644000175000001440000000134711576116034025750 0ustar benuserspackage com.umlet.element.relation; import java.awt.BasicStroke; import java.awt.Shape; import java.awt.Stroke; public class DoubleStroke implements Stroke { private Stroke outerStroke; private Stroke innerStroke; public DoubleStroke(int lineWidth, int distanceBetweenLines, int cap, int join, float miterlimit, float[] dash, float dash_phase) { this.outerStroke = new BasicStroke(lineWidth + distanceBetweenLines, cap, join, miterlimit, dash, dash_phase); this.innerStroke = new BasicStroke(lineWidth, cap, join, miterlimit, dash, dash_phase); } @Override public Shape createStrokedShape(Shape s) { Shape outline = outerStroke.createStrokedShape(s); return innerStroke.createStrokedShape(outline); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/Port.java0000644000175000001440000000047511576116034024273 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class Port extends Rectangle { String _string; public String getString() { return _string; } public Port(String s, int a, int b, int c, int d) { super(a, b, c, d); _string = s; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/Role.java0000644000175000001440000000044611576116034024246 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class Role extends Rectangle { String _string; public String getString() { return _string; } public Role(String s, int a, int b, int c, int d) { super(a, b, c, d); _string = s; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/EmptyShape.java0000644000175000001440000000032411576116034025417 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class EmptyShape extends Rectangle { public EmptyShape(int fontsize) { super(0, 0, fontsize, fontsize); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/Multiplicity.java0000644000175000001440000000046611576116034026037 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class Multiplicity extends Rectangle { String _string; public String getString() { return _string; } public Multiplicity(String s, int a, int b, int c, int d) { super(a, b, c, d); _string = s; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/Arrow.java0000644000175000001440000000247511576116034024443 0ustar benuserspackage com.umlet.element.relation; import java.awt.Point; import java.awt.Rectangle; @SuppressWarnings("serial") public class Arrow extends Rectangle { private Point _arrowEndA; private Point _arrowEndB; // A.Mueller start private Point _crossEndA; private Point _crossEndB; private int _arcStart; private int _arcEnd; // A.Mueller end public Point getArrowEndA() { return _arrowEndA; } public Point getArrowEndB() { return _arrowEndB; } public void setArrowEndA(Point p) { _arrowEndA = p; } public void setArrowEndB(Point p) { _arrowEndB = p; } // A.Mueller start public void setCrossEndA(Point p) { _crossEndA = p; } public void setCrossEndB(Point p) { _crossEndB = p; } public int getArcStart() { return _arcStart; } public int getArcEnd() { return _arcEnd; } public void setArcStart(int a) { _arcStart = a; } public void setArcEnd(int a) { _arcEnd = a; } public Point getCrossEndA() { return _crossEndA; } public Point getCrossEndB() { return _crossEndB; } // A.Mueller end private String _arrowType = null; public String getString() { return _arrowType; } public Arrow(String arrowType) { super(0, 0, 1, 1); _arrowType = arrowType; } @Override public String toString() { return "Type: " + _arrowType + " / Coordinates: " + x + "," + y; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/NoShape.java0000644000175000001440000000026411576116034024700 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class NoShape extends Rectangle { public NoShape() { super(0, 0, 1, 1); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/Qualifier.java0000644000175000001440000000046011576116034025262 0ustar benuserspackage com.umlet.element.relation; import java.awt.Rectangle; @SuppressWarnings("serial") public class Qualifier extends Rectangle { String _string; public String getString() { return _string; } public Qualifier(String s, int a, int b, int c, int d) { super(a, b, c, d); _string = s; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/relation/RelationLinePoint.java0000644000175000001440000000102711576116034026740 0ustar benuserspackage com.umlet.element.relation; import com.umlet.element.Relation; public class RelationLinePoint { private Relation _relation; private int _linePointId; private int stickingLineId; public Relation getRelation() { return _relation; } public int getLinePointId() { return _linePointId; } public int getStickingLineId() { return this.stickingLineId; } public RelationLinePoint(Relation r, int lp, int stick) { _relation = r; _linePointId = lp; this.stickingLineId = stick; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/Package.java0000644000175000001440000001777411576116034023077 0ustar benuserspackage com.umlet.element; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Area; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Package extends GridElement { Area lastKnown = new Area(); public Package() { super(); } private Vector getStringVector() { Vector ret = Utils.decomposeStrings(this.getPanelAttributes()); return ret; } @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Vector tmp = new Vector(getStringVector()); // in order to make the addition of "--" possible if (tmp.size() == 0) tmp.add(" "); if (!tmp.contains("--")) tmp.add("--"); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); boolean borders = false; // G. Mueller start boolean normal = false; // int maxUpperBox=5*this.getHandler().getFontHandler().getFontsize(); int maxUpperBox = (int) (this.getWidth() * 0.4); // I think this looks better int lines = 0; int yPosBorder = yPos; // LME: coloring (some code doubled) for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (tmp.elementAt(0).equals("--") && (borders == false)) yPosBorder = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); // if there is no Packagename if (s.equals("--") && (borders == false)) { g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, maxUpperBox, yPosBorder); g2.fillRect(0, yPosBorder, this.getWidth() - 1, this.getHeight() - yPosBorder - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, maxUpperBox, yPosBorder); g2.drawRect(0, yPosBorder, this.getWidth() - 1, this.getHeight() - yPosBorder - 1); // yPos to write the String centered yPosBorder = (int) this.getHandler().getFontHandler().getFontSize() / 2 + yPosBorder / 2 + this.getHeight() / 2 - (tmp.size() - lines) * ((int) (this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; } else if (!normal && (i > 1) && (tmp.elementAt(i - 1).equals("--") && tmp.elementAt(i).startsWith("left:"))) { yPosBorder = (lines + 1) * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2 + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); } else if (!borders) { maxUpperBox = Math.max(maxUpperBox, this.getHandler().getFontHandler().getTextWidth(s) + (int) this.getHandler().getFontHandler().getFontSize()); yPosBorder += (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); } else if (normal) { yPosBorder += (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); } else if (!normal) { yPosBorder += (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); } } for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (tmp.elementAt(0).equals("--") && (borders == false)) yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); // if there is no Packagename if (s.equals("--") && (borders == false)) { borders = true; // g2.drawRect(0,0,maxUpperBox,yPos); // g2.drawRect(0,yPos,this.getWidth()-1,this.getHeight()-yPos-1); // yPos to write the String centered yPos = (int) this.getHandler().getFontHandler().getFontSize() / 2 + yPos / 2 + this.getHeight() / 2 - (tmp.size() - lines) * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; } else if (!normal && (i > 1) && (tmp.elementAt(i - 1).equals("--") && tmp.elementAt(i).startsWith("left:"))) { // writes the string normal yPos = (lines + 1) * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s.substring(5), (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); normal = true; } else if (!borders) { lines++; maxUpperBox = Math.max(maxUpperBox, this.getHandler().getFontHandler().getTextWidth(s) + (int) this.getHandler().getFontHandler().getFontSize()); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else if (normal) { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else if (!normal) { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // G. Mueller End } /* * Rectangle r=this.getBounds(); * g.drawRect(0,0,(int)r.getWidth()-1,(int)r.getHeight()-1); * if (_selected) { * g.drawRect(1,1,(int)r.getWidth()-3,(int)r.getHeight()-3); * } */ } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); Vector tmp = new Vector(getStringVector()); if (tmp.size() == 0) tmp.add(" "); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); boolean borders = false; // int maxUpperBox=5*this.getHandler().getFontHandler().getFontsize(); int maxUpperBox = (int) (width * 0.4); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); // G. Mueller start if (tmp.elementAt(0).equals("--") && (borders == false)) yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); // if there is no Packagename // G.Mueller End if (s.equals("--") && (borders == false)) borders = true; else if (!borders) { maxUpperBox = Math.max(maxUpperBox, this.getHandler().getFontHandler().getTextWidth(s) + (int) this.getHandler().getFontHandler().getFontSize()); yPos += (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); } } p.addPoint(new Point(x, y)); p.addPoint(new Point(x + maxUpperBox, y)); p.addPoint(new Point(x + maxUpperBox, y + yPos)); p.addPoint(new Point(x + width, y + yPos)); p.addPoint(new Point(x + width, y + height)); p.addPoint(new Point(x, y + height), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/UseCase.java0000644000175000001440000000575311576116034023066 0ustar benuserspackage com.umlet.element; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.util.Vector; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class UseCase extends GridElement { public UseCase() { super(); } private Vector getStringVector() { Vector ret = Utils.decomposeStrings(this.getPanelAttributes()); return ret; } @Override public void paintEntity(Graphics g) { int a = Math.max(1, (getWidth() - 1) / 2); int b = (getHeight() - 1) / 2; boolean found = false; int x = ((getWidth() - 1) / 9 * 4); int y = (int) Math.round((Math.sqrt(((a * a * b * b) - (b * b * x * x)) / (a * a)))); int yPos = 0; int yPos1 = b; Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(bgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillOval(0, 0, 2 * a, 2 * b); g2.setComposite(composites[0]); if (isSelected()) g2.setColor(fgColor); else g2.setColor(fgColorBase); Vector tmp = new Vector(getStringVector()); if (tmp.contains("lt=.")) { tmp.remove("lt=."); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); } g2.drawOval(0, 0, 2 * a, 2 * b); if (tmp.contains("--")) { yPos = ((b - y) / 2); g2.drawLine(a - x, b - y, a + x, b - y); found = true; } else { yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; } for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if ((s.equals("--")) && found) { yPos = yPos1; } else if (found) { this.getHandler().getFontHandler().writeText(g2, s, a, yPos + 5, true); yPos += 5 * this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); //First point is the top left then the points are added clockwise p.addPoint(new Point(x + width / 4, y)); p.addPoint(new Point(x + width * 3 / 4, y)); p.addPoint(new Point(x + width, y + height / 4)); p.addPoint(new Point(x + width, y + height * 3 / 4)); p.addPoint(new Point(x + width * 3 / 4, y + height)); p.addPoint(new Point(x + width / 4, y + height)); p.addPoint(new Point(x, y + height * 3 / 4)); p.addPoint(new Point(x, y + height / 4), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/0000755000175000001440000000000011576116036022175 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/EER_Rel_Diamond.java0000644000175000001440000000556611576116034025722 0ustar benuserspackage com.umlet.element.custom; // Some import to have access to more Java features import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class EER_Rel_Diamond extends com.baselet.element.GridElement { // Change this method if you want to edit the graphical // representation of your custom element. @Override public void paintEntity(Graphics g) { // Some unimportant initialization stuff; setting color, font // quality, etc. You should not have to change this. Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); // Finally, change other graphical attributes using // drawLine, getWidth, getHeight.. // Define the elements outline using a polygon, rectangle, oval, etc. Polygon poly = new Polygon(); poly.addPoint(this.getWidth() / 2, 0); poly.addPoint(this.getWidth() - 1, this.getHeight() / 2); poly.addPoint(this.getWidth() / 2, this.getHeight() - 1); poly.addPoint(0, this.getHeight() / 2); g2.setComposite(composites[1]); // set aplha composite for drawing the background color g2.setColor(bgColor); g2.fillPolygon(poly); // fill the background g2.setComposite(composites[0]); // reset composite settings if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); // It's getting interesting here: // First, the strings you type in the element editor are read and // split into lines. Then, by default, they are printed out on the // element, aligned to the left. Change this to modify this default // text printing and to react to special strings (like the "--" string // in the UML class elements which draw a line). Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = this.getHeight() / 2 - (((int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize()) * tmp.size()) / 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // Draw the elements outline g2.drawPolygon(poly); } // Change this method if you want to set the resize-attributes of // your custom element @Override public int getPossibleResizeDirections() { // Remove from this list the borders you don't want to be resizeable. return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Artefact.java0000644000175000001440000000446111576116034024574 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class Artefact extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); // symbol outline g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) (10 * zoom); int startY = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), startY + yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // small component symbol g2.drawLine(this.getWidth() - (int) (30 * zoom), (int) (10 * zoom), this.getWidth() - (int) (30 * zoom), (int) (40 * zoom)); g2.drawLine(this.getWidth() - (int) (30 * zoom), (int) (40 * zoom), this.getWidth() - (int) (5 * zoom), (int) (40 * zoom)); g2.drawLine(this.getWidth() - (int) (5 * zoom), (int) (40 * zoom), this.getWidth() - (int) (5 * zoom), (int) (20 * zoom)); g2.drawLine(this.getWidth() - (int) (5 * zoom), (int) (20 * zoom), this.getWidth() - (int) (15 * zoom), (int) (10 * zoom)); g2.drawLine(this.getWidth() - (int) (15 * zoom), (int) (10 * zoom), this.getWidth() - (int) (30 * zoom), (int) (10 * zoom)); g2.drawLine(this.getWidth() - (int) (5 * zoom), (int) (20 * zoom), this.getWidth() - (int) (15 * zoom), (int) (20 * zoom)); g2.drawLine(this.getWidth() - (int) (15 * zoom), (int) (20 * zoom), this.getWidth() - (int) (15 * zoom), (int) (10 * zoom)); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/InitialState.java0000644000175000001440000000112011576116034025422 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class InitialState extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); g2.fillOval(0, 0, this.getWidth(), this.getHeight()); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Signal.java0000644000175000001440000000700511576116034024255 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class Signal extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(Color.red); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = 0; yPos = this.getHeight() / 2 - (tmp.size() - 1) * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; int signalType = 0; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals(">")) signalType = 1; // send signal else if (s.equals("<")) signalType = 2; // accept signal else if (s.equals("x")) signalType = 3; // time signal else { // draw string yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } if (signalType == 1) { // send signal g2.drawLine(0, 0, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0, this.getWidth() - 1, this.getHeight() / 2); g2.drawLine(this.getWidth(), this.getHeight() / 2, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), this.getHeight()); g2.drawLine(0, this.getHeight() - 1, 0, 0); } else if (signalType == 2) { // accept signal g2.drawLine(0, 0, this.getWidth(), 0); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(0, 0, (int) this.getHandler().getFontHandler().getFontSize() - 2, this.getHeight() / 2); g2.drawLine((int) this.getHandler().getFontHandler().getFontSize() - 2, this.getHeight() / 2, 0, this.getHeight()); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, this.getWidth() - 1, 0); } else if (signalType == 3) { // time signal g2.drawLine(0, 0, this.getWidth(), 0); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.drawLine(this.getWidth() - 1, 0, 0, this.getHeight() - 1); } else { // NO signal specified g2.drawLine(0, 0, this.getWidth(), 0); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(this.getWidth() - 1, 0, this.getWidth() - 1, this.getHeight() - 1); g2.drawLine(0, this.getHeight() - 1, 0, 0); } } public int doesCoordinateAppearToBeConnectedToMe(Point p) { int ret = 0; int tmpX = p.x - this.getX(); int tmpY = p.y - this.getY(); if ((tmpX > -4) && (tmpX < this.getWidth() + 4)) { if ((tmpY > -4) && (tmpY < 4)) ret += 1; if ((tmpY > this.getHeight() - 4) && (tmpY < this.getHeight() + 4)) ret += 4; } if ((tmpY > -4) && (tmpY < this.getHeight() + 4)) { if ((tmpX > -4) && (tmpX < 12)) ret += 8; if ((tmpX > this.getWidth() - 4) && (tmpX < this.getWidth() + 4)) ret += 2; } return ret; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/ReceiveSignal.java0000644000175000001440000000420311576116034025555 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class ReceiveSignal extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Polygon poly = new Polygon(); poly.addPoint(0, 0); poly.addPoint(this.getWidth() - 1, 0); poly.addPoint(this.getWidth() - 1, this.getHeight() - 1); poly.addPoint(0, this.getHeight() - 1); poly.addPoint((int) this.getHandler().getFontHandler().getFontSize() - 2, this.getHeight() / 2); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y)); p.addPoint(new Point(x + width, y)); p.addPoint(new Point(x + width, y + height)); p.addPoint(new Point(x, y + height)); p.addPoint(new Point(x + (int) this.getHandler().getFontHandler().getFontSize() - 2, y + height / 2), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Text.java0000644000175000001440000000475111576116034023771 0ustar benuserspackage com.umlet.element.custom; // Some import to have access to more Java features import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; @SuppressWarnings("serial") public class Text extends com.baselet.element.GridElement { // Change this method if you want to edit the graphical // representation of your custom element. @Override public void paintEntity(Graphics g) { // Some unimportant initialization stuff; setting color, font // quality, etc. You should not have to change this. Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(fgColor); // It's getting interesting here: // First, the strings you type in the element editor are read and // split into lines. // Then, by default, they are printed out on the element, aligned // to the left. // Change this to modify this default text printing and to react // to special strings // (like the "--" string in the UML class elements which draw a line). Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // Finally, change other graphical attributes using // drawLine, getWidth, getHeight.. /* * int fnt = this.getHandler().getFontHandler().getFontsize()/3; * int w = getWidth(); * int h = getHeight(); * g2.drawLine(1,1,fnt,1); * g2.drawLine(1,1,1,fnt); * g2.drawLine(w-1,h,w-1,h-fnt); * g2.drawLine(w-1,h-1,w-fnt,h-1); */ } /* * Uncommented because this method makes the Textarea not-resizable and removes the stickingpolygon * // Advanced: change this method to modify the area where relations * // stick to your custom element. * @Override * public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { * // By default, the element returns its outer borders. Change it, * // if your element needs to stick to relations differently. * // See, for example, the source code of the UML interface element. * return null; * } */ } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SynchBarVertical.java0000644000175000001440000000615211576116034026245 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class SynchBarVertical extends GridElement { private static int textHeight = 0; @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); int yPos = 0; textHeight = 0; // reset Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); textHeight = tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())); boolean ADAPT_SIZE = false; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); TextLayout l = new TextLayout(s, this.getHandler().getFontHandler().getFont(), Constants.FRC); Rectangle2D r2d = l.getBounds(); int width = (int) r2d.getWidth(); if ((this.getWidth() / 2 - width / 2) < 0) { ADAPT_SIZE = true; break; } this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } if (ADAPT_SIZE) { (new Resize(this, -this.getHandler().getGridSize(), 0, 0, 0)).execute(this.getHandler()); (new Resize(this, 0, 0, this.getHandler().getGridSize(), 0)).execute(this.getHandler()); return; } if (yPos > this.getHeight()) { (new Resize(this, 0, 0, 0, (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()))).execute(this.getHandler()); return; } g2.fillRect(this.getWidth() / 2 - (int) (3 * zoom), textHeight + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), (int) (5 * zoom), this.getHeight() - textHeight - (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2); } /* * public int doesCoordinateAppearToBeConnectedToMe(Point p) { * int ret=0; * int tmpX=p.x-this.getX(); * int tmpY=p.y-this.getY(); * if (tmpY>textHeight+4 && tmpY0 && tmpX<16) ret+=8; * if (tmpX>this.getWidth()/2-4 && tmpX tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() * 3, yPos, false); // offset into box yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // Finally, change other graphical attributes using // drawLine, getWidth, getHeight.. int fnt = (int) this.getHandler().getFontHandler().getFontSize(); g2.drawLine((int) this.getHandler().getFontHandler().getFontSize(), 0, this.getWidth() - 1, 0); // top g2.drawLine((int) this.getHandler().getFontHandler().getFontSize(), getHeight() - 1, getWidth() - 1, getHeight() - 1); // bottom // left side g2.drawLine((int) this.getHandler().getFontHandler().getFontSize(), 0, (int) this.getHandler().getFontHandler().getFontSize(), fnt); // top g2.drawLine(fnt, fnt * 2, fnt, fnt * 3); // middle g2.drawLine(fnt, fnt * 4, fnt, getHeight() - 1); // bottom g2.drawLine(getWidth() - 1, 0, getWidth() - 1, getHeight() - 1); // right side g2.drawLine(0, fnt, fnt * 2, fnt); // top box top line g2.drawLine(0, fnt * 2, fnt * 2, fnt * 2); // top box bottom line g2.drawLine(0, fnt, 0, fnt * 2); // top box left line g2.drawLine(fnt * 2, fnt, fnt * 2, fnt * 2); // top box right line g2.drawLine(0, fnt * 3, fnt * 2, fnt * 3); // bottom box top line g2.drawLine(0, fnt * 4, fnt * 2, fnt * 4); // bottom box bottom line g2.drawLine(0, fnt * 3, 0, fnt * 4); // bottom box left line g2.drawLine(fnt * 2, fnt * 3, fnt * 2, fnt * 4); // bottom box right line } // Change this method if you want to set the resize-attributes of // your custom element @Override public int getPossibleResizeDirections() { // Remove from this list the borders you don't want to be resizeable. return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Component.java0000644000175000001440000000737711576116034025016 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class Component extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); boolean normal = false; // G.M // symbol outline g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = 0; int startY = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.startsWith("'") || (normal == true)) { // G.M startY = (int) this.getHandler().getFontHandler().getFontSize(); s = s.substring(1, s.length()); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) (10 * zoom), startY + yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); normal = true; } else { if (s.startsWith("*")) { startY = (int) this.getHandler().getFontHandler().getFontSize(); s = s.substring(1, s.length()); } yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, startY + yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } // small component symbol g2.drawLine(getWidth() - (int) (50 * zoom), (int) (10 * zoom), getWidth() - (int) (15 * zoom), (int) (10 * zoom)); g2.drawLine(getWidth() - (int) (50 * zoom), (int) (35 * zoom), getWidth() - (int) (15 * zoom), (int) (35 * zoom)); g2.drawLine(getWidth() - (int) (15 * zoom), (int) (10 * zoom), getWidth() - (int) (15 * zoom), (int) (35 * zoom)); g2.drawLine(getWidth() - (int) (50 * zoom), (int) (10 * zoom), getWidth() - (int) (50 * zoom), (int) (15 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (15 * zoom), getWidth() - (int) (45 * zoom), (int) (15 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (20 * zoom), getWidth() - (int) (45 * zoom), (int) (20 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (15 * zoom), getWidth() - (int) (55 * zoom), (int) (20 * zoom)); g2.drawLine(getWidth() - (int) (45 * zoom), (int) (15 * zoom), getWidth() - (int) (45 * zoom), (int) (20 * zoom)); g2.drawLine(getWidth() - (int) (50 * zoom), (int) (20 * zoom), getWidth() - (int) (50 * zoom), (int) (25 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (25 * zoom), getWidth() - (int) (45 * zoom), (int) (25 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (30 * zoom), getWidth() - (int) (45 * zoom), (int) (30 * zoom)); g2.drawLine(getWidth() - (int) (55 * zoom), (int) (25 * zoom), getWidth() - (int) (55 * zoom), (int) (30 * zoom)); g2.drawLine(getWidth() - (int) (45 * zoom), (int) (25 * zoom), getWidth() - (int) (45 * zoom), (int) (30 * zoom)); g2.drawLine(getWidth() - (int) (50 * zoom), (int) (30 * zoom), getWidth() - (int) (50 * zoom), (int) (35 * zoom)); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Database.java0000644000175000001440000000554211576116034024550 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class Database extends com.baselet.element.GridElement { // Change this method if you want to edit the graphical // representation of your custom element. @Override public void paintEntity(Graphics g) { // Some unimportant initialization stuff; setting color, font // quality, etc. You should not have to change this. Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); int inset = (int) this.getHandler().getFontHandler().getFontSize(); // It's getting interesting here: // First, the strings you type in the element editor are read and // split into lines. // Then, by default, they are printed out on the element, aligned // to the left. // Change this to modify this default text printing and to react // to special strings // (like the "--" string in the UML class elements which draw a line). Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = inset + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); boolean CENTER = true; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { CENTER = false; g2.drawLine(0, yPos, this.getWidth(), yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER) { this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); } else { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); } yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } // Finally, change other graphical attributes using // drawLine, getWidth, getHeight.. g2.drawLine(0, this.getHeight() - 1 - inset / 2, 0, inset / 2); g2.drawOval(0, 0, this.getWidth(), inset); g2.drawArc(0, this.getHeight() - 1 - inset, this.getWidth(), (int) this.getHandler().getFontHandler().getFontSize(), 180, 180); g2.drawLine(this.getWidth() - 1, inset / 2, this.getWidth() - 1, this.getHeight() - 1 - inset / 2); } // Change this method if you want to set the resize-attributes of // your custom element @Override public int getPossibleResizeDirections() { // Remove from this list the borders you don't want to be resizeable. return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/InteractionFrame.java0000644000175000001440000001025011576116034026266 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class InteractionFrame extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); float yPos = 0; yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int textWidth = 0; // A.Mueller start boolean center = false; int topHeight = tmp.size(); int maxWidthTemp = 0; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); maxWidthTemp = Math.max(this.getHandler().getFontHandler().getTextWidth(s), maxWidthTemp); if (s.equals("--")) { textWidth = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + maxWidthTemp + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); topHeight = i; yPos += (this.getHandler().getFontHandler().getDistanceBetweenTexts() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); center = true; } else if (s.equals("-.")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(0, (int) yPos, this.getWidth(), (int) yPos); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += this.getHandler().getFontHandler().getFontSize(); if (center) this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, (int) yPos, true); else this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, (int) yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } if (textWidth == 0) textWidth = maxWidthTemp; /* * * for (int i=0; itextWidth)?((int)r2d.getWidth()):(textWidth); * } * */ // A.Mueller end int w = (((int) this.getHandler().getFontHandler().getFontSize() * 7) > textWidth) ? ((int) this.getHandler().getFontHandler().getFontSize() * 7) : (textWidth); // A.Mueller start int h = topHeight * ((int) this.getHandler().getFontHandler().getFontSize() + (int) (3 * zoom)) + (int) this.getHandler().getFontHandler().getFontSize(); int sw = w - (topHeight - 1) * (int) this.getHandler().getFontHandler().getFontSize(); // // int h=tmp.size()*(this.getHandler().getFontHandler().getFontsize()+3)+this.getHandler().getFontHandler().getFontsize(); // int sw=w-(tmp.size()-1)*this.getHandler().getFontHandler().getFontsize(); // // A.Mueller end g2.drawLine(0, h, sw, h); g2.drawLine(w + (int) this.getHandler().getFontHandler().getFontSize(), 0, w + (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize()); g2.drawLine(sw, h, w + (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize()); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/AlternativeUseCase.java0000644000175000001440000000362011576116034026566 0ustar benuserspackage com.umlet.element.custom; // Some import to have access to more Java features import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; @SuppressWarnings("serial") public class AlternativeUseCase extends com.baselet.element.GridElement { // Change this method if you want to edit the graphical // representation of your custom element. @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, getWidth() - 1, getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, getWidth() - 1, getHeight() - 1); boolean center = false; Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (s.equals("--")) { yPos = (int) (35 * zoom); center = true; } else if (center == true) { this.getHandler().getFontHandler().writeText(g2, s, (getWidth() - 1) / 2, yPos, true); center = false; } else { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } g2.drawLine(0, (int) (30 * zoom), getWidth() - 1, (int) (30 * zoom)); g2.drawOval(getWidth() - (int) (59 * zoom), (int) (3 * zoom), (int) (55 * zoom), (int) (20 * zoom)); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/RegionEndState.java0000644000175000001440000000172711576116034025720 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class RegionEndState extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); g2.drawOval(0, 0, this.getWidth() - 1, this.getHeight() - 1); AffineTransform at = g2.getTransform(); AffineTransform at2 = (AffineTransform) at.clone(); at2.rotate(Math.toRadians(45), getWidth() / 2, getHeight() / 2); g2.setTransform(at2); g2.drawLine(0, this.getHeight() / 2, this.getWidth(), this.getHeight() / 2); g2.drawLine(this.getWidth() / 2, 0, this.getWidth() / 2, this.getHeight()); g2.setTransform(at); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SeqObjectActive.java0000644000175000001440000000163611576116034026057 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import com.baselet.control.Constants; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class SeqObjectActive extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); } @Override public int getPossibleResizeDirections() { // allow height changes only return Constants.RESIZE_TOP | Constants.RESIZE_BOTTOM; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Decision.java0000644000175000001440000000276611576116034024606 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Decision extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Polygon poly = new Polygon(); poly.addPoint(this.getWidth() / 2, 0); poly.addPoint(this.getWidth(), this.getHeight() / 2); poly.addPoint(this.getWidth() / 2, this.getHeight()); poly.addPoint(0, this.getHeight() / 2); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); y += 1; width += 1; p.addPoint(new Point(x + width / 2, y)); p.addPoint(new Point(x + width, y + height / 2)); p.addPoint(new Point(x + width / 2, y + height)); p.addPoint(new Point(x, y + height / 2), true); return p; } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Taxonomy_of_Workprocesses.java0000644000175000001440000001110111576116034030263 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Taxonomy_of_Workprocesses extends com.baselet.element.GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int level = 0; float yPos = 10 * zoom; float xPos = 10 * zoom; float dist = 10 * this.getHandler().getFontHandler().getDistanceBetweenTexts(); float ovalHeight = 3 * this.getHandler().getFontHandler().getFontSize(); float ovalWidth = 10 * this.getHandler().getFontHandler().getFontSize(); Point nextDock = new Point((int) (xPos + ovalWidth / 2 + 0.5), (int) (ovalHeight + yPos + 0.5)); Vector dock = new Vector(); dock.add(nextDock); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); int currentLineLevel = calculateLevel(s); s = s.replaceAll("\t", ""); if ((currentLineLevel > level) && (i > 0)) { level++; nextDock = new Point((int) (xPos + ovalWidth / 2 + 0.5), (int) (ovalHeight + yPos + 0.5)); dock.add(nextDock); nextDock = dock.elementAt(level - 1); drawDockAnchor(g2, nextDock); } if ((currentLineLevel < level)) { level = currentLineLevel; } xPos = 10 * zoom + ovalWidth * level; drawProcess(g2, xPos, yPos, s); if (level > 0) { // change dock color to red if too much tabs occur Color color = g2.getColor(); if (currentLineLevel > level) g2.setColor(Color.red); nextDock = dock.elementAt(level - 1); drawDock(g2, nextDock, xPos, yPos); // reset color g2.setColor(color); } nextDock = new Point((int) (xPos + ovalWidth / 2 + 0.5), (int) (yPos + ovalHeight + 0.5)); dock.set(level, nextDock); yPos += 2 * ovalHeight - dist; } } @Override public int getPossibleResizeDirections() { return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } public StickingPolygon generateStickingBorder() { StickingPolygon p = new StickingPolygon(); return p; } private void drawProcess(Graphics2D g2, float xPos, float yPos, String name) { float zoom = getHandler().getZoomFactor(); float ovalHeight = 3 * this.getHandler().getFontHandler().getFontSize(); float ovalWidth = 10 * this.getHandler().getFontHandler().getFontSize(); g2.drawOval((int) (xPos + 0.5), (int) (yPos + 0.5), (int) (ovalWidth + 0.5), (int) (ovalHeight + 0.5)); this.getHandler().getFontHandler().writeText(g2, name, (int) (xPos + ovalWidth / 2 + 0.5), (int) (yPos + 5 * zoom + ovalHeight / 2 + 0.5), true); } private void drawDock(Graphics2D g2, Point nextDock, float xPos, float yPos) { float zoom = getHandler().getZoomFactor(); float ovalHeight = 3 * this.getHandler().getFontHandler().getFontSize(); g2.drawLine(nextDock.x, (int) (nextDock.y + 9 * zoom + 0.5), nextDock.x, (int) (ovalHeight / 2 + yPos + 0.5)); g2.drawLine(nextDock.x, (int) (ovalHeight / 2 + yPos + 0.5), (int) (xPos + 0.5), (int) (ovalHeight / 2 + yPos + 0.5)); } private void drawDockAnchor(Graphics2D g2, Point nextDock) { float zoom = getHandler().getZoomFactor(); int[] xkanten = { nextDock.x, nextDock.x + (int) (6 * zoom), nextDock.x - (int) (6 * zoom) }; int[] ykanten = { nextDock.y, nextDock.y + (int) (9 * zoom), nextDock.y + (int) (9 * zoom) }; int kanten_zahl = 3; g2.drawPolygon(new Polygon(xkanten, ykanten, kanten_zahl)); } // calculates the hierarchy level according to tab count in the string protected int calculateLevel(String s) { int level = 0; while ((s.length() > 0) && (s.charAt(0) == '\t')) { level++; s = s.substring(1); } // Logger.getAnonymousLogger().info("string=="+s+";index=="+level); return level; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/State.java0000644000175000001440000000514011576116034024116 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class State extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, (int) (30 * zoom), (int) (30 * zoom)); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, (int) (30 * zoom), (int) (30 * zoom)); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = 0; // A.Mueller start if (tmp.contains("--") || tmp.contains("-.")) yPos = 2 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); else // A.Mueller end yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; boolean CENTER = true; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); // A.Mueller start if (s.equals("--")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.drawLine(0, yPos, getWidth(), yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); CENTER = false; } else if (s.equals("-.")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(0, yPos, getWidth(), yPos); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); CENTER = false; } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER) this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); else this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // A.Mueller end } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SeqDestroyMark.java0000644000175000001440000000216711576116034025761 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class SeqDestroyMark extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; colorize(g2); // enable colors g2.setColor(fgColor); Rectangle r = this.getBounds(); g2.drawLine(0, 0, (int) r.getWidth() - 1, (int) r.getHeight() - 1); g2.drawLine((int) r.getWidth() - 1, 0, 0, (int) r.getHeight() - 1); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); int px = x + width / 2; int py = y + height / 2; p.addPoint(new Point(px - 4, py - 4)); p.addPoint(new Point(px + 4, py - 4)); p.addPoint(new Point(px + 4, py + 4)); p.addPoint(new Point(px - 4, py + 4), true); return p; } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Node.java0000644000175000001440000000657511576116034023740 0ustar benuserspackage com.umlet.element.custom; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Node extends GridElement { public Node() { super(); } @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); int size_3d = (int) (10 * zoom); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, size_3d, this.getWidth() - size_3d - 1, this.getHeight() - size_3d - 1); Polygon p = new Polygon(); p.addPoint(this.getWidth() - size_3d - 1, this.getHeight() - 1); p.addPoint(this.getWidth() - size_3d - 1, size_3d); p.addPoint(this.getWidth() - 1, 0); p.addPoint(this.getWidth() - 1, this.getHeight() - size_3d - 1); Polygon p1 = new Polygon(); p1.addPoint(0, size_3d); p1.addPoint(size_3d, 0); p1.addPoint(this.getWidth() - 1, 0); p1.addPoint(this.getWidth() - size_3d - 1, size_3d); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); g2.setColor(new Color(230, 230, 230)); g2.fillPolygon(p); g2.fillPolygon(p1); g2.setComposite(composites[0]); g2.setColor(fgColor); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, size_3d, this.getWidth() - size_3d - 1, this.getHeight() - size_3d - 1); // draw polygons by hand to avoid double painted line g2.drawLine(0, size_3d, size_3d, 0); g2.drawLine(size_3d, 0, this.getWidth() - 1, 0); g2.drawLine(this.getWidth() - 1, 0, this.getWidth() - 1, this.getHeight() - size_3d - 1); g2.drawLine(this.getWidth() - 1, this.getHeight() - size_3d - 1, this.getWidth() - size_3d - 1, this.getHeight() - 1); g2.drawLine(this.getWidth() - size_3d - 1, size_3d, this.getWidth() - 1, 0); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); yPos = yPos + size_3d; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (s.startsWith("center:")) { s = s.substring(7); this.getHandler().getFontHandler().writeText(g2, s, (this.getWidth() - size_3d - 1) / 2, yPos, true); } else this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { int size_3d = 10; StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y + size_3d)); p.addPoint(new Point(x, y + height)); p.addPoint(new Point(x + width - size_3d, y + height)); p.addPoint(new Point(x + width, y + height - size_3d)); p.addPoint(new Point(x + width, y)); p.addPoint(new Point(x + size_3d, y), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SynchBar.java0000644000175000001440000000321511576116034024550 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class SynchBar extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(Color.red); int yPos = 0; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, 0, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // g2.fillRect(0,7,this.getWidth(),this.getHeight()-15); g2.fillRect(0, (int) (7 * zoom), this.getWidth(), (int) (5 * zoom)); } public int doesCoordinateAppearToBeConnectedToMe(Point p) { int ret = 0; int tmpX = p.x - this.getX(); int tmpY = p.y - this.getY(); if ((tmpX > -4) && (tmpX < this.getWidth() + 4)) { if ((tmpY > 0) && (tmpY < 8)) ret += 1; if ((tmpY > this.getHeight() - 16) && (tmpY < this.getHeight() + 0)) ret += 4; } // if (tmpY>-4 && tmpY0 && tmpX<8) ret+=8; // if (tmpX>this.getWidth()-4 && tmpX getStringVector() { return Utils.decomposeStrings(this.getPanelAttributes()); } @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(fgColor); // Constants.getFRC(g2); Vector tmp = getStringVector(); int yPos = 0; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); boolean CENTER = true; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { CENTER = false; g2.drawLine(0, yPos, this.getWidth(), yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER) { this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); } else { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); } yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } Rectangle r = this.getBounds(); g.drawRect(0, 0, (int) r.getWidth() - 1, (int) r.getHeight() - 1); /* * if (_selected) { * g.drawRect(1,1,(int)r.getWidth()-3,(int)r.getHeight()-3); * } */ } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/FinalState.java0000644000175000001440000000144211576116034025071 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import com.baselet.element.GridElement; /** * @author Ludwig */ @SuppressWarnings("serial") public class FinalState extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); g2.drawOval(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.fillOval((int) (4 * zoom), (int) (4 * zoom), this.getWidth() - (int) (8 * zoom), this.getHeight() - (int) (8 * zoom)); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SynchBarHorizontal.java0000644000175000001440000000630011576116034026620 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class SynchBarHorizontal extends GridElement { private static int textWidth = 0; @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); textWidth = 0; // reset Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; boolean ADAPT_SIZE_X = false; int textHeight = tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); TextLayout l = new TextLayout(s, this.getHandler().getFontHandler().getFont(), Constants.FRC); Rectangle2D r2d = l.getBounds(); textWidth = ((int) r2d.getWidth() > textWidth) ? ((int) r2d.getWidth()) : (textWidth); if ((this.getWidth() - textWidth) < 0) { ADAPT_SIZE_X = true; break; } yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, 0, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } if (ADAPT_SIZE_X) { (new Resize(this, -this.getHandler().getGridSize(), 0, 0, 0)).execute(this.getHandler()); (new Resize(this, 0, 0, this.getHandler().getGridSize(), 0)).execute(this.getHandler()); return; } if (textHeight > this.getHeight()) { (new Resize(this, 0, 0, 0, 20)).execute(this.getHandler()); return; } g2.fillRect(textWidth + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), getHeight() / 2 - (int) (3 * zoom), this.getWidth() - textWidth - (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2, (int) (5 * zoom)); } /* * public int doesCoordinateAppearToBeConnectedToMe(Point p) { * int ret=0; * int tmpX=p.x-this.getX(); * int tmpY=p.y-this.getY(); * if (tmpX>(textWidth+4) && tmpX0 && tmpY<8) ret+=1; * if (tmpY>this.getHeight()/2-8 && tmpY tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); yPos = yPos + size_3d; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (s.startsWith("center:")) { s = s.substring(7); this.getHandler().getFontHandler().writeText(g2, s, (this.getWidth() - size_3d - 1) / 2, yPos, true); } else this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { float zoom = getHandler().getZoomFactor(); int size_3d = (int) (10 * zoom); StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y + size_3d)); p.addPoint(new Point(x, y + height)); p.addPoint(new Point(x + width - size_3d, y + height)); p.addPoint(new Point(x + width, y + height - size_3d)); p.addPoint(new Point(x + width, y)); p.addPoint(new Point(x + size_3d, y), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/TimeSignal.java0000644000175000001440000000754611576116034025106 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class TimeSignal extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); boolean ADAPT_SIZE = false; int x0, y0, b, h; x0 = (int) (this.getWidth() / 2 - 20 * zoom); y0 = 0; b = (int) (this.getWidth() / 2 + 20 * zoom); h = (int) (40 * zoom); // g2.drawLine(x0,y0,b,y0); // g2.drawLine(b, h, x0, h); // g2.drawLine(x0,y0,b, h); // g2.drawLine(b,y0,x0, h); Polygon poly = new Polygon(); poly.addPoint(x0, y0); poly.addPoint(b, y0); poly.addPoint(x0, h); poly.addPoint(b, h); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = 0; yPos += 4 * this.getHandler().getGridSize(); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.drawLine(this.getWidth() / 2 - (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos, this.getWidth() / 2 + (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); TextLayout l = new TextLayout(s, this.getHandler().getFontHandler().getFont(), Constants.FRC); Rectangle2D r2d = l.getBounds(); int width = (int) r2d.getWidth(); int xPos = this.getWidth() / 2 - width / 2; if (xPos < 0) { ADAPT_SIZE = true; break; } this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } if (ADAPT_SIZE) { (new Resize(this, -this.getHandler().getGridSize(), 0, 0, 0)).execute(this.getHandler()); (new Resize(this, 0, 0, this.getHandler().getGridSize(), 0)).execute(this.getHandler()); return; } if (yPos > this.getHeight()) { (new Resize(this, 0, 0, 0, 20)).execute(this.getHandler()); return; } } /* * public int doesCoordinateAppearToBeConnectedToMe(Point p) { * int tmpX=p.x-this.getX()-this.getWidth()/2; * int tmpY=p.y-this.getY()-(2*this.getHandler().getMainUnit()+20)/2; * if ((tmpX>-4 && tmpX<+4)&&(tmpY>-4 && tmpY<+4)) { * return 15; * } else return 0; * } */ @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { float zoom = getHandler().getZoomFactor(); StickingPolygon p = new StickingPolygon(); int px = x + width / 2; int py = (int) (y + (40 * zoom) / 2); p.addPoint(new Point(px - 4, py - 4)); p.addPoint(new Point(px + 4, py - 4)); p.addPoint(new Point(px + 4, py + 4)); p.addPoint(new Point(px - 4, py + 4), true); return p; } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/SendSignal.java0000644000175000001440000000542011576116034025066 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class SendSignal extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Polygon poly = new Polygon(); poly.addPoint(0, 0); poly.addPoint(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0); poly.addPoint(this.getWidth() - 1, this.getHeight() / 2); poly.addPoint(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), this.getHeight() - 1); poly.addPoint(0, this.getHeight() - 1); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } // g2.drawLine(0,0,this.getWidth()-this.getHandler().getFontHandler().getFontsize(),0); // g2.drawLine(this.getWidth()-this.getHandler().getFontHandler().getFontsize(), this.getHeight()-1, 0, this.getHeight()-1); // g2.drawLine(this.getWidth()-this.getHandler().getFontHandler().getFontsize(),0,this.getWidth()-1,this.getHeight()/2); // g2.drawLine(this.getWidth(),this.getHeight()/2,this.getWidth()-this.getHandler().getFontHandler().getFontsize(),this.getHeight()); // g2.drawLine(0, this.getHeight()-1, 0, 0); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y)); p.addPoint(new Point(x + width - (int) this.getHandler().getFontHandler().getFontSize(), y)); p.addPoint(new Point(x + width, y + height / 2)); p.addPoint(new Point(x + width - (int) this.getHandler().getFontHandler().getFontSize(), y + height)); p.addPoint(new Point(x, y + height), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/HistoryState.java0000644000175000001440000000265411576116034025507 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.font.LineMetrics; import java.awt.geom.Rectangle2D; import com.baselet.control.Constants; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class HistoryState extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); colorize(g2); // enable colors g2.setColor(fgColor); g2.fillOval(0, 0, this.getWidth(), this.getHeight()); // Measure the font and the message Rectangle2D bounds = this.getHandler().getFontHandler().getFont().getStringBounds("H", Constants.FRC); LineMetrics metrics = this.getHandler().getFontHandler().getFont().getLineMetrics("H", Constants.FRC); float width = (float) bounds.getWidth(); // The width of our text float lineheight = metrics.getHeight(); // Total line height float ascent = metrics.getAscent(); // Top of text to baseline // Now display the message centered horizontally and vertically in this float x0 = ((this.getWidth() - width) / 2); float y0 = ((this.getHeight() - lineheight) / 2 + ascent); g2.setColor(Color.WHITE); g2.drawString("H", x0, y0); g2.setColor(fgColor); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/ThreeWayRelation.java0000644000175000001440000000412711576116034026270 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class ThreeWayRelation extends com.baselet.element.GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Polygon poly = new Polygon(); poly.addPoint(this.getWidth() / 2, 0); poly.addPoint(this.getWidth(), this.getHeight() / 2); poly.addPoint(this.getWidth() / 2, this.getHeight() - 1); poly.addPoint(0, this.getHeight() / 2); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); y += 1; width += 1; p.addPoint(new Point(x + width / 2, y)); p.addPoint(new Point(x + width, y + height / 2)); p.addPoint(new Point(x + width / 2, y + height)); p.addPoint(new Point(x, y + height / 2), true); return p; } @Override public int getPossibleResizeDirections() { return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/StateSubDiagram.java0000644000175000001440000000153211576116034026056 0ustar benuserspackage com.umlet.element.custom; // Some import to have access to more Java features import java.awt.Graphics; import java.awt.Graphics2D; @SuppressWarnings("serial") public class StateSubDiagram extends State { @Override public void paintEntity(Graphics g) { super.paintEntity(g); float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; int w = getWidth(); int h = getHeight(); // draw substate sign g2.drawRoundRect(w - (int) (65 * zoom), h - (int) (16 * zoom), (int) (20 * zoom), (int) (10 * zoom), (int) (8 * zoom), (int) (8 * zoom)); g2.drawLine(w - (int) (45 * zoom), h - (int) (11 * zoom), w - (int) (35 * zoom), h - (int) (11 * zoom)); g2.drawRoundRect(w - (int) (35 * zoom), h - (int) (16 * zoom), (int) (20 * zoom), (int) (10 * zoom), (int) (8 * zoom), (int) (8 * zoom)); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Systemborder.java0000644000175000001440000000641611576116034025527 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class Systemborder extends com.baselet.element.GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, getWidth() - 1, getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, getWidth() - 1, getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); boolean center = false; boolean downleft = false; boolean upcenter = false; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.startsWith("center:") && !s.equals("center:")) { if (tmp.size() == 1) { yPos = ((getHeight() - 1) / 2) - (int) (10 * zoom); } else { yPos = ((getHeight() - 1) / 2) - (int) this.getHandler().getFontHandler().getFontSize() * (tmp.size() / 2) - (int) (10 * zoom); } center = true; s = s.replace("center:", ""); } else if (s.startsWith("bottomleft:") && !s.equals("bottomleft:")) { downleft = true; s = s.replace("bottomleft:", ""); yPos = (getHeight() - 1) - (int) this.getHandler().getFontHandler().getFontSize(); } else if (s.startsWith("topcenter:") && !s.equals("topcenter:")) { upcenter = true; s = s.replace("topcenter:", ""); // yPos+=this.getHandler().getFontHandler().getFontsize(); } if (center) { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (getWidth() - 1) / 2, yPos, true); yPos += 2 * this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else if (downleft) { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); } else if (upcenter) { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (getWidth() - 1) / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } } // Change this method if you want to set the resize-attributes of // your custom element @Override public int getPossibleResizeDirections() { // Remove from this list the borders you don't want to be resizeable. return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/PackageAggregationHierarchy.java0000644000175000001440000001220111576116034030374 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class PackageAggregationHierarchy extends com.baselet.element.GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); // init graph and colors Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); // extract property strings Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); // draw bounding box g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); // init coordinates; int level = 0; float yPos = 10 * zoom; float xPos = 10 * zoom; float packageHeight = this.getHandler().getFontHandler().getFontSize(); float packageWidth = 2 * this.getHandler().getFontHandler().getFontSize(); Vector dock = new Vector(); Point nextDock = new Point((int) (xPos + packageWidth / 3 + 0.5), (int) (2 * packageHeight + yPos + 0.5)); dock.add(nextDock); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); int currentLineLevel = calculateLevel(s); s = s.replaceAll("\t", ""); // increase level if ((currentLineLevel > level) && (i > 0)) { level++; nextDock = new Point((int) (xPos + packageWidth / 3 + 0.5), (int) (2 * packageHeight + yPos + 0.5)); dock.add(nextDock); nextDock = dock.elementAt(level - 1); drawDockAnchor(g2, nextDock); } // decrease level if (currentLineLevel < level) { level = currentLineLevel; } xPos = (10 * zoom) + (float) (packageWidth * level * 1.5); drawPackage(g2, xPos, yPos, packageHeight, packageWidth, s); // draw docks for non root elements if (level > 0) { // change dock color to red if too much tabs occur Color color = g2.getColor(); if (currentLineLevel > level) g2.setColor(Color.red); nextDock = dock.elementAt(level - 1); drawDock(g2, nextDock, xPos, yPos, packageHeight); // reset color g2.setColor(color); } nextDock = new Point((int) (xPos + packageWidth / 3 + 0.5), (int) (2 * packageHeight + yPos + 0.5)); dock.set(level, nextDock); yPos += 2 * packageHeight + this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } @Override public int getPossibleResizeDirections() { return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } public StickingPolygon generateStickingBorder() { StickingPolygon p = new StickingPolygon(); return p; } private void drawDockAnchor(Graphics2D g2, Point nextDock) { // Logger.getAnonymousLogger().info("\ndrawDock: \ndock.x/y: " + nextDock.x + "/" + nextDock.y); float zoom = getHandler().getZoomFactor(); g2.drawOval(nextDock.x - (int) (5 * zoom + 0.5), nextDock.y - (int) (10 * zoom + 0.5), (int) (10 * zoom + 0.5), (int) (10 * zoom + 0.5)); g2.drawLine(nextDock.x, nextDock.y - (int) (8 * zoom + 0.5), nextDock.x, nextDock.y - (int) (2 * zoom + 0.5)); g2.drawLine(nextDock.x - (int) (3 * zoom + 0.5), nextDock.y - (int) (5 * zoom + 0.5), nextDock.x + (int) (3 * zoom + 0.5), nextDock.y - (int) (5 * zoom + 0.5)); } private void drawDock(Graphics2D g2, Point nextDock, float xPos, float yPos, float packageHeight) { // Logger.getAnonymousLogger().info("\ndrawDock: \ndock.x/y: " + nextDock.x + "/" + nextDock.y + "\nx/yPos: " + xPos + "/" + yPos); g2.drawLine(nextDock.x, nextDock.y, nextDock.x, (int) (packageHeight / 2 + 0.5) + (int) (yPos + 0.5)); g2.drawLine(nextDock.x, (int) (packageHeight / 2 + 0.5) + (int) (yPos + 0.5), (int) (xPos + 0.5), (int) (packageHeight / 2 + 0.5) + (int) (yPos + 0.5)); } private void drawPackage(Graphics2D g2, float xPos, float yPos, float packageHeight, float packageWidth, String name) { // Logger.getAnonymousLogger().info("\nxPos: " + xPos + "\nyPos: " + yPos + "\nzoom: " + zoom + "\nname: " + name); g2.drawRect((int) (xPos + 0.5), (int) (yPos + 0.5), (int) (packageWidth / 3 + 0.5), (int) (packageHeight / 4 + 0.5)); g2.drawRect((int) (xPos + 0.5), (int) (packageHeight / 4 + 0.5) + (int) (yPos + 0.5), (int) (packageWidth + 0.5), (int) (packageHeight + 0.5)); this.getHandler().getFontHandler().writeText(g2, name, (int) (xPos + packageWidth + this.getHandler().getFontHandler().getDistanceBetweenTexts() + 0.5), (int) (packageHeight + yPos + 0.5), false); } // calculates the hierarchy level according to tab count in the string protected int calculateLevel(String s) { int level = 0; while ((s.length() > 0) && (s.charAt(0) == '\t')) { level++; s = s.substring(1); } // Logger.getAnonymousLogger().info("string=="+s+";index=="+level); return level; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/EER_Entity.java0000644000175000001440000001023711576116034025010 0ustar benuserspackage com.umlet.element.custom; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class EER_Entity extends GridElement { int ySave = 0; boolean hasAttributes = false; private Vector getStringVector() { Vector ret = Utils.decomposeStrings(this.getPanelAttributes()); return ret; } @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); Vector tmp = getStringVector(); boolean CENTER = true; boolean drawInnerRect = false; int yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2; // ### draw rectangles and lines (some duplicated code) Polygon poly = new Polygon(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { CENTER = false; ySave = yPos + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 3; } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER && s.startsWith("##")) drawInnerRect = true; yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); if (CENTER) ySave = yPos; } } poly.addPoint(0, 0); poly.addPoint(this.getWidth() - 1, 0); if (CENTER) { hasAttributes = false; // see getStickingBorder() ySave = this.getHeight(); poly.addPoint(this.getWidth() - 1, this.getHeight() - 1); poly.addPoint(0, this.getHeight() - 1); } else { hasAttributes = true; // see getStickingBorder() g.drawLine((int) (10 * zoom), ySave, (int) (10 * zoom), yPos + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() - (int) this.getHandler().getFontHandler().getDistanceBetweenTexts()); poly.addPoint(this.getWidth() - 1, ySave); poly.addPoint(0, ySave); } g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawPolygon(poly); if (drawInnerRect) { if (CENTER) g.drawRect((int) (3 * zoom), (int) (3 * zoom), this.getWidth() - (int) (7 * zoom), this.getHeight() - (int) (7 * zoom)); else g.drawRect((int) (3 * zoom), (int) (3 * zoom), this.getWidth() - (int) (7 * zoom), ySave - (int) (6 * zoom)); } // #### draw text CENTER = true; yPos = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { CENTER = false; ySave = yPos + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 3; } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER) { String s1 = s; if (s.startsWith("##")) { drawInnerRect = true; s1 = s1.substring(2); } this.getHandler().getFontHandler().writeText(g2, s1, this.getWidth() / 2, yPos, true); } else { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize(), yPos, false); } yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); if (CENTER) ySave = yPos; } } } // @Override // public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { // StickingPolygon p = new StickingPolygon(); // p.addPoint(new Point(x, y)); // p.addPoint(new Point(x + width, y)); // p.addPoint(new Point(x + width, y + ySave - 1)); // if (!hasAttributes) p.addPoint(new Point(x, y + ySave - 1), true); // else p.addLine(new Point(x, y + ySave - 1), new Point(x, y)); // return p; // } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/Taxonomy_of_Actors.java0000644000175000001440000001162511576116034026660 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Taxonomy_of_Actors extends com.baselet.element.GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int level = 0; float yPos = 10 * zoom; float xPos = 10 * zoom; float actorHeight = 60 * zoom; float actorWidth = 14 * zoom; Vector dock = new Vector(); Point nextDock = new Point((int) (xPos + actorWidth / 2 + 0.5), (int) (actorHeight + yPos + 0.5)); dock.add(nextDock); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); int currentLineLevel = calculateLevel(s); s = s.replaceAll("\t", ""); // increase level if ((currentLineLevel > level) && (i > 0)) { level++; nextDock = new Point((int) (xPos + actorWidth / 2 + 0.5), (int) (actorHeight + yPos + 0.5)); dock.add(nextDock); nextDock = dock.elementAt(level - 1); drawDockAnchor(g2, nextDock); } // decrease level if ((currentLineLevel < level)) { level = currentLineLevel; } xPos = 10 * zoom + 4 * actorWidth * level; drawActor(g2, xPos, yPos, s); // draw docks for non root elements if (level > 0) { // change dock color to red if too much tabs occur Color color = g2.getColor(); if (currentLineLevel > level) g2.setColor(Color.red); nextDock = dock.elementAt(level - 1); drawDock(g2, nextDock, xPos, yPos); // reset color g2.setColor(color); } nextDock = new Point((int) (xPos + actorWidth / 2 + 0.5), (int) (actorHeight + yPos + 0.5)); dock.set(level, nextDock); yPos += actorHeight; } } @Override public int getPossibleResizeDirections() { return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; } public StickingPolygon generateStickingBorder() { StickingPolygon p = new StickingPolygon(); return p; } private void drawDock(Graphics2D g2, Point nextDock, float xPos, float yPos) { float zoom = getHandler().getZoomFactor(); float dockHeight = 50 * zoom; g2.drawLine(nextDock.x, nextDock.y, nextDock.x, (int) (dockHeight / 2 + yPos + 0.5)); g2.drawLine(nextDock.x, (int) (dockHeight / 2 + yPos + 0.5), (int) (xPos - 4 * zoom + 0.5), (int) (dockHeight / 2 + yPos + 0.5)); } private void drawActor(Graphics2D g2, float xPos, float yPos, String name) { float zoom = getHandler().getZoomFactor(); float head = 14 * zoom; float distance = 10 * zoom; g2.drawOval((int) (xPos + 0.5), (int) (yPos + 0.5), (int) (head + 0.5), (int) (head + 0.5)); g2.drawLine((int) (head / 2 + xPos + 0.5), (int) (head + yPos + 0.5), (int) (head / 2 + xPos + 0.5), (int) (yPos + head * 3 - distance + 0.5)); g2.drawLine((int) (xPos - 4 * zoom + 0.5), (int) (yPos + head + head / 3 + 0.5), (int) (xPos + head + 4 * zoom + 0.5), (int) (yPos + head + head / 3 + 0.5)); g2.drawLine((int) (head / 2 + xPos + 0.5), (int) (yPos + head * 3 - distance + 0.5), (int) (head + xPos + 0.5), (int) (yPos + head * 4 - distance + 0.5)); g2.drawLine((int) (head / 2 + xPos), (int) (yPos + head * 3 - distance + 0.5), (int) (xPos + 0.5), (int) (yPos + head * 4 - distance + 0.5)); // this.getHandler().getFontHandler().writeText(g2, name, xPos, yPos + (int) (4.5*head), false); this.getHandler().getFontHandler().writeText(g2, name, (int) (xPos + head * 1.5 + this.getHandler().getFontHandler().getDistanceBetweenTexts() + 0.5), (int) (2 * head + yPos + 0.5), false); } private void drawDockAnchor(Graphics2D g2, Point nextDock) { float zoom = getHandler().getZoomFactor(); int[] xkanten = { nextDock.x, nextDock.x + (int) (6 * zoom), nextDock.x - (int) (6 * zoom) }; int[] ykanten = { nextDock.y - (int) (9 * zoom), nextDock.y, nextDock.y }; int kanten_zahl = 3; g2.drawPolygon(new Polygon(xkanten, ykanten, kanten_zahl)); } // calculates the hierarchy level according to tab count in the string protected int calculateLevel(String s) { int level = 0; while ((s.length() > 0) && (s.charAt(0) == '\t')) { level++; s = s.substring(1); } // Logger.getAnonymousLogger().info("string=="+s+";index=="+level); return level; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/InitialFinalState.java0000644000175000001440000000206611576116034026406 0ustar benuserspackage com.umlet.element.custom; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class InitialFinalState extends GridElement { @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(Color.red); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); boolean initialState = false; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("i")) initialState = true; } if (!initialState) { g2.drawOval(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.fillOval((int) (4 * zoom), (int) (4 * zoom), this.getWidth() - (int) (8 * zoom), this.getHeight() - (int) (8 * zoom)); } else { g2.fillOval(0, 0, this.getWidth(), this.getHeight()); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/custom/ActiveClass.java0000644000175000001440000000317511576116034025245 0ustar benuserspackage com.umlet.element.custom; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Vector; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public class ActiveClass extends GridElement { @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(fgColor); Vector tmp = Utils.decomposeStrings(this.getPanelAttributes()); int yPos = 0; yPos = this.getHeight() / 2 - tmp.size() * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } g2.drawLine(0, 0, this.getWidth(), 0); g2.drawLine(this.getWidth() - 1, 0, this.getWidth() - 1, this.getHeight() - 1); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(0, this.getHeight() - 1, 0, 0); g2.drawLine((int) this.getHandler().getFontHandler().getFontSize() / 2, 0, (int) this.getHandler().getFontHandler().getFontSize() / 2, this.getHeight() - 1); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize() / 2, 0, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize() / 2, this.getHeight() - 1); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/0000755000175000001440000000000011576116036022517 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/End.java0000644000175000001440000000157411576116034024075 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class End extends Element { public End(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), id == null ? "End" : id); this.setWidth((int) (21 * getZoom())); this.setHeight((int) (21 * getZoom())); } @Override public boolean connectOut_overrideable() { return false; } @Override public void paint() { Point cord = this.getPosition(); this.getGraphics().drawArc(cord.x - (int) (10 * getZoom()), cord.y - (int) (10 * getZoom()), (int) (21 * getZoom()), (int) (21 * getZoom()), 0, 360); this.getGraphics().fillArc(cord.x - (int) (6 * getZoom()), cord.y - (int) (6 * getZoom()), (int) (13 * getZoom()), (int) (13 * getZoom()), 0, 360); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/StartElement.java0000644000175000001440000000213311576116034025766 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class StartElement extends Element { public StartElement(DiagramHandler handler, Graphics2D g, int padding, String id) { super(handler, g, padding, id); } @Override public void paint() { } @Override public boolean arrowIn() { return false; } public void connectTo(Element e) { if (e != null) { if (this.connectOut_overrideable() && e.connectIn()) { Point from = this.getPosition(); Point to = e.getConnect(Direction.TOP); if (from.x == to.x) from = this.getConnect(Direction.BOTTOM); else if (from.x < to.x) from = this.getConnect(Direction.RIGHT); else if (from.x > to.x) from = this.getConnect(Direction.LEFT); if (from.x != to.x) this.getGraphics().drawLine(from.x, from.y, to.x, from.y); if (this.arrowOut() && e.arrowIn()) Connector.drawArrow(this.getGraphics(), getZoom(), to.x, from.y, to.x, to.y); else this.getGraphics().drawLine(to.x, from.y, to.x, to.y); } } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Container.java0000644000175000001440000001662011576116034025307 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import java.util.ArrayList; import com.baselet.diagram.DiagramHandler; public class Container extends Element { private ArrayList columns; private StartElement start; private StopElement stop; private Container parent; private ArrayList rows; private int max_row; private int current_row; private int init_row; public Container(DiagramHandler handler, Graphics2D g, Container parent, ArrayList rows, int row) { super(handler, g, 0, null); this.columns = new ArrayList(); this.columns.add(new Column(g)); this.rows = rows; this.init_row = row; this.max_row = row; this.current_row = row; this.parent = parent; if (Const.AutoInsertIF && (this.parent != null)) this.setStartElement(new If(handler, g, null)); else if (this.parent != null) this.setStartElement(new StartElement(handler, g, 0, null)); } public Container addNewContainer() { Container c = new Container(this.getHandler(), this.getGraphics(), this, this.rows, this.current_row); this.columns.get(this.columns.size() - 1).addElement(c); return c; } public Container addNewWhile(String condition) { Container c = new While(this.getHandler(), this.getGraphics(), this, this.rows, this.current_row, condition); this.columns.get(this.columns.size() - 1).addElement(c); return c; } protected ArrayList getColumns() { return this.columns; } protected Column getLastColumn() { return this.columns.get(this.columns.size() - 1); } public boolean isRoot() { if (this.parent == null) return true; return false; } public Container close() { if (Const.AutoInsertIF && (this.parent != null)) this.setStopElement(new EndIf(this.getHandler(), this.getGraphics(), null)); else if (this.parent != null) this.setStopElement(new StopElement(this.getHandler(), this.getGraphics(), 0, null)); return this.parent; } private Row getNextRow() { while (this.rows.size() <= current_row) this.rows.add(new Row()); return this.rows.get(current_row); } private Row getFirstRow() { int init_row = this.init_row; if (this.start != null) init_row--; while (this.rows.size() <= init_row) this.rows.add(new Row()); return this.rows.get(init_row); } private Row getLastRow() { int max_row = this.max_row; if (this.stop != null) max_row--; while (this.rows.size() <= max_row) this.rows.add(new Row()); return this.rows.get(max_row); } private void inc_row() { this.current_row++; if (this.current_row > this.max_row) { this.max_row++; if (this.parent != null) this.parent.inc_row(); } } public void setStartElement(StartElement e) { this.getFirstRow().exchangeElementOrInsert(this.start, e); if (this.start == null) { this.current_row++; this.init_row++; this.max_row++; if (this.parent != null) this.parent.inc_row(); } this.start = e; } public void setStopElement(StopElement e) { this.getLastRow().exchangeElementOrInsert(this.stop, e); if (this.stop == null) { this.max_row++; if (this.parent != null) this.parent.inc_row(); } this.stop = e; } public void addColumn() { this.columns.add(new Column(this.getGraphics())); this.current_row = this.init_row; } public void addElement(Element e) { this.columns.get(this.columns.size() - 1).addElement(e); this.getNextRow().addElement(e); this.inc_row(); } @Override public boolean arrowIn() { if (start == null) return false; else return start.arrowIn(); } @Override public boolean connectIn() { for (Column c : this.columns) if (c.getFirstElement().connectIn()) return true; return false; } @Override public boolean connectOut_overrideable() { for (Column c : this.columns) if (c.getLastElement().connectOut()) return true; return false; } @Override protected Point getConnect(Direction dir) { if (dir.equals(Direction.TOP)) { if (this.start != null) return this.start.getConnect(dir); } if (dir.equals(Direction.BOTTOM)) { if (this.stop != null) return this.stop.getConnect(dir); } return super.getConnect(dir); } @Override protected int getHeight() { int height = 0; for (Column c : this.columns) { int h = c.getHeight(); if (h > height) height = h; } if (this.start != null) height += this.start.getHeight(); if (this.stop != null) height += this.stop.getHeight(); return height; } @Override public int getLeftWidth() { int width = 0, i = 0; for (i = 0; i < this.columns.size() / 2; i++) width += this.columns.get(i).getWidth(); if (this.columns.size() % 2 == 1) width += this.columns.get(i).getLeftWidth(); width += ((this.columns.size() - 1)) / 2.0 * (Const.COLUMN_PAD * getZoom()); if (start != null) if (start.getLeftWidth() > width) width = start.getLeftWidth(); if (stop != null) if (stop.getLeftWidth() > width) width = stop.getLeftWidth(); return width; } @Override protected int getRightWidth() { int width = 0, i = this.columns.size() / 2; if (this.columns.size() % 2 == 1) { width += this.columns.get(i).getRightWidth(); i++; } for (; i < this.columns.size(); i++) width += this.columns.get(i).getWidth(); width += ((this.columns.size() - 1)) / 2.0 * (Const.COLUMN_PAD * getZoom()); if (start != null) if (start.getRightWidth() > width) width = start.getRightWidth(); if (stop != null) if (stop.getRightWidth() > width) width = stop.getRightWidth(); return width; } @Override public int getWidth() { int width = 0, i = 0; for (i = 0; i < this.columns.size(); i++) width += this.columns.get(i).getWidth(); width += (this.columns.size() - 1) * (Const.COLUMN_PAD * getZoom()); if (start != null) if (start.getWidth() > width) width = start.getWidth(); if (stop != null) if (stop.getWidth() > width) width = stop.getWidth(); return width; } @Override public void setX(int x) { if (this.start != null) this.start.setX(x); if (this.stop != null) this.stop.setX(x); if (this.columns.size() == 1) this.columns.get(0).setX(x); else { x -= this.getLeftWidth(); int i = 1; for (Column c : this.columns) { x += c.getLeftWidth(); c.setX(x); x += c.getRightWidth(); if (i < this.columns.size()) x += (Const.COLUMN_PAD * getZoom()); i++; } } } protected StartElement getStartElement() { return start; } protected StopElement getStopElement() { return stop; } public void removeEmptyColumns() { // remove empty columns first (may be possible because of goto element for (int i = 0; i < this.columns.size();) { if (this.columns.get(i).isEmpty()) this.columns.remove(i); else i++; } } @Override public void paint() { boolean paintstart = this.connectIn(); boolean paintstop = this.connectOut(); if (this.start == null) paintstart = false; if (this.stop == null) paintstop = false; if (paintstart) this.start.paint(); if (paintstop) this.stop.paint(); for (Column c : this.columns) { if (paintstart) this.start.connectTo(c.getFirstElement()); c.paint(); if (paintstop) this.stop.connectTo(c.getLastElement()); } } @Override public void printData(String prefix) { prefix += " "; for (Column c : this.columns) { c.printData(prefix + "\n"); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/If.java0000644000175000001440000000153511576116034023722 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import com.baselet.diagram.DiagramHandler; public class If extends StartElement { private int h = (int) (40 * getZoom()); private int w = (int) (40 * getZoom()); public If(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), id == null ? "If" : id); this.setHeight(h); this.setWidth(w); } @Override public void paint() { int x = this.getPosition().x; int y = this.getPosition().y; this.getGraphics().drawLine(x, y - h / 2, x + w / 2, y); this.getGraphics().drawLine(x, y - h / 2, x - w / 2, y); this.getGraphics().drawLine(x, y + h / 2, x + w / 2, y); this.getGraphics().drawLine(x, y + h / 2, x - w / 2, y); } @Override public boolean arrowIn() { return true; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Element.java0000644000175000001440000000622011576116034024751 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public abstract class Element { private Graphics2D graphics; private int leftwidth, rightwidth, height; private int padding; private Point cord; private String id; private Row row; private DiagramHandler handler; private float zoom; // specifies whether the element must not connect to another element. private boolean terminated; public Element(DiagramHandler handler, Graphics2D g, int padding, String id) { this.handler = handler; this.graphics = g; this.padding = padding; this.id = id; this.leftwidth = 0; this.rightwidth = 0; this.height = 0; this.cord = new Point(0, 0); this.zoom = handler.getZoomFactor(); } public void setRow(Row row) { this.row = row; } public Row getRow() { return this.row; } public final void setTerminated() { this.terminated = true; } public final void setNotTerminated() { this.terminated = false; } public Point getPosition() { return this.cord; } public void setY(int y) { this.cord.y = y; } public void setX(int x) { this.cord.x = x; } protected Graphics2D getGraphics() { return graphics; } public String getId() { return this.id; } protected int getHeight() { return height; } protected void setHeight(int height) { this.height = height; } protected int getLeftWidth() { return leftwidth; } protected int getRightWidth() { return rightwidth; } protected int getWidth() { return this.getLeftWidth() + this.getRightWidth(); } protected void setWidth(int width) { this.setLeftWidth(width / 2); this.setRightWidth(width - width / 2); } protected void setLeftWidth(int width) { this.leftwidth = width; } protected void setRightWidth(int width) { this.rightwidth = width; } protected int getPadding() { return this.padding; } public abstract void paint(); public boolean connectIn() { return true; } public boolean connectOut_overrideable() { return true; } public final boolean connectOut() { return this.connectOut_overrideable() && !this.terminated; } public boolean arrowOut() { return true; } public boolean arrowIn() { return true; } public void printData(String prefix) { System.out.println(prefix + this.getClass().getSimpleName()); } // get connect for GOTO element protected Point getNonStdConnectIn(Direction dir) { return this.getConnect(dir); } protected Point getNonStdConnectOut(Direction dir) { return this.getConnect(dir); } protected Point getConnect(Direction dir) { Point c = (Point) this.cord.clone(); if (dir == Direction.TOP) c.y -= this.getHeight() / 2; else if (dir == Direction.BOTTOM) c.y += this.getHeight() - this.getHeight() / 2; else if (dir == Direction.LEFT) c.x -= this.getLeftWidth(); else if (dir == Direction.RIGHT) c.x += this.getRightWidth(); return c; } protected DiagramHandler getHandler() { return handler; } protected float getZoom() { return zoom; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/EventRecieve.java0000644000175000001440000000255211576116034025750 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class EventRecieve extends Activity { private int width = (int) (15 * getZoom()); public EventRecieve(DiagramHandler handler, Graphics2D g, String label, String id) { super(handler, label, g, id == null ? label : id); this.setLeftWidth(width); } @Override public boolean connectIn() { return false; } @Override protected Point getNonStdConnectOut(Direction dir) { if (dir.equals(Direction.LEFT)) { Point c = this.getConnect(Direction.BOTTOM); Point c2 = this.getConnect(Direction.LEFT); c.x = c2.x + width; this.getGraphics().drawLine(c.x, c.y, c.x, c.y + (int) (3 * getZoom())); c.y += (int) (3 * getZoom()); return c; } else return this.getConnect(dir); } @Override public void paint() { int bh = this.getHeight() / 2; Point cord = this.getPosition(); int uh = cord.y - (this.getHeight() - bh); bh += cord.y; this.label.paint(); int[] xPoints = { cord.x - this.getLeftWidth(), cord.x + this.getRightWidth(), cord.x + this.getRightWidth(), cord.x - this.getLeftWidth(), cord.x - this.getLeftWidth() + width }; int[] yPoints = { uh, uh, bh, bh, cord.y }; this.getGraphics().drawPolygon(xPoints, yPoints, xPoints.length); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Fork.java0000644000175000001440000000707011576116034024265 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class Fork extends StartElement { private int h = (int) (4 * getZoom()); // pad for the connectors private int pad = (int) (20 * getZoom()); private int w = (int) (80 * getZoom()); // padding between connectors private int con_pad = (int) (10 * getZoom()); private Integer current_left_x; private Integer current_right_x; public Fork(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), id == null ? "Fork" : id); this.setHeight(h + pad); this.setWidth(w); } @Override public void paint() { int x = this.getPosition().x; int y = this.getPosition().y; this.getGraphics().fillRect(x - w / 2, y - (h + pad) / 2, w, (int) (4 * getZoom())); } @Override public boolean arrowIn() { return true; } @Override protected Point getNonStdConnectIn(Direction dir) { Point c = this.getConnect(Direction.TOP); if (dir.equals(Direction.LEFT)) c.x -= (int) (10 * getZoom()); else if (dir.equals(Direction.RIGHT)) c.x += (int) (10 * getZoom()); if (this.arrowIn()) Connector.drawArrow(this.getGraphics(), getZoom(), c.x, c.y - (int) (10 * getZoom()), c.x, c.y); else this.getGraphics().drawLine(c.x, c.y - (int) (10 * getZoom()), c.x, c.y); c.y -= (int) (10 * getZoom()); return c; } @Override protected Point getNonStdConnectOut(Direction dir) { Point c = this.getConnect(dir); if (dir.equals(Direction.LEFT)) { this.getGraphics().drawLine(c.x - (int) (10 * getZoom()), c.y + (int) (3 * getZoom()), c.x, c.y); c.x -= (int) (10 * getZoom()); c.y += (int) (3 * getZoom()); } else if (dir.equals(Direction.RIGHT)) { this.getGraphics().drawLine(c.x + (int) (10 * getZoom()), c.y + (int) (3 * getZoom()), c.x, c.y); c.x += (int) (10 * getZoom()); c.y += (int) (3 * getZoom()); } return c; } @Override protected Point getConnect(Direction dir) { Point c = (Point) this.getPosition().clone(); if (this.current_left_x == null) { this.current_left_x = this.getPosition().x; this.current_right_x = this.current_left_x; } if (dir == Direction.TOP) c.y -= (pad + h) / 2; else if (dir == Direction.BOTTOM) c.y += (h - pad) / 2; else if (dir == Direction.LEFT) { if (c.x - this.current_left_x < w / 2 - this.con_pad) this.current_left_x -= this.con_pad; c.x = this.current_left_x; c.y += (h - pad) / 2; } else if (dir == Direction.RIGHT) { if (this.current_right_x - c.x < w / 2 - this.con_pad) this.current_right_x += this.con_pad; c.x = this.current_right_x; c.y += (h - pad) / 2; } return c; } @Override public void connectTo(Element e) { if (e != null) { if (this.connectOut_overrideable() && e.connectIn()) { Point from = this.getPosition(); Point to = e.getConnect(Direction.TOP); if (from.x == to.x) from = this.getConnect(Direction.BOTTOM); else if (from.x < to.x) from = this.getConnect(Direction.RIGHT); else if (from.x > to.x) from = this.getConnect(Direction.LEFT); if (from.x != to.x) { this.getGraphics().drawLine(from.x, from.y, to.x, to.y - (int) (Const.PAD * getZoom()) * 2); from.x = to.x; from.y = (int) (to.y - Const.PAD * getZoom() * 2); } if (this.arrowOut() && e.arrowIn()) Connector.drawArrow(this.getGraphics(), getZoom(), from.x, from.y, to.x, to.y); else this.getGraphics().drawLine(from.x, from.y, to.x, to.y); } } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Condition.java0000644000175000001440000000475411576116034025320 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class Condition extends WhileElement { private Label label; public Condition(DiagramHandler handler, String label, Graphics2D g) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), null); this.setLeftWidth((int) (20 * getZoom())); this.label = new Label(handler, label, g, (int) (6 * getZoom())); } @Override public boolean arrowIn() { return false; } @Override protected int getHeight() { return super.getHeight() + this.label.getHeight() + this.label.getPadding() * 2; } @Override protected int getLeftWidth() { return super.getLeftWidth(); } @Override protected int getRightWidth() { return this.label.getWidth() + super.getRightWidth() + this.label.getPadding() * 2; } @Override public void setY(int y) { super.setY(y); this.label.setY(y); } @Override public void setX(int x) { super.setX(x); this.label.setX(x + label.getLeftWidth() + label.getPadding()); } @Override protected Point getNonStdConnectOut(Direction dir) { Point c = this.getConnect(Direction.BOTTOM); this.getGraphics().drawLine(c.x, c.y, c.x, c.y + (int) (5 * getZoom())); c.y += (int) (5 * getZoom()); return c; } @Override public void paint() { Point cord = this.getPosition(); int h = this.getHeight(); int width = this.label.getWidth() + this.label.getPadding() * 2; int height = this.label.getHeight() / 2 + this.label.getPadding(); int pad = this.label.getPadding(); // draw connector line this.getGraphics().drawLine(cord.x, cord.y - h / 2, cord.x, cord.y + h - h / 2); // draw left bracket this.getGraphics().drawLine(cord.x + pad / 2, cord.y - height, cord.x + pad / 2, cord.y + height); this.getGraphics().drawLine(cord.x + pad / 2, cord.y - height, cord.x + pad / 2 + (int) (5 * getZoom()), cord.y - height); this.getGraphics().drawLine(cord.x + pad / 2, cord.y + height, cord.x + pad / 2 + (int) (5 * getZoom()), cord.y + height); this.label.paint(); // draw right bracket this.getGraphics().drawLine(cord.x + width, cord.y - height, cord.x + width, cord.y + height); this.getGraphics().drawLine(cord.x + width, cord.y - height, cord.x + width - (int) (5 * getZoom()), cord.y - height); this.getGraphics().drawLine(cord.x + width, cord.y + height, cord.x + width - (int) (5 * getZoom()), cord.y + height); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/While.java0000644000175000001440000000376511576116034024443 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.util.ArrayList; import com.baselet.diagram.DiagramHandler; public class While extends Container { private WhileElement while_element; public While(DiagramHandler handler, Graphics2D g, Container parent, ArrayList rows, int row, String condition) { super(handler, g, parent, rows, row); if ((condition != null) && !condition.equals("")) this.while_element = new Condition(handler, condition, g); else this.while_element = new LineSpacer(handler, g); super.setStartElement(new If(handler, g, null)); this.addElement(this.while_element); this.addColumn(); } @Override public int getLeftWidth() { int width = this.getColumns().get(0).getWidth(); if (this.getColumns().size() > 1) width += this.getColumns().get(1).getLeftWidth() + (Const.COLUMN_PAD * getZoom()); return width; } @Override protected int getRightWidth() { int width = 0; ArrayList columns = this.getColumns(); if (columns.size() > 1) width += columns.get(1).getRightWidth(); for (int i = 2; i < columns.size(); i++) width += columns.get(i).getWidth() + (Const.COLUMN_PAD * getZoom()); return width; } @Override public void paint() { this.getStartElement().setNotTerminated(); this.getStartElement().paint(); this.getStopElement().paint(); this.while_element.connectTo(this.getStartElement(), this.getStopElement()); this.while_element.paint(); ArrayList columns = this.getColumns(); for (int i = 1; i < columns.size(); i++) { Column c = columns.get(i); this.getStartElement().connectTo(c.getFirstElement()); c.paint(); this.getStopElement().connectTo(c.getLastElement()); } } // dont allow change of start/stop elements @Override public void setStartElement(StartElement e) { } @Override public void setStopElement(StopElement e) { super.setStopElement(new EndIf(this.getHandler(), this.getGraphics(), null)); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/WhileElement.java0000644000175000001440000000226411576116034025746 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public abstract class WhileElement extends Element { public WhileElement(DiagramHandler handler, Graphics2D g, int padding, String id) { super(handler, g, padding, id); } public void connectTo(StartElement start, StopElement stop) { if (this.connectOut() && start.connectIn()) { Point from = this.getConnect(Direction.TOP); Point to = start.getConnect(Direction.LEFT); this.getGraphics().drawLine(from.x, from.y, from.x, to.y); if (this.arrowOut() && start.arrowIn()) Connector.drawArrow(this.getGraphics(), getZoom(), from.x, to.y, to.x, to.y); else this.getGraphics().drawLine(from.x, to.y, to.x, to.y); } if (this.connectIn() && stop.connectOut()) { Point to = this.getConnect(Direction.BOTTOM); Point from = stop.getConnect(Direction.LEFT); this.getGraphics().drawLine(from.x, from.y, to.x, from.y); if (this.arrowIn() && stop.arrowOut()) Connector.drawArrow(this.getGraphics(), getZoom(), to.x, from.y, to.x, to.y); else this.getGraphics().drawLine(to.x, from.y, to.x, to.y); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Label.java0000644000175000001440000000251511576116034024402 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Rectangle2D; import com.baselet.diagram.DiagramHandler; public class Label extends Element { private String[] label; private int line_height; public Label(DiagramHandler handler, String label, Graphics2D g, int padding) { super(handler, g, padding, null); this.label = label.split("\\\\"); int w = 0, h = 0; for (int i = 0; i < this.label.length; i++) { Rectangle2D rect = g.getFont().getStringBounds(this.label[i], g.getFontRenderContext()); w = w < (int) (rect.getMaxX() - rect.getMinX()) ? (int) (rect.getMaxX() - rect.getMinX()) : w; h += (int) (rect.getMaxY() - rect.getMinY()); this.line_height = (int) (rect.getMaxY() - rect.getMinY()); } this.setWidth(w); this.setHeight(h); } @Override public boolean connectIn() { return false; } @Override public boolean connectOut_overrideable() { return false; } @Override public void paint() { Point cord = this.getPosition(); int y = cord.y - this.getHeight() / 2 - this.getPadding(); for (int i = 0; i < this.label.length; i++) this.getGraphics().drawString(this.label[i], cord.x - this.getWidth() / 2, y + this.getHeight() - (this.label.length - i - 1) * this.line_height - 1); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Row.java0000644000175000001440000000357411576116034024140 0ustar benuserspackage com.umlet.element.activity; import java.util.ArrayList; public class Row { private ArrayList elements; public Row() { this.elements = new ArrayList(); } public void exchangeElementOrInsert(Element old_element, Element new_element) { if (this.elements.contains(old_element)) { this.elements.set(this.elements.indexOf(old_element), new_element); } else this.addElement(new_element); new_element.setRow(this); } public boolean isLeft(Element e) { if (e.equals(this.elements.get(0))) return true; return false; } public boolean isRight(Element e) { if (e.equals(this.elements.get(this.elements.size() - 1))) return true; return false; } public ArrayList makeExclusiveLeft(Element e, ArrayList rows) { Row new_row = new Row(); int index = this.elements.indexOf(e); for (int i = 0; i < index; i++) { new_row.addElement(this.elements.get(0)); this.elements.remove(0); } rows.add(rows.indexOf(this) + 1, new_row); return rows; } public ArrayList makeExclusiveRight(Element e, ArrayList rows) { Row new_row = new Row(); int index = this.elements.indexOf(e); int size = this.elements.size(); for (int i = index + 1; i < size; i++) { new_row.addElement(this.elements.get(index + 1)); this.elements.remove(index + 1); } rows.add(rows.indexOf(this) + 1, new_row); return rows; } public void addElement(Element e) { this.elements.add(e); e.setRow(this); } public int setElementYPosition(int offset) { int h = this.getHeight(); int y = offset + h / 2; for (Element e : this.elements) { e.setY(y); } return offset + h; } public int getHeight() { int height = 0; for (Element e : this.elements) { int h = e.getHeight() + e.getPadding() * 2; if (h > height) height = h; } return height; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Const.java0000644000175000001440000000104411576116034024445 0ustar benuserspackage com.umlet.element.activity; public class Const { // vertical pad between elements public static int PAD = 10; // horizontal pad between columns public static int COLUMN_PAD = 30; // seperation of goto elements public static int GOTO_SEP = 4; // left/right pad for diagram border public static int DIAGRAM_PAD = 30; // minwidth/height of the diagram public static int MIN_WIDTH = 50; public static int MIN_HEIGHT = 50; public static final boolean DEBUG = false; public static boolean AutoInsertIF; } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/AEnd.java0000644000175000001440000000141411576116034024167 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class AEnd extends End { public AEnd(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, id == null ? "AEnd" : id); } @Override public void paint() { Point cord = this.getPosition(); this.getGraphics().drawArc(cord.x - (int) (10 * getZoom()), cord.y - (int) (10 * getZoom()), (int) (21 * getZoom()), (int) (21 * getZoom()), 0, 360); int delta = (int) (21 * getZoom() / 2 / Math.sqrt(2)); this.getGraphics().drawLine(cord.x - delta, cord.y - delta, cord.x + delta, cord.y + delta); this.getGraphics().drawLine(cord.x - delta, cord.y + delta, cord.x + delta, cord.y - delta); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/EventRaise.java0000644000175000001440000000176211576116034025433 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class EventRaise extends Activity { private int width = (int) (15 * getZoom()); public EventRaise(DiagramHandler handler, Graphics2D g, String label, String id) { super(handler, label, g, id == null ? label : id); this.setRightWidth(width); } @Override public boolean connectOut_overrideable() { return false; } @Override public void paint() { int bh = this.getHeight() / 2; Point cord = this.getPosition(); int uh = cord.y - (this.getHeight() - bh); bh += cord.y; this.label.paint(); int[] xPoints = { cord.x - this.getLeftWidth(), cord.x + this.getRightWidth() - width, cord.x + this.getRightWidth(), cord.x + this.getRightWidth() - width, cord.x - this.getLeftWidth() }; int[] yPoints = { uh, uh, cord.y, bh, bh }; this.getGraphics().drawPolygon(xPoints, yPoints, xPoints.length); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/LineSpacer.java0000644000175000001440000000137211576116034025410 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class LineSpacer extends WhileElement { public LineSpacer(DiagramHandler handler, Graphics2D g) { super(handler, g, 0, null); this.setHeight((int) (Const.PAD * 2 * getZoom())); this.setWidth((int) (Const.PAD * 6 * getZoom())); } @Override public boolean arrowIn() { return false; } @Override protected Point getNonStdConnectOut(Direction dir) { return this.getConnect(Direction.BOTTOM); } @Override public void paint() { int h = this.getHeight() / 2; Point cord = this.getPosition(); this.getGraphics().drawLine(cord.x, cord.y - h, cord.x, cord.y + h); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Start.java0000644000175000001440000000127311576116034024460 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class Start extends Element { public Start(DiagramHandler handler, Graphics2D g) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), null); this.setWidth((int) (21 * getZoom())); this.setHeight((int) (21 * getZoom())); } @Override public boolean connectIn() { return false; } @Override public void paint() { Point cord = this.getPosition(); this.getGraphics().fillArc(cord.x - (int) (10 * getZoom()), cord.y - (int) (10 * getZoom()), (int) (21 * getZoom()), (int) (21 * getZoom()), 0, 360); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/GoTo.java0000644000175000001440000000275311576116034024237 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.umlet.element.ActivityDiagramText; public class GoTo { private Graphics2D graphics; private String to_id; private Element from_element; private Element to_element; private Direction dir; public GoTo(Graphics2D g, Element from, String to) { this.graphics = g; this.to_id = to; this.from_element = from; } public void setDirection(Direction dir) { this.dir = dir; } public Element getFromElement() { return this.from_element; } public Element getToElement() { return this.to_element; } public String getToElementId() { return this.to_id; } public void setToElement(Element e) { this.to_element = e; } public void paint(ActivityDiagramText dia) { if (this.from_element.connectOut_overrideable() && this.to_element.connectIn() && this.to_element.arrowIn()) { Point from = this.from_element.getNonStdConnectOut(dir); Point to = this.to_element.getNonStdConnectIn(dir); Point to_origin = this.to_element.getConnect(dir); int x = dia.getGotoPosition(dir); this.graphics.drawLine(from.x, from.y, x, from.y); this.graphics.drawLine(x, from.y, x, to.y); if ((to.x == to_origin.x) && (to.y == to_origin.y)) { float zoom = dia.getHandler().getZoomFactor(); Connector.drawArrow(this.graphics, zoom, x, to.y, to.x, to.y); } else this.graphics.drawLine(x, to.y, to.x, to.y); } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Activity.java0000644000175000001440000000253011576116034025154 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import com.baselet.diagram.DiagramHandler; public class Activity extends Element { protected Label label; public Activity(DiagramHandler handler, String label, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), id == null ? label : id); this.label = new Label(handler, label, g, (int) (5 * getZoom())); } @Override protected int getHeight() { return this.label.getHeight() + this.label.getPadding() * 2 + super.getHeight(); } @Override protected int getLeftWidth() { return this.label.getLeftWidth() + this.label.getPadding() + super.getLeftWidth(); } @Override protected int getRightWidth() { return this.label.getRightWidth() + this.label.getPadding() + super.getRightWidth(); } @Override public void setY(int y) { super.setY(y); this.label.setY(y); } @Override public void setX(int x) { super.setX(x); this.label.setX(x); } @Override public void paint() { int h = this.getHeight(); this.label.paint(); this.getGraphics().drawRoundRect(this.getPosition().x - this.label.getLeftWidth() - this.label.getPadding(), this.getPosition().y - h / 2, this.label.getWidth() + this.label.getPadding() * 2, h, (int) (20 * getZoom()), (int) (20 * getZoom())); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Connector.java0000644000175000001440000000305111576116034025311 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; public class Connector { private Element e1, e2; private Graphics2D graphics; public static void drawArrow(Graphics2D graphics, float zoom, int x1, int y1, int x2, int y2) { double ax1, ax2, ay1, ay2; int ax_1, ax_2, ay_1, ay_2; double angle = Math.atan2(y2 - y1, x2 - x1); ax1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)) - (int) (7 * zoom); ax2 = ax1; ay1 = -(int) (4 * zoom); ay2 = (int) (5 * zoom); ax_1 = (int) (Math.cos(angle) * ax1 - Math.sin(angle) * ay1) + x1; ay_1 = (int) (Math.sin(angle) * ax1 + Math.cos(angle) * ay1) + y1; ax_2 = (int) (Math.cos(angle) * ax2 - Math.sin(angle) * ay2) + x1; ay_2 = (int) (Math.sin(angle) * ax2 + Math.cos(angle) * ay2) + y1; graphics.drawLine(x1, y1, x2, y2); graphics.drawLine(x2, y2, ax_1, ay_1); graphics.drawLine(x2, y2, ax_2, ay_2); } public Connector(Graphics2D g, Element e1, Element e2) { this.graphics = g; this.e1 = e1; this.e2 = e2; } public void paint() { if (e1.connectOut() && e2.connectIn()) { Point c2 = this.e2.getConnect(Direction.TOP); Point c1 = this.e1.getConnect(Direction.BOTTOM); if ((c1 != null) && (c2 != null)) { if (!c1.equals(c2)) { if (e1.arrowOut() && e2.arrowIn()) { float zoom = e1.getHandler().getZoomFactor(); Connector.drawArrow(this.graphics, zoom, c1.x, c1.y, c2.x, c2.y); } else this.graphics.drawLine(c1.x, c1.y, c2.x, c2.y); } } } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Direction.java0000644000175000001440000000013711576116034025301 0ustar benuserspackage com.umlet.element.activity; public enum Direction { TOP, LEFT, RIGHT, BOTTOM; } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/PartActivity.java0000644000175000001440000000357711576116034026017 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class PartActivity extends Activity { private int minwidth = (int) (120 * getZoom()); private int height = (int) (20 * getZoom()); public PartActivity(DiagramHandler handler, String label, Graphics2D g, String id) { super(handler, label, g, id == null ? label : id); this.setHeight(height); } @Override protected int getLeftWidth() { return super.getLeftWidth() > minwidth / 2 ? super.getLeftWidth() : minwidth / 2; } @Override protected int getRightWidth() { return super.getRightWidth() > minwidth / 2 ? super.getRightWidth() : minwidth / 2; } @Override public void paint() { Point cord = this.getPosition(); int h = this.getHeight(); this.label.paint(); this.getGraphics().drawRoundRect(cord.x - this.getLeftWidth(), cord.y - h / 2, this.getWidth(), h, (int) (20 * getZoom()), (int) (20 * getZoom())); this.getGraphics().drawRoundRect(cord.x - minwidth / 4, cord.y + h / 2 - height + (int) (5 * getZoom()), (int) (30 * getZoom()), (int) (10 * getZoom()), (int) (10 * getZoom()), (int) (10 * getZoom())); this.getGraphics().drawRoundRect(cord.x + (int) (15 * getZoom()), cord.y + h / 2 - height + (int) (5 * getZoom()), (int) (30 * getZoom()), (int) (10 * getZoom()), (int) (10 * getZoom()), (int) (10 * getZoom())); int x1 = cord.x - minwidth / 4 + (int) (30 * getZoom()); int x2 = cord.x + (int) (15 * getZoom()); int y = cord.y + h / 2 - height / 2; this.getGraphics().drawLine(x1, y, x2, y); this.getGraphics().drawLine(x2, y, x2 - (int) (3 * getZoom()), y - (int) (2 * getZoom())); this.getGraphics().drawLine(x2, y, x2 - (int) (3 * getZoom()), y + (int) (2 * getZoom())); } @Override public void setY(int y) { super.setY(y); this.label.setY(y - height / 2); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/StopElement.java0000644000175000001440000000245211576116034025622 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class StopElement extends Element { public StopElement(DiagramHandler handler, Graphics2D g, int padding, String id) { super(handler, g, padding, id); } @Override public void paint() { } @Override public boolean arrowIn() { return false; } public void connectTo(Element e) { if (e != null) { if (this.connectIn() && e.connectOut()) { Point to = this.getPosition(); Point from = e.getConnect(Direction.BOTTOM); if (from.x == to.x) to = this.getConnect(Direction.TOP); else if (from.x < to.x) to = this.getConnect(Direction.LEFT); else if (from.x > to.x) to = this.getConnect(Direction.RIGHT); if (from.x != to.x) { this.getGraphics().drawLine(from.x, from.y, from.x, to.y); if (this.arrowIn() && e.arrowOut()) Connector.drawArrow(this.getGraphics(), getZoom(), from.x, to.y, to.x, to.y); else this.getGraphics().drawLine(from.x, to.y, to.x, to.y); } else { if (this.arrowIn() && e.arrowOut()) Connector.drawArrow(this.getGraphics(), getZoom(), from.x, from.y, to.x, to.y); else this.getGraphics().drawLine(from.x, from.y, to.x, to.y); } } } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Column.java0000644000175000001440000000325311576116034024620 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.util.ArrayList; public class Column { private ArrayList elements; private Graphics2D graphics; public Column(Graphics2D graphics) { this.elements = new ArrayList(); this.graphics = graphics; } public boolean isEmpty() { return this.elements.isEmpty(); } public Element getFirstElement() { if (!this.elements.isEmpty()) return this.elements.get(0); return null; } public Element getLastElement() { if (!this.elements.isEmpty()) return this.elements.get(this.elements.size() - 1); return null; } public void addElement(Element e) { this.elements.add(e); } public int getHeight() { int height = 0; for (Element e : this.elements) height += e.getHeight() + e.getPadding() * 2; return height; } public int getLeftWidth() { int width = 0; for (Element e : this.elements) { int w = e.getLeftWidth(); if (w > width) width = w; } return width; } public int getRightWidth() { int width = 0; for (Element e : this.elements) { int w = e.getRightWidth(); if (w > width) width = w; } return width; } public int getWidth() { return this.getLeftWidth() + this.getRightWidth(); } public void setX(int x) { for (Element e : this.elements) e.setX(x); } public void paint() { Element current = null; for (Element e : this.elements) { if (current != null) (new Connector(this.graphics, current, e)).paint(); e.paint(); current = e; } } public void printData(String prefix) { for (Element e : this.elements) e.printData(prefix); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/EndIf.java0000644000175000001440000000155111576116034024347 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import com.baselet.diagram.DiagramHandler; public class EndIf extends StopElement { private int h = (int) (40 * getZoom()); private int w = (int) (40 * getZoom()); public EndIf(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * handler.getZoomFactor()), id == null ? "EndIf" : id); this.setHeight(h); this.setWidth(w); } @Override public void paint() { int x = this.getPosition().x; int y = this.getPosition().y; this.getGraphics().drawLine(x, y - h / 2, x + w / 2, y); this.getGraphics().drawLine(x, y - h / 2, x - w / 2, y); this.getGraphics().drawLine(x, y + h / 2, x + w / 2, y); this.getGraphics().drawLine(x, y + h / 2, x - w / 2, y); } @Override public boolean arrowIn() { return true; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/activity/Sync.java0000644000175000001440000000653011576116034024300 0ustar benuserspackage com.umlet.element.activity; import java.awt.Graphics2D; import java.awt.Point; import com.baselet.diagram.DiagramHandler; public class Sync extends StopElement { private int h = (int) (4 * getZoom()); // pad for the connectors private int pad = (int) (20 * getZoom()); private int w = (int) (80 * getZoom()); // padding between connectors private int con_pad = (int) (10 * getZoom()); private Integer current_left_x; private Integer current_right_x; public Sync(DiagramHandler handler, Graphics2D g, String id) { super(handler, g, (int) (Const.PAD * 2 * handler.getZoomFactor()), id == null ? "Sync" : id); this.setHeight(h + pad); this.setWidth(w); } @Override public void paint() { int x = this.getPosition().x; int y = this.getPosition().y; this.getGraphics().fillRect(x - w / 2, y + (pad - h) / 2, w, (int) (4 * getZoom())); } @Override public boolean arrowIn() { return true; } @Override protected Point getNonStdConnectIn(Direction dir) { Point c = this.getConnect(dir); Point c2 = (Point) c.clone(); if (dir.equals(Direction.LEFT)) c2.x -= (int) (10 * getZoom()); else if (dir.equals(Direction.RIGHT)) c2.x += (int) (10 * getZoom()); c2.y -= (int) (10 * getZoom()); if (this.arrowIn()) Connector.drawArrow(this.getGraphics(), getZoom(), c2.x, c2.y, c.x, c.y); else this.getGraphics().drawLine(c2.x, c2.y, c.x, c.y); return c2; } @Override protected Point getNonStdConnectOut(Direction dir) { Point c = this.getConnect(Direction.BOTTOM); if (dir.equals(Direction.LEFT)) c.x -= (int) (10 * getZoom()); else if (dir.equals(Direction.RIGHT)) c.x += (int) (10 * getZoom()); this.getGraphics().drawLine(c.x, c.y + (int) (5 * getZoom()), c.x, c.y); c.y += (int) (5 * getZoom()); return c; } @Override protected Point getConnect(Direction dir) { Point c = (Point) this.getPosition().clone(); if (this.current_left_x == null) { this.current_left_x = this.getPosition().x; this.current_right_x = this.current_left_x; } if (dir == Direction.TOP) c.y += (pad - h) / 2; else if (dir == Direction.BOTTOM) c.y += (pad + h) / 2; else if (dir == Direction.LEFT) { if (c.x - this.current_left_x < w / 2 - this.con_pad) this.current_left_x -= this.con_pad; c.x = this.current_left_x; c.y += (pad - h) / 2; } else if (dir == Direction.RIGHT) { if (this.current_right_x - c.x < w / 2 - this.con_pad) this.current_right_x += this.con_pad; c.x = this.current_right_x; c.y += (pad - h) / 2; } return c; } @Override public void connectTo(Element e) { if (e != null) { if (this.connectIn() && e.connectOut()) { Point to = this.getPosition(); Point from = e.getConnect(Direction.BOTTOM); if (from.x == to.x) to = this.getConnect(Direction.TOP); else if (from.x < to.x) to = this.getConnect(Direction.LEFT); else if (from.x > to.x) to = this.getConnect(Direction.RIGHT); if (from.x != to.x) { this.getGraphics().drawLine(from.x, from.y, from.x, to.y - (int) (Const.PAD * 2 * getZoom())); from.y = to.y - (int) (Const.PAD * 2 * getZoom()); } if (this.arrowIn() && e.arrowOut()) Connector.drawArrow(this.getGraphics(), getZoom(), from.x, from.y, to.x, to.y); else this.getGraphics().drawLine(from.x, from.y, to.x, to.y); } } } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/Class.java0000644000175000001440000002363011576116034022575 0ustar benuserspackage com.umlet.element; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.awt.Rectangle; import java.util.Vector; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Class extends GridElement { // A.Mueller start private Vector innerClasses; private boolean _isTemplate = false; private boolean _isInnerClass = false; private String _panelString = ""; private int _templateHeight = 0; private int _templateWidth = 0; // A.Mueller end public Class() { super(); innerClasses = new Vector(); // A.Mueller } private Vector getStringVector() { if (this.isInnerClass()) return Utils.decomposeStrings(_panelString); // A.Mueller Vector ret = Utils.decomposeStrings(this.getPanelAttributes()); return ret; } // A.Mueller start public Vector getInnerClasses() { return this.innerClasses; } public boolean isInnerClass() { return _isInnerClass; } public void setIsInnerClass(boolean i) { this._isInnerClass = i; } public void setPanelString(String p) { this._panelString = p; } // A.Mueller end @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); // setAutoresize(50, 50); int innerSoFar = 0; // A.Mueller _isTemplate = false; Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Vector tmp = getStringVector(); int yPos = 0; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); Composite[] composites = colorize(g2); // LME: enable colors g2.setColor(fgColor); Rectangle r = this.getBounds(); LineType lineType = LineType.SOLID; int thickness = 1; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("bt=.")) { lineType = LineType.DASHED; } if (s.equals("bt=*")) { thickness = 2; } else if (s.startsWith("template") && (i == 0)) { String[] template = s.split("="); if (template.length != 2) _isTemplate = false; else _isTemplate = true; } } if (!_isTemplate) { g2.setComposite(composites[1]); // set aplha composite for drawing the background color g2.setColor(bgColor); g2.fillRect(0, 0, (int) r.getWidth() - 1, (int) r.getHeight() - 1); g2.setComposite(composites[0]); // reset composite settings if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g2.setStroke(Utils.getStroke(lineType, thickness)); g2.drawRect(0, 0, (int) r.getWidth() - 1, (int) r.getHeight() - 1); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } boolean CENTER = true; for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("bt=.") || s.equals("bt=*")) { /* don't draw these lines because they are only for markup */ } else if (s.equals("--")) { CENTER = false; // A.Mueller start if (_isTemplate) g2.drawLine(0, yPos, this.getWidth() - 1 - this.getWidth() / 10, yPos); else g2.drawLine(0, yPos, this.getWidth() - 1, yPos); // A.Mueller end yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); // A.Mueller start } else if (s.equals("{active}") && (i == 0)) { g2.drawLine((int) this.getHandler().getFontHandler().getFontSize() / 2, 0, (int) this.getHandler().getFontHandler().getFontSize() / 2, this.getHeight() - 1); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize() / 2, 0, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize() / 2, this.getHeight() - 1); yPos = this.getHeight() / 2 - (tmp.size() - 1) * ((int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts())) / 2; } else if (s.startsWith("template") && (i == 0)) { String[] template = s.split("="); if (template.length == 2) { _templateWidth = this.getHandler().getFontHandler().getTextWidth(template[1]) + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); _templateHeight = (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()) + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); Polygon border = new Polygon(); border.addPoint(0, _templateHeight / 2); border.addPoint(getWidth() - _templateWidth, _templateHeight / 2); border.addPoint(0, _templateHeight / 2); border.addPoint(0, this.getHeight()); border.addPoint(0, this.getHeight() - 1); border.addPoint(this.getWidth() - this.getWidth() / 10, this.getHeight() - 1); border.addPoint(this.getWidth() - this.getWidth() / 10, this.getHeight() - 1); border.addPoint(this.getWidth() - this.getWidth() / 10, _templateHeight + 1); border.addPoint(getWidth() - _templateWidth, _templateHeight + 1); border.addPoint(getWidth() - _templateWidth, _templateHeight / 2); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.setComposite(composites[1]); // set alpha composite g2.setColor(bgColor); g2.fillRect(getWidth() - _templateWidth, 0, _templateWidth, _templateHeight + 1); g2.fillPolygon(border); g2.setComposite(composites[0]); // reset composite if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); // draw border lines of template box g2.drawRect(getWidth() - _templateWidth, 0, _templateWidth - 1, _templateHeight); // template box this.getHandler().getFontHandler().writeText(g2, template[1], getWidth() - _templateWidth + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), (int) this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), false); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); // draw border lines of class g2.drawLine(0, _templateHeight / 2, getWidth() - _templateWidth, _templateHeight / 2); g2.drawLine(0, _templateHeight / 2, 0, this.getHeight()); g2.drawLine(0, this.getHeight() - 1, this.getWidth() - this.getWidth() / 10, this.getHeight() - 1); g2.drawLine(this.getWidth() - this.getWidth() / 10, this.getHeight() - 1, this.getWidth() - this.getWidth() / 10, _templateHeight); yPos = yPos + _templateHeight + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else _isTemplate = false; } else if (s.equals("{innerclass")) { String state = ""; // Counting the inner lines helps to determine the Height of the // resulting innerClass (lines times the fontsize gives us the height of // the contents) by adding also the INNER words we make sure to have enough // space at the bottom since the lines of the classes also need space int innerLines = 0; int innerCount = 0; for (i++; i < tmp.size(); i++) { if (tmp.elementAt(i).equals("{innerclass")) { innerCount++; innerLines++; } else if (tmp.elementAt(i).equals("innerclass}")) { if (innerCount > 0) innerCount--; else break; } else innerLines++; state = state + "\n" + tmp.elementAt(i); } Class temp; try { temp = innerClasses.get(innerSoFar); temp.setPanelString(state); } catch (ArrayIndexOutOfBoundsException e) { temp = new Class(); innerClasses.add(innerSoFar, temp); temp.setHandler(this.getHandler()); temp.setIsInnerClass(true); temp.setPanelString(state); innerSoFar++; } int height = innerLines * (int) this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * --innerLines; if (this.isSelected()) temp.onSelected(); else temp.onDeselected(); temp.setLocation(5, yPos); if (_isTemplate) temp.setSize((int) (this.getWidth() - this.getWidth() / 10 - 10 * zoom), height); else temp.setSize((int) (this.getWidth() - 10 * zoom), height); temp.paintEntity(g.create((int) (5 * zoom), yPos, (int) (this.getWidth() - 5 * zoom), temp.getHeight())); yPos = yPos + temp.getHeight() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); // A.Mueller end } else { if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); yPos += (int) this.getHandler().getFontHandler().getFontSize(); if (CENTER) { // A.Mueller if (_isTemplate) this.getHandler().getFontHandler().writeText(g2, s, (this.getWidth() - this.getWidth() / 10) / 2, yPos, true); else this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); } else { this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); } yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } // g2.setStroke(Constants.getStroke(0, 1)); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { // LME: define the polygon on which relations stick on if (!_isTemplate) return super.generateStickingBorder(x, y, width, height); StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y + _templateHeight / 2)); p.addPoint(new Point(x + (9 * width) / 10 + 1, y + _templateHeight / 2)); p.addPoint(new Point(x + (9 * width) / 10 + 1, y + height)); p.addPoint(new Point(x, y + height), true); return p; } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/Interface.java0000644000175000001440000001070411576116034023426 0ustar benuserspackage com.umlet.element; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; @SuppressWarnings("serial") public class Interface extends GridElement { public Interface() { super(); } private Vector getStringVector() { return Utils.decomposeStrings(this.getPanelAttributes()); } @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); Composite[] composites = colorize(g2); // enable colors g2.setColor(fgColor); /* * FontRenderContext rendering; * if (Constants.getFontsize()>12) { * rendering=new FontRenderContext(null, true, true); * g2.setRenderingHints(Constants.UxRenderingQualityHigh()); * } * else { * rendering=new FontRenderContext(null, false, false); * g2.setRenderingHints(Constants.UxRenderingQualityLow()); * } */ boolean ADAPT_SIZE = false; Vector tmp = getStringVector(); int yPos = 0; yPos += 2 * this.getHandler().getGridSize(); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); if (s.equals("--")) { yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); g2.drawLine(this.getWidth() / 2 - (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos, this.getWidth() / 2 + (int) this.getHandler().getFontHandler().getFontSize() * 4, yPos); yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); } else { yPos += (int) this.getHandler().getFontHandler().getFontSize(); TextLayout l = new TextLayout(s, this.getHandler().getFontHandler().getFont(), Constants.FRC); Rectangle2D r2d = l.getBounds(); int width = (int) r2d.getWidth(); int xPos = this.getWidth() / 2 - width / 2; if (xPos < 0) { ADAPT_SIZE = true; break; } this.getHandler().getFontHandler().writeText(g2, s, this.getWidth() / 2, yPos, true); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } } if (ADAPT_SIZE) { (new Resize(this, -this.getHandler().getGridSize(), 0, 0, 0)).execute(this.getHandler()); (new Resize(this, 0, 0, this.getHandler().getGridSize(), 0)).execute(this.getHandler()); return; } if (yPos > this.getHeight()) { (new Resize(this, 0, 0, 0, 20)).execute(this.getHandler()); return; } g2.setComposite(composites[1]); g2.setColor(bgColor); g.fillOval(this.getWidth() / 2 - (int) (10 * zoom), 0, (int) (20 * zoom), (int) (20 * zoom)); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); g.drawOval(this.getWidth() / 2 - (int) (10 * zoom), 0, (int) (20 * zoom), (int) (20 * zoom)); /* * if (_selected) { * g.drawOval(this.getWidth()/2-Constants.getFontsize()+1, 1, 2*Constants.getFontsize()-2, 2*Constants.getFontsize()-2); * } */ } /* * public int doesCoordinateAppearToBeConnectedToMe(Point p) { * int tmpX=p.x-this.getX(); * int tmpY=p.y-this.getY(); * int links=this.getWidth()/2-this.getHandler().getMainUnit(); * int rechts=this.getWidth()/2+this.getHandler().getMainUnit(); * int oben=0; * int unten=2*this.getHandler().getMainUnit(); * if (tmpX>links-4 && tmpXoben-4 && tmpYunten-4 && tmpYoben-4 && tmpYlinks-4 && tmpXrechts-4 && tmpX getStringVector() { return Utils.decomposeStrings(this.getPanelAttributes()); } @Override public void paintEntity(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); // g2.setColor(_activeColor); Composite[] composites = colorize(g2); // enable colors int yPos = 0; yPos += (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(); Vector tmp = this.getStringVector(); Polygon poly = new Polygon(); poly.addPoint(0, 0); poly.addPoint(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0); poly.addPoint(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0); poly.addPoint(this.getWidth() - 1, (int) this.getHandler().getFontHandler().getFontSize()); poly.addPoint(this.getWidth() - 1, (int) this.getHandler().getFontHandler().getFontSize()); poly.addPoint(this.getWidth() - 1, this.getHeight() - 1); poly.addPoint(this.getWidth() - 1, this.getHeight() - 1); poly.addPoint(0, this.getHeight() - 1); poly.addPoint(0, this.getHeight() - 1); poly.addPoint(0, 0); // p.addPoint(this.getWidth()-Constants.getFontsize(),0); p.addPoint(this.getWidth()-Constants.getFontsize(), Constants.getFontsize()); // p.addPoint(this.getWidth()-Constants.getFontsize(),Constants.getFontsize()); p.addPoint(this.getWidth()-1, Constants.getFontsize()); g2.setComposite(composites[1]); g2.setColor(bgColor); g2.fillPolygon(poly); g2.setComposite(composites[0]); if (isSelected) g2.setColor(fgColor); else g2.setColor(fgColorBase); for (int i = 0; i < tmp.size(); i++) { String s = tmp.elementAt(i); yPos += (int) this.getHandler().getFontHandler().getFontSize(); this.getHandler().getFontHandler().writeText(g2, s, (int) this.getHandler().getFontHandler().getFontSize() / 2, yPos, false); yPos += this.getHandler().getFontHandler().getDistanceBetweenTexts(); } g2.drawLine(0, 0, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0, this.getWidth() - 1, (int) this.getHandler().getFontHandler().getFontSize()); g2.drawLine(this.getWidth() - 1, (int) this.getHandler().getFontHandler().getFontSize(), this.getWidth() - 1, this.getHeight() - 1); g2.drawLine(this.getWidth() - 1, this.getHeight() - 1, 0, this.getHeight() - 1); g2.drawLine(0, this.getHeight() - 1, 0, 0); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), 0, this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize()); g2.drawLine(this.getWidth() - (int) this.getHandler().getFontHandler().getFontSize(), (int) this.getHandler().getFontHandler().getFontSize(), this.getWidth() - 1, (int) this.getHandler().getFontHandler().getFontSize()); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/SequenceDiagram.java0000644000175000001440000007106611576116034024573 0ustar benuserspackage com.umlet.element; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.awt.font.TextLayout; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.FontHandler; // An interaction represents a synchronous/asynchronous message // that is sent between two objects. class Interaction { private int srcObj; private boolean srcObjHasControl; private int arrowKind; // 1=SYNC, 2= ASYNC, 3=EDGE, 4=FILLED private int lineKind; // 1=SOLID, 2=DOTTED private int destObj; private boolean destObjHasControl; private String methodName; public Interaction(int srcObj, boolean srcObjHasControl, int arrowKind, int lineKind, int destObj, boolean destObjHasControl, String methodName) { this.srcObj = srcObj; this.srcObjHasControl = srcObjHasControl; this.arrowKind = arrowKind; this.lineKind = lineKind; this.destObj = destObj; this.destObjHasControl = destObjHasControl; this.methodName = methodName; } public boolean hasControl(int objNum) { if ((srcObjHasControl && (srcObj == objNum)) || (destObjHasControl && (destObj == objNum))) return true; else return false; } @Override public boolean equals(Object o) { if (!(o instanceof Interaction)) return false; Interaction i = (Interaction) o; return (srcObj == i.srcObj) && (srcObjHasControl == i.srcObjHasControl) && (arrowKind == i.arrowKind) && (destObj == i.destObj) && (destObjHasControl == i.destObjHasControl) && ((methodName == null) | methodName.equals(i.methodName)); } @Override public int hashCode() { return (methodName != null ? methodName.hashCode() : 1) + srcObj + (srcObjHasControl ? 1 : 0) + arrowKind + destObj + (destObjHasControl ? 1 : 0); } public int getSrcObj() { return srcObj; } public boolean getSrcObjHasControl() { return srcObjHasControl; } public int getArrowKind() { return arrowKind; } public int getLineKind() { return lineKind; } public int getDestObj() { return destObj; } public boolean getDestObjHasControl() { return destObjHasControl; } public String getMethodName() { return methodName; } } // Contains all interactions entered by the user and // offers various comfort-functions for finding and // working with interactions class InteractionManagement { private Set[] level; // private Set[] level; @SuppressWarnings("unchecked") InteractionManagement(int numLevels) { level = new HashSet[numLevels]; for (int i = 0; i < numLevels; i++) { level[i] = new HashSet(); } } public boolean controlBoxExists(int levelNum, int objNum) { Iterator it = level[levelNum - 1].iterator(); while (it.hasNext()) { Interaction ia = it.next(); if (ia.hasControl(objNum)) return true; } return false; } public void add(int numLevel, Interaction i) { level[numLevel - 1].add(i); } public Set getInteractionsInLevel(int levelNum) { return level[levelNum - 1]; } public int getNumLevels() { return level.length; } } @SuppressWarnings("serial") public class SequenceDiagram extends com.baselet.element.GridElement { public int controlFlowBoxWidth = 20; // the dimensions for the rectangle(s) (=objects) in the first line public int rectDistance = 60; // distance between two columns public int rectHeight; // computed public int rectWidth; // computed // int extraTextSpace = 0; public int borderDistance = 10; // d between the component bordeR and the diagram private int yOffsetforTitle = 0; public int rectToFirstLevelDistance = 0; public int levelHeight = 30;// LME//60; // these two constants are important for the arrowhead public int arrowX = 5; public int arrowY = 5; public final int SYNC = 1; public final int ASYNC = 2; public final int EDGE = 3; // LME public final int FILLED = 4; // LME public final int SOLID = 1; // LME public final int DOTTED = 2; // LME private Map labeltonumber; private int levelNum = 0; private InteractionManagement im; public SequenceDiagram() { } @Override public void setHandler(DiagramHandler handler) { super.setHandler(handler); zoomValues(); } @Override public void paintEntity(Graphics g) { zoomValues(); float zoom = getHandler().getZoomFactor(); // Some unimportant initialization stuff; setting color, font // quality, etc. You should not have to change this. Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(fgColor); // draw the border g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); levelNum = 1; Vector lines = Utils.decomposeStrings(this.getPanelAttributes()); if (lines.size() == 0) return; if (lines.elementAt(0).startsWith("title:")) { String title = lines.elementAt(0).substring("title:".length()); if ((title != null) && (title.length() > 0)) { this.getHandler().getFontHandler().writeText(g2, title, (int) (5 * zoom), (int) this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), false); int titlewidth = this.getHandler().getFontHandler().getTextWidth(title); int ty = (int) (8 * zoom) + (int) (this.getHandler().getFontHandler().getFontSize() + this.getHandler().getFontHandler().getDistanceBetweenTexts()); g2.drawLine(0, ty, titlewidth + (int) (10 * zoom), ty); g2.drawLine(titlewidth + (int) (10 * zoom), ty, titlewidth + ty + (int) (10 * zoom), 0); lines.remove(0); yOffsetforTitle = (int) (25 * zoom); } } else yOffsetforTitle = 0; for (int i = 1; i < lines.size(); i++) { String element = lines.elementAt(i); if (element.indexOf("iframe{") >= 0) { element = "9999->0:" + element; // dummy: space for interactionframe lines.set(i, element); } else if (element.indexOf("iframe}") >= 0) { element = "9999<-0:" + element; // dummy: space for interactionframe lines.set(i, element); } // AB: match whitespace characters from the beginning to the end of the line if (lines.elementAt(i).matches("\\A\\s*\\z")) continue; levelNum++; } String firstLine = lines.elementAt(0); Vector obj = Utils.decomposeStrings(firstLine, "|"); int numObjects = obj.size(); // LABEL ADDING // get the labels of the Sequencediagram String newhead = ""; // delete the ids from the header this.labeltonumber = new HashMap(); Pattern p_label = Pattern.compile("([^\\~]+)(\\~([a-zA-Z0-9]+))?(\\_)?"); for (int i = 1; i <= numObjects; i++) { Matcher m = p_label.matcher(obj.get(i - 1)); if (m.matches() && (m.group(2) != null)) { this.labeltonumber.put(m.group(3), i); newhead += "|" + m.group(1) + (m.group(4) == null ? "" : m.group(4)); } else { newhead += "|" + obj.get(i - 1); } if (!this.labeltonumber.containsKey(Integer.toString(i))) // only write number if no other label has this number { this.labeltonumber.put(Integer.toString(i), i); // columnnumber as label for backward compatibility } } obj = Utils.decomposeStrings(newhead.length() > 0 ? newhead.substring(1) : "", "|"); // LABELADDING STOP (exchanged parseInteger Methods with labeltonumber.get methods // parse the messages int curLevel = 0; im = new InteractionManagement(levelNum); String boxStrings = ""; for (int i = 1; i < lines.size(); i++) { String methodName = ""; if (lines.elementAt(i).matches("\\A\\s*\\z")) continue; curLevel++; Vector interactions = Utils.decomposeStrings(lines.elementAt(i), ";"); for (int j = 0; j < interactions.size(); j++) { Pattern p = Pattern.compile("\\A(\\w+)(->>|->|-/>|.>>|.>|./>|->>>|.>>>|<<-|<-|>|->|-/>|.>>|.>|./>|->>>|.>>>)(\\d+)(:((\\d+)(,(\\d+))*))*(?::(.*))?\\z"); // 1->2:1,2:methodName // 1->2:abc Matcher m = p.matcher(interactions.elementAt(j)); if (!m.matches()) continue; Integer srcObj = this.labeltonumber.get(m.group(1)); Integer destObj = this.labeltonumber.get(m.group(3)); int arrowKind = -1; int lineKind = -1; boolean reverse = false; // arrow direction flag if (m.group(2).equals("->")) { arrowKind = ASYNC; lineKind = SOLID; } else if (m.group(2).equals("->>")) { arrowKind = SYNC; lineKind = SOLID; } else if (m.group(2).equals("-/>")) { arrowKind = EDGE; lineKind = SOLID; } // LME else if (m.group(2).equals("->>>")) { arrowKind = FILLED; lineKind = SOLID; } // LME else if (m.group(2).equals(".>")) { arrowKind = ASYNC; lineKind = DOTTED; } // LME else if (m.group(2).equals(".>>")) { arrowKind = SYNC; lineKind = DOTTED; } // LME else if (m.group(2).equals("./>")) { arrowKind = EDGE; lineKind = DOTTED; } // LME else if (m.group(2).equals(".>>>")) { arrowKind = FILLED; lineKind = DOTTED; } // LME else if (m.group(2).equals("<-")) { arrowKind = ASYNC; lineKind = SOLID; reverse = true; } else if (m.group(2).equals("<<-")) { arrowKind = SYNC; lineKind = SOLID; reverse = true; } else if (m.group(2).equals("= 0) group += element.substring(element.indexOf("iframe")); // append info for interactionframe } else // LABLING ADD { String[] grouparray = group.split(","); group = ""; for (String tmp : grouparray) { Integer tempgroup = this.labeltonumber.get(tmp); if (tempgroup != null) group += "," + tempgroup; } if (group.length() > 0) { group = group.substring(1); } else { if (grouparray.length == 1) { group = "#"; methodName = grouparray[0]; } } } // STOP LABLING ADD boxStrings += ";" + group; // LME: get alive Objects boolean srcObjHasControl = srcObj != null ? group.contains(String.valueOf(srcObj)) : false; boolean destObjHasControl = destObj != null ? group.contains(String.valueOf(destObj)) : false; if (methodName.isEmpty()) { methodName = m.group(9); } // LME: removed (in V6) since not necessary // if(destObj==srcObj) levelNum++; //LME: expand the Entity's size if ((srcObj == null) || (destObj == null)) continue; if (!reverse) im.add(curLevel, new Interaction(srcObj, srcObjHasControl, arrowKind, lineKind, destObj, destObjHasControl, methodName)); // normal arrow direction 1->2 else im.add(curLevel, new Interaction(destObj, destObjHasControl, arrowKind, lineKind, srcObj, srcObjHasControl, methodName)); // reverse arrow direction 1<-2 } // #for } // end message parsing // find out the width of the column with the longest text double maxWidth = 0; double maxHeight = 0; for (int i = 0; i < numObjects; i++) { String s = obj.elementAt(i); if (s.startsWith(FontHandler.FormatLabels.UNDERLINE) && s.endsWith(FontHandler.FormatLabels.UNDERLINE) && (s.length() > 2)) { s = s.substring(1, s.length() - 1); } TextLayout layout = new TextLayout(s, this.getHandler().getFontHandler().getFont(), g2.getFontRenderContext()); maxWidth = Math.max(layout.getBounds().getWidth(), maxWidth); maxHeight = Math.max(layout.getBounds().getHeight(), maxHeight); } rectWidth = (int) Math.floor(maxWidth + 1) + 2 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); rectHeight = (int) Math.floor(maxHeight + 1) + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); // draw the first line of the sequence diagram int ypos = borderDistance + yOffsetforTitle; int xpos = borderDistance; for (int i = 0; i < numObjects; i++) { boolean underline = false; String s = obj.elementAt(i); if (s.startsWith(FontHandler.FormatLabels.UNDERLINE) && s.endsWith(FontHandler.FormatLabels.UNDERLINE) && (s.length() > 2)) { underline = true; s = s.substring(1, s.length() - 1); } TextLayout layout = new TextLayout(s, this.getHandler().getFontHandler().getFont(), g2.getFontRenderContext()); g2.drawRect(xpos, ypos, rectWidth - 1, rectHeight - 1); int dx = (rectWidth - 2 - (int) Math.floor(layout.getBounds().getWidth() + 1)) / 2; int dy = (rectHeight - 2 - (int) Math.floor(layout.getBounds().getHeight() + 1)) / 2; int tx = xpos + dx; int ty = ypos + dy + (int) layout.getBounds().getHeight(); layout.draw(g2, tx, ty); if (underline) g2.drawLine(tx, ty + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() / 2, tx + (int) layout.getBounds().getWidth(), ty + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() / 2); xpos += rectWidth + rectDistance; } // draw the messages int maxTextXpos = drawMessages(g2); maxTextXpos += 3 * this.getHandler().getFontHandler().getDistanceBetweenTexts(); // add extra space if (boxStrings.length() > 1) { try { drawControlFlowBoxesWithLines(g2, boxStrings.substring(1), numObjects); // LME: 1,2;1,2;... cut first ;-character } catch (ArrayIndexOutOfBoundsException e) { // do nothing: this exception is thrown, when entering text, // that is not rendered to an control flow box } } // set our component to the correct size int rWidth = rectWidth * numObjects + rectDistance * (numObjects - 1) + 2 * borderDistance; int rHeight = 2 * borderDistance + yOffsetforTitle + rectHeight + rectToFirstLevelDistance + levelNum * levelHeight; rWidth = (rWidth > maxTextXpos ? rWidth : maxTextXpos); // align the borders to the grid rWidth += this.getHandler().getGridSize() - rWidth % this.getHandler().getGridSize(); rHeight += this.getHandler().getGridSize() - rHeight % this.getHandler().getGridSize(); setSize(rWidth, rHeight); } private int drawMessages(Graphics2D g2) { float zoom = getHandler().getZoomFactor(); int maxTextXpos = 0; for (int i = 0; i < im.getNumLevels(); i++) { Set interactions = im.getInteractionsInLevel(i + 1); Iterator it = interactions.iterator(); while (it.hasNext()) { Interaction ia = it.next(); if (ia.getSrcObj() == ia.getDestObj()) { // draw an arc-arrow int xTextOffset = 0; int w = (int) (30 * zoom); int h = (int) (levelHeight * 0.66); int x = hCenterForObj(ia.getSrcObj()) - w / 2; // nt y= vCenterForLevel(i+1) - h/2; int ay = (vCenterForLevel(i + 1) + (int) (5 * zoom)); // + levelHeight/2 -1; if (im.controlBoxExists(i + 1, ia.getSrcObj())) { x += controlFlowBoxWidth / 2; xTextOffset = controlFlowBoxWidth / 2; } g2.drawArc(x, ay, w, h, 90, -180); Point p1 = new Point(x + w / 2, ay + h); Point d1 = new Point(x + w / 2 + (int) (3 * zoom), p1.y - (int) (6 * zoom)); Point d2 = new Point(x + w / 2 + (int) (4 * zoom), p1.y + (int) (4 * zoom)); if (ia.getArrowKind() == ASYNC) { // Pfeil offen g2.drawLine(p1.x, p1.y, d1.x, d1.y); g2.drawLine(p1.x, p1.y, d2.x, d2.y); } else if (ia.getArrowKind() == SYNC) { int xs[] = { p1.x, d1.x, d2.x }; int ys[] = { p1.y, d1.y, d2.y }; Color oldColor = g2.getColor(); g2.setColor(bgColor); g2.fillPolygon(xs, ys, 3); g2.setColor(oldColor); g2.drawPolygon(xs, ys, 3); } else if (ia.getArrowKind() == EDGE) { g2.drawLine(p1.x, p1.y, d2.x, d2.y); } else if (ia.getArrowKind() == FILLED) { Polygon p = new Polygon(); p.addPoint(p1.x, p1.y); p.addPoint(d1.x, d1.y); p.addPoint(d2.x, d2.y); g2.fillPolygon(p); } // print the methodname if ((ia.getMethodName() != null) && !ia.getMethodName().equals("")) { int fx1 = x + w + 2; int fy1 = ay; int fx2 = hCenterForObj(ia.getSrcObj()) + rectWidth / 2; int fy2 = ay + h; int tx = printMethodName(g2, ia.getMethodName(), fx1 + xTextOffset, fx2 + xTextOffset, fy1, fy2, true, false); maxTextXpos = maxTextXpos > tx ? maxTextXpos : tx; } } else { // draw an arrow from the source-object to the destination object int begX = hCenterForObj(ia.getSrcObj()); int endX = (ia.getSrcObj() < ia.getDestObj()) ? hCenterForObj(ia.getDestObj()) - 1 : hCenterForObj(ia.getDestObj()) + 1; int arrowY = vCenterForLevel(i + 1) + levelHeight / 2 - 1; if (ia.getSrcObjHasControl()) { // LME: shrink arrow if box exists begX += (ia.getSrcObj() < ia.getDestObj()) ? (controlFlowBoxWidth / 2) : (-controlFlowBoxWidth / 2); } if (ia.getDestObjHasControl()) { // LME: shrink arrow if box exists endX += (ia.getSrcObj() < ia.getDestObj()) ? (-controlFlowBoxWidth / 2) : (controlFlowBoxWidth / 2); } drawArrow(g2, new Point(begX, arrowY), new Point(endX, arrowY), ia.getArrowKind(), ia.getLineKind()); if ((ia.getMethodName() != null) && !ia.getMethodName().equals("")) { final int b = 2; if (ia.getSrcObj() < ia.getDestObj()) { int tx = printMethodName(g2, ia.getMethodName(), begX + b, endX - arrowX - b, arrowY - 1 - levelHeight / 1, arrowY - 1, false, true); maxTextXpos = maxTextXpos > tx ? maxTextXpos : tx; } else { int tx = printMethodName(g2, ia.getMethodName(), endX + arrowX + b, begX - b, arrowY - 1 - levelHeight / 2, arrowY - 1, false, true); maxTextXpos = maxTextXpos > tx ? maxTextXpos : tx; } } } } } return maxTextXpos; } // prints the given methodName in an intelligent manner into // the supplied rectangle. // The method may put pixels anywhere into the supplied rectangle // including the borders. (In other words eg. the point begX/endY // may be set by this method.) // if the fontsize gets very big this method may cross the vertical borders. private int printMethodName(Graphics2D g2, String methodName, int begX, int endX, int begY, int endY, boolean centerVertically, boolean centerHorizontically) { if ((methodName == null) || methodName.equals("")) { log.error("SequenceDiagram->printMethodName was called with an invalid argument."); return 0; } Font font = this.getHandler().getFontHandler().getFont(); TextLayout layout = new TextLayout(methodName, font, g2.getFontRenderContext()); // draw it horizontally centered int dx = (centerHorizontically) ? (endX - begX - (int) layout.getBounds().getWidth()) / 2 : 0; int dy = (centerVertically) ? (endY - begY - (int) layout.getBounds().getHeight()) / 2 : 1; layout.draw(g2, begX + dx, endY - dy); return begX + dx + (int) layout.getBounds().getWidth(); } public void drawControlFlowBoxesWithLines(Graphics2D g2, String s, int numObjects) { // LME int level = 1; StringTokenizer mainTokens = new StringTokenizer(s, ";"); int tokNum = mainTokens.countTokens(); int[][] tField = new int[numObjects][tokNum + 2]; Vector interactionframes = new Vector(); HashMap interactionframesText = new HashMap(); // collect all tokens into an array: create another view to sequentially access data of a specific object // 1,2;#;1,3;1,3;1;3 will be transfomed to // tField: [110] // [000] // [101] // [101] // [100] // [001] while (mainTokens.hasMoreTokens()) { String main = mainTokens.nextToken(); if (main.indexOf("#") >= 0) { // if no box, clear entire row for (int i = 0; i < numObjects; i++) tField[i][level - 1] = 0; // clear if ((main.indexOf("#iframe{") >= 0) || (main.indexOf("#iframe}") >= 0)) { if (main.indexOf("#iframe{") >= 0) interactionframes.add(new Integer(level)); else interactionframes.add(new Integer(level * (-1))); // distinguish betweeen start and end of the iframe if (main.indexOf("iframe{:") >= 0) { interactionframesText.put("" + level, main.substring(main.indexOf("iframe{:") + 8)); // put text into hashmap } } level++; } else { StringTokenizer innerT = new StringTokenizer(main, ","); for (int i = 0; i < numObjects; i++) tField[i][level - 1] = 0; // clear while (innerT.hasMoreTokens()) { String is = innerT.nextToken(); int objNum = Integer.parseInt(is); tField[objNum - 1][level - 1] = 1; } level++; } // #else } // #while for (int actObjNum = 0; actObjNum < numObjects; actObjNum++) { // controlFlowBoxWidth = controlFlowBoxWidth * getHandler().getGridSize() / 10; // rectDistance = rectDistance / getHandler().getGridSize() / 10; // levelHeight = levelHeight / getHandler().getGridSize() / 10; int offset = 2; int objNum = actObjNum + 1; int x1 = hCenterForObj(objNum) - controlFlowBoxWidth / 2; int startLevel = -1, boxSize = 0; int lineX = hCenterForObj(actObjNum + 1); int lineY1 = borderDistance + yOffsetforTitle + rectHeight; for (int i = 0; i < tokNum + 1; i++) { if (tField[actObjNum][i] == 1) { if (startLevel == -1) startLevel = i; boxSize++; } if ((tField[actObjNum][i] == 0) && (startLevel != -1)) { int y1 = vCenterForLevel(startLevel + offset) - levelHeight - 1; g2.drawRect(x1, y1, controlFlowBoxWidth - 1, levelHeight * boxSize); // draw the box g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); // #draw the line between the boxes g2.drawLine(lineX, lineY1, lineX, y1); // # g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); // # lineY1 = y1 + levelHeight * boxSize; // # startLevel = -1; boxSize = 0; } } // #for(int i // LME: draw the tail int lineY2 = borderDistance + yOffsetforTitle + rectHeight + levelNum * levelHeight + rectToFirstLevelDistance; g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(lineX, lineY1, lineX, lineY2); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } // #for(int actObjNum // LME: draw the interaction frames int fullSets = interactionframes.size() - (interactionframes.size() % 2); if (fullSets >= 2) { int pos = 0; while (pos < fullSets) { pos = recurseInteractionFrames(g2, interactionframes, interactionframesText, pos, 0); pos++; } } } /** * Recusion level step of interactionframes * ie: * iframe{ * iframe{ * } * iframe{ * } * } */ public int recurseInteractionFrames(Graphics2D g2, Vector interactionframes, HashMap interactionframesText, int pos, int recursionLevel) { int pos1 = interactionframes.elementAt(pos); int posX; while ((pos < interactionframes.size()) && ((posX = interactionframes.elementAt(pos)) > 0)) { // traverse through iframes an same level pos1 = posX; pos++; pos = recurseInteractionFrames(g2, interactionframes, interactionframesText, pos, recursionLevel + 1); // step on level deeper into recursion if (pos1 <= 0) return pos; int pos2 = interactionframes.elementAt(pos) * (-1); drawInteractionFrame(g2, pos1, pos2, recursionLevel, interactionframesText.get("" + pos1)); pos++; } return pos; } private void drawInteractionFrame(Graphics2D g2, int pos1, int pos2, int recursionLevel, String text) { float zoom = getHandler().getZoomFactor(); int pos11 = (pos1 + 1) * levelHeight + yOffsetforTitle; int h = (pos2 - pos1) * levelHeight; int x = (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 2 + recursionLevel * 4; g2.drawRect(x, pos11, this.getWidth() - (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() * 4 - 1 - recursionLevel * 8, h); int uLinePos = pos11 + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) (this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts()); int textPos = pos11 + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize(); int textWidth = 0; if ((text == null) || text.equals("")) text = " "; g2.drawString(text, x + (int) (10 * zoom), textPos); int pW = this.getHandler().getFontHandler().getTextWidth(text); textWidth = (pW > textWidth) ? (pW) : (textWidth); g2.drawLine(x, uLinePos, x + textWidth + (int) (15 * zoom), uLinePos); g2.drawLine(x + textWidth + (int) (15 * zoom), uLinePos, x + textWidth + (int) (25 * zoom), pos11 + (int) (10 * zoom)); g2.drawLine(x + textWidth + (int) (25 * zoom), pos11, x + textWidth + (int) (25 * zoom), pos11 + (int) (10 * zoom)); } public void drawArrow(Graphics2D g2, Point srcObj, Point destObj, int arrowKind, int lineKind) { Point p1, p2; if (srcObj.x < destObj.x) { p1 = new Point(destObj.x - arrowX, destObj.y + arrowY); p2 = new Point(destObj.x - arrowX, destObj.y - arrowY); } else { p1 = new Point(destObj.x + arrowX, destObj.y + arrowY); p2 = new Point(destObj.x + arrowX, destObj.y - arrowY); } if (arrowKind == SYNC) { g2.drawLine(p1.x, p1.y, p2.x, p2.y); g2.drawLine(destObj.x, destObj.y, p1.x, p1.y); g2.drawLine(destObj.x, destObj.y, p2.x, p2.y); if (lineKind == DOTTED) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(srcObj.x, srcObj.y, p1.x, destObj.y); } else if (arrowKind == ASYNC) { g2.drawLine(destObj.x, destObj.y, p1.x, p1.y); g2.drawLine(destObj.x, destObj.y, p2.x, p2.y); if (lineKind == DOTTED) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(srcObj.x, srcObj.y, destObj.x, destObj.y); } else if (arrowKind == EDGE) { g2.drawLine(destObj.x, destObj.y, p2.x, p2.y); if (lineKind == DOTTED) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(srcObj.x, srcObj.y, destObj.x, destObj.y); } else if (arrowKind == FILLED) { Polygon p = new Polygon(); p.addPoint(p1.x, p1.y); p.addPoint(p2.x, p2.y); p.addPoint(destObj.x, destObj.y); g2.fillPolygon(p); if (lineKind == DOTTED) g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); g2.drawLine(srcObj.x, srcObj.y, p1.x, destObj.y); } g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } protected int hCenterForObj(int objNum) { return (objNum * rectWidth + (objNum - 1) * rectDistance + borderDistance - rectWidth / 2); } protected int vCenterForLevel(int level) { return (level * levelHeight + rectToFirstLevelDistance + rectHeight + borderDistance + yOffsetforTitle - levelHeight / 2); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes: dynamic resize is done by the diagram itself private void zoomValues() { float zoom = getHandler().getZoomFactor(); controlFlowBoxWidth = (int) (20 * zoom); rectDistance = (int) (60 * zoom); rectHeight = 2 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize() + 10; rectWidth = 2 * (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) this.getHandler().getFontHandler().getFontSize() + 10; borderDistance = (int) (10 * zoom); levelHeight = (int) (30 * zoom); arrowX = (int) (5 * zoom); arrowY = (int) (5 * zoom); } } umlet-11.3.orig/sourcefiles/src/com/umlet/element/ActivityDiagramText.java0000644000175000001440000003506511576116034025463 0ustar benuserspackage com.umlet.element; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.baselet.control.Utils; import com.baselet.element.StickingPolygon; import com.umlet.element.activity.AEnd; import com.umlet.element.activity.Activity; import com.umlet.element.activity.Condition; import com.umlet.element.activity.Const; import com.umlet.element.activity.Container; import com.umlet.element.activity.Direction; import com.umlet.element.activity.Element; import com.umlet.element.activity.End; import com.umlet.element.activity.EndIf; import com.umlet.element.activity.EventRaise; import com.umlet.element.activity.EventRecieve; import com.umlet.element.activity.Fork; import com.umlet.element.activity.GoTo; import com.umlet.element.activity.If; import com.umlet.element.activity.LineSpacer; import com.umlet.element.activity.PartActivity; import com.umlet.element.activity.Row; import com.umlet.element.activity.Start; import com.umlet.element.activity.StartElement; import com.umlet.element.activity.StopElement; import com.umlet.element.activity.Sync; @SuppressWarnings("serial") public class ActivityDiagramText extends com.baselet.element.GridElement { private ArrayList rows; private ArrayList containers; private Container root_container; private Container current_container; private HashMap elements; private String title; private Graphics2D graphics; private ArrayList gotos; private int goto_seperation_left; private int goto_seperation_right; private float zoom; private final String normalchars = "[^\\~\\>]";// "[ \\w\\\\\\(\\)]"; private final String conditionChars = "[^\\]]"; private final String title_pattern = "title\\:(" + normalchars + "+)"; private final String line_pattern = "(\\t*)" + // tabs 1 "(\\[([ " + conditionChars + "]+)\\])?" + // conditions 2..3 "(" + // 4 "(" + // 5 "(Start)" + // start 6 "|(End|AEnd)" + // end7 "|(\\|)" + // linespacer 8 "|(If|Fork)|(EndIf|Sync)" + // if blocks 9/10 "|(While(\\[(" + normalchars + "*)\\])?)" + // while 11..13 "|(\\>(" + normalchars + "+))" + // recieve event 14..15 "|((" + normalchars + "+)\\>)" + // raise event 16..17 "|((" + normalchars + "+)\\.\\.)" + // partactivity 18..19 "|(" + normalchars + "+)" + // activity 20 ")" + "(\\~(" + normalchars + "+)?)?" + // ids 21..22 ")?" + "\\s*" + "(\\-\\>(" + normalchars + "+))?" + // goto 23..24 "\\s*"; public ActivityDiagramText() { } private void init(Graphics2D graphics) { zoom = getHandler().getZoomFactor(); this.graphics = graphics; this.rows = new ArrayList(); this.gotos = new ArrayList(); this.containers = new ArrayList(); this.elements = new HashMap(); this.rows.add(new Row()); this.root_container = new Container(getHandler(), graphics, null, rows, 0); this.current_container = this.root_container; this.title = null; this.goto_seperation_left = (int) (5 * zoom); this.goto_seperation_right = (int) (5 * zoom); // Some unimportant initialization stuff; setting color, font // quality, etc. You should not have to change this. this.graphics = graphics; this.graphics.setFont(this.getHandler().getFontHandler().getFont()); this.graphics.setColor(fgColor); } private String preparse(String line) { String parsed_line = ""; Pattern p_empty = Pattern.compile("\\s*"); Pattern p_title = Pattern.compile(this.title_pattern); if (!p_empty.matcher(line).matches()) { Pattern p = Pattern.compile(this.line_pattern); Matcher m_title = p_title.matcher(line); if (m_title.matches()) { parsed_line = null; this.title = m_title.group(1); } else if (p.matcher(line).matches()) parsed_line = line; else parsed_line = null; } return parsed_line; } public int getGotoPosition(Direction dir) { if (Direction.LEFT.equals(dir)) { if (this.goto_seperation_left + (Const.GOTO_SEP * zoom) < (Const.DIAGRAM_PAD * zoom)) this.goto_seperation_left += (Const.GOTO_SEP * zoom); return (int) ((Const.DIAGRAM_PAD * zoom) - this.goto_seperation_left); } else { if (this.goto_seperation_right + (Const.GOTO_SEP * zoom) < (Const.DIAGRAM_PAD * zoom)) this.goto_seperation_right += (Const.GOTO_SEP * zoom); return (int) (this.root_container.getWidth() + (Const.DIAGRAM_PAD * zoom) + this.goto_seperation_right); } } private Vector preparse(Vector lines) { if (lines.isEmpty()) return lines; Vector parsed_lines = new Vector(); Iterator it = lines.iterator(); String current_line = this.preparse(it.next()); if (current_line == null) current_line = ""; while (current_line.equals("") && it.hasNext()) { current_line = this.preparse(it.next()); if (current_line == null) current_line = ""; } String previous_line = current_line; int current_depth = 0; int last_depth = 0; while (it.hasNext()) { current_line = this.preparse(it.next()); if (current_line != null) { if (!current_line.equals("")) { for (current_depth = 0; current_line.charAt(current_depth) == '\t'; current_depth++); if (!previous_line.equals("") || (current_depth == last_depth)) parsed_lines.add(previous_line); previous_line = current_line; last_depth = current_depth; } else if (!previous_line.equals("")) { parsed_lines.add(previous_line); previous_line = current_line; } } } if (!previous_line.equals("")) parsed_lines.add(previous_line); return parsed_lines; } private void addElement(Element e) { this.current_container.addElement(e); this.elements.put(e.getId(), e); } @Override public void paintEntity(Graphics g) { this.init((Graphics2D) g); Vector lines = Utils.decomposeStringsWithEmptyLines(this.getPanelAttributes()); lines = this.preparse(lines); if (lines.size() == 0) return; Const.AutoInsertIF = true; while ((lines.size() > 0) && lines.elementAt(0).startsWith("var:")) { if (lines.elementAt(0).equals("var:noautoif")) Const.AutoInsertIF = false; lines.remove(0); } int current_depth = 0; Pattern p = Pattern.compile(line_pattern); StartElement start_element = null; Element current_element = null; this.containers.add(this.root_container); for (Iterator it = lines.iterator(); it.hasNext();) { String line = it.next(); Matcher m = p.matcher(line); Container closed_container = null; if (m.matches()) { Pattern p_empty = Pattern.compile("\\s*"); Matcher m_empty = p_empty.matcher(line); /* NEW COLUMN IN CURRENT LAYER */ if (m_empty.matches()) { /* start element was no start element (example: IF element without following container) */ if (start_element != null) { this.addElement(start_element); start_element = null; } if (!this.current_container.isRoot()) this.current_container.addColumn(); // empty line - no need to proceed with other stuff continue; } /* DEPTH */ if (m.group(1) != null) { /* NEW LAYER */ if (m.group(1).length() > current_depth) { for (; current_depth < m.group(1).length(); current_depth++) { this.current_container = this.current_container.addNewContainer(); this.containers.add(this.current_container); if (start_element != null) { this.current_container.setStartElement(start_element); this.elements.put(start_element.getId(), start_element); start_element = null; } } } else { /* start element was no start element (example: IF element without following container) */ if (start_element != null) { this.addElement(start_element); start_element = null; } /* CLOSE LAYER(s) */ if (m.group(1).length() < current_depth) { for (; current_depth > m.group(1).length(); current_depth--) { closed_container = this.current_container; if (!this.current_container.isRoot()) this.current_container = this.current_container.close(); } } } } Element e = null; /* BEDINGUNG */ if (m.group(2) != null) { String input = ""; if (m.group(3) != null) input = m.group(3); e = new Condition(getHandler(), input, this.graphics); current_element = e; } if (e != null) this.addElement(e); e = null; if (m.group(4) != null) { String id = m.group(22); /* START */ if (m.group(6) != null) { e = new Start(getHandler(), graphics); } /* END */ else if (m.group(7) != null) { if (m.group(7).equals("AEnd")) e = new AEnd(getHandler(), graphics, id); else e = new End(getHandler(), graphics, id); } /* LINESPACER */ else if (m.group(8) != null) { e = new LineSpacer(getHandler(), graphics); } /* IF/FORK */ else if (m.group(9) != null) { // these elements are processed as soon as a the // new container is opened (or as single elements // if none is openend if (m.group(9).equals("Fork")) start_element = new Fork(getHandler(), graphics, id); else start_element = new If(getHandler(), graphics, id); current_element = start_element; } /* ENDIF/SYNC */ else if (m.group(10) != null) { // set as stop element if a container has been closed StopElement se; if (m.group(10).equals("Sync")) se = new Sync(getHandler(), graphics, id); else se = new EndIf(getHandler(), graphics, id); if (closed_container != null) { closed_container.setStopElement(se); this.elements.put(se.getId(), se); } else e = se; current_element = se; } /* WHILE */ else if (m.group(11) != null) { this.current_container = this.current_container.addNewWhile(m.group(13)); current_depth++; } /* GET EVENT */ else if (m.group(15) != null) e = new EventRecieve(getHandler(), graphics, m.group(15), id); /* RAISE EVENT */ else if (m.group(17) != null) e = new EventRaise(getHandler(), graphics, m.group(17), id); /* PARTACTIVITY */ else if (m.group(19) != null) e = new PartActivity(getHandler(), m.group(19), graphics, id); /* ACTIVITY */ else if (m.group(20) != null) e = new Activity(getHandler(), m.group(20), graphics, id); } if (e != null) { current_element = e; this.addElement(e); } /* GOTO */ if (m.group(23) != null) { if ((m.group(24) != null) && (current_element != null)) { String connect_to = m.group(24); this.gotos.add(new GoTo(graphics, current_element, connect_to)); current_element.setTerminated(); } } } } // if a Startelement was the last element if (start_element != null) this.addElement(start_element); // close opened containers while (!this.current_container.isRoot()) { this.current_container = this.current_container.close(); } // remove empty columns of containers (maybe there if only a goto element was there) for (Container c : this.containers) c.removeEmptyColumns(); // PROCESS GOTO ELEMENTS ArrayList valid_gotos = new ArrayList(); for (Iterator it = this.gotos.iterator(); it.hasNext();) { GoTo go = it.next(); Element from = go.getFromElement(); go.setToElement(this.elements.get(go.getToElementId())); Element to = go.getToElement(); if ((from != null) && (to != null)) { valid_gotos.add(go); boolean fromleft = from.getRow().isLeft(from); boolean fromright = from.getRow().isRight(from); boolean toleft = to.getRow().isLeft(to); boolean toright = to.getRow().isRight(to); if (fromleft) { go.setDirection(Direction.LEFT); if (!toleft) this.rows = to.getRow().makeExclusiveLeft(to, this.rows); } else if (toleft) { go.setDirection(Direction.LEFT); this.rows = from.getRow().makeExclusiveLeft(from, this.rows); } else if (fromright) { go.setDirection(Direction.RIGHT); if (!toright) this.rows = to.getRow().makeExclusiveRight(to, this.rows); } else if (toright) { go.setDirection(Direction.RIGHT); this.rows = from.getRow().makeExclusiveRight(from, this.rows); } else { go.setDirection(Direction.LEFT); this.rows = from.getRow().makeExclusiveLeft(from, this.rows); this.rows = to.getRow().makeExclusiveLeft(to, this.rows); } } } // draw title int offset = 0; int width = (int) (this.root_container.getWidth() + (Const.DIAGRAM_PAD * zoom) * 2); int height = 0; if (this.title != null) { offset += (int) (25 * zoom); height += (int) (25 * zoom); if ((title != null) && (title.length() > 0)) { this.getHandler().getFontHandler().writeText(this.graphics, title, (int) (10 * zoom), (int) this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts(), false); int titlewidth = this.getHandler().getFontHandler().getTextWidth(title); int ty = (int) this.getHandler().getFontHandler().getFontSize() + (int) this.getHandler().getFontHandler().getDistanceBetweenTexts() + (int) (8 * zoom); this.graphics.drawLine(0, ty, titlewidth + (int) (10 * zoom), ty); this.graphics.drawLine(titlewidth + (int) (10 * zoom), ty, titlewidth + ty + (int) (10 * zoom), 0); } } /* COMPUTE POSITIONS */ for (Row r : this.rows) offset = r.setElementYPosition(offset); this.root_container.setX((int) (this.root_container.getLeftWidth() + (Const.DIAGRAM_PAD * zoom))); if (Const.DEBUG) this.root_container.printData(""); for (Row r : this.rows) height += r.getHeight(); if (width < (Const.MIN_WIDTH * zoom)) width = (int) (Const.MIN_WIDTH * zoom); if (height < (Const.MIN_HEIGHT * zoom)) height = (int) (Const.MIN_HEIGHT * zoom); // draw diagram this.setSize(width, height); this.graphics.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); this.root_container.paint(); // draw goto elements for (Iterator it = valid_gotos.iterator(); it.hasNext();) it.next().paint(this); } @Override public int getPossibleResizeDirections() { return 0; } // deny size changes: dynamic resize is done by the diagram itself public StickingPolygon generateStickingBorder() { return null; } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/0000755000175000001440000000000011576116036020544 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/umlet/custom/FileClassLoader.java0000644000175000001440000000207211576116034024402 0ustar benuserspackage com.umlet.custom; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import com.baselet.control.Path; public class FileClassLoader extends ClassLoader { public FileClassLoader() { super(); } public FileClassLoader(ClassLoader parent) { super(parent); } @Override protected Class findClass(String className) throws ClassNotFoundException { Class c = null; try { byte data[] = loadClassData(className); c = defineClass(className, data, 0, data.length); if (c == null) throw new ClassNotFoundException(className); } catch (IOException e) { throw new ClassNotFoundException(className); } return c; } private byte[] loadClassData(String className) throws IOException { File f = new File(Path.temp() + className + ".class"); byte buff[] = new byte[(int) f.length()]; FileInputStream fis = new FileInputStream(f); DataInputStream dis = new DataInputStream(fis); dis.readFully(buff); dis.close(); return buff; } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomVariable.java0000644000175000001440000000045611576116034024332 0ustar benuserspackage com.umlet.custom; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface CustomVariable { } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomElement.java0000644000175000001440000004135011576116034024174 0ustar benuserspackage com.umlet.custom; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.Arc2D; import java.awt.geom.CubicCurve2D; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.QuadCurve2D; import java.awt.geom.RoundRectangle2D; import java.util.Arrays; import java.util.List; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Constants.AlignHorizontal; import com.baselet.control.Constants.AlignVertical; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.element.GridElement; @SuppressWarnings("serial") public abstract class CustomElement extends GridElement { private class Text { private String text; private int x, y; private AlignHorizontal align; private AlignVertical valign; private Integer fixedSize; private Text(String text, int x, int y, AlignHorizontal align, AlignVertical valign) { this.text = text; this.x = x; this.y = y; this.align = align; this.valign = valign; } private Text(String text, int x, int y, AlignHorizontal align, AlignVertical valign, Integer fixedSize) { this.text = text; this.x = x; this.y = y; this.align = align; this.valign = valign; this.fixedSize = fixedSize; // some texts should not be zoomed } } protected float zoom; // We need a seperate program behaviour for 10% and 20% zoom. Otherwise manual resized entities would have the following bugs: // 10%: entity grow without end, 20%: relations don't stick on the right or bottom end of entity private boolean bugfix; protected Graphics2D g2; protected float temp; protected int width, height; protected Composite[] composites; private String code; private Vector shapes; private Vector texts; // The temp-variables are needed to store styles with setLineType etc. methods temporarily so that draw-Methods know the actual set style private LineType tmpLineType; private int tmpLineThickness; private Color tmpFgColor; private Color tmpBgColor; private float tmpAlpha; private boolean specialLine, specialFgColor, specialBgColor; private boolean wordWrap = false; public CustomElement() { this.shapes = new Vector(); this.texts = new Vector(); } public abstract void paint(); public final void setCode(String code) { this.code = code; } public final String getCode() { return this.code; } private void drawShapes() { g2.setColor(bgColor); g2.setComposite(this.composites[1]); for (StyleShape s : this.shapes) { specialBgColor = ((s.getBgColor() != bgColor)); if (specialBgColor) { g2.setColor(s.getBgColor()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, s.getAlpha())); } this.g2.fill(s.getShape()); if (specialBgColor) { g2.setColor(bgColor); g2.setComposite(this.composites[1]); } } g2.setComposite(this.composites[0]); g2.setColor(fgColor); for (StyleShape s : this.shapes) { specialLine = ((s.getLineType() != LineType.SOLID) || (s.getLineThickness() != Constants.DEFAULT_LINE_THICKNESS)); specialFgColor = (s.getFgColor() != Constants.DEFAULT_FOREGROUND_COLOR); if (specialLine) g2.setStroke(Utils.getStroke(s.getLineType(), s.getLineThickness())); if (specialFgColor) { if (isSelected) g2.setColor(Constants.DEFAULT_SELECTED_COLOR); else g2.setColor(s.getFgColor()); } this.g2.draw(s.getShape()); if (specialLine) g2.setStroke(Utils.getStroke(LineType.SOLID, Constants.DEFAULT_LINE_THICKNESS)); if (specialFgColor) g2.setColor(fgColor); } for (Text t : this.texts) { boolean applyZoom = true; if (t.fixedSize != null) { getHandler().getFontHandler().setFontSize(t.fixedSize); applyZoom = false; } this.getHandler().getFontHandler().writeText(this.g2, t.text, t.x, t.y, t.align, t.valign, applyZoom); if (t.fixedSize != null) { getHandler().getFontHandler().resetFontSize(); } } this.texts.clear(); this.shapes.clear(); } @Override public final void paintEntity(Graphics g) { this.g2 = (Graphics2D) g; composites = this.colorize(g2); g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(fgColor); zoom = getHandler().getZoomFactor(); if (zoom < 0.25) bugfix = true; else bugfix = false; // width and height must be zoomed back to 100% before any custom code is applied temp = this.getWidth(); width = Math.round(temp / zoom); // use Math.round cause (int) would round down from 239.99998 to 240 temp = this.getHeight(); height = Math.round(temp / zoom); // Set width and height on grid (used for manually resized custom elements mainly width = onGrid(width); height = onGrid(height); // secure this thread before executing the code! // String key = "R" + Math.random(); // CustomElementSecurityManager.addThread(Thread.currentThread(), key); resetAll(); // Reset all tempstyle variables before painting paint(); // calls the paint method of the specific custom element // CustomElementSecurityManager.remThread(Thread.currentThread(), key); width = onGrid(width); height = onGrid(height); // After the custom code we zoom the width and height back width *= zoom; height *= zoom; this.drawShapes(); // Resize elements if manual resize is not set // if (!this.allowResize || (this.autoResizeandManualResizeEnabled() && !this.isManualResized())) { // CHANGED: Resize every custom object by +1px to get consistent height and width if (!bugfix) this.setSize(this.width + 1, this.height + 1); // } } @Override public final GridElement CloneFromMe() { CustomElement e = (CustomElement) super.CloneFromMe(); e.code = this.code; return e; } @CustomFunction(param_defaults = "text,x,y") protected final int print(String text, int x, int inY) { int y = inY; List list = wordWrap ? Utils.splitString(text, (int) (width * zoom)) : Arrays.asList(new String[] {text}); for (String s : list) { this.texts.add(new Text(s, (int) (x * zoom), (int) (y * zoom), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); y += textHeight(); } return y - inY; } @CustomFunction(param_defaults = "text,y") protected final int printLeft(String text, int inY) { int y = inY; List list = wordWrap ? Utils.splitString(text, (int) (width * zoom)) : Arrays.asList(new String[] {text}); for (String s : list) { this.texts.add(new Text(s, ((int) this.getHandler().getFontHandler().getDistanceBetweenTexts()), (int) (y * zoom), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); y += textHeight(); } return y - inY; } @CustomFunction(param_defaults = "text,y") protected final int printRight(String text, int inY) { int y = inY; List list = wordWrap ? Utils.splitString(text, (int) (width * zoom)) : Arrays.asList(new String[] {text}); for (String s : list) { this.texts.add(new Text(s, (int) ((width * zoom - this.textWidth(s, true))), (int) (y * zoom), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); y += textHeight(); } return y - inY; } @CustomFunction(param_defaults = "text,y") protected final int printCenter(String text, int inY) { int y = inY; List list = wordWrap ? Utils.splitString(text, (int) (width * zoom)) : Arrays.asList(new String[] {text}); for (String s : list) { this.texts.add(new Text(s, (int) (((onGrid(width) * zoom - this.textWidth(s, true)) / 2)), (int) (y * zoom), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); y += textHeight(); } return y - inY; } @CustomFunction(param_defaults = "text,x,y,fixedFontSize") protected final int printFixedSize(String text, int x, int inY, int fixedFontSize) { int y = inY; List list = wordWrap ? Utils.splitString(text, width) : Arrays.asList(new String[] {text}); for (String s : list) { this.texts.add(new Text(s, x, y, AlignHorizontal.LEFT, AlignVertical.BOTTOM, fixedFontSize)); y += textHeight(); } return y - inY; } @CustomFunction(param_defaults = "value") protected final int onGrid(int value) { return onGrid(value, false); } @CustomFunction(param_defaults = "value, roundUp") protected final int onGrid(int value, boolean roundUp) { if (value % 10 != 0) { value -= (value % 10); if (roundUp) value += 10; } // BUGFIX for 10% and 20% zoom: Otherwise a manual resized entity border wouldn't be visible because of the exclusion of line 146 if (bugfix) value--; return value; } @CustomFunction(param_defaults = "value1,value2") protected final int min(int value1, int value2) { return Math.min(value1, value2); } @CustomFunction(param_defaults = "value1,value2") protected final int max(int value1, int value2) { return Math.max(value1, value2); } @CustomFunction(param_defaults = "minWidth, minHeight, horizontalSpacing") protected final void setAutoresize(int minWidth, int minHeight, int horizontalSpacing) { if (!isManualResized()) { height = minHeight; // minimal height width = minWidth; // minimal width // calculates the width and height of the component for (String textline : Utils.decomposeStrings(this.getPanelAttributes())) { height = height + textHeight(); width = Math.max(textWidth(textline, false) + 10 + horizontalSpacing, width); } if (height < minHeight) height = minHeight; if (width < minWidth) width = minWidth; } } @Override @CustomFunction(param_defaults = "") public final boolean isManualResized() { return super.isManualResized(); } @CustomFunction(param_defaults = "wordWrap") public final void setWordWrap(boolean wordWrap) { this.wordWrap = wordWrap; } @CustomFunction(param_defaults = "") public final boolean isWordWrap() { return wordWrap; } @CustomFunction(param_defaults = "x, y, width, height, start, extent") protected final void drawArcOpen(float x, float y, float width, float height, float start, float extent) { this.shapes.add(new StyleShape(new Arc2D.Float(x * zoom, y * zoom, width * zoom, height * zoom, start, extent, Arc2D.OPEN), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, width, height, start, extent") protected final void drawArcChord(float x, float y, float width, float height, float start, float extent) { this.shapes.add(new StyleShape(new Arc2D.Float(x * zoom, y * zoom, width * zoom, height * zoom, start, extent, Arc2D.CHORD), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, width, height, start, extent") protected final void drawArcPie(float x, float y, float width, float height, float start, float extent) { this.shapes.add(new StyleShape(new Arc2D.Float(x * zoom, y * zoom, width * zoom, height * zoom, start, extent, Arc2D.PIE), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, radius") protected final void drawCircle(int x, int y, int radius) { this.shapes.add(new StyleShape(new Ellipse2D.Float((int) ((x - radius) * zoom), (int) ((y - radius) * zoom), (int) (radius * 2 * zoom), (int) (radius * 2 * zoom)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2") protected final void drawCurveCubic(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) { this.shapes.add(new StyleShape(new CubicCurve2D.Float(x1 * zoom, y1 * zoom, ctrlx1 * zoom, ctrly1 * zoom, ctrlx2 * zoom, ctrly2 * zoom, x2 * zoom, y2 * zoom), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x1, y1, ctrlx, ctrly, x2, y2") protected final void drawCurveQuad(float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { this.shapes.add(new StyleShape(new QuadCurve2D.Float(x1 * zoom, y1 * zoom, ctrlx * zoom, ctrly * zoom, x2 * zoom, y2 * zoom), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, radiusX, radiusYs") protected final void drawEllipse(int x, int y, int radiusX, int radiusY) { this.shapes.add(new StyleShape(new Ellipse2D.Float((int) ((x - radiusX) * zoom), (int) ((y - radiusY) * zoom), (int) (radiusX * 2 * zoom), (int) (radiusY * 2 * zoom)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x1, y1, x2, y2") protected final void drawLine(int x1, int y1, int x2, int y2) { this.shapes.add(new StyleShape(new Line2D.Float((int) (x1 * zoom), (int) (y1 * zoom), (int) (x2 * zoom), (int) (y2 * zoom)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "y") protected final void drawLineHorizontal(int y) { this.shapes.add(new StyleShape(new Line2D.Float((int) (0 * zoom), (int) (y * zoom), getHandler().realignToGrid(false, (int) (width * zoom), true), (int) (y * zoom)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x") protected final void drawLineVertical(int x) { this.shapes.add(new StyleShape(new Line2D.Float((int) (x * zoom), (int) (0 * zoom), (int) (x * zoom), getHandler().realignToGrid(false, (int) (height * zoom), true)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "polygon") protected final void drawPolygon(Polygon polygon) { for (int i = 0; i < polygon.xpoints.length; i++) { polygon.xpoints[i] *= zoom; } for (int i = 0; i < polygon.ypoints.length; i++) { polygon.ypoints[i] *= zoom; } this.shapes.add(new StyleShape(polygon, tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, width, height") protected final void drawRectangle(int x, int y, int width, int height) { this.shapes.add(new StyleShape(new Rectangle((int) (x * zoom), (int) (y * zoom), (int) (width * zoom), (int) (height * zoom)), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } @CustomFunction(param_defaults = "x, y, width, height, arcw, arch") protected final void drawRectangleRound(int x, int y, int width, int height, float arcw, float arch) { this.shapes.add(new StyleShape(new RoundRectangle2D.Float((int) (x * zoom), (int) (y * zoom), (int) (width * zoom), (int) (height * zoom), arcw * zoom, arch * zoom), tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } // EXAMPLE: drawShape(new java.awt.geom.RoundRectangle2D.Float(10,10, 50, 40, 15,15)); // WARNING: Shapes aren't zoomed automatically @CustomFunction(param_defaults = "shape") protected final void drawShape(Shape shape) { this.shapes.add(new StyleShape(shape, tmpLineType, tmpLineThickness, tmpFgColor, tmpBgColor, tmpAlpha)); } /* * STYLING METHODS */ @CustomFunction(param_defaults = "lineType") protected final void setLineType(int lineType) { if (lineType == 0) this.tmpLineType = LineType.SOLID; else if (lineType == 1) this.tmpLineType = LineType.DASHED; else if (lineType == 2) this.tmpLineType = LineType.DOTTED; else if (lineType == 3) this.tmpLineType = LineType.DOUBLE; else if (lineType == 4) this.tmpLineType = LineType.DOUBLE_DASHED; else if (lineType == 5) this.tmpLineType = LineType.DOUBLE_DOTTED; else this.tmpLineType = LineType.SOLID; } @CustomFunction(param_defaults = "lineThickness") protected final void setLineThickness(int lineThickness) { this.tmpLineThickness = lineThickness; } @CustomFunction(param_defaults = "foregroundColor") protected final void setForegroundColor(String fgColorString) { tmpFgColor = Utils.getColor(fgColorString); if (tmpFgColor == null) { if (fgColorString.equals("fg")) tmpFgColor = fgColor; } } @CustomFunction(param_defaults = "backgroundColor") protected final void setBackgroundColor(String bgColorString) { tmpBgColor = Utils.getColor(bgColorString); if (tmpBgColor == null) { if (bgColorString.equals("bg")) tmpBgColor = bgColor; } // Transparency is 0% if none or 50% if anything else if (bgColorString.equals("none")) tmpAlpha = Constants.ALPHA_FULL_TRANSPARENCY; else tmpAlpha = Constants.ALPHA_MIDDLE_TRANSPARENCY; } @CustomFunction(param_defaults = "") protected final void resetAll() { tmpLineThickness = Constants.DEFAULT_LINE_THICKNESS; tmpLineType = LineType.SOLID; tmpFgColor = fgColor; tmpBgColor = bgColor; tmpAlpha = alphaFactor; } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomFunction.java0000644000175000001440000000051011576116034024361 0ustar benuserspackage com.umlet.custom; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface CustomFunction { String param_defaults(); } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/ErrorHandler.java0000644000175000001440000000312311576116034023773 0ustar benuserspackage com.umlet.custom; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.util.HashMap; import com.baselet.control.Constants; import com.umlet.gui.CustomCodeSyntaxPane; public class ErrorHandler implements MouseMotionListener { private CustomCodeSyntaxPane codepane; private HashMap errors; public ErrorHandler(CustomCodeSyntaxPane codepane) { this.codepane = codepane; this.errors = new HashMap(); } /******************** ERROR HANDLING *************************/ @Override public void mouseDragged(MouseEvent arg0) { } @Override public void mouseMoved(MouseEvent me) { int line = (me.getY() - 3) / this.codepane.getFontMetrics(this.codepane.getFont()).getHeight(); if (this.errors.get(line) != null) { this.codepane.setToolTipText(this.errors.get(line)); } else this.codepane.setToolTipText(null); } protected void clearErrors() { this.errors.clear(); //TODO CUSTOM ELMENTS REFACTORING // this.codepane.getStyledDocument().setCharacterAttributes(0, this.codepane.getText().length(), this.codepane.getStyledDocument().getStyle("default"), true); } protected void addError(Integer line, String error, int from, int length) { if (this.errors.containsKey(line)) this.errors.put(line, this.errors.get(line) + Constants.NEWLINE + error); else this.errors.put(line, error); //TODO CUSTOM ELMENTS REFACTORING // this.codepane.getStyledDocument().setCharacterAttributes(from, length, this.codepane.getStyledDocument().getStyle("error"), true); } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/StyleShape.java0000644000175000001440000000511311576116034023466 0ustar benuserspackage com.umlet.custom; import java.awt.Color; import java.awt.Shape; import com.baselet.control.Constants.LineType; /** * Extended shape which supports the stroketype and the line thickness */ public class StyleShape { private Shape shape; private LineType lineType; private int lineThickness; private Color fgColor; private Color bgColor; private float alpha; public StyleShape(Shape shape, LineType lineType, int lineThickness, Color fgColor, Color bgColor, float alpha) { super(); this.shape = shape; this.lineType = lineType; this.lineThickness = lineThickness; this.fgColor = fgColor; this.bgColor = bgColor; this.alpha = alpha; } public Shape getShape() { return shape; } public LineType getLineType() { return lineType; } public int getLineThickness() { return lineThickness; } public Color getFgColor() { return fgColor; } public Color getBgColor() { return bgColor; } public float getAlpha() { return alpha; } public void setShape(Shape shape) { this.shape = shape; } public void setLineType(LineType lineType) { this.lineType = lineType; } public void setLineThickness(int lineThickness) { this.lineThickness = lineThickness; } public void setFgColor(Color fgColor) { this.fgColor = fgColor; } public void setBgColor(Color bgColor) { this.bgColor = bgColor; } public void setAlpha(float alpha) { this.alpha = alpha; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Float.floatToIntBits(alpha); result = prime * result + ((bgColor == null) ? 0 : bgColor.hashCode()); result = prime * result + ((fgColor == null) ? 0 : fgColor.hashCode()); result = prime * result + lineThickness; result = prime * result + ((shape == null) ? 0 : shape.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StyleShape other = (StyleShape) obj; if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha)) return false; if (bgColor == null) { if (other.bgColor != null) return false; } else if (!bgColor.equals(other.bgColor)) return false; if (fgColor == null) { if (other.fgColor != null) return false; } else if (!fgColor.equals(other.fgColor)) return false; if (lineThickness != other.lineThickness) return false; if (lineType != other.lineType) return false; if (shape == null) { if (other.shape != null) return false; } else if (!shape.equals(other.shape)) return false; return true; } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomElementCompileTask.java0000644000175000001440000000051611576116034026327 0ustar benuserspackage com.umlet.custom; import java.util.TimerTask; public class CustomElementCompileTask extends TimerTask { private CustomElementHandler handler; public CustomElementCompileTask(CustomElementHandler handler) { this.handler = handler; } @Override public void run() { handler.runCompilation(); } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomElementHandler.java0000644000175000001440000002115311576116034025471 0ustar benuserspackage com.umlet.custom; import java.awt.Rectangle; import java.util.Timer; import java.util.TimerTask; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.diagram.CustomPreviewHandler; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.umlet.gui.CustomCodeSyntaxPane; import com.umlet.gui.CustomElementPanel; public class CustomElementHandler { private Timer timer; private CustomCodeSyntaxPane codepane; private CustomPreviewHandler preview; private GridElement editedEntity; private GridElement originalElement; private TimerTask compiletask; private boolean changed; private ErrorHandler errorhandler; private HelpHandler helphandler; private boolean compilation_running; private CustomElementPanel panel; boolean keypressed; private String old_text; public CustomElementHandler() { this.codepane = new CustomCodeSyntaxPane(null); this.errorhandler = new ErrorHandler(this.codepane); this.helphandler = new HelpHandler(this.codepane, this); this.codepane.addMouseMotionListener(this.errorhandler); this.codepane.addKeyListener(this.helphandler); this.preview = new CustomPreviewHandler(); this.timer = new Timer(true); this.changed = false; this.compilation_running = false; this.old_text = null; this.panel = new CustomElementPanel(this); this.codepane.initJSyntaxPane(); //for undo/redo this.codepane.initCodePanelListener(); //TODO CUSTOM ELMENTS REFACTORING // StyledDocument doc = codepane.getStyledDocument(); // Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); // doc.addStyle("default", def); // Style err = doc.addStyle("error", def); // StyleConstants.setForeground(err, Color.red); // StyleConstants.setBold(err, true); // StyleConstants.setItalic(err, true); } public CustomElementPanel getPanel() { return this.panel; } public void newEntity() { this.newEntity("Default"); } public void newEntity(String template) { this.preview.closePreview(); this.originalElement = null; this.editedEntity = CustomElementCompiler.getInstance().genEntityFromTemplate(template, this.errorhandler); if (editedEntity instanceof CustomElement) this.codepane.setText(((CustomElement) this.editedEntity).getCode()); else { this.codepane.setText(""); } this.editedEntity.setPanelAttributes("// Modify the text below and" + Constants.NEWLINE + "// observe the element preview." + Constants.NEWLINE + Constants.NEWLINE + "Hello, World! " + Constants.NEWLINE + "Enjoy " + Program.PROGRAM_NAME + "!"); this.editedEntity.setBounds(20, 20, 200, 200); this.updatePreview(editedEntity); this.getPreviewHandler().getDrawPanel().getSelector().select(editedEntity); this.setChanged(false); this.start(); } public void editEntity(CustomElement e) { this.preview.closePreview(); this.originalElement = e; this.editedEntity = e.CloneFromMe(); this.editedEntity.setLocation(20, 20); this.codepane.setText(e.getCode()); this.updatePreview(this.editedEntity); this.getPreviewHandler().getDrawPanel().getSelector().select(editedEntity); this.setChanged(false); this.start(); } public void saveEntity() { GridElement e = CustomElementCompiler.getInstance().genEntity(this.codepane.getText(), errorhandler); this.editedEntity = e; this.updatePreview(e); // update preview panel to set the entities bounds... this.updateElement(e); this.setChanged(false); } public boolean closeEntity() { if (this.changed) { /* * int ch=JOptionPane.showOptionDialog(Main.getInstance().getGUI(),"Save changes?","CustomElement",JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE,null, null, null); * if (ch==JOptionPane.YES_OPTION) * this.saveEntity(); * else if (ch==JOptionPane.CANCEL_OPTION) * return false; * else * this.setChanged(false); */ this.setChanged(false); } this.stop(); this.preview.closePreview(); this.preview.getDrawPanel().getSelector().deselectAll(); //clear controller before editing new custom element Main.getInstance().getDiagramHandler().getController().clear(); DrawPanel dia = Main.getInstance().getGUI().getCurrentDiagram(); if (dia != null) dia.getSelector().updateSelectorInformation(); else Main.getInstance().setPropertyPanelToGridElement(null); return true; } public CustomPreviewHandler getPreviewHandler() { return this.preview; } public CustomCodeSyntaxPane getCodePane() { return this.codepane; } private void updatePreview(GridElement e) { if (e != null) { Vector entities = this.preview.getDrawPanel().getAllEntities(); if (entities.size() > 0) { e.setBounds(entities.get(0).getBounds()); e.setPanelAttributes(entities.get(0).getPanelAttributes()); if (this.preview.getDrawPanel().getSelector().getSelectedEntities().size() > 0) this.preview.getDrawPanel().getSelector().singleSelectWithoutUpdatePropertyPanel(e); this.preview.getDrawPanel().remove(entities.get(0)); } e.setHandler(this.preview); this.preview.getDrawPanel().add(e); e.repaint(); } } // starts the task private void start() { this.compiletask = new CustomElementCompileTask(this); this.timer.schedule(compiletask, Constants.CUSTOM_ELEMENT_COMPILE_INTERVAL, Constants.CUSTOM_ELEMENT_COMPILE_INTERVAL); } // stops the task private void stop() { if (this.compiletask != null) this.compiletask.cancel(); } // runs compilation every 1 seconds and updates gui/errors... protected void runCompilation() { if (!this.compilation_running && !keypressed) // prevent 2 compilations to run at the same time (if compilation takes more then 1sec) { this.compilation_running = true; String txt = this.codepane.getText(); if (!txt.equals(this.old_text)) { this.setChanged(true); this.errorhandler.clearErrors(); this.old_text = txt; GridElement e = CustomElementCompiler.getInstance().genEntity(txt, errorhandler); if (e != null) { this.editedEntity = e; this.panel.setCustomElementSaveable(true); this.updatePreview(e); } else { this.panel.setCustomElementSaveable(false); } } this.compilation_running = false; } keypressed = false; } private void setChanged(boolean changed) { this.changed = changed; Main.getInstance().getGUI().setCustomElementChanged(this, changed); } // reloads the element on all open panels and adds it to the custom element panel if not already there. private void updateElement(GridElement element) { // if a new element has been created add it to current diagram if (this.originalElement == null) { DiagramHandler current = null; DrawPanel c = Main.getInstance().getGUI().getCurrentDiagram(); if (c == null) { Main.getInstance().doNew(); current = Main.getInstance().getGUI().getCurrentDiagram().getHandler(); } else current = c.getHandler(); Vector ents = current.getDrawPanel().getAllEntities(); // set location for element int x = 10, y = 10; for (GridElement e : ents) { if (e.getY() + e.getHeight() + 10 > y) y = e.getY() + e.getHeight() + 10; } Rectangle bounds = new Rectangle(x, y, element.getWidth(), element.getHeight()); this.addElementToDiagram(element, current, true, bounds, element.getPanelAttributes()); } else { // replace edited element (and ONLY edited element) this.originalElement.getHandler().getDrawPanel().remove(this.originalElement); this.addElementToDiagram(element, this.originalElement.getHandler(), true, this.originalElement.getBounds(), this.originalElement.getPanelAttributes()); } } private void addElementToDiagram(GridElement e, DiagramHandler d, boolean setchanged, Rectangle bounds, String state) { // TODO bug if custom elements get inserted in zoomed drawpanel // the zoom to 100% bugfix works for inserting new elements but editing old elements with zoom will not work anymore // We must zoom to the defaultGridsize before execution // int oldZoom = d.getGridSize(); // d.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); GridElement e2 = e.CloneFromMe(); e2.setHandler(d); e2.setPanelAttributes(state); e2.setBounds(bounds); d.getDrawPanel().add(e2); if (setchanged) d.setChanged(true); // And zoom back to the oldGridsize after execution // d.setGridAndZoom(oldZoom, false); } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/CustomElementCompiler.java0000644000175000001440000001602011576116034025663 0ustar benuserspackage com.umlet.custom; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.SystemInfo; import com.baselet.control.Path; import com.baselet.control.Utils; import com.baselet.element.ErrorOccurred; import com.baselet.element.GridElement; public class CustomElementCompiler { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static CustomElementCompiler compiler; private static final String templatefile = "Default.java"; private String template; private Pattern template_pattern; private Pattern empty_line; private Pattern error_pattern; private Matcher template_match; private String classname; private int beforecodelines; // lines of code before the custom code begins (for error processing) private Vector compilation_errors; private boolean global_error; public static CustomElementCompiler getInstance() { if (compiler == null) compiler = new CustomElementCompiler(); return compiler; } private File sourcefile; private CustomElementCompiler() { this.global_error = false; this.compilation_errors = new Vector(); this.beforecodelines = 0; this.template_pattern = Pattern.compile("(.*)(/\\*\\*\\*\\*CUSTOM_CODE START\\*\\*\\*\\*/\n)(.*)(\n\\s\\s/\\*\\*\\*\\*CUSTOM_CODE END\\*\\*\\*\\*/)(.*)", Pattern.DOTALL); this.error_pattern = Pattern.compile(".*ERROR.*at line ([0-9]+).*\\s*$"); this.empty_line = Pattern.compile("^\\s*$"); this.template = this.loadJavaSource(new File(Path.customElements() + templatefile)); if (!"".equals(this.template)) { this.template_match = this.template_pattern.matcher(this.template); try { if (template_match.matches()) beforecodelines = this.template_match.group(1).split(Constants.NEWLINE).length; else this.global_error = true; } catch (Exception ex) { ex.printStackTrace(); } } else global_error = true; this.classname = Constants.CUSTOM_ELEMENT_CLASSNAME; File tmpDir = new File(Path.temp()); tmpDir.mkdir(); this.sourcefile = new File(Path.temp() + this.classname + ".java"); sourcefile.deleteOnExit(); new File(Path.temp() + this.classname + ".class").deleteOnExit(); } // compiles the element and returns the new entity if successful private CustomElement compile(String code) { this.saveJavaSource(code); CustomElement entity = null; this.compilation_errors.clear(); try { StringWriter compilerErrorMessageSW = new StringWriter(); // catch compiler messages PrintWriter compilerErrorMessagePW = new PrintWriter(compilerErrorMessageSW); String path = Path.executable(); String javaVersion = "-\"" + SystemInfo.JAVA_VERSION + "\""; String classpath = "-classpath \"" + path + "\"" + File.pathSeparator + "\"" + path + "bin/\""; String sourcefile = "\"" + this.sourcefile.getAbsolutePath() + "\""; // Compiler Information at http://dev.eclipse.org/viewcvs/index.cgi/jdt-core-home/howto/batch%20compile/batchCompile.html?revision=1.7 @SuppressWarnings("deprecation") boolean compilationSuccessful = org.eclipse.jdt.internal.compiler.batch.Main.compile( javaVersion + " " + classpath + " " + sourcefile, new PrintWriter(System.out), compilerErrorMessagePW); if (compilationSuccessful) { FileClassLoader fcl = new FileClassLoader(Thread.currentThread().getContextClassLoader()); Class c = fcl.findClass(this.classname); // load class by type name if (c != null) entity = (CustomElement) c.newInstance(); } else { this.compilation_errors.addAll(Utils.decomposeStrings(compilerErrorMessageSW.toString())); } } catch (Exception e) { log.error(null, e); } return entity; } // loads the source from a file private String loadJavaSource(File sourceFile) { // LME3 String _javaSource = ""; if ((sourceFile != null) && (sourceFile.getName().endsWith(".java"))) { try { BufferedReader br = new BufferedReader(new FileReader(sourceFile)); String line; while ((line = br.readLine()) != null) _javaSource += line + Constants.NEWLINE; } catch (Exception e) { log.error(null, e); } } return _javaSource.replaceAll("\r\n", Constants.NEWLINE); } // saves the source to a file private void saveJavaSource(String code) { // LME3 BufferedWriter bw; try { bw = new BufferedWriter(new FileWriter(sourcefile, false)); bw.write(this.parseCodeIntoTemplate(code)); bw.flush(); bw.close(); } catch (IOException e) { log.error(null, e); } } private String parseCodeFromTemplate(String template) { Matcher m = this.template_pattern.matcher(template); if (m.matches()) return m.group(3); else return ""; } private String parseCodeIntoTemplate(String code) { return template_match.group(1).replaceFirst("", this.classname) + template_match.group(2) + code + template_match.group(4) + template_match.group(5); } private void handleErrors(String txt, ErrorHandler errorhandler) { txt = txt.replaceAll("\r\n", Constants.NEWLINE); String[] text = txt.split(Constants.NEWLINE); for (int x = 0; x < compilation_errors.size(); x++) { Matcher m = this.error_pattern.matcher(compilation_errors.get(x)); if (m.matches()) { int errorLineNr = Integer.parseInt(m.group(1)) - this.beforecodelines; x += 3; // The error description is 3 lines later String error = compilation_errors.get(x); int beftxt = 0, i = 0; for (; (i < errorLineNr - 1) && (i < text.length - 1); i++) beftxt += text[i].length() + 1; if (i < text.length) { for (Matcher emptymatcher = this.empty_line.matcher(text[i]); emptymatcher.matches() && (i > 0); i--) { beftxt -= text[i - 1].length() + 1; emptymatcher = this.empty_line.matcher(text[i - 1]); } errorhandler.addError(i, error, beftxt, text[i].length()); } } } } public GridElement genEntity(String code, ErrorHandler errorhandler) { if (!Constants.enable_custom_elements) return new ErrorOccurred("Custom Elements are disabled\nEnable them in the Options\nOnly open Custom Elements\nfrom trusted sources!"); if (this.global_error) return new ErrorOccurred(); if (code == null) code = this.parseCodeFromTemplate(this.template); CustomElement element = this.compile(code); if (element != null) { element.setCode(code); return element; } else if (errorhandler != null) this.handleErrors(code, errorhandler); return new ErrorOccurred(); } public GridElement genEntity(String code) { return this.genEntity(code, null); } public GridElement genEntityFromTemplate(String templatename, ErrorHandler errorhandler) { String template = this.loadJavaSource(new File(Path.customElements() + templatename + ".java")); if (!"".equals(template)) return this.genEntity(this.parseCodeFromTemplate(template), errorhandler); return null; } } umlet-11.3.orig/sourcefiles/src/com/umlet/custom/HelpHandler.java0000644000175000001440000001521411576116034023576 0ustar benuserspackage com.umlet.custom; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.Action; import javax.swing.ActionMap; import com.baselet.control.Constants; import com.baselet.gui.JMultiLineToolTip; import com.umlet.gui.CustomCodeSyntaxPane; public class HelpHandler implements KeyListener { private CustomCodeSyntaxPane codepane; private ArrayList functions; private ArrayList variables; private ArrayList defaultdescriptors; // descriptors that are displayed in empty lines private CustomElementHandler handler; private class FunctionDesc { private String defaults; private String description; private Pattern pattern; private FunctionDesc(Method m) { CustomFunction cm = m.getAnnotation(CustomFunction.class); String patternstring = "\\s*"; String patternclosestring = ""; String mname = m.getName(); for (int i = 0; i < mname.length(); i++) { if (i != 0) { patternclosestring += ")?"; patternstring += "("; } patternstring += mname.charAt(i); } patternstring += "\\s*(\\("; patternclosestring += ")?"; defaults = mname + "("; description = mname + "("; String[] params = cm.param_defaults().split(","); Class[] types = m.getParameterTypes(); for (int i = 0; (i < params.length) && (i < types.length); i++) { if (i != 0) { defaults += ", "; description += ", "; patternstring += "(,"; patternclosestring += ")?"; } patternstring += ".*"; defaults += params[i]; description += types[i].getSimpleName() + " " + params[i]; } defaults += ")"; description += ")"; patternstring += "\\)?" + patternclosestring + "\\s*"; pattern = Pattern.compile(patternstring); } } private class VariableDesc { private String description; private Pattern pattern; private VariableDesc(Field f) { String patternstring = "\\s*"; String patternclosestring = ""; String mname = f.getName(); for (int i = 0; i < mname.length(); i++) { if (i != 0) { patternclosestring += ")?"; patternstring += "("; } patternstring += mname.charAt(i); } patternstring += patternclosestring + "\\s*"; description = mname; pattern = Pattern.compile(patternstring); } } public HelpHandler(CustomCodeSyntaxPane codepane, CustomElementHandler handler) { this.codepane = codepane; this.functions = new ArrayList(); this.variables = new ArrayList(); this.defaultdescriptors = new ArrayList(); for (Method m : (CustomElement.class).getDeclaredMethods()) { if (m.isAnnotationPresent(CustomFunction.class)) { this.functions.add(new FunctionDesc(m)); } } for (Field f : (CustomElement.class).getDeclaredFields()) { if (f.isAnnotationPresent(CustomVariable.class)) this.variables.add(new VariableDesc(f)); } // Fill defaultdescriptors with all beginnings of custom functions ("draw...","print...",etc) for (FunctionDesc func : functions) { String firstPartOfFuncName = func.description.split("[A-Z(]")[0] + "..."; if (!defaultdescriptors.contains(firstPartOfFuncName)) defaultdescriptors.add(firstPartOfFuncName); } this.handler = handler; } private void displaytooltip(boolean display) { JMultiLineToolTip tip = (JMultiLineToolTip) this.codepane.getToolTip(); ActionMap m = this.codepane.getActionMap(); Action post = m.get("postTip"); Action hide = m.get("hideTip"); boolean tipvisible = false; if (tip != null) { tipvisible = (tip.getParent() != null); } if (display && (post != null)) { if (!tipvisible) { post.actionPerformed(new ActionEvent(this.codepane, ActionEvent.ACTION_PERFORMED, "")); tip = (JMultiLineToolTip) this.codepane.getToolTip(); } else { hide.actionPerformed(new ActionEvent(this.codepane, ActionEvent.ACTION_PERFORMED, "")); post.actionPerformed(new ActionEvent(this.codepane, ActionEvent.ACTION_PERFORMED, "")); tip = (JMultiLineToolTip) this.codepane.getToolTip(); } if (tip.getParent() != null) { Point p = this.codepane.getLocationOnScreen(); int pos = this.codepane.getCaretPosition(); String[] lines = this.codepane.getText().split(Constants.NEWLINE, -1); int linenum = 0; for (int cur_pos = 0; (linenum < lines.length) && (cur_pos <= pos); cur_pos += lines[linenum].length() + 1, linenum++); p.y += linenum * this.codepane.getFontMetrics(this.codepane.getFont()).getHeight() + 3; p.x += 15; tip.getParent().getParent().getParent().getParent().setLocation(p); } } else if ((hide != null) && tipvisible) hide.actionPerformed(new ActionEvent(this.codepane, ActionEvent.ACTION_PERFORMED, "")); } private ArrayList parseFunctionVariableDesc() { String[] lines = this.codepane.getText().split(Constants.NEWLINE, -1); int linenum = 0; int pos = this.codepane.getCaretPosition(); int cur_pos = 0; while ((linenum < lines.length) && (cur_pos <= pos)) { cur_pos += lines[linenum].length() + 1; linenum++; } linenum--; cur_pos -= lines[linenum].length() + 1; ArrayList descriptors = new ArrayList(); if (lines[linenum].equals("")) descriptors.addAll(this.defaultdescriptors); else { String[] segments = lines[linenum].split("[=;+-,]|\\*|\\/|\\("); for (String line : segments) { if ((cur_pos <= pos) && (cur_pos + line.length() >= pos)) { for (FunctionDesc fd : this.functions) { Matcher m = fd.pattern.matcher(line); if (m.matches()) descriptors.add(fd.description); } for (VariableDesc vd : this.variables) { Matcher m = vd.pattern.matcher(line); if (m.matches()) descriptors.add(vd.description); } break; } cur_pos += line.length() + 1; } } return descriptors; } @Override public void keyPressed(KeyEvent ke) { } @Override public void keyReleased(KeyEvent ke) { this.handler.keypressed = true; ArrayList descriptors = this.parseFunctionVariableDesc(); if (descriptors.isEmpty()) this.displaytooltip(false); else { String text = ""; for (int i = 0; i < descriptors.size(); i++) { if (i != 0) text += Constants.NEWLINE; text += descriptors.get(i); } this.codepane.setToolTipText(text); this.displaytooltip(true); } } @Override public void keyTyped(KeyEvent ke) { } } umlet-11.3.orig/sourcefiles/src/com/baselet/0000755000175000001440000000000011576116036017523 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/gui/0000755000175000001440000000000011576116036020307 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/0000755000175000001440000000000011576116036022134 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/PaletteRelationListener.java0000644000175000001440000001113311576116034027576 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.command.AddLinePoint; import com.baselet.diagram.command.Move; import com.baselet.diagram.command.MoveLinePoint; import com.baselet.diagram.command.RemoveLinePoint; import com.umlet.element.Relation; public class PaletteRelationListener extends PaletteEntityListener { private static HashMap listener = new HashMap(); public static PaletteRelationListener getInstance(DiagramHandler handler) { if (!listener.containsKey(handler)) listener.put(handler, new PaletteRelationListener(handler)); return listener.get(handler); } private boolean IS_DRAGGING_LINEPOINT = false; private boolean IS_DRAGGING_LINE = false; private int LINEPOINT = -1; private PaletteRelationListener(DiagramHandler handler) { super(handler); } @Override public void mousePressed(MouseEvent me) { super.mousePressed(me); if (me.getButton() == MouseEvent.BUTTON1) { this.IS_DRAGGING = false; Relation rel = (Relation) me.getComponent(); int where = rel.getLinePoint(new Point(me.getX(), me.getY())); if (where >= 0) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = where; } else if (rel.isWholeLine(me.getX(), me.getY())) { IS_DRAGGING_LINE = true; IS_DRAGGING = true; } else if (me.getButton() == MouseEvent.BUTTON2) { IS_DRAGGING_DIAGRAM = true; IS_DRAGGING_LINE = false; IS_DRAGGING_LINEPOINT = false; IS_DRAGGING = false; } } } @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); if (IS_DRAGGING_LINEPOINT & (LINEPOINT >= 0)) { Relation rel = (Relation) me.getComponent(); if (rel.isOnLine(LINEPOINT) && (rel.isPartOfGroup() == false)) { // L.Trescher this.controller.executeCommand( new RemoveLinePoint(rel, LINEPOINT)); } } IS_DRAGGING_LINEPOINT = false; IS_DRAGGING_LINE = false; } @Override public void mouseMoved(MouseEvent me) { super.mouseMoved(me); Relation rel = (Relation) me.getComponent(); int where = rel.getLinePoint(new Point(me.getX(), me.getY())); if (where >= 0) { Main.getInstance().getGUI().setCursor(Constants.HAND_CURSOR); } else if (rel.isWholeLine(me.getX(), me.getY())) { Main.getInstance().getGUI().setCursor(Constants.MOVE_CURSOR); } else Main.getInstance().getGUI().setCursor(Constants.CROSS_CURSOR); return; } @Override public void mouseDragged(MouseEvent me) { super.mouseDragged(me); if (this.doReturn()) return; if (this.IS_DRAGGING) return; if (this.IS_DRAGGED_FROM_PALETTE) return; if (this.IS_DRAGGING_DIAGRAM) return; Relation r = (Relation) me.getComponent(); int gridSize = Main.getInstance().getDiagramHandler().getGridSize(); // delta int delta_x = 0; int delta_y = 0; if (IS_DRAGGING_LINEPOINT) { Vector tmp = r.getLinePoints(); Point p = tmp.elementAt(LINEPOINT); delta_x = (r.getX() + p.x) % gridSize; delta_y = (r.getY() + p.y) % gridSize; } Point newp = this.getNewCoordinate(); Point oldp = this.getOldCoordinate(); int diffx = newp.x - oldp.x - delta_x; int diffy = newp.y - oldp.y - delta_y; if (IS_DRAGGING_LINEPOINT & (LINEPOINT >= 0)) { this.controller.executeCommand( new MoveLinePoint(r, LINEPOINT, diffx, diffy)); return; } else if (IS_DRAGGING_LINE) { this.controller.executeCommand(new Move(r, diffx, diffy)); if (r.getLocationOnScreen().x + r.getWidth() <= handler.getDrawPanel().getLocationOnScreen().x) { IS_DRAGGING_LINE = false; IS_DRAGGING_LINEPOINT = false; } return; } int where = r.getLinePoint(new Point(me.getX(), me.getY())); if (!this.IS_DRAGGED_FROM_PALETTE) { if ((where >= 0)) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = where; this.controller.executeCommand( new MoveLinePoint(r, where, diffx, diffy)); return; } else { Point p = new Point(me.getX(), me.getY()); int ins = r.getWhereToInsert(p); if (ins > 0) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = ins; this.controller.executeCommand( new AddLinePoint(r, ins, me.getX(), me.getY())); return; } } } } @Override protected boolean allowCopyEntity() { if (!IS_DRAGGING_LINEPOINT) return true; return false; } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/PropertyPanelListener.java0000644000175000001440000000526411576116034027316 0ustar benuserspackage com.baselet.gui.listener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import com.baselet.control.Main; import com.baselet.diagram.CustomPreviewHandler; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.command.ChangeState; import com.baselet.diagram.command.CustomCodePropertyChanged; import com.baselet.diagram.command.HelpPanelChanged; import com.baselet.element.GridElement; public class PropertyPanelListener implements KeyListener, FocusListener { @Override public void keyReleased(KeyEvent e) { /** * Esc: Leaves the Property Panel */ if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { Main.getInstance().getGUI().requestFocus(); } else if (!e.isActionKey() && !isUndoRedo(e)) { updateGridElement(); } } private boolean isUndoRedo(KeyEvent e) { return (e.isControlDown() && (e.getKeyCode() == KeyEvent.VK_Z || e.getKeyCode() == KeyEvent.VK_Y)); } @Override public void focusGained(FocusEvent e) { updateGridElement(); // Workaround which is needed to make selection of a autocompletion element via mouse work } @Override public void focusLost(FocusEvent e) {} @Override public void keyTyped(KeyEvent ke) {} @Override public void keyPressed(KeyEvent e) {} protected void updateGridElement() { GridElement gridElement = Main.getInstance().getEditedGridElement(); String s = Main.getInstance().getPropertyString(); DiagramHandler handler = Main.getInstance().getDiagramHandler(); if (gridElement != null) { //only create command if changes were made if (!s.equals(gridElement.getPanelAttributes())) { int newCaretPos = Main.getInstance().getGUI().getPropertyPane().getCaretPosition(); int oldCaretPos = newCaretPos - (s.length()-gridElement.getPanelAttributes().length()); if (gridElement.getHandler() instanceof CustomPreviewHandler) { gridElement.getHandler().getController().executeCommand(new CustomCodePropertyChanged(gridElement.getPanelAttributes(), s, oldCaretPos, newCaretPos)); } else { gridElement.getHandler().getController().executeCommand(new ChangeState(gridElement, gridElement.getPanelAttributes(), s, oldCaretPos, newCaretPos)); } } } else if (handler != null && !s.equals(handler.getHelpText())) { // help panel has been edited handler.getController().executeCommand(new HelpPanelChanged(s)); } // Scrollbars must be updated cause some entities can grow out of screen border by typing text inside (eg: autoresize custom elements) if (handler != null) handler.getDrawPanel().updatePanelAndScrollbars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/PaletteComboBoxListener.java0000644000175000001440000000247111576116034027536 0ustar benuserspackage com.baselet.gui.listener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import javax.swing.JComboBox; import com.baselet.control.Main; public class PaletteComboBoxListener implements ActionListener, MouseWheelListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JComboBox) { String paletteName = ((JComboBox) e.getSource()).getSelectedItem().toString(); Main.getInstance().getGUI().selectPalette(paletteName); setZoom(); } } @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.getSource() instanceof JComboBox) { JComboBox comboBox = ((JComboBox) e.getSource()); int newIndex = comboBox.getSelectedIndex() + e.getWheelRotation(); // wheelrotation is -1 (up) or +1 (down) if (comboBox.getItemAt(newIndex) != null) { String newSelectedItem = comboBox.getItemAt(newIndex).toString(); Main.getInstance().getGUI().selectPalette(newSelectedItem); comboBox.setSelectedIndex(newIndex); setZoom(); } } } private void setZoom() { if ((Main.getInstance().getPalette() != null)) { int factor = Main.getInstance().getPalette().getGridSize(); Main.getInstance().getGUI().setValueOfZoomDisplay(factor); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/CustomPreviewEntityListener.java0000644000175000001440000000141511576116034030515 0ustar benuserspackage com.baselet.gui.listener; import java.util.HashMap; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class CustomPreviewEntityListener extends GridElementListener { private static HashMap entitylistener = new HashMap(); public static CustomPreviewEntityListener getInstance(DiagramHandler handler) { if (!entitylistener.containsKey(handler)) entitylistener.put(handler, new CustomPreviewEntityListener(handler)); return entitylistener.get(handler); } public CustomPreviewEntityListener(DiagramHandler handler) { super(handler); } @Override public void mouseDoubleClicked(GridElement me) { } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/DividerListener.java0000644000175000001440000000152311576116034026072 0ustar benuserspackage com.baselet.gui.listener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.PaletteHandler; public class DividerListener implements ComponentListener { @Override public void componentHidden(ComponentEvent e) {} @Override public void componentMoved(ComponentEvent e) {} @Override public void componentResized(ComponentEvent e) { PaletteHandler p = Main.getInstance().getPalette(); if ((p != null) && (p.getDrawPanel() != null)) p.getDrawPanel().updatePanelAndScrollbars(); DiagramHandler h = Main.getInstance().getDiagramHandler(); if ((h != null) && (h.getDrawPanel() != null)) h.getDrawPanel().updatePanelAndScrollbars(); } @Override public void componentShown(ComponentEvent e) {} } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/GridElementListener.java0000644000175000001440000003600711576116034026710 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Vector; import javax.swing.JComponent; import javax.swing.JPopupMenu; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.SystemInfo; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.SelectorFrame; import com.baselet.diagram.command.AddElement; import com.baselet.diagram.command.Command; import com.baselet.diagram.command.Macro; import com.baselet.diagram.command.Move; import com.baselet.diagram.command.MoveLinePoint; import com.baselet.diagram.command.Resize; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; import com.umlet.element.Relation; import com.umlet.element.relation.RelationLinePoint; public class GridElementListener extends UniversalListener { private static HashMap entitylistener = new HashMap(); private final static Logger log = Logger.getLogger(Utils.getClassName()); public static GridElementListener getInstance(DiagramHandler handler) { if (!entitylistener.containsKey(handler)) entitylistener.put(handler, new GridElementListener(handler)); return entitylistener.get(handler); } protected boolean IS_DRAGGING = false; protected boolean IS_DRAGGING_DIAGRAM = false; protected boolean IS_RESIZING = false; protected boolean IS_DRAGGED_FROM_PALETTE = false; protected boolean IS_FIRST_MOVE = false; protected boolean IS_FIRST_DRAGGING_OVER = false; private int RESIZE_DIRECTION = 0; private Resize FIRST_RESIZE = null; private Vector ALL_MOVE_COMMANDS = null; protected boolean DESELECT_MULTISEL = false; private boolean LASSO_ACTIVE = false; private Rectangle lassoToleranceRectangle; private final int lassoTolerance = 2; private Point mousePressedPoint; private int resizeDirection; protected GridElementListener(DiagramHandler handler) { super(handler); } @Override public void mouseDragged(MouseEvent me) { super.mouseDragged(me); log.debug("Entity dragged"); GridElement e = (GridElement) me.getComponent(); // Lasso selection is only activated if mouse is moved more than lasso_tolerance to avoid accidential activation instead of selecting the entity if (LASSO_ACTIVE && (lassoToleranceRectangle != null) && !lassoToleranceRectangle.contains(new Point(getOffset(me).x, getOffset(me).y))) { dragLasso(me, e); return; } if (this.doReturn()) return; if (IS_DRAGGING_DIAGRAM) dragDiagram(); if (IS_DRAGGING) dragEntity(e); if (IS_RESIZING) resizeEntity(e, me); } @Override protected Point getOffset(MouseEvent me) { return new Point(me.getX() + me.getComponent().getX(), me.getY() + me.getComponent().getY()); } @Override public void mouseMoved(MouseEvent me) { super.mouseMoved(me); log.debug("Entity moved"); if (this.IS_DRAGGED_FROM_PALETTE) { log.debug("mouseMoved with dragged"); GridElement e = (GridElement) me.getComponent(); e.setLocation(me.getX() - 100, me.getY() - 20); } GridElement e = (GridElement) me.getComponent(); resizeDirection = e.getResizeArea(me.getX(), me.getY()); resizeDirection = resizeDirection & e.getPossibleResizeDirections(); // LME if (resizeDirection == 0) Main.getInstance().getGUI().setCursor(Constants.HAND_CURSOR); if ((resizeDirection == Constants.RESIZE_TOP) | (resizeDirection == Constants.RESIZE_BOTTOM)) Main.getInstance().getGUI().setCursor(Constants.TB_CURSOR); if ((resizeDirection == Constants.RESIZE_RIGHT) | (resizeDirection == Constants.RESIZE_LEFT)) Main.getInstance().getGUI().setCursor(Constants.LR_CURSOR); if ((resizeDirection == Constants.RESIZE_TOP_RIGHT) | (resizeDirection == Constants.RESIZE_BOTTOM_LEFT)) Main.getInstance().getGUI().setCursor(Constants.NE_CURSOR); if ((resizeDirection == Constants.RESIZE_BOTTOM_RIGHT) | (resizeDirection == Constants.RESIZE_TOP_LEFT)) Main.getInstance().getGUI().setCursor(Constants.NW_CURSOR); } private void dragDiagram() { if (this.doReturn()) return; log.debug("dragDiagram()"); Point newp = this.getNewCoordinate(); Point oldp = this.getOldCoordinate(); int diffx = newp.x - oldp.x; int diffy = newp.y - oldp.y; Vector v = this.diagram.getAllEntities(); Vector moveCommands = new Vector(); for (int i = 0; i < v.size(); i++) { GridElement e = v.elementAt(i); if (e.isPartOfGroup()) continue; moveCommands.add(new Move(e, diffx, diffy)); } this.controller.executeCommand(new Macro(moveCommands)); } private void showContextMenu(GridElement me, int x, int y) { if (!this.selector.getSelectedEntities().contains(me)) this.selector.singleSelect(me); selector.setDominantEntity(me); JPopupMenu contextMenu = Main.getInstance().getGUI().getContextMenu(me); if (contextMenu != null) contextMenu.show(me, x, y); } @Override public void mousePressed(MouseEvent me) { super.mousePressed(me); GridElement e = (GridElement) me.getComponent(); mousePressedPoint = getOffset(me); if (!handler.getDrawPanel().equals(Main.getInstance().getPalettePanel())) Main.getInstance().getPalettePanel().getSelector().deselectAllWithoutUpdatePropertyPanel(); if (me.getButton() == MouseEvent.BUTTON3) { this.showContextMenu(e, me.getX(), me.getY()); } else if (me.getButton() == MouseEvent.BUTTON2) { IS_DRAGGING_DIAGRAM = true; } else if (me.getButton() == MouseEvent.BUTTON1) { if (me.getClickCount() == 1) { pressedLeftButton(me); } if (me.getClickCount() == 2) { this.mouseDoubleClicked(e); } } } private void pressedLeftButton(MouseEvent me) { GridElement e = (GridElement) me.getComponent(); // Ctrl + Mouseclick initializes the lasso if ((me.getModifiers() & SystemInfo.META_KEY.getMask()) != 0) initializeLasso(me); int ra = e.getResizeArea(me.getX(), me.getY()); ra = ra & e.getPossibleResizeDirections(); // LME if (ra != 0) { IS_RESIZING = true; RESIZE_DIRECTION = ra; } else { IS_DRAGGING = true; if ((me.getModifiers() & SystemInfo.META_KEY.getMask()) != 0) { if (e.isSelected()) DESELECT_MULTISEL = true; else this.selector.select(e); } } if (!this.selector.getSelectedEntities().contains(e)) this.selector.singleSelect(e); else this.selector.updateSelectorInformation(); } public void mouseDoubleClicked(GridElement me) { GridElement e = me.CloneFromMe(); GridElementListener eListener = handler.getEntityListener(e); Command cmd; int gridSize = Main.getInstance().getDiagramHandler().getGridSize(); cmd = new AddElement(e, me.getX() + gridSize * 2, me.getY() + gridSize * 2); // this.IS_FIRST_DRAGGING_OVER=true; this.controller.executeCommand(cmd); this.selector.singleSelect(e); e.setStickingBorderActive(false); eListener.IS_FIRST_DRAGGING_OVER = false; } @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); // log.debug("Entity mouse released"); if (this.IS_DRAGGED_FROM_PALETTE) this.IS_DRAGGED_FROM_PALETTE = false; GridElement e = (GridElement) me.getComponent(); e.setStickingBorderActive(true); if ((me.getModifiers() & SystemInfo.META_KEY.getMask()) != 0) { if (e.isSelected() && DESELECT_MULTISEL) this.selector.deselect(e); } DESELECT_MULTISEL = false; IS_DRAGGING = false; IS_DRAGGING_DIAGRAM = false; IS_RESIZING = false; IS_FIRST_DRAGGING_OVER = false; FIRST_RESIZE = null; ALL_MOVE_COMMANDS = null; if (LASSO_ACTIVE) { LASSO_ACTIVE = false; ((JComponent) me.getComponent()).remove(selector.getSelectorFrame()); } } private void initializeLasso(MouseEvent me) { lassoToleranceRectangle = new Rectangle(mousePressedPoint.x - lassoTolerance, mousePressedPoint.y - lassoTolerance, lassoTolerance * 2, lassoTolerance * 2); LASSO_ACTIVE = true; SelectorFrame selframe = selector.getSelectorFrame(); selframe.setLocation(mousePressedPoint); selframe.setSize(1, 1); Main.getInstance().getDiagramHandler().getDrawPanel().add(selframe, 0); Main.getInstance().getGUI().setCursor(Constants.DEFAULT_CURSOR); } private void dragLasso(MouseEvent me, GridElement e) { selector.setSelectorFrameActive(true); selector.getSelectorFrame().setDisplacement(e.getX(), e.getY()); selector.getSelectorFrame().resizeTo(me.getX(), me.getY()); // Subtract difference between entityx/entityy and the position of the mouse cursor selector.deselectAll(); // If lasso is active the clicked and therefore automatically selected entity gets unselected } /** * Dragging entities must be a Macro, because undo should undo the full move (and not only a small part which would * happen with many short Move actions) and it must consider sticking relations at the dragging-start and later */ private void dragEntity(GridElement e) { DESELECT_MULTISEL = false; Point newp = this.getNewCoordinate(); Point oldp = this.getOldCoordinate(); int diffx = newp.x - oldp.x; int diffy = newp.y - oldp.y; if (!IS_FIRST_DRAGGING_OVER) { firstDragging(diffx, diffy); } else { continueDragging(diffx, diffy); } this.controller.executeCommand(new Macro(ALL_MOVE_COMMANDS)); } /** * At the beginning of dragging entities sticking relations must be calculated (and also moved from now on) */ private void firstDragging(int diffx, int diffy) { Vector entitiesToBeMoved = this.selector.getSelectedEntities(); Vector moveCommands = new Vector(); Vector linepointCommands = new Vector(); for (GridElement e : entitiesToBeMoved) { moveCommands.add(new Move(e, diffx, diffy)); if (e instanceof Relation) continue; StickingPolygon stick = null; if (e.isStickingBorderActive()) stick = e.generateStickingBorder(e.getX(), e.getY(), e.getWidth(), e.getHeight()); if (stick != null) { Vector affectedRelationPoints = stick.getStickingRelationLinePoints(this.diagram); for (int j = 0; j < affectedRelationPoints.size(); j++) { RelationLinePoint tmpRlp = affectedRelationPoints.elementAt(j); if (entitiesToBeMoved.contains(tmpRlp.getRelation())) continue; linepointCommands.add(new MoveLinePoint(tmpRlp.getRelation(), tmpRlp.getLinePointId(), diffx, diffy)); } } } Vector allCommands = new Vector(); allCommands.addAll(moveCommands); allCommands.addAll(linepointCommands); ALL_MOVE_COMMANDS = allCommands; this.IS_FIRST_DRAGGING_OVER = true; } /** * After the firstDragging is over, the vector of entities which should be dragged doesn't change (nothing starts sticking during dragging) */ private void continueDragging(int diffx, int diffy) { Vector tmpVector = new Vector(); for (int i = 0; i < ALL_MOVE_COMMANDS.size(); i++) { Command tmpCommand = ALL_MOVE_COMMANDS.elementAt(i); if (tmpCommand instanceof Move) { Move m = (Move) tmpCommand; tmpVector.add(new Move(m.getEntity(), diffx, diffy)); } else if (tmpCommand instanceof MoveLinePoint) { MoveLinePoint m = (MoveLinePoint) tmpCommand; tmpVector.add(new MoveLinePoint(m.getRelation(), m.getLinePointId(), diffx, diffy)); } } ALL_MOVE_COMMANDS = tmpVector; } private void resizeEntity(GridElement e, MouseEvent me) { int gridSize = Main.getInstance().getDiagramHandler().getGridSize(); int delta_x = 0; int delta_y = 0; final Point newp = this.getNewCoordinate(); final Point oldp = this.getOldCoordinate(); // If Shift is pressed and the resize direction is any diagonal direction, both axis are resized proportional if (me.isShiftDown() && (resizeDirection == Constants.RESIZE_TOP_LEFT || resizeDirection == Constants.RESIZE_TOP_RIGHT || resizeDirection == Constants.RESIZE_BOTTOM_LEFT || resizeDirection == Constants.RESIZE_BOTTOM_RIGHT)) { if (e.getWidth() > e.getHeight()) { float proportion = (float) newp.x / mousePressedPoint.x; newp.setLocation(newp.x, mousePressedPoint.y*proportion); } else { float proportion = (float) newp.y / mousePressedPoint.y; newp.setLocation(mousePressedPoint.x*proportion, newp.y); } } if ((RESIZE_DIRECTION & Constants.RESIZE_RIGHT) > 0) { delta_x = (e.getX() + e.getWidth()) % gridSize; } if ((RESIZE_DIRECTION & Constants.RESIZE_BOTTOM) > 0) { delta_y = (e.getY() + e.getHeight()) % gridSize; } int diffx = newp.x - oldp.x - delta_x; int diffy = newp.y - oldp.y - delta_y; int diffw = 0; int diffh = 0; e.setManualResized(); // AB: get minsize; add 0.5 to round float at typecast; then add rest to stick on grid // AB: Would be better if this is defined in the Entity class int minSize = (int) (2 * this.handler.getFontHandler().getFontSize() + 0.5); minSize = minSize - minSize % gridSize; if ((RESIZE_DIRECTION & Constants.RESIZE_LEFT) > 0) { // AB: get diffx; add MAIN_UNIT because of a natural offset (possible bug in mouse pos calculation?) diffx = newp.x - e.getX() + gridSize; // AB: only shrink to minimum size if (e.getWidth() - diffx < minSize) { diffx = e.getWidth() - minSize; } if (RESIZE_DIRECTION == Constants.RESIZE_LEFT) { diffy = 0; } } if ((RESIZE_DIRECTION & Constants.RESIZE_RIGHT) > 0) { // AB: get diffx; add MAIN_UNIT because of a natural offset (possible bug in mouse pos calculation?) diffx = newp.x - (e.getX() + e.getWidth()) + gridSize; // AB: only shrink to minimum size if (e.getWidth() + diffx < minSize) { diffx = minSize - e.getWidth(); } if (RESIZE_DIRECTION == Constants.RESIZE_RIGHT) { diffy = 0; } diffw = diffx; diffx = 0; } if ((RESIZE_DIRECTION & Constants.RESIZE_TOP) > 0) { // AB: get diffy; add MAIN_UNIT because of a natural offset (possible bug in mouse pos calculation?) diffy = newp.y - e.getY() + gridSize; // AB: only shrink to minimum size if (e.getHeight() - diffy < minSize) { diffy = e.getHeight() - minSize; } if (RESIZE_DIRECTION == Constants.RESIZE_TOP) { diffx = 0; } } if ((RESIZE_DIRECTION & Constants.RESIZE_BOTTOM) > 0) { // AB: get diffy; add MAIN_UNIT because of a natural offset (possible bug in mouse pos calculation?) diffy = newp.y - (e.getY() + e.getHeight()) + gridSize; // AB: only shrink to minimum size if (e.getHeight() + diffy < minSize) { diffy = minSize - e.getHeight(); } if (RESIZE_DIRECTION == Constants.RESIZE_BOTTOM) { diffx = 0; } diffh = diffy; diffy = 0; } Resize resize; if (FIRST_RESIZE == null) { resize = new Resize(e, diffx, diffy, diffw, diffh); FIRST_RESIZE = resize; } else { resize = new Resize(e, diffx, diffy, diffw, diffh, FIRST_RESIZE); } this.controller.executeCommand(resize); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/DiagramListener.java0000644000175000001440000000746611576116034026064 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.util.Vector; import javax.swing.JComponent; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.SystemInfo; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.SelectorFrame; import com.baselet.diagram.command.Command; import com.baselet.diagram.command.Macro; import com.baselet.diagram.command.Move; import com.baselet.element.GridElement; public class DiagramListener extends UniversalListener implements MouseWheelListener { private final static Logger log = Logger.getLogger(Utils.getClassName()); public DiagramListener(DiagramHandler handler) { super(handler); } @Override public void mousePressed(MouseEvent me) { super.mousePressed(me); selector.deselectAll(); if (!handler.getDrawPanel().equals(Main.getInstance().getPalettePanel())) { Main.getInstance().getPalettePanel().getSelector().deselectAllWithoutUpdatePropertyPanel(); } log.debug("mousePressed!!"); if ((me.getModifiers() & SystemInfo.META_KEY.getMask()) != 0) { SelectorFrame selframe = this.selector.getSelectorFrame(); selframe.setLocation((int) getOffset(me).getX(), (int) getOffset(me).getY()); selframe.setSize(1, 1); ((JComponent) me.getComponent()).add(selframe, 0); selector.setSelectorFrameActive(true); } } @Override public void mouseMoved(MouseEvent me) { super.mouseMoved(me); log.debug("DiagramLister move"); // for (Entity e : this.diagram.getSelector().getSelectedEntities()) { // EntityListener listener = handler.getEntityListener(e); // if(listener.IS_DRAGGED_FROM_PALETTE){ // log.debug("IS_DRAGGED_FROM_PALETTE"); // listener.IS_FIRST_MOVE = false; // e.changeLocation(me.getX()-e.getX(), me.getY()-e.getY()); // handler.getEntityListener(e).IS_DRAGGED_FROM_PALETTE = false; // handler.getEntityListener(e).IS_DRAGGING = true; // e.setLocation(me.getX()-100, me.getY()-20); // } // } Main.getInstance().getGUI().setCursor(Constants.DEFAULT_CURSOR); } @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); // for(Entity e: this.diagram.getSelector().getSelectedEntities()){ // if(handler.getEntityListener(e).IS_DRAGGED_FROM_PALETTE){ // handler.getEntityListener(e).IS_DRAGGED_FROM_PALETTE = false; // } // } } @Override public void mouseDragged(MouseEvent me) { super.mouseDragged(me); log.debug("mouseDragged!!"); if (this.doReturn()) return; Point newp = this.getNewCoordinate(); Point oldp = this.getOldCoordinate(); int diffx = newp.x - oldp.x; int diffy = newp.y - oldp.y; Vector v = this.diagram.getAllEntities(); Vector moveCommands = new Vector(); for (int i = 0; i < v.size(); i++) { GridElement e = v.elementAt(i); if (e.isPartOfGroup()) continue; moveCommands.add(new Move(e, diffx, diffy)); } this.controller.executeCommand(new Macro(moveCommands)); } @Override protected Point getOffset(MouseEvent me) { return new Point(me.getX(), me.getY()); } @Override public void mouseWheelMoved(MouseWheelEvent e) { // Only if Ctrl is pressed while scrolling, we zoom in and out if ((e.getModifiersEx() & SystemInfo.META_KEY.getMaskDown()) == SystemInfo.META_KEY.getMaskDown()) { int actualZoom = Main.getInstance().getDiagramHandler().getGridSize(); // e.getWheelRotation is -1 if scrolling up and +1 if scrolling down therefore we subtract it Main.getInstance().getDiagramHandler().setGridAndZoom(actualZoom - e.getWheelRotation()); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/ScrollbarListener.java0000644000175000001440000000153011576116034026425 0ustar benuserspackage com.baselet.gui.listener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import com.baselet.diagram.DrawPanel; public class ScrollbarListener implements MouseListener, MouseWheelListener { private DrawPanel drawpanel; public ScrollbarListener(DrawPanel drawpanel) { super(); this.drawpanel = drawpanel; } @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) { drawpanel.updatePanelAndScrollbars(); } @Override public void mouseWheelMoved(MouseWheelEvent e) { drawpanel.updatePanelAndScrollbars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/GUIListener.java0000644000175000001440000001262711576116034025137 0ustar benuserspackage com.baselet.gui.listener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Vector; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.command.Command; import com.baselet.diagram.command.Macro; import com.baselet.diagram.command.Move; import com.baselet.diagram.command.MoveLinePoint; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; import com.umlet.element.Relation; import com.umlet.element.relation.RelationLinePoint; public class GUIListener implements KeyListener { @Override public void keyPressed(KeyEvent e) { DiagramHandler handler = Main.getInstance().getDiagramHandler(); if ((handler != null) && !e.isAltDown() && !e.isAltGraphDown() /* && !e.isControlDown() && !e.isMetaDown() */) { /** * Enter: jumps directly into the diagram */ if (e.getKeyCode() == KeyEvent.VK_ENTER) { Main.getInstance().getGUI().focusPropertyPane(); } /** * Ctrl +/-: Zoom diagram by 10% */ // KeyChar check doesn't check non-numpad + on some keyboards, therefore we also need KeyEvent.VK_PLUS else if (((e.getKeyChar() == '+') || (e.getKeyCode() == KeyEvent.VK_PLUS))) { int actualZoom = handler.getGridSize(); handler.setGridAndZoom(actualZoom + 1); } // KeyChar check doesn't check non-numpad - on some keyboards, therefore we also need KeyEvent.VK_MINUS else if (((e.getKeyChar() == '-') || (e.getKeyCode() == KeyEvent.VK_MINUS))) { int actualZoom = handler.getGridSize(); handler.setGridAndZoom(actualZoom - 1); } /** * Cursors: Move diagram by a small distance */ else { int diffx = 0; int diffy = 0; if ((e.getKeyCode() == KeyEvent.VK_DOWN) || (e.getKeyCode() == KeyEvent.VK_KP_DOWN)) diffy = handler.getGridSize(); if ((e.getKeyCode() == KeyEvent.VK_UP) || (e.getKeyCode() == KeyEvent.VK_KP_UP)) diffy = -handler.getGridSize(); if ((e.getKeyCode() == KeyEvent.VK_LEFT) || (e.getKeyCode() == KeyEvent.VK_KP_LEFT)) diffx = -handler.getGridSize(); if ((e.getKeyCode() == KeyEvent.VK_RIGHT) || (e.getKeyCode() == KeyEvent.VK_KP_RIGHT)) diffx = handler.getGridSize(); if ((diffx != 0) || (diffy != 0)) { Vector entitiesToBeMoved; // Move only selected entities or all if no entity is selected entitiesToBeMoved = handler.getDrawPanel().getSelector().getSelectedEntities(); if (entitiesToBeMoved.isEmpty()) entitiesToBeMoved = handler.getDrawPanel().getAllEntities(); // TODO The following code is very similar to EntityListener 96-144 and should be refactored Vector moveCommands = new Vector(); for (int i = 0; i < entitiesToBeMoved.size(); i++) { GridElement entity = entitiesToBeMoved.elementAt(i); if (entity.isPartOfGroup()) continue; entity.setStickingBorderActive(true); moveCommands.add(new Move(entity, diffx, diffy)); } Vector linepointCommands = new Vector(); for (int i = 0; i < entitiesToBeMoved.size(); i++) { GridElement tmpEntity = entitiesToBeMoved.elementAt(i); if (tmpEntity instanceof Relation) continue; StickingPolygon stick = null; if (tmpEntity.isStickingBorderActive()) stick = tmpEntity.generateStickingBorder(tmpEntity.getX(), tmpEntity.getY(), tmpEntity.getWidth(), tmpEntity.getHeight()); else tmpEntity.setStickingBorderActive(true); if (stick != null) { Vector affectedRelationPoints = stick.getStickingRelationLinePoints(handler.getDrawPanel()); for (int j = 0; j < affectedRelationPoints.size(); j++) { RelationLinePoint tmpRlp = affectedRelationPoints.elementAt(j); if (entitiesToBeMoved.contains(tmpRlp.getRelation())) continue; linepointCommands.add(new MoveLinePoint(tmpRlp.getRelation(), tmpRlp.getLinePointId(), diffx, diffy)); } } } Vector ALL_MOVE_COMMANDS = new Vector(); ALL_MOVE_COMMANDS.addAll(moveCommands); ALL_MOVE_COMMANDS.addAll(linepointCommands); Vector tmpVector = new Vector(); for (int i = 0; i < ALL_MOVE_COMMANDS.size(); i++) { Command tmpCommand = ALL_MOVE_COMMANDS.elementAt(i); if (tmpCommand instanceof Move) { Move m = (Move) tmpCommand; tmpVector.add(new Move(m.getEntity(), diffx, diffy)); } else if (tmpCommand instanceof MoveLinePoint) { MoveLinePoint m = (MoveLinePoint) tmpCommand; tmpVector.add(new MoveLinePoint(m.getRelation(), m.getLinePointId(), diffx, diffy)); } } ALL_MOVE_COMMANDS = tmpVector; handler.getController().executeCommand(new Macro(ALL_MOVE_COMMANDS)); Main.getInstance().getDiagramHandler().getDrawPanel().updatePanelAndScrollbars(); } } } // TODO implement ESC Overview // if ((e.getModifiersEx() == 0) && (e.getKeyCode() == KeyEvent.VK_ESCAPE)) { // if ((handler != null) && (handler.getDrawPanel() != null)) { // // As long as the horizontal or vertical scrollbar is visible we must zoom 1 step out // while (handler.getDrawPanel().getScrollPanel().getHorizontalScrollBar().isVisible() || // handler.getDrawPanel().getScrollPanel().getVerticalScrollBar().isVisible()) { // int actualZoom = handler.getGridSize(); // handler.setGridAndZoom(actualZoom - 1); // } // } // } } @Override public void keyReleased(KeyEvent arg0) {} @Override public void keyTyped(KeyEvent arg0) {} } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/HyperLinkActiveListener.java0000644000175000001440000000074611576116034027553 0ustar benuserspackage com.baselet.gui.listener; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import com.baselet.control.BrowserLauncher; public class HyperLinkActiveListener implements HyperlinkListener { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { BrowserLauncher.openURL(e.getURL().toString()); } catch (Throwable t) { t.printStackTrace(); } } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/CustomPreviewListener.java0000644000175000001440000000034611576116034027322 0ustar benuserspackage com.baselet.gui.listener; import com.baselet.diagram.DiagramHandler; public class CustomPreviewListener extends DiagramListener { public CustomPreviewListener(DiagramHandler handler) { super(handler); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/RelationListener.java0000644000175000001440000001027211576116034026262 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.command.AddLinePoint; import com.baselet.diagram.command.Move; import com.baselet.diagram.command.MoveLinePoint; import com.baselet.diagram.command.RemoveLinePoint; import com.umlet.element.Relation; public class RelationListener extends GridElementListener { private static HashMap listener = new HashMap(); public static RelationListener getInstance(DiagramHandler handler) { if (!listener.containsKey(handler)) listener.put(handler, new RelationListener(handler)); return listener.get(handler); } private boolean IS_DRAGGING_LINEPOINT = false; private boolean IS_DRAGGING_LINE = false; private int LINEPOINT = -1; private RelationListener(DiagramHandler handler) { super(handler); } @Override public void mousePressed(MouseEvent me) { super.mousePressed(me); if (me.getButton() == MouseEvent.BUTTON1) { this.IS_DRAGGING = false; this.IS_RESIZING = false; Relation rel = (Relation) me.getComponent(); int where = rel.getLinePoint(new Point(me.getX(), me.getY())); if (where >= 0) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = where; } else if (rel.isWholeLine(me.getX(), me.getY())) { IS_DRAGGING_LINE = true; IS_DRAGGING = true; } else if (me.getButton() == MouseEvent.BUTTON2) { IS_DRAGGING_DIAGRAM = true; IS_DRAGGING_LINE = false; IS_DRAGGING_LINEPOINT = false; IS_DRAGGING = false; } } } @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); if (IS_DRAGGING_LINEPOINT & (LINEPOINT >= 0)) { Relation rel = (Relation) me.getComponent(); if (rel.isOnLine(LINEPOINT) && (rel.isPartOfGroup() == false)) { // L.Trescher this.controller.executeCommand( new RemoveLinePoint(rel, LINEPOINT)); } } IS_DRAGGING_LINEPOINT = false; IS_DRAGGING_LINE = false; } @Override public void mouseMoved(MouseEvent me) { super.mouseMoved(me); Relation rel = (Relation) me.getComponent(); int where = rel.getLinePoint(new Point(me.getX(), me.getY())); if (where >= 0) { Main.getInstance().getGUI().setCursor(Constants.HAND_CURSOR); } else if (rel.isWholeLine(me.getX(), me.getY())) { Main.getInstance().getGUI().setCursor(Constants.MOVE_CURSOR); } else Main.getInstance().getGUI().setCursor(Constants.CROSS_CURSOR); return; } @Override public void mouseDragged(MouseEvent me) { super.mouseDragged(me); if (this.doReturn()) return; if (this.IS_DRAGGING) return; if (this.IS_DRAGGING_DIAGRAM) return; Relation r = (Relation) me.getComponent(); int MAIN_UNIT = Main.getInstance().getDiagramHandler().getGridSize(); // delta int delta_x = 0; int delta_y = 0; if (IS_DRAGGING_LINEPOINT) { Vector tmp = r.getLinePoints(); Point p = tmp.elementAt(LINEPOINT); delta_x = (r.getX() + p.x) % MAIN_UNIT; delta_y = (r.getY() + p.y) % MAIN_UNIT; } Point newp = this.getNewCoordinate(); Point oldp = this.getOldCoordinate(); int diffx = newp.x - oldp.x - delta_x; int diffy = newp.y - oldp.y - delta_y; if (IS_DRAGGING_LINEPOINT & (LINEPOINT >= 0)) { this.controller.executeCommand( new MoveLinePoint(r, LINEPOINT, diffx, diffy)); return; } else if (IS_DRAGGING_LINE) { this.controller.executeCommand(new Move(r, diffx, diffy)); return; } int where = r.getLinePoint(new Point(me.getX(), me.getY())); if (where >= 0) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = where; this.controller.executeCommand( new MoveLinePoint(r, where, diffx, diffy)); return; } else { Point p = new Point(me.getX(), me.getY()); int ins = r.getWhereToInsert(p); if (ins > 0) { IS_DRAGGING_LINEPOINT = true; LINEPOINT = ins; this.controller.executeCommand( new AddLinePoint(r, ins, me.getX(), me.getY())); return; } } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/UniversalListener.java0000644000175000001440000000710611576116034026457 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.event.ComponentAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import com.baselet.control.Main; import com.baselet.diagram.Controller; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.Selector; import com.baselet.diagram.SelectorFrame; public abstract class UniversalListener extends ComponentAdapter implements MouseListener, MouseMotionListener { protected DiagramHandler handler; protected DrawPanel diagram; public Selector selector; protected Controller controller; protected UniversalListener(DiagramHandler handler) { _return = false; this.handler = handler; this.diagram = handler.getDrawPanel(); this.selector = diagram.getSelector(); this.controller = handler.getController(); } private int _xOffset, _yOffset; private boolean _return; // variable used to coordinate listener exits with inherited listeners private int old_x_eff, old_y_eff; private int new_x_eff, new_y_eff; @Override public void mouseClicked(MouseEvent arg0) {} @Override public void mouseEntered(MouseEvent me) {} @Override public void mousePressed(MouseEvent me) { Main.getInstance().getGUI().requestFocus(); // to avoid beeing stuck in the propertyPanel Point off = this.getOffset(me); _xOffset = off.x; _yOffset = off.y; // everytime a mouse is pressed within a listener the gui gets the current diagram! Main.getInstance().setCurrentDiagramHandler(this.handler); if ((Main.getInstance().getDiagramHandler() != null)) { int factor = Main.getInstance().getDiagramHandler().getGridSize(); Main.getInstance().getGUI().setValueOfZoomDisplay(factor); } } @Override public void mouseReleased(MouseEvent me) { _return = false; if (this.selector.isSelectorFrameActive()) { SelectorFrame selframe = this.selector.getSelectorFrame(); this.diagram.remove(selframe); this.selector.deselectAll(); this.selector.multiSelect(selframe.getLocation(), selframe.getSize()); this.selector.setSelectorFrameActive(false); this.diagram.repaint(); } diagram.updatePanelAndScrollbars(); } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseMoved(MouseEvent me) { } @Override public void mouseDragged(MouseEvent me) { // Get new mouse coordinates if (this.selector.isSelectorFrameActive()) { // TODO this.selector.getSelectorFrame().resizeTo((int) getOffset(me).getX(), (int) getOffset(me).getY()); _return = true; return; } _return = false; Point off = this.getOffset(me); int xNewOffset = off.x; int yNewOffset = off.y; int gridSize = Main.getInstance().getDiagramHandler().getGridSize(); new_x_eff = gridSize * ((xNewOffset - gridSize / 2) / gridSize); new_y_eff = gridSize * ((yNewOffset - gridSize / 2) / gridSize); old_x_eff = gridSize * ((_xOffset - gridSize / 2) / gridSize); old_y_eff = gridSize * ((_yOffset - gridSize / 2) / gridSize); _xOffset = xNewOffset; _yOffset = yNewOffset; } // only call after mouseDragged protected final boolean doReturn() { return _return; } // only call after mouseDragged protected final Point getOldCoordinate() { return new Point(old_x_eff, old_y_eff); } // only call after mouseDragged protected final Point getNewCoordinate() { return new Point(new_x_eff, new_y_eff); } protected abstract Point getOffset(MouseEvent me); } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/listener/PaletteEntityListener.java0000644000175000001440000001563111576116034027304 0ustar benuserspackage com.baselet.gui.listener; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.command.AddElement; import com.baselet.diagram.command.Command; import com.baselet.element.GridElement; public class PaletteEntityListener extends GridElementListener { Map previousDraggingLocation; private static HashMap entitylistener = new HashMap(); private Vector copiedEntities; public static PaletteEntityListener getInstance(DiagramHandler handler) { if (!entitylistener.containsKey(handler)) entitylistener.put(handler, new PaletteEntityListener(handler)); return entitylistener.get(handler); } protected PaletteEntityListener(DiagramHandler handler) { super(handler); previousDraggingLocation = new Hashtable(); copiedEntities = new Vector(); } @Override public void mouseDoubleClicked(GridElement me) { copyEntity(me); } @Override public void mousePressed(MouseEvent me) { super.mousePressed(me); Vector selectedEntities = handler.getDrawPanel().getSelector().getSelectedEntities(); for (GridElement currentEntity : selectedEntities) { currentEntity.setStickingBorderActive(false); if (this.IS_DRAGGING) previousDraggingLocation.put(currentEntity, currentEntity.getLocation()); } } @Override public void mouseDragged(MouseEvent me) { super.mouseDragged(me); GridElement entity = (GridElement) me.getComponent(); if (IS_DRAGGED_FROM_PALETTE) { moveDraggedEntities(); } else { if (entity.getLocationOnScreen().x + entity.getWidth() <= handler.getDrawPanel().getLocationOnScreen().x) { resetEntities(); insertDraggedEntities(me); handler.getDrawPanel().getSelector().deselectAllWithoutUpdatePropertyPanel(); } } } private void moveDraggedEntities() { for (GridElement copiedEntity : copiedEntities) { int x = this.getNewCoordinate().x - this.getOldCoordinate().x; int y = this.getNewCoordinate().y - this.getOldCoordinate().y; x = Main.getInstance().getDiagramHandler().realignToGrid(false, x); y = Main.getInstance().getDiagramHandler().realignToGrid(false, y); copiedEntity.changeLocation(x, y); } } private void resetEntities() { Vector selectedEntities = handler.getDrawPanel().getSelector().getSelectedEntities(); for (GridElement currentEntity : selectedEntities) { Point previousLocation = previousDraggingLocation.get(currentEntity); currentEntity.setStickingBorderActive(true); currentEntity.setLocation(previousLocation.x, previousLocation.y); } } private void insertDraggedEntities(MouseEvent me) { GridElement entity = (GridElement) me.getComponent(); DrawPanel currentDiagram = Main.getInstance().getGUI().getCurrentDiagram(); Vector selectedEntities = handler.getDrawPanel().getSelector().getSelectedEntities(); if (!allowCopyEntity()) return; copiedEntities.clear(); // We save the actual zoom level of the diagram and the palette int oldZoomDiagram = currentDiagram.getHandler().getGridSize(); int oldZoomPalette = handler.getGridSize(); // and reset the zoom level of both to default before inserting the new entity (to avoid problems with entity-size) currentDiagram.getHandler().setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); this.IS_DRAGGING = false; this.IS_DRAGGED_FROM_PALETTE = true; for (GridElement currentEntity : selectedEntities) { GridElement copiedEntity = copyEntity(currentEntity); copiedEntities.add(copiedEntity); int x = (currentEntity.getX() - entity.getX()); int y = (currentEntity.getY() - entity.getY()); x -= (entity.getWidth() / 2); y -= (entity.getHeight() / 2); copiedEntity.setLocation(x, y); } // After inserting the new entity we restore the old zoom level of both diagrams currentDiagram.getHandler().setGridAndZoom(oldZoomDiagram, false); handler.setGridAndZoom(oldZoomPalette, false); // set entity positions relative to current mouse pointer location on screen updateEntityPositions(me); } private void updateEntityPositions(MouseEvent me) { DiagramHandler currentHandler = Main.getInstance().getDiagramHandler(); Point mousePosition = me.getLocationOnScreen(); int mouseX = mousePosition.x - currentHandler.getDrawPanel().getLocationOnScreen().x; int mouseY = mousePosition.y - currentHandler.getDrawPanel().getLocationOnScreen().y; for (GridElement copiedEntity : copiedEntities) { int x = copiedEntity.getLocation().x; int y = copiedEntity.getLocation().y; x += mouseX; y += mouseY; x = Main.getInstance().getDiagramHandler().realignToGrid(false, x); y = Main.getInstance().getDiagramHandler().realignToGrid(false, y); copiedEntity.setLocation(x, y); } } @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); Main.getInstance().getDiagramHandler().getDrawPanel().updatePanelAndScrollbars(); } protected boolean allowCopyEntity() { return true; } protected GridElement copyEntity(GridElement me) { DrawPanel currentDiagram = Main.getInstance().getGUI().getCurrentDiagram(); // We save the actual zoom level of the diagram and the palette int oldZoomDiagram = currentDiagram.getHandler().getGridSize(); int oldZoomPalette = handler.getGridSize(); // and reset the zoom level of both to default before inserting the new entity (to avoid problems with entity-size) currentDiagram.getHandler().setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); GridElement e = me.CloneFromMe(); Command cmd; Point viewp = currentDiagram.getScrollPane().getViewport().getViewPosition(); int upperLeftX = (int) (viewp.getX() - viewp.getX() % oldZoomDiagram); int upperLeftY = (int) (viewp.getY() - viewp.getY() % oldZoomDiagram); cmd = new AddElement(e, handler.realignToGrid(((upperLeftX / oldZoomDiagram) + Constants.PASTE_DISPLACEMENT_GRIDS) * Constants.DEFAULTGRIDSIZE), handler.realignToGrid(((upperLeftY / oldZoomDiagram) + Constants.PASTE_DISPLACEMENT_GRIDS) * Constants.DEFAULTGRIDSIZE)); currentDiagram.getHandler().getController().executeCommand(cmd); currentDiagram.getSelector().singleSelect(e); e.setStickingBorderActive(false); // After inserting the new entity we restore the old zoom level of both diagrams currentDiagram.getHandler().setGridAndZoom(oldZoomDiagram, false); handler.setGridAndZoom(oldZoomPalette, false); return e; } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/JLink.java0000644000175000001440000000136611576116034022165 0ustar benuserspackage com.baselet.gui; import java.awt.Cursor; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JLabel; import com.baselet.control.BrowserLauncher; public class JLink extends JLabel { /** * */ private static final long serialVersionUID = 1L; private String url; public JLink(String url, String text) { super("" + text + ""); this.url = url; setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); setToolTipText(url); addMouseListener(new LinkMouseAdapter()); } private class LinkMouseAdapter extends MouseAdapter { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 0) BrowserLauncher.openURL(url); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/MultiLineToolTipUI.java0000644000175000001440000000465711576116034024637 0ustar benuserspackage com.baselet.gui; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import javax.swing.BorderFactory; import javax.swing.CellRendererPane; import javax.swing.JComponent; import javax.swing.JTextArea; import javax.swing.JToolTip; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicToolTipUI; public class MultiLineToolTipUI extends BasicToolTipUI { static MultiLineToolTipUI sharedInstance = new MultiLineToolTipUI(); Font smallFont; public static JToolTip tip; protected CellRendererPane rendererPane; private static JTextArea textArea; public static ComponentUI createUI(JComponent c) { return sharedInstance; } public MultiLineToolTipUI() { super(); } @Override public void installUI(JComponent c) { super.installUI(c); tip = (JToolTip) c; rendererPane = new CellRendererPane(); c.add(rendererPane); } @Override public void uninstallUI(JComponent c) { super.uninstallUI(c); c.remove(rendererPane); rendererPane = null; } @Override public void paint(Graphics g, JComponent c) { Dimension size = c.getSize(); textArea.setBackground(c.getBackground()); rendererPane.paintComponent(g, textArea, c, 1, 1, size.width - 1, size.height - 1, true); } @Override public Dimension getPreferredSize(JComponent c) { String tipText = ((JToolTip) c).getTipText(); if (tipText == null) return new Dimension(0, 0); textArea = new JTextArea(tipText); textArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); rendererPane.removeAll(); rendererPane.add(textArea); textArea.setWrapStyleWord(true); int width = ((JMultiLineToolTip) c).getFixedWidth(); int columns = ((JMultiLineToolTip) c).getColumns(); if (columns > 0) { textArea.setColumns(columns); textArea.setSize(0, 0); textArea.setLineWrap(true); textArea.setSize(textArea.getPreferredSize()); } else if (width > 0) { textArea.setLineWrap(true); Dimension d = textArea.getPreferredSize(); d.width = width; d.height++; textArea.setSize(d); } else textArea.setLineWrap(false); Dimension dim = textArea.getPreferredSize(); dim.height += 1; dim.width += 1; return dim; } @Override public Dimension getMinimumSize(JComponent c) { return getPreferredSize(c); } @Override public Dimension getMaximumSize(JComponent c) { return getPreferredSize(c); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/0000755000175000001440000000000011576116036021733 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/EclipseGUI.java0000644000175000001440000002171511576116034024533 0ustar benuserspackage com.baselet.gui.eclipse; import java.awt.Cursor; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.util.Hashtable; import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.text.JTextComponent; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.io.DiagramFileHandler; import com.baselet.gui.BaseGUI; import com.baselet.gui.OwnSyntaxPane; import com.baselet.plugin.editor.Contributor; import com.baselet.plugin.editor.Contributor.ActionName; import com.baselet.plugin.editor.Editor; import com.umlet.custom.CustomElementHandler; @SuppressWarnings("serial") public class EclipseGUI extends BaseGUI { public enum Pane { PROPERTY, CUSTOMCODE, DIAGRAM } private final static Logger log = Logger.getLogger(Utils.getClassName()); private Editor editor; private Hashtable diagrams; private Contributor contributor; private int mainSplitPosition, rightSplitPosition, mailSplitPosition; public EclipseGUI(Main main) { super(main); this.diagrams = new Hashtable(); } @Override public void close(DiagramHandler diagram) { // eclipse does the closing } @Override public void closeWindow() { this.main.closeProgram(); } @Override public void diagramSelected(DiagramHandler handler) { // the menues are only visible if a diagram is selected. (contributor manages this) //AB: just update the export menu DrawPanel currentDiagram = Main.getInstance().getGUI().getCurrentDiagram(); if (currentDiagram == null) return; //Possible if method is called at loading a palette boolean enable = (handler != null) && !currentDiagram.getAllEntities().isEmpty(); contributor.setExportAsEnabled(enable); } @Override public void setPaste(boolean value) { if (this.contributor != null) this.contributor.setPaste(value); } @Override public void enableSearch(boolean enable) { if (this.editor != null) { this.editor.enableSearch(enable); } } @Override public CustomElementHandler getCurrentCustomHandler() { if (this.editor == null) return null; return this.editor.getCustomElementHandler(); } @Override public DrawPanel getCurrentDiagram() { if (this.editor == null) return null; return this.editor.getDiagram(); } @Override public int getMainSplitPosition() { return mainSplitPosition; } @Override public int getRightSplitPosition() { return rightSplitPosition; } @Override public int getMailSplitPosition() { return mailSplitPosition; } @Override public String getSelectedPalette() { if (this.editor != null) { return this.editor.getSelectedPaletteName() + "." + Program.EXTENSION; } return null; } @Override public JFrame getTopContainer() { return null; } @Override protected void init() { // We load the constants as startingsplitpositions into the variables mainSplitPosition = Constants.main_split_position; rightSplitPosition = Constants.right_split_position; mailSplitPosition = Constants.mail_split_position; } @Override public void open(DiagramHandler diagram) { // not called by eclipse plugin (handles open by createEditor function) } @Override public void selectPalette(String palette) { editor.selectPalette(palette); } @Override public void setCustomElementChanged(CustomElementHandler handler, boolean changed) { } @Override public void setCustomElementSelected(boolean selected) { if ((this.editor != null) && (this.contributor != null)) this.contributor.setCustomElementSelected(selected); } @Override public void setCustomPanelEnabled(boolean enable) { if (this.editor != null) { this.editor.setCustomPanelEnabled(enable); if (this.contributor != null) this.contributor.setCustomPanelEnabled(enable); } } @Override public void setMailPanelEnabled(boolean enable) { if (this.editor != null) { this.editor.setMailPanelEnabled(enable); } } @Override public boolean isMailPanelVisible() { return editor.isMailPanelVisible(); } @Override public void updateDiagramName(DiagramHandler diagram, String name) { Editor editor = this.diagrams.get(diagram); if (editor != null) editor.dirtyChanged(); } @Override public void setDiagramChanged(DiagramHandler diagram, boolean changed) { Editor editor = this.diagrams.get(diagram); if ((editor != null) && changed) editor.dirtyChanged(); } @Override public void setUngroupEnabled(boolean enabled) { } @Override public void setCursor(Cursor cursor) { if (this.editor != null) this.editor.setCursor(cursor); } public void setCurrentEditor(Editor editor) { if (!this.diagrams.containsKey(editor.getDiagram())) this.diagrams.put(editor.getDiagram().getHandler(), editor); this.editor = editor; } public void editorRemoved(Editor editor) { // Before removing the editor, we have to store the actual splitpositions // to variables so that a new editor has the same splitpositions mainSplitPosition = editor.getMainSplitLocation(); rightSplitPosition = editor.getRightSplitLocation(); mailSplitPosition = editor.getMailSplitLocation(); this.diagrams.remove(editor); if (editor.equals(this.editor)) { this.editor = null; } } @Override public OwnSyntaxPane getPropertyPane() { return this.editor.getPropertyPane(); } @Override public String getPropertyPanelText() { if (this.editor != null) return this.editor.getPropertyPane().getText(); return ""; } @Override public void setPropertyPanelText(String text) { if (this.editor != null) { OwnSyntaxPane propertyTextPane = editor.getPropertyPane(); if (!propertyTextPane.getText().equals(text)) { propertyTextPane.setText(text); //AB: Can be removed because of jsyntaxpane implementation //propertyTextPane.checkPanelForSpecialChars(); // Reset the vertical and horizontal scrollbar position to the upper left corner propertyTextPane.setCaretPosition(0); } } } public void panelDoAction(Pane pane, ActionName actionName) { JTextComponent textpane = null; if (pane == Pane.PROPERTY) textpane = editor.getPropertyPane(); else if (pane == Pane.CUSTOMCODE) textpane = editor.getCustomPane(); if (textpane != null) { if (actionName == ActionName.COPY) { textpane.copy(); } else if (actionName == ActionName.CUT) { textpane.cut(); int pos = textpane.getSelectionStart(); textpane.setCaretPosition(pos); } else if (actionName == ActionName.PASTE) { try { // We retrieve the content from the system clipboard Transferable cont = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this); if (cont != null) { // If it's not null we save the length of the content and add the actual selection start int pos = ((String) cont.getTransferData(DataFlavor.stringFlavor)).length() + textpane.getSelectionStart(); textpane.paste(); // After pasting the clipboard content we want to set the actual cursor position to the end of the pasted content textpane.setCaretPosition(pos); } } catch (Exception e) { log.error(null, e); } } else if (actionName == ActionName.SELECTALL) { textpane.selectAll(); } } } @Override public void requestFocus() { if (this.editor != null) this.editor.requestFocus(); } @Override public String chooseFileName() { String fileName = null; if (this.editor != null) { int returnVal = DiagramFileHandler.getOpenFileChooser().showOpenDialog(this.editor.getPanel()); if (returnVal == JFileChooser.APPROVE_OPTION) { fileName = DiagramFileHandler.getOpenFileChooser().getSelectedFile().getAbsolutePath(); } } return fileName; } @Override public void openDialog(String title, JComponent component) { if (this.editor != null) { javax.swing.SwingUtilities.invokeLater(new ShowDialog(title, component)); } } @Override public void repaint() { if (this.editor != null) this.editor.repaint(); } public void setContributor(Contributor contributor) { this.contributor = contributor; } @Override public void elementsSelected(int count) { super.elementsSelected(count); if (this.contributor != null) this.contributor.setElementsSelected(count); } public void setPaneFocused(Pane pane) { if (this.contributor != null) this.contributor.setGlobalActionHandlers(pane); } public Contributor getContributor() { return this.contributor; } @Override public void setValueOfZoomDisplay(int i) { if (contributor != null) contributor.updateZoomMenuRadioButton(i); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/ShowDialog.java0000644000175000001440000000077111576116034024641 0ustar benuserspackage com.baselet.gui.eclipse; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JOptionPane; public class ShowDialog implements Runnable { JComponent component; String title; public ShowDialog(String title, JComponent comp) { this.component = comp; this.title = title; } @Override public void run() { JDialog dialog = (new JOptionPane(component, JOptionPane.PLAIN_MESSAGE)) .createDialog(title); dialog.setVisible(true); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/MenuFactoryEclipse.java0000644000175000001440000001404611576116034026342 0ustar benuserspackage com.baselet.gui.eclipse; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.SwingUtilities; import org.apache.log4j.Logger; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; import com.baselet.control.Constants; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.gui.MenuFactory; import com.baselet.plugin.editor.Contributor; public class MenuFactoryEclipse extends MenuFactory { private final static Logger log = Logger.getLogger(MenuFactoryEclipse.class); private static MenuFactoryEclipse instance = null; public static MenuFactoryEclipse getInstance() { if (instance == null) instance = new MenuFactoryEclipse(); return instance; } @Override protected void doAction(final String menuItem, final Object param) { log.info("doAction " + menuItem); DiagramHandler actualHandler = Main.getInstance().getDiagramHandler(); // Edit Palette cannot be put in a separate invokeLater thread, or otherwise getActivePage() will be null! if (menuItem.equals(EDIT_CURRENT_PALETTE)) { String paletteName = Main.getInstance().getPalette().getFileHandler().getFullPathName(); IFileStore fileStore = EFS.getLocalFileSystem().getStore(new File(paletteName).toURI()); if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditorOnFileStore(page, fileStore); } catch (PartInitException e) { log.error("Cannot open palette file", e); } } } else if (menuItem.equals(SEARCH)) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Main.getInstance().getGUI().enableSearch(true); } }); } else if (menuItem.equals(ZOOM) && (actualHandler != null)) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Main.getInstance().getDiagramHandler().setGridAndZoom((Integer) param); } }); } // If the action is not overwritten, it is part of the default actions else { log.debug("super.doAction"); super.doAction(menuItem, param); log.debug("super.doAction complete"); } log.debug("doAction complete"); } public Action createOptions() { return createAction(OPTIONS, null); } public Action createOnlineHelp() { return createAction(ONLINE_HELP, null); } public Action createOnlineSampleDiagrams() { return createAction(ONLINE_SAMPLE_DIAGRAMS, null); } public Action createProgramHomepage() { return createAction(PROGRAM_HOMEPAGE, null); } public Action createMailTo() { return createAction(MAIL_TO, null); } public Action createRateProgram() { return createAction(RATE_PROGRAM, null); } public Action createAboutProgram() { return createAction(ABOUT_PROGRAM, null); } public Action createNewCustomElement() { return createAction(NEW_CE, null); } public Action createCustomElementsTutorial() { return createAction(CUSTOM_ELEMENTS_TUTORIAL, null); } public Action createUndo() { return createAction(UNDO, null); } public Action createRedo() { return createAction(REDO, null); } public Action createPrint() { return createAction(PRINT, null); } public Action createCopy() { return createAction(COPY, null); } public Action createCut() { return createAction(CUT, null); } public Action createPaste() { return createAction(PASTE, null); } public Action createDelete() { return createAction(DELETE, null); } public Action createSelectAll() { return createAction(SELECT_ALL, null); } public Action createSearch() { return createAction(SEARCH, null); } public Action createEditSelected() { return createAction(EDIT_SELECTED, null); } public Action createEditCurrentPalette() { return createAction(EDIT_CURRENT_PALETTE, null); } public List createExportAsActions() { List actions = new ArrayList(); for (final String format : Constants.exportFormatList) { actions.add(createAction(format.toUpperCase() + "...", EXPORT_AS, format)); } return actions; } public IMenuManager createZoom() { final IMenuManager zoom = new MenuManager(ZOOM); for (String z : Constants.zoomValueList) { zoom.add(createAction(z, ZOOM, Integer.parseInt(z.substring(0, z.length() - 2)), IAction.AS_RADIO_BUTTON)); } return zoom; } private List aList = new ArrayList(); public IMenuManager createNewCustomElementFromTemplate(final Contributor con) { IMenuManager menu = new MenuManager(NEW_FROM_TEMPLATE); for (String template : Main.getInstance().getTemplateNames()) { Action a = createAction(template, NEW_FROM_TEMPLATE, template); menu.add(a); aList.add(a); } menu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { for (Action a : aList) { a.setEnabled(!con.isCustomPanelEnabled()); } } }); return menu; } private Action createAction(final String name, final String param) { return createAction(name, name, param); } private Action createAction(final String menuName, final String actionName, final Object param) { return createAction(menuName, actionName, param, IAction.AS_UNSPECIFIED); } private Action createAction(final String menuName, final String actionName, final Object param, int style) { return new Action(menuName, style) { @Override public void run() { doAction(actionName, param); } }; } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/CustomCodePaneFocusListener.java0000644000175000001440000000133311576116034030153 0ustar benuserspackage com.baselet.gui.eclipse; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Main; import com.baselet.gui.eclipse.EclipseGUI.Pane; public class CustomCodePaneFocusListener implements FocusListener { @Override public void focusGained(FocusEvent e) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) ((EclipseGUI) Main.getInstance().getGUI()).setPaneFocused(Pane.CUSTOMCODE); } @Override public void focusLost(FocusEvent e) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) ((EclipseGUI) Main.getInstance().getGUI()).setPaneFocused(Pane.DIAGRAM); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/TextPaneFocusListener.java0000644000175000001440000000135311576116034027034 0ustar benuserspackage com.baselet.gui.eclipse; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Main; import com.baselet.gui.eclipse.EclipseGUI.Pane; public class TextPaneFocusListener implements FocusListener { @Override public void focusGained(FocusEvent e) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) ((EclipseGUI) Main.getInstance().getGUI()).setPaneFocused(Pane.PROPERTY); } @Override public void focusLost(FocusEvent e) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) ((EclipseGUI) Main.getInstance().getGUI()).setPaneFocused(Pane.DIAGRAM); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/eclipse/UpdateActionBars.java0000644000175000001440000000046411576116034025770 0ustar benuserspackage com.baselet.gui.eclipse; import org.eclipse.ui.IActionBars; public class UpdateActionBars implements Runnable { private IActionBars bars; public UpdateActionBars(IActionBars bars) { this.bars = bars; } @Override public void run() { this.bars.updateActionBars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/BaseGUI.java0000644000175000001440000001506411576116034022375 0ustar benuserspackage com.baselet.gui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Font; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; import javax.swing.plaf.InsetsUIResource; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.CustomPreviewHandler; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.baselet.gui.listener.PropertyPanelListener; import com.umlet.custom.CustomElement; import com.umlet.custom.CustomElementHandler; @SuppressWarnings("serial") public abstract class BaseGUI extends JPanel { private final static Logger log = Logger.getLogger(Utils.getClassName()); protected Main main; protected int selected_elements; protected OwnSyntaxPane propertyTextPane; protected boolean paletteEdited = false; public BaseGUI(Main main) { this.main = main; } public final void initGUI() throws Exception { try { UIManager.setLookAndFeel(Constants.ui_manager); } catch (Exception e) { // If the LookAndFeel cannot be set, it gets logged (without stacktrace) and the default style is used log.error(e.getMessage()); } this.initGUIParameters(); this.setLayout(new BorderLayout()); this.init(); this.requestFocus(); } public OwnSyntaxPane createPropertyTextPane() { JPanel propertyTextPanel = new JPanel(); propertyTextPane = new OwnSyntaxPane(propertyTextPanel); // add listener to propertyTextPane PropertyPanelListener pListener = new PropertyPanelListener(/*propertyTextPane*/); propertyTextPane.addKeyListener(pListener); propertyTextPane.addFocusListener(pListener); propertyTextPanel.setLayout(new BoxLayout(propertyTextPanel, BoxLayout.Y_AXIS)); JScrollPane propertyTextScrollPane = new JScrollPane(propertyTextPane); propertyTextScrollPane.setBorder(null); propertyTextScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); propertyTextScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); JLabel propertyLabel = new JLabel(" Properties"); propertyLabel.setAlignmentX(Component.LEFT_ALIGNMENT); propertyLabel.setFont(new Font("SansSerif", Font.BOLD, 11)); propertyTextPanel.add(propertyLabel); propertyTextPanel.add(propertyTextScrollPane); propertyTextPane.initJSyntaxPane(); return propertyTextPane; } public MailPanel createMailPanel() { return new MailPanel(); } public void focusPropertyPane() { propertyTextPane.requestFocus(); // The robot class simulates pressing a certain key // try { // new Robot().keyPress(character); // } catch (AWTException e) { // log.error(null, e); // } } public JPopupMenu getContextMenu(Component comp) { MenuFactorySwing menuFactory = MenuFactorySwing.getInstance(); GridElement entity = null; if (comp instanceof GridElement) entity = (GridElement) comp; else return null; JPopupMenu contextMenu = new JPopupMenu(); if (entity instanceof CustomElement) { contextMenu.add(menuFactory.createEditSelected()); } if (!(entity.getHandler() instanceof CustomPreviewHandler)) { contextMenu.add(menuFactory.createDelete()); } JMenuItem group = menuFactory.createGroup(); contextMenu.add(group); if (this.selected_elements < 2) group.setEnabled(false); JMenuItem ungroup = menuFactory.createUngroup(); contextMenu.add(ungroup); if (!(entity instanceof Group)) ungroup.setEnabled(false); if (Program.PROGRAM_NAME == ProgramName.UMLET) { contextMenu.add(menuFactory.createSetColor(true)); contextMenu.add(menuFactory.createSetColor(false)); } // insert alignment menu JMenu alignmentMenu = menuFactory.createAlign(); alignmentMenu.setEnabled(this.selected_elements > 1); // only enable when at least 2 elements are selected contextMenu.add(alignmentMenu); return contextMenu; } public void elementsSelected(int count) { this.selected_elements = count; } protected void initGUIParameters() { UIManager.put("TabbedPane.selected", Color.white); UIManager.put("TabbedPane.tabInsets", new InsetsUIResource(0, 4, 1, 0)); UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0)); } public void setPaletteEdited(boolean isEdited) { this.paletteEdited = isEdited; } public boolean getPaletteEdited() { return this.paletteEdited; } public abstract CustomElementHandler getCurrentCustomHandler(); public abstract void setCustomPanelEnabled(boolean enable); public abstract void setMailPanelEnabled(boolean enable); public abstract boolean isMailPanelVisible(); public abstract void updateDiagramName(DiagramHandler diagram, String name); public abstract void setDiagramChanged(DiagramHandler diagram, boolean changed); public abstract void setCustomElementChanged(CustomElementHandler handler, boolean changed); public abstract void closeWindow(); protected abstract void init(); public abstract String getSelectedPalette(); public abstract void selectPalette(String palette); public abstract void open(DiagramHandler diagram); public abstract void close(DiagramHandler diagram); public abstract DrawPanel getCurrentDiagram(); public abstract void setPaste(boolean value); public abstract void setUngroupEnabled(boolean enabled); public abstract void setCustomElementSelected(boolean selected); public abstract void diagramSelected(DiagramHandler handler); public abstract void enableSearch(boolean enable); public abstract int getMainSplitPosition(); public abstract int getMailSplitPosition(); public abstract int getRightSplitPosition(); public abstract JFrame getTopContainer(); public abstract OwnSyntaxPane getPropertyPane(); public abstract String getPropertyPanelText(); public abstract void setPropertyPanelText(String text); public abstract String chooseFileName(); public abstract void openDialog(String title, JComponent component); public abstract void setValueOfZoomDisplay(int i); } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/MenuFactory.java0000644000175000001440000002442011576116034023406 0ustar benuserspackage com.baselet.gui; import java.util.ArrayList; import java.util.List; import java.util.Vector; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.apache.log4j.Logger; import com.baselet.control.BrowserLauncher; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.Selector; import com.baselet.diagram.command.Align; import com.baselet.diagram.command.ChangeColor; import com.baselet.diagram.command.Copy; import com.baselet.diagram.command.CreateGroup; import com.baselet.diagram.command.Cut; import com.baselet.diagram.command.Paste; import com.baselet.diagram.command.RemoveElement; import com.baselet.diagram.command.UnGroup; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.baselet.gui.standalone.StandaloneGUI; import com.umlet.custom.CustomElement; public class MenuFactory { protected final static Logger log = Logger.getLogger(Utils.getClassName()); //FILE public static final String FILE = "File"; protected static final String NEW = "New"; protected static final String OPEN = "Open..."; protected static final String RECENT_FILES = "Recent files"; protected static final String SAVE = "Save"; protected static final String SAVE_AS = "Save as..."; protected static final String EXPORT_AS = "Export as..."; protected static final String MAIL_TO = "Mail to..."; protected static final String EDIT_CURRENT_PALETTE = "Edit Current Palette"; protected static final String OPTIONS = "Options..."; protected static final String PRINT = "Print..."; protected static final String EXIT = "Exit"; //EDIT public static final String EDIT = "Edit"; protected static final String UNDO = "Undo"; protected static final String REDO = "Redo"; protected static final String DELETE = "Delete"; protected static final String SELECT_ALL = "Select All"; protected static final String GROUP = "Group"; protected static final String UNGROUP = "Ungroup"; protected static final String CUT = "Cut"; protected static final String COPY = "Copy"; protected static final String PASTE = "Paste"; //CUSTOM ELEMENTS public static final String CUSTOM_ELEMENTS = "Custom Elements"; protected static final String NEW_CE = "New..."; protected static final String NEW_FROM_TEMPLATE = "New from Template"; protected static final String EDIT_SELECTED = "Edit Selected..."; protected static final String CUSTOM_ELEMENTS_TUTORIAL = "Custom Elements Tutorial..."; protected static final String CUSTOM_ELEMENTS_TUTORIAL_URL = "http://www.umlet.com/ce/ce.htm"; // HELP public static final String HELP = "Help"; protected static final String ONLINE_HELP = "Online Help..."; protected static final String ONLINE_SAMPLE_DIAGRAMS = "Online Sample Diagrams..."; protected static final String PROGRAM_HOMEPAGE = Program.PROGRAM_NAME + " Homepage..."; protected static final String RATE_PROGRAM = "Rate " + Program.PROGRAM_NAME + " at Eclipse Marketplace..."; protected static final String ABOUT_PROGRAM = "About " + Program.PROGRAM_NAME; // CONTEXT ON ELEMENT protected static final String SET_FOREGROUND_COLOR = "Set foreground color"; protected static final String SET_BACKGROUND_COLOR = "Set background color"; protected static final String ALIGN = "Align"; // OTHERS protected static final String SEARCH = "Search"; protected static final String ZOOM = "Zoom to"; protected void doAction(final String menuItem, final Object param) { //AB: Hopefully this will resolve threading issues and work for eclipse AND standalone SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Main main = Main.getInstance(); BaseGUI gui = main.getGUI(); DiagramHandler diagramHandler = gui.getCurrentDiagram().getHandler(); DiagramHandler actualHandler = main.getDiagramHandler(); Selector actualSelector = actualHandler == null ? null : actualHandler.getDrawPanel().getSelector(); if (menuItem.equals(NEW)) { main.doNew(); } else if (menuItem.equals(OPEN)) { main.doOpen(); } else if (menuItem.equals(RECENT_FILES)) { main.doOpen((String) param); } else if (menuItem.equals(SAVE) && diagramHandler != null) { diagramHandler.doSave(); } else if (menuItem.equals(SAVE_AS) && diagramHandler != null) { diagramHandler.doSaveAs(Program.EXTENSION); } else if (menuItem.equals(EXPORT_AS) && diagramHandler != null) { diagramHandler.doSaveAs((String) param); } else if (menuItem.equals(MAIL_TO)) { gui.setMailPanelEnabled(!gui.isMailPanelVisible()); } else if (menuItem.equals(EDIT_CURRENT_PALETTE)) { main.doOpen(main.getPalette().getFileHandler().getFullPathName()); } else if (menuItem.equals(OPTIONS)) { OptionPanel.getInstance().showOptionPanel(); } else if (menuItem.equals(PRINT) && diagramHandler != null) { diagramHandler.doPrint(); } else if (menuItem.equals(EXIT)) { main.getGUI().closeWindow(); } else if (menuItem.equals(UNDO) && (actualHandler != null) && (actualSelector != null)) { actualHandler.getController().undo(); if (gui instanceof StandaloneGUI) ((StandaloneGUI) gui).updateGrayedOutMenuItems(actualHandler); } else if (menuItem.equals(REDO) && (actualHandler != null)) { actualHandler.getController().redo(); if (gui instanceof StandaloneGUI) ((StandaloneGUI) gui).updateGrayedOutMenuItems(actualHandler); } else if (menuItem.equals(DELETE) && (actualHandler != null) && (actualSelector != null)) { Vector v = actualSelector.getSelectedEntities(); if (v.size() > 0) actualHandler.getController().executeCommand(new RemoveElement(v)); } else if (menuItem.equals(SELECT_ALL) && (actualHandler != null) && (actualSelector != null)) { actualSelector.selectAll(); } else if (menuItem.equals(GROUP) && (actualHandler != null)) { Main.getInstance().getDiagramHandler().getController().executeCommand(new CreateGroup()); } else if (menuItem.equals(UNGROUP) && (actualHandler != null) && (actualSelector != null)) { Vector gridElements = actualSelector.getSelectedEntities(); for (GridElement gridElement : gridElements) { if (gridElement instanceof Group) actualHandler.getController().executeCommand(new UnGroup((Group) gridElement)); } } else if (menuItem.equals(CUT) && (actualHandler != null)) { if (!actualHandler.getDrawPanel().getAllEntities().isEmpty()) actualHandler.getController().executeCommand(new Cut()); } else if (menuItem.equals(COPY) && (actualHandler != null)) { if (!actualHandler.getDrawPanel().getAllEntities().isEmpty()) actualHandler.getController().executeCommand(new Copy()); } else if (menuItem.equals(PASTE) && (actualHandler != null)) { actualHandler.getController().executeCommand(new Paste()); } else if (menuItem.equals(NEW_CE)) { if (gui.getCurrentCustomHandler().closeEntity()) { gui.setCustomPanelEnabled(true); gui.getCurrentCustomHandler().getPanel().setCustomElementIsNew(true); gui.getCurrentCustomHandler().newEntity(); } } else if (menuItem.equals(NEW_FROM_TEMPLATE)) { if (gui.getCurrentCustomHandler().closeEntity()) { gui.setCustomPanelEnabled(true); gui.getCurrentCustomHandler().getPanel().setCustomElementIsNew(true); gui.getCurrentCustomHandler().newEntity((String) param); } } else if (menuItem.equals(EDIT_SELECTED)) { GridElement entity = main.getEditedGridElement(); if ((entity != null) && (entity instanceof CustomElement)) { if (gui.getCurrentCustomHandler().closeEntity()) { gui.setCustomPanelEnabled(true); gui.getCurrentCustomHandler().getPanel().setCustomElementIsNew(false); gui.getCurrentCustomHandler().editEntity((CustomElement) entity); } } } else if (menuItem.equals(CUSTOM_ELEMENTS_TUTORIAL)) { BrowserLauncher.openURL(MenuFactory.CUSTOM_ELEMENTS_TUTORIAL_URL); } else if (menuItem.equals(ONLINE_HELP)) { BrowserLauncher.openURL(Program.WEBSITE + "/faq.htm"); } else if (menuItem.equals(ONLINE_SAMPLE_DIAGRAMS)) { if (Program.PROGRAM_NAME == ProgramName.UMLET) BrowserLauncher.openURL("http://www.itmeyer.at/umlet/uml2/"); else if (Program.PROGRAM_NAME == ProgramName.PLOTLET) BrowserLauncher.openURL("http://www.itmeyer.at/umlet/uml2/"); } else if (menuItem.equals(PROGRAM_HOMEPAGE)) { BrowserLauncher.openURL(Program.WEBSITE); } else if (menuItem.equals(RATE_PROGRAM)) { if (Program.PROGRAM_NAME == ProgramName.UMLET) BrowserLauncher.openURL("http://marketplace.eclipse.org/content/umlet-uml-tool-fast-uml-diagrams"); else if (Program.PROGRAM_NAME == ProgramName.PLOTLET) BrowserLauncher.openURL("http://marketplace.eclipse.org/content/plotlet"); } else if (menuItem.equals(ABOUT_PROGRAM)) { AboutPanel.getInstance().setVisible(); } else if (menuItem.equals(SET_FOREGROUND_COLOR) && (actualHandler != null)) { actualHandler.getController().executeCommand(new ChangeColor((String) param, true)); } else if (menuItem.equals(SET_BACKGROUND_COLOR) && (actualHandler != null)) { actualHandler.getController().executeCommand(new ChangeColor((String) param, false)); } else if (menuItem.equals(ALIGN) && (actualHandler != null) && (actualSelector != null)) { Vector v = actualSelector.getSelectedEntities(); if (v.size() > 0) { actualHandler.getController().executeCommand(new Align(v, actualSelector.getDominantEntity(), (String) param)); } } } }); } // These components should only be enabled if the drawpanel is not empty protected List diagramDependendComponents = new ArrayList(); public void updateDiagramDependendComponents() { DrawPanel currentDiagram = Main.getInstance().getGUI().getCurrentDiagram(); if (currentDiagram == null) return; //Possible if method is called at loading a palette DiagramHandler handler = currentDiagram.getHandler(); boolean enable = !((handler == null) || handler.getDrawPanel().getAllEntities().isEmpty()); for (JComponent component : diagramDependendComponents) { component.setEnabled(enable); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/AboutPanel.java0000644000175000001440000000262511576116034023207 0ustar benuserspackage com.baselet.gui; import java.awt.Color; import java.net.URL; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.border.LineBorder; import org.apache.log4j.Logger; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Path; import com.baselet.control.Utils; import com.baselet.gui.listener.HyperLinkActiveListener; @SuppressWarnings("serial") public class AboutPanel extends JPanel { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static AboutPanel window; private AboutPanel() { super(); JEditorPane pane = new JEditorPane(); pane.setBorder(new LineBorder(Color.GRAY, 1, true)); showHTML(pane); add(pane); } public static AboutPanel getInstance() { if (window == null) window = new AboutPanel(); return window; } public void setVisible() { Main.getInstance().getGUI().openDialog("About " + Program.PROGRAM_NAME, this); } protected String getStartUpFileName() { return "file:///" + Path.homeProgram() + "html/about.html"; } private void showHTML(JEditorPane edit) { try { edit.setPage(new URL(getStartUpFileName())); edit.addHyperlinkListener(new HyperLinkActiveListener()); edit.setEditable(false); edit.setSelectionColor(Color.WHITE); } catch (Exception e) { log.error(null, e); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/MenuFactorySwing.java0000644000175000001440000001463311576116034024423 0ustar benuserspackage com.baselet.gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.KeyStroke; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import com.baselet.control.Constants; import com.baselet.control.Constants.SystemInfo; import com.baselet.control.Main; public class MenuFactorySwing extends MenuFactory { private static MenuFactorySwing instance = null; public static MenuFactorySwing getInstance() { if (instance == null) instance = new MenuFactorySwing(); return instance; } public JMenuItem createNew() { return createJMenuItem(false, NEW, KeyEvent.VK_N, true, null); } public JMenuItem createOpen() { return createJMenuItem(false, OPEN, KeyEvent.VK_O, true, null); } public JMenu createRecentFiles() { final JMenu recentFiles = new JMenu(); recentFiles.setText(RECENT_FILES); recentFiles.addMenuListener(new MenuListener() { @Override public void menuDeselected(MenuEvent e) {} @Override public void menuCanceled(MenuEvent e) {} @Override public void menuSelected(MenuEvent e) { recentFiles.removeAll(); for (final String file : Main.getInstance().getRecentFiles()) { recentFiles.add(createJMenuItem(false, file, RECENT_FILES, file)); } } }); return recentFiles; } public JMenuItem createSave() { return createJMenuItem(true, SAVE, KeyEvent.VK_S, true, null); } public JMenuItem createSaveAs() { return createJMenuItem(true, SAVE_AS, null); } public JMenu createExportAs() { final JMenu export = new JMenu(); export.setText(EXPORT_AS); diagramDependendComponents.add(export); for (final String format : Constants.exportFormatList) { export.add(createJMenuItem(true, format.toUpperCase() + "...", EXPORT_AS, format)); } return export; } public JMenuItem createMailTo() { return createJMenuItem(true, MAIL_TO, KeyEvent.VK_M, true, null); } public JMenuItem createEditCurrentPalette() { return createJMenuItem(false, EDIT_CURRENT_PALETTE, null); } public JMenuItem createOptions() { return createJMenuItem(false, OPTIONS, null); } public JMenuItem createPrint() { return createJMenuItem(true, PRINT, KeyEvent.VK_P, true, null); } public JMenuItem createExit() { return createJMenuItem(false, EXIT, null); } public JMenuItem createUndo() { return createJMenuItem(false, UNDO, KeyEvent.VK_Z, true, null); } public JMenuItem createRedo() { return createJMenuItem(false, REDO, KeyEvent.VK_Y, true, null); } public JMenuItem createDelete() { return createJMenuItem(false, DELETE, KeyEvent.VK_DELETE, false, null); } public JMenuItem createSelectAll() { return createJMenuItem(false, SELECT_ALL, KeyEvent.VK_A, true, null); } public JMenuItem createGroup() { return createJMenuItem(false, GROUP, KeyEvent.VK_G, true, null); } public JMenuItem createUngroup() { return createJMenuItem(false, UNGROUP, KeyEvent.VK_U, true, null); } public JMenuItem createCut() { return createJMenuItem(false, CUT, KeyEvent.VK_X, true, null); } public JMenuItem createCopy() { return createJMenuItem(false, COPY, KeyEvent.VK_C, true, null); } public JMenuItem createPaste() { return createJMenuItem(false, PASTE, KeyEvent.VK_V, true, null); } public JMenuItem createNewCustomElement() { return createJMenuItem(false, NEW_CE, null); } public JMenu createNewCustomElementFromTemplate() { JMenu menu = new JMenu(NEW_FROM_TEMPLATE); for (String template : Main.getInstance().getTemplateNames()) { menu.add(createJMenuItem(false, template, NEW_FROM_TEMPLATE, template)); } return menu; } public JMenuItem createEditSelected() { return createJMenuItem(false, EDIT_SELECTED, null); } public JMenuItem createCustomElementTutorial() { return createJMenuItem(false, CUSTOM_ELEMENTS_TUTORIAL, null); } public JMenuItem createOnlineHelp() { return createJMenuItem(false, ONLINE_HELP, null); } public JMenuItem createOnlineSampleDiagrams() { return createJMenuItem(false, ONLINE_SAMPLE_DIAGRAMS, null); } public JMenuItem createProgramHomepage() { return createJMenuItem(false, PROGRAM_HOMEPAGE, null); } public JMenuItem createRateProgram() { return createJMenuItem(false, RATE_PROGRAM, null); } public JMenu createSetColor(boolean fg) { String name = (fg == true ? SET_FOREGROUND_COLOR : SET_BACKGROUND_COLOR); JMenu menu = new JMenu(name); menu.add(createJMenuItem(false, "default", name, "default")); for (String color : Constants.colorMap.keySet()) { JMenuItem item = createJMenuItem(false, color, name, color); menu.add(item); item.setIcon(new PlainColorIcon(color)); } return menu; } public JMenuItem createAboutProgram() { return createJMenuItem(false, ABOUT_PROGRAM, null); } public JMenu createAlign() { JMenu alignMenu = new JMenu(ALIGN); for (String direction : new String[]{"Left", "Right", "Top", "Bottom"}) { alignMenu.add(createJMenuItem(false, direction, ALIGN, direction)); } return alignMenu; } private JMenuItem createJMenuItem(boolean grayWithoutDiagram, final String name, Object param) { return createJMenuItem(grayWithoutDiagram, name, name, null, null, param); } private JMenuItem createJMenuItem(boolean grayWithoutDiagram, final String name, Integer mnemonic, Boolean meta, Object param) { return createJMenuItem(grayWithoutDiagram, name, name, mnemonic, meta, param); } private JMenuItem createJMenuItem(boolean grayWithoutDiagram, final String menuName, final String actionName, final Object param) { return createJMenuItem(grayWithoutDiagram, menuName, actionName, null, null, param); } private JMenuItem createJMenuItem(boolean grayWithoutDiagram, final String menuName, final String actionName, Integer mnemonic, Boolean meta, final Object param) { JMenuItem menuItem = new JMenuItem(menuName); if (mnemonic != null) { menuItem.setMnemonic(mnemonic); menuItem.setAccelerator(KeyStroke.getKeyStroke(mnemonic, (!meta ? 0 : SystemInfo.META_KEY.getMask()))); } menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doAction(actionName, param); } }); if (grayWithoutDiagram) diagramDependendComponents.add(menuItem); return menuItem; } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/OwnSyntaxPane.java0000644000175000001440000000503411576116034023730 0ustar benuserspackage com.baselet.gui; import java.awt.Color; import java.awt.Dimension; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.text.PlainDocument; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.util.Configuration; import org.apache.log4j.Logger; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Utils; import com.plotlet.gui.PlotletSyntaxKit; import com.umlet.gui.UmletSyntaxKit; @SuppressWarnings("serial") public class OwnSyntaxPane extends JEditorPane { private final static Logger log = Logger.getLogger(Utils.getClassName()); private JPanel panel; public OwnSyntaxPane(JPanel panel) { this.panel = panel; this.setBackground(Color.WHITE); //AB: Reduce tab size (works only if document type is plain) this.getDocument().putProperty(PlainDocument.tabSizeAttribute, 3); } @Override public void setSize(Dimension d) { if (d.width < getParent().getSize().width) d.width = getParent().getSize().width; super.setSize(d); } @Override public boolean getScrollableTracksViewportWidth() { return false; } public JPanel getPanel() { return this.panel; } public void initJSyntaxPane() { DefaultSyntaxKit.initKit(); Configuration conf = DefaultSyntaxKit.getConfig(DefaultSyntaxKit.class); //remove built-in undo/redo conf.remove("Action.undo"); conf.remove("Action.redo"); if (Program.PROGRAM_NAME == ProgramName.PLOTLET) { log.info("Register PlotletSyntaxKit"); try { // IMPORTANT: The config-key "Action.combo-completion.Items" only accepts a semikolon-separated string because we have changed the method: // jsyntaxpane/actions/ComboCompletionAction.java#setItems(). Otherwise it would only accept a real list String autocompletionList = PlotletSyntaxKit.createAutocompletionList(";"); DefaultSyntaxKit.getConfig(PlotletSyntaxKit.class).put("Action.combo-completion.ItemsAsString", autocompletionList); } catch (Exception e) { log.error("Error at creating the autocompletion"); } DefaultSyntaxKit.registerContentType("text/propertypanel", PlotletSyntaxKit.class.getCanonicalName()); } else { log.info("Register UmletSyntaxKit"); //removes the line numbering conf.remove("Components"); DefaultSyntaxKit.registerContentType("text/propertypanel", UmletSyntaxKit.class.getCanonicalName()); } this.setContentType("text/propertypanel"); this.validate(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/StartUpHelpText.java0000644000175000001440000001242511576116034024234 0ustar benuserspackage com.baselet.gui; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.net.URL; import java.util.Scanner; import javax.swing.JEditorPane; import org.apache.log4j.Logger; import com.baselet.control.Constants.Metakey; import com.baselet.control.Constants.SystemInfo; import com.baselet.control.Main; import com.baselet.control.Path; import com.baselet.control.Utils; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.baselet.gui.listener.HyperLinkActiveListener; @SuppressWarnings("serial") public class StartUpHelpText extends JEditorPane implements ContainerListener, ComponentListener { private final static Logger log = Logger.getLogger(Utils.getClassName()); private DrawPanel panel; private boolean visible; public StartUpHelpText(DrawPanel panel) { super(); this.panel = panel; // If the GUI is null (e.g.: if main is used in batch mode) the startup help text is not required if (Main.getInstance().getGUI() == null) return; panel.add(this); panel.addContainerListener(this); panel.addComponentListener(this); this.addMouseListener(new DelegatingMouseListener()); showHTML(this); setVisible(); } // Must be overwritten to hide the helptext if a the custom elements panel is toggled without elements on the drawpanel @Override public void setEnabled(boolean en) { super.setEnabled(en); if (en && this.visible) { if (this.panel.getAllEntities().size() == 0) this.setVisible(); else this.visible = false; } else { this.visible = this.isVisible(); this.setInvisible(); } } private void setVisible() { if (panel != null) { this.setVisible(true); this.panel.repaint(); } } private void setInvisible() { this.setVisible(false); if (this.panel != null) this.panel.repaint(); } private String getStartUpFileName() { return Path.homeProgram() + "html/startuphelp.html"; } private void showHTML(JEditorPane edit) { try { replaceSystemspecificMetakey(); edit.setPage(new URL("file:///" + getStartUpFileName())); edit.addHyperlinkListener(new HyperLinkActiveListener()); edit.setEditable(false); edit.setBackground(Color.WHITE); edit.setSelectionColor(edit.getBackground()); edit.setSelectedTextColor(edit.getForeground()); } catch (Exception e) { log.error(null, e); } } private void replaceSystemspecificMetakey() throws FileNotFoundException, IOException { String text = ""; File f = new File(getStartUpFileName()); Scanner sc = new Scanner(f); while(sc.hasNextLine()) { String line = sc.nextLine(); if (SystemInfo.META_KEY == Metakey.CTRL) line = line.replace(Metakey.CMD.toString(), Metakey.CTRL.toString()); else if (SystemInfo.META_KEY == Metakey.CMD) line = line.replace(Metakey.CTRL.toString(), Metakey.CMD.toString()); text += line + "\n"; } f.createNewFile(); FileWriter w = new FileWriter(f); w.write(text); w.close(); } @Override public void componentAdded(ContainerEvent e) { if (!this.equals(e.getChild()) && (e.getChild() instanceof GridElement)) this.setInvisible(); } @Override public void componentRemoved(ContainerEvent e) { if ((e.getContainer().getComponentCount() <= 1) && !this.equals(e.getChild())) this.setVisible(); } @Override public void componentResized(ComponentEvent arg0) { Dimension size = this.panel.getSize(); Dimension labelSize = this.getPreferredSize(); this.setSize(labelSize); this.setLocation(size.width / 2 - (labelSize.width / 2), Math.max(25, size.height / 2 - labelSize.height)); } @Override public void paint(Graphics g) { //Subpixel rendering must be disabled for the startuphelp (looks bad) ((Graphics2D) g).setRenderingHints(Utils.getUxRenderingQualityHigh(false)); super.paint(g); ((Graphics2D) g).setRenderingHints(Utils.getUxRenderingQualityHigh(true)); } @Override public void componentHidden(ComponentEvent arg0) {} @Override public void componentMoved(ComponentEvent arg0) {} @Override public void componentShown(ComponentEvent arg0) {} /** * The MouseListener of this JEditorPane just delegates the * MouseEvents up to the DiagramListener of the Handler */ private class DelegatingMouseListener implements MouseListener { @Override public void mouseClicked(MouseEvent e) { panel.getHandler().getListener().mouseClicked(e); } @Override public void mouseEntered(MouseEvent e) { panel.getHandler().getListener().mouseEntered(e); } @Override public void mouseExited(MouseEvent e) { panel.getHandler().getListener().mouseExited(e); } @Override public void mousePressed(MouseEvent e) { panel.getHandler().getListener().mousePressed(e); } @Override public void mouseReleased(MouseEvent e) { panel.getHandler().getListener().mouseReleased(e); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/OptionPanel.java0000644000175000001440000001460611576116034023407 0ustar benuserspackage com.baselet.gui; import java.awt.Component; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; @SuppressWarnings("serial") public class OptionPanel extends JPanel implements ActionListener { public static OptionPanel optionpanel; public static OptionPanel getInstance() { if (optionpanel == null) optionpanel = new OptionPanel(); return optionpanel; } private JFrame optionframe; private JCheckBox show_stickingpolygon; private JCheckBox show_grid; private JCheckBox enable_custom_elements; private JComboBox ui_manager; private JComboBox default_fontsize; private JComboBox default_fontfamily; private Vector uis_technicalNameVector; private OptionPanel() { this.setLayout(new GridLayout(0, 2, 4, 4)); this.setAlignmentX(Component.LEFT_ALIGNMENT); this.show_stickingpolygon = new JCheckBox(); this.show_grid = new JCheckBox(); this.enable_custom_elements = new JCheckBox(); uis_technicalNameVector = new Vector(); Vector uis_humanReadableNameVector = new Vector(); LookAndFeelInfo[] lookAndFeelInfoArray = Constants.lookAndFeels.toArray(new LookAndFeelInfo[Constants.lookAndFeels.size()]); for (LookAndFeelInfo info : lookAndFeelInfoArray) { uis_technicalNameVector.add(info.getClassName()); uis_humanReadableNameVector.add(info.getName()); } this.ui_manager = new JComboBox(uis_humanReadableNameVector); this.default_fontsize = new JComboBox(Constants.fontSizeList.toArray(new Integer[Constants.fontSizeList.size()])); this.default_fontfamily = new JComboBox(Constants.fontFamilyList.toArray(new String[Constants.fontFamilyList.size()])); this.add(new JLabel("Show sticking ploygon")); this.add(this.show_stickingpolygon); this.add(new JLabel("Show grid")); this.add(this.show_grid); this.add(new JLabel("Enable Custom Elements")); this.add(this.enable_custom_elements); if (Program.RUNTIME_TYPE == RuntimeType.STANDALONE) { this.add(new JLabel("Select " + Program.PROGRAM_NAME + " style")); this.add(this.ui_manager); } this.add(new JLabel("Select default fontsize")); this.add(this.default_fontsize); this.add(new JLabel("Select default fontfamily")); this.add(this.default_fontfamily); JButton button_ok = new JButton("Ok"); button_ok.setActionCommand("Ok"); button_ok.addActionListener(this); JButton button_cancel = new JButton("Cancel"); button_cancel.setActionCommand("Cancel"); button_cancel.addActionListener(this); JPanel button_panel = new JPanel(); button_panel.setLayout(new BoxLayout(button_panel, BoxLayout.X_AXIS)); button_panel.add(Box.createHorizontalGlue()); button_panel.add(button_cancel); button_panel.add(Box.createRigidArea(new Dimension(20, 0))); button_panel.add(button_ok); button_panel.add(Box.createHorizontalGlue()); button_panel.setAlignmentX(Component.LEFT_ALIGNMENT); JPanel parent = new JPanel(); parent.setLayout(new BoxLayout(parent, BoxLayout.Y_AXIS)); parent.add(Box.createRigidArea(new Dimension(10, 10))); parent.add(this); parent.add(Box.createRigidArea(new Dimension(0, 20))); parent.add(button_panel); parent.add(Box.createRigidArea(new Dimension(0, 20))); this.optionframe = new JFrame(Program.PROGRAM_NAME + " Options"); this.optionframe.setContentPane(parent); this.optionframe.setLocation(50, 50); this.optionframe.pack(); //autoresize of the optionframe } public void showOptionPanel() { this.show_stickingpolygon.setSelected(Constants.show_stickingpolygon); this.show_grid.setSelected(Constants.show_grid); this.enable_custom_elements.setSelected(Constants.enable_custom_elements); this.ui_manager.setSelectedIndex(uis_technicalNameVector.indexOf(Constants.ui_manager)); this.default_fontsize.setSelectedItem(Constants.defaultFontsize); this.default_fontfamily.setSelectedItem(Constants.defaultFontFamily); javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { optionframe.setVisible(true); optionframe.toFront(); } }); } private void hideOptionPanel() { this.optionframe.setVisible(false); } // ok or cancel button pressed @Override public void actionPerformed(ActionEvent ae) { this.hideOptionPanel(); if (ae.getActionCommand().equals("Ok")) { Constants.show_stickingpolygon = this.show_stickingpolygon.isSelected(); Constants.show_grid = this.show_grid.isSelected(); Constants.enable_custom_elements = this.enable_custom_elements.isSelected(); String newui = this.uis_technicalNameVector.get(this.ui_manager.getSelectedIndex()); if (!Constants.ui_manager.equals(newui) && (newui != null)) { Constants.ui_manager = newui; try { JFrame frame = Main.getInstance().getGUI().getTopContainer(); if (frame != null) { UIManager.setLookAndFeel(newui); SwingUtilities.updateComponentTreeUI(frame); SwingUtilities.updateComponentTreeUI(this.optionframe); frame.pack(); this.optionframe.pack(); } } catch (Exception ex) {} } Integer newsize = (Integer) this.default_fontsize.getSelectedItem(); if (Constants.defaultFontsize != newsize) { Constants.defaultFontsize = newsize; for (DiagramHandler d : Main.getInstance().getDiagrams()) { d.getFontHandler().resetFontSize(); } for (DiagramHandler d : Main.getInstance().getPalettes().values()) { d.getFontHandler().resetFontSize(); } } String newfamily = (String) this.default_fontfamily.getSelectedItem(); if (Constants.defaultFontFamily != newfamily) Constants.defaultFontFamily = newfamily; // After changing some options (eg: grid or fontsize) the GUI needs to be repainted Main.getInstance().getGUI().repaint(); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/PlainColorIcon.java0000644000175000001440000000122011576116034024016 0ustar benuserspackage com.baselet.gui; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import javax.swing.Icon; import com.baselet.control.Utils; public class PlainColorIcon implements Icon { private Color color; public PlainColorIcon(String color) { this.color = Utils.getColor(color); } @Override public void paintIcon(Component c, Graphics g, int x, int y) { Color old_color = g.getColor(); g.setColor(color); g.fillRect(x, y, 10, 10); g.setColor(old_color); } @Override public int getIconWidth() { return 10; } @Override public int getIconHeight() { return 10; } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/TabComponent.java0000644000175000001440000000764111576116034023551 0ustar benuserspackage com.baselet.gui; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.gui.standalone.TabListener; @SuppressWarnings("serial") public class TabComponent extends JPanel { private DiagramHandler handler; private TabListener listener; private Color background; private JButton button; public TabComponent(final JTabbedPane pane, DiagramHandler handler) { super(new FlowLayout(FlowLayout.LEFT, 0, 0)); this.handler = handler; setOpaque(false); // make JLabel read titles from JTabbedPane JLabel label = new JLabel() { @Override public String getText() { int i = pane.indexOfTabComponent(TabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 7)); add(label); button = new TabButton(); add(button); this.listener = new TabListener(handler, pane); this.addMouseListener(this.listener); this.background = this.getBackground(); } @Override public void setEnabled(boolean en) { super.setEnabled(en); if (en) { this.setBackground(this.background); this.addMouseListener(this.listener); } else { this.setBackground(Color.lightGray); this.removeMouseListener(this.listener); } this.button.setEnabled(en); } private class TabButton extends JButton implements MouseListener { public TabButton() { int size = 17; setPreferredSize(new Dimension(size, size)); setToolTipText("close this tab"); // Make it transparent setContentAreaFilled(false); // No need to be focusable setFocusable(false); setBorder(BorderFactory.createEtchedBorder()); setBorderPainted(false); // Making nice rollover effect // we use the same listener for all buttons addMouseListener(this); } @Override public void setEnabled(boolean en) { super.setEnabled(en); if (en) { this.addMouseListener(this); this.setToolTipText("close this tab"); } else { this.removeMouseListener(this); this.setToolTipText(null); } } @Override public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(true); } } @Override public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(false); } } @Override public void mouseClicked(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { handler.doClose(); if (Main.getInstance().getDiagrams().size() == 0) Main.getInstance().doNew(); } @Override public void mouseReleased(MouseEvent arg0) { } // we don't want to update UI for this button @Override public void updateUI() {} // paint the cross @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g.create(); // shift the image for pressed buttons if (getModel().isPressed()) { g2.translate(1, 1); } g2.setColor(Color.BLACK); int delta = 6; g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1); g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1); g2.dispose(); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/MailPanel.java0000644000175000001440000004543611576116034023026 0ustar benuserspackage com.baselet.gui; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.UIManager; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.io.DiagramFileHandler; public class MailPanel extends JPanel { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static final long serialVersionUID = 1L; /** * Some int and String */ private final int paddingTop = 1; private final int paddingBottom = 1; private final int outerPaddingLeft = 15; private final int outerPaddingRight = 15; private final int halfHorizontalDividerSpace = 2; private final int verticalDividerSpace = 10; /** * Components */ private GridBagLayout layout = new GridBagLayout(); private JLabel lb_from = new JLabel("From:"); private JTextField tf_from = new JTextField(); private JLink lnk_smtpInfo = new JLink(Program.WEBSITE + "/smtp.htm", "What is SMTP?"); private JLabel lb_smtp = new JLabel("SMTP:"); private JTextField tf_smtp = new JTextField(); private JCheckBox cb_smtp_auth = new JCheckBox(); private JLabel lb_smtpUser = new JLabel("User:"); private JTextField tf_smtpUser = new JTextField(); private JLabel lb_smtpPW = new JLabel("PW:"); private JPasswordField pf_smtpPW = new JPasswordField(); private JCheckBox cb_pwSave = new JCheckBox(); private JLabel lb_to = new JLabel("To:"); private JTextField tf_to = new JTextField(); private JLabel lb_cc = new JLabel("CC:"); private JTextField tf_cc = new JTextField(); private JLabel lb_bcc = new JLabel("BCC:"); private JTextField tf_bcc = new JTextField(); private JLabel lb_subject = new JLabel("Subject:"); private JTextField tf_subject = new JTextField(); private JTextArea ta_text = new JTextArea(5, 5); JScrollPane sp_text = new JScrollPane(ta_text); private JCheckBox cb_attachXml = new JCheckBox(); private JCheckBox cb_attachGif = new JCheckBox(); private JCheckBox cb_attachPdf = new JCheckBox(); private JButton bt_send = new JButton("Send"); private JButton bt_cancel = new JButton("Cancel"); private JPanel panel_attachments = new JPanel(new FlowLayout(FlowLayout.LEFT)); private JPanel panel_attachmentsWithButton = new JPanel(layout); // the padding between lines is different for the labels and text components of the grid bag layout private Insets paddingLeftLabel = new Insets(paddingTop, outerPaddingLeft, paddingBottom, halfHorizontalDividerSpace); private Insets paddingMessagebox = new Insets(paddingTop, outerPaddingLeft, paddingBottom, outerPaddingRight); private Insets paddingText = new Insets(paddingTop, halfHorizontalDividerSpace, paddingBottom, outerPaddingRight); private Insets paddingCheckbox = new Insets(paddingTop - 2, halfHorizontalDividerSpace, paddingBottom - 2, outerPaddingRight); private Insets paddingRightLabel = new Insets(paddingTop, halfHorizontalDividerSpace, paddingBottom, halfHorizontalDividerSpace); private Insets noPadding = new Insets(0, 0, 0, 0); // the label doesn't get any additional space. it's always as short as possible private double noWeight = 0; private double fullWeight = 1; private double leftWeight = 0.75; private double rightWeight = 0.25; // the constraint int to fill the width private int fillWidth = GridBagConstraints.HORIZONTAL; private int fillBoth = GridBagConstraints.BOTH; public MailPanel() { initAndFillComponents(); setLayout(layout); setSize(new Dimension(0, Constants.mail_split_position)); int line = 0; addComponent(this, layout, Box.createRigidArea(new Dimension(0, verticalDividerSpace)), 0, line, 10, 1, fillWidth, fullWeight, 0, noPadding); line++; addComponent(this, layout, lb_to, 0, line, 1, 1, fillWidth, noWeight, 0, paddingLeftLabel); addComponent(this, layout, tf_to, 1, line, 1, 1, fillWidth, leftWeight, 0, paddingText); addComponent(this, layout, lb_from, 2, line, 1, 1, fillWidth, noWeight, 0, paddingRightLabel); addComponent(this, layout, tf_from, 3, line, 1, 1, fillWidth, rightWeight, 0, paddingRightLabel); addComponent(this, layout, lnk_smtpInfo, 4, line, 1, 1, fillWidth, noWeight, 0, paddingText); line++; addComponent(this, layout, lb_cc, 0, line, 1, 1, fillWidth, noWeight, 0, paddingLeftLabel); addComponent(this, layout, tf_cc, 1, line, 1, 1, fillWidth, leftWeight, 0, paddingText); addComponent(this, layout, lb_smtp, 2, line, 1, 1, fillWidth, noWeight, 0, paddingRightLabel); addComponent(this, layout, tf_smtp, 3, line, 1, 1, fillWidth, rightWeight, 0, paddingRightLabel); addComponent(this, layout, cb_smtp_auth, 4, line, 1, 1, fillWidth, noWeight, 0, paddingText); line++; addComponent(this, layout, lb_bcc, 0, line, 1, 1, fillWidth, noWeight, 0, paddingLeftLabel); addComponent(this, layout, tf_bcc, 1, line, 1, 1, fillWidth, leftWeight, 0, paddingText); addComponent(this, layout, lb_smtpUser, 2, line, 1, 1, fillWidth, noWeight, 0, paddingRightLabel); addComponent(this, layout, tf_smtpUser, 3, line, 1, 1, fillWidth, rightWeight, 0, paddingRightLabel); line++; addComponent(this, layout, lb_subject, 0, line, 1, 1, fillWidth, noWeight, 0, paddingLeftLabel); addComponent(this, layout, tf_subject, 1, line, 1, 1, fillWidth, leftWeight, 0, paddingText); addComponent(this, layout, lb_smtpPW, 2, line, 1, 1, fillWidth, noWeight, 0, paddingRightLabel); addComponent(this, layout, pf_smtpPW, 3, line, 1, 1, fillWidth, rightWeight, 0, paddingRightLabel); addComponent(this, layout, cb_pwSave, 4, line, 1, 1, fillWidth, noWeight, 0, paddingCheckbox); line++; addComponent(this, layout, Box.createRigidArea(new Dimension(0, verticalDividerSpace)), 0, line, 10, 1, fillWidth, fullWeight, 0, noPadding); line++; addComponent(this, layout, sp_text, 0, line, 5, 1, fillBoth, leftWeight, 1, paddingMessagebox); line++; addComponent(this, layout, panel_attachmentsWithButton, 1, line, 5, 1, fillWidth, fullWeight, 0, noPadding); line++; addComponent(this, layout, Box.createRigidArea(new Dimension(0, verticalDividerSpace)), 0, line, 4, 1, fillWidth, fullWeight, 0, noPadding); } private void initAndFillComponents() { ta_text.setText(Constants.DEFAULT_MAILTEXT); cb_pwSave.setText("save in config"); cb_attachXml.setText("attach " + Program.EXTENSION.toUpperCase()); cb_attachGif.setText("attach GIF"); cb_attachPdf.setText("attach PDF"); cb_smtp_auth.setText("authentication"); bt_send.addActionListener(new SendActionListener()); bt_cancel.addActionListener(new CancelActionListener()); cb_smtp_auth.addActionListener(new AuthentificationActionListener()); // Set Tooltips String adressToolTip = "Separate multiple adresses with ','"; cb_pwSave.setToolTipText("WARNING: The password is stored as plain text in " + Program.CONFIG_NAME); tf_from.setToolTipText(adressToolTip); tf_to.setToolTipText(adressToolTip); tf_cc.setToolTipText(adressToolTip); tf_bcc.setToolTipText(adressToolTip); // Fill Attachment Panel panel_attachments.add(cb_attachXml); panel_attachments.add(Box.createRigidArea(new Dimension(5, 0))); panel_attachments.add(cb_attachGif); panel_attachments.add(Box.createRigidArea(new Dimension(5, 0))); panel_attachments.add(cb_attachPdf); // Fill the superpanel which holds attachments and the send button addComponent(panel_attachmentsWithButton, layout, panel_attachments, 0, 0, 1, 1, fillWidth, fullWeight, 0, noPadding); addComponent(panel_attachmentsWithButton, layout, bt_send, 1, 0, 1, 1, fillWidth, fullWeight, 0, paddingText); addComponent(panel_attachmentsWithButton, layout, bt_cancel, 2, 0, 1, 1, fillWidth, fullWeight, 0, paddingText); setAllFonts(); readConstants(); checkVisibilityOfSmtpAuth(); } private void sendMail() { /** * Initialize some variables and objects */ String smtpHost = tf_smtp.getText(); String smtpUser = tf_smtpUser.getText(); String smtpPW = String.valueOf(pf_smtpPW.getPassword()); String from = tf_from.getText(); String[] to = removeWhitespaceAndSplitAt(tf_to.getText()); String[] cc = removeWhitespaceAndSplitAt(tf_cc.getText()); String[] bcc = removeWhitespaceAndSplitAt(tf_bcc.getText()); String subject = tf_subject.getText(); String text = ta_text.getText(); boolean useSmtpAuthentication = false; File diagramXml = null; File diagramGif = null; File diagramPdf = null; int nrOfAttachments = 0; // Set SMTP Authentication if the user or password field isn't empty if (!smtpUser.isEmpty() || !smtpPW.isEmpty()) useSmtpAuthentication = true; // Create the temp diagrams to send try { final String diagramName = "diagram_" + new SimpleDateFormat("yyyyMMdd_hhmmss").format(new Date()); DiagramFileHandler fileHandler = Main.getInstance().getDiagramHandler().getFileHandler(); if (cb_attachXml.isSelected()) { nrOfAttachments++; diagramXml = fileHandler.doSaveTempDiagram(diagramName, Program.EXTENSION); } if (cb_attachGif.isSelected()) { nrOfAttachments++; diagramGif = fileHandler.doSaveTempDiagram(diagramName, "gif"); } if (cb_attachPdf.isSelected()) { nrOfAttachments++; diagramPdf = fileHandler.doSaveTempDiagram(diagramName, "pdf"); } } catch (Exception e) { JOptionPane.showMessageDialog(this, "There has been an error with your diagram. Please make sure it's not empty.", "Diagram Error", JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); return; } /** * Check if all necessary fields are filled */ String errorMsg = null; if (smtpHost.isEmpty()) errorMsg = "The SMTP field must not be empty"; else if (from.isEmpty()) errorMsg = "The FROM field must not be empty"; else if (to.length == 0) errorMsg = "The TO field must not be empty"; if (errorMsg != null) { JOptionPane.showMessageDialog(this, errorMsg, "Error", JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); return; } /** * Set up the mail */ try { // Get system properties and session Properties props = System.getProperties(); Session session = Session.getInstance(props); // Define message and it's parts MimeMessage message = new MimeMessage(session); MimeBodyPart textPart = new MimeBodyPart(); MimeBodyPart[] attachmentPart = new MimeBodyPart[nrOfAttachments]; for (int i = 0; i < nrOfAttachments; i++) attachmentPart[i] = new MimeBodyPart(); // Build multipart message Multipart multipart = new MimeMultipart(); multipart.addBodyPart(textPart); for (int i = 0; i < nrOfAttachments; i++) multipart.addBodyPart(attachmentPart[i]); message.setContent(multipart); /** * Fill the message properties */ // Set the SMTP Host props.put("mail.smtp.host", smtpHost); // We want to close the connection immediately after sending props.put("mail.smtp.quitwait", "false"); // We want to use encryption if needed props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.ssl.protocols", "SSLv3 TLSv1"); // If authentication is needed we set it to true if (useSmtpAuthentication) props.put("mail.smtp.auth", "true"); else props.put("mail.smtp.auth", "false"); // Set all recipients of any kind (TO, CC, BCC) message.setFrom(new InternetAddress(from)); for (int i = 0; i < to.length; i++) { message.addRecipient(Message.RecipientType.TO, new InternetAddress(to[i])); } for (int i = 0; i < cc.length; i++) { message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i])); } for (int i = 0; i < bcc.length; i++) { message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i])); } // Set subject, text and attachment message.setSubject(subject); textPart.setText(text); int i = 0; if (cb_attachXml.isSelected()) attachmentPart[i++].attachFile(diagramXml); if (cb_attachGif.isSelected()) attachmentPart[i++].attachFile(diagramGif); if (cb_attachPdf.isSelected()) attachmentPart[i++].attachFile(diagramPdf); /** * Send message (if no authentication is used, we use the short variant to send a mail */ if (useSmtpAuthentication) { Transport transport = session.getTransport("smtp"); try { transport.connect(smtpHost, smtpUser, smtpPW); transport.sendMessage(message, message.getAllRecipients()); } finally { transport.close(); } } else { // No SMTP Authentication Transport.send(message); } closePanel(); } catch (Exception e) { log.error(null, e); if (e instanceof MessagingException) { // SMTP Error JOptionPane.showMessageDialog(this, "There has been an error with your smtp server." + Constants.NEWLINE + "Please recheck your smtp server and login data.", "SMTP Error", JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } else { // Other Error JOptionPane.showMessageDialog(this, "There has been an error sending your mail." + Constants.NEWLINE + "Please recheck your input data.", "Sending Error", JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } } finally { if (diagramXml != null) diagramXml.delete(); if (diagramGif != null) diagramGif.delete(); if (diagramPdf != null) diagramPdf.delete(); } } /** * Adds a component to this panel * * @param gbl * The GridBagLayout of this component * @param c * The Component to add * @param x * The x value of grid where the component starts * @param y * The y value of grid where the component starts * @param width * How many spaces of the grid's width will be used by the component * @param height * How many spaces of the grid's height will be used by the component * @param fill * If the component's display area is larger than the component's requested size this param determines whether and how to resize the component * @param weightx * Specifies how to distribute extra horizontal space. * @param weighty * Specifies how to distribute extra vertical space. * @param insets * Specifies the external padding of the component (= minimum amount of space between the component and the edges of its display area) */ private void addComponent(JPanel panel, GridBagLayout gbl, Component c, int x, int y, int width, int height, int fill, double weightx, double weighty, Insets insets) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = width; gbc.gridheight = height; gbc.fill = fill; gbc.weightx = weightx; gbc.weighty = weighty; gbc.insets = insets; gbl.setConstraints(c, gbc); panel.add(c); } private String[] removeWhitespaceAndSplitAt(String inputString) { if (inputString.isEmpty()) return new String[] {}; String returnString = ""; for (int i = 0; i < inputString.length(); i++) { if (inputString.charAt(i) != ' ') returnString += inputString.charAt(i); } return returnString.split(","); } private void storeConstants() { Constants.mail_smtp = tf_smtp.getText(); Constants.mail_smtp_auth = cb_smtp_auth.isSelected(); Constants.mail_smtp_user = tf_smtpUser.getText(); Constants.mail_smtp_pw_store = cb_pwSave.isSelected(); if (cb_pwSave.isSelected()) Constants.mail_smtp_pw = String.valueOf(pf_smtpPW.getPassword()); else Constants.mail_smtp_pw = ""; Constants.mail_from = tf_from.getText(); Constants.mail_to = tf_to.getText(); Constants.mail_cc = tf_cc.getText(); Constants.mail_bcc = tf_bcc.getText(); Constants.mail_xml = cb_attachXml.isSelected(); Constants.mail_gif = cb_attachGif.isSelected(); Constants.mail_pdf = cb_attachPdf.isSelected(); } private void readConstants() { tf_smtp.setText(Constants.mail_smtp); cb_smtp_auth.setSelected(Constants.mail_smtp_auth); tf_smtpUser.setText(Constants.mail_smtp_user); cb_pwSave.setSelected(Constants.mail_smtp_pw_store); pf_smtpPW.setText(Constants.mail_smtp_pw); tf_from.setText(Constants.mail_from); tf_to.setText(Constants.mail_to); tf_cc.setText(Constants.mail_cc); tf_bcc.setText(Constants.mail_bcc); cb_attachXml.setSelected(Constants.mail_xml); cb_attachGif.setSelected(Constants.mail_gif); cb_attachPdf.setSelected(Constants.mail_pdf); } private void setAllFonts() { Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12); Font fontBold = new Font(Font.SANS_SERIF, Font.BOLD, 12); Font fontSmallItalic = new Font(Font.SANS_SERIF, Font.ITALIC, 10); lb_smtp.setFont(fontBold); tf_smtp.setFont(font); lb_smtpUser.setFont(fontBold); tf_smtpUser.setFont(font); lb_smtpPW.setFont(fontBold); pf_smtpPW.setFont(font); lb_from.setFont(fontBold); tf_from.setFont(font); lb_to.setFont(fontBold); tf_to.setFont(font); lb_cc.setFont(fontBold); tf_cc.setFont(font); lb_bcc.setFont(fontBold); tf_bcc.setFont(font); lb_subject.setFont(fontBold); tf_subject.setFont(font); ta_text.setFont(font); cb_attachXml.setFont(fontBold); cb_attachGif.setFont(fontBold); cb_attachPdf.setFont(fontBold); lnk_smtpInfo.setFont(fontSmallItalic); cb_smtp_auth.setFont(fontSmallItalic); cb_pwSave.setFont(fontSmallItalic); } public void closePanel() { storeConstants(); Constants.mail_split_position = (int) this.getSize().getHeight(); Main.getInstance().getGUI().setMailPanelEnabled(false); } private class SendActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { sendMail(); } } private class CancelActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { closePanel(); } } private void checkVisibilityOfSmtpAuth() { boolean val = cb_smtp_auth.isSelected(); lb_smtpUser.setVisible(val); tf_smtpUser.setVisible(val); lb_smtpPW.setVisible(val); pf_smtpPW.setVisible(val); cb_pwSave.setVisible(val); if (!val) { tf_smtpUser.setText(""); pf_smtpPW.setText(""); cb_pwSave.setSelected(false); } repaint(); } private class AuthentificationActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { checkVisibilityOfSmtpAuth(); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/0000755000175000001440000000000011576116036022437 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/SearchListener.java0000644000175000001440000000243211576116034026214 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import javax.swing.JTextField; import com.baselet.control.Constants; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.command.Search; public class SearchListener implements KeyListener, MouseMotionListener { public SearchListener() {} @Override public void keyPressed(KeyEvent arg0) { } @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { JTextField search = (JTextField) e.getComponent(); DiagramHandler h = Main.getInstance().getDiagramHandler(); if ((h != null) && !"".equals(search) && (search != null)) h.getController().executeCommand(new Search(search.getText())); Main.getInstance().getGUI().enableSearch(false); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) Main.getInstance().getGUI().enableSearch(false); } @Override public void keyTyped(KeyEvent arg0) {} @Override public void mouseDragged(MouseEvent me) {} @Override public void mouseMoved(MouseEvent me) { Main.getInstance().getGUI().setCursor(Constants.TEXT_CURSOR); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/ZoomListener.java0000644000175000001440000000232711576116034025736 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.AWTEvent; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import javax.swing.JComboBox; import com.baselet.control.Main; public class ZoomListener implements ActionListener, MouseWheelListener { @Override public void actionPerformed(ActionEvent e) { handleEvent(e); } @Override public void mouseWheelMoved(MouseWheelEvent e) { handleEvent(e); } private void handleEvent(AWTEvent e) { if ((Main.getInstance().getGUI() instanceof StandaloneGUI) && (Main.getInstance().getDiagramHandler() != null)) { // The offset is -1 (wheel up) or +1 (wheel down) or 0 (no wheel used) int offset = 0; if (e instanceof MouseWheelEvent) offset = ((MouseWheelEvent) e).getWheelRotation(); String zoomFactor = ((JComboBox) e.getSource()).getSelectedItem().toString(); zoomFactor = zoomFactor.substring(0, zoomFactor.length() - 2); // Cut the zoomvalue eg: "120%" to "12" int newZoomFactor = Integer.parseInt(zoomFactor) + offset; if ((newZoomFactor > 0) && (newZoomFactor < 21)) Main.getInstance().getDiagramHandler().setGridAndZoom(newZoomFactor); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/MenuListener.java0000644000175000001440000000314011576116034025710 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.Color; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JLabel; import com.baselet.control.Constants; import com.baselet.control.Main; public class MenuListener implements MouseListener, MouseMotionListener { private static MenuListener _menulistener; public static MenuListener getInstance() { if (_menulistener == null) _menulistener = new MenuListener(); return _menulistener; } protected MenuListener() {} @Override public void mouseClicked(MouseEvent me) { } @Override public void mouseEntered(MouseEvent me) { Main.getInstance().getGUI().setCursor(Constants.HAND_CURSOR); JLabel label = (JLabel) me.getComponent(); label.setForeground(Color.blue); } @Override public void mouseExited(MouseEvent me) { Main.getInstance().getGUI().setCursor(Constants.DEFAULT_CURSOR); JLabel label = (JLabel) me.getComponent(); label.setForeground(Color.black); } @Override public void mousePressed(MouseEvent me) { JLabel label = (JLabel) me.getComponent(); if (!label.getText().startsWith("Discard")) Main.getInstance().getGUI().getCurrentCustomHandler().saveEntity(); if (Main.getInstance().getGUI().getCurrentCustomHandler().closeEntity()) { Main.getInstance().getGUI().setCustomPanelEnabled(false); } } @Override public void mouseReleased(MouseEvent me) { } @Override public void mouseDragged(MouseEvent me) { } @Override public void mouseMoved(MouseEvent me) { } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/FileDropListener.java0000644000175000001440000000116511576116034026515 0ustar benuserspackage com.baselet.gui.standalone; import java.io.File; import java.io.IOException; import org.apache.log4j.Logger; import com.baselet.control.Main; import com.baselet.control.Utils; public class FileDropListener implements FileDrop.Listener { private static Logger log = Logger.getLogger(Utils.getClassName()); @Override public void filesDropped(File[] files) { for (int i = 0; i < files.length; i++) { try { String filename = files[i].getCanonicalPath(); Main.getInstance().doOpen(filename); } catch (IOException e) { log.error("Cannot open file dropped"); } } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/FileDrop.java0000644000175000001440000007703411576116034025017 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.datatransfer.DataFlavor; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.io.Reader; import com.baselet.gui.standalone.FileDrop.TransferableObject; /** * This class makes it easy to drag and drop files from the operating * system to a Java program. Any java.awt.Component can be * dropped onto, but only javax.swing.JComponents will indicate * the drop event with a changed border. *

* To use this class, construct a new FileDrop by passing it the target component and a Listener to receive notification when file(s) have been dropped. Here is an example: *

*

 *      JPanel myPanel = new JPanel();
 *      new FileDrop( myPanel, new FileDrop.Listener()
 *      {   public void filesDropped( java.io.File[] files )
 *          {   
 *              // handle file drop
 *              ...
 *          }   // end filesDropped
 *      }); // end FileDrop.Listener
 * 
*

* You can specify the border that will appear when files are being dragged by calling the constructor with a javax.swing.border.Border. Only JComponents will show any indication with a border. *

* You can turn on some debugging features by passing a PrintStream object (such as System.out) into the full constructor. A null value will result in no extra debugging information being output. *

*

* I'm releasing this code into the Public Domain. Enjoy. *

*

* Original author: Robert Harder, rharder@usa.net *

*

* 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. *

* * @author Robert Harder * @author rharder@users.sf.net * @version 1.0.1 */ public class FileDrop { private transient javax.swing.border.Border normalBorder; private transient java.awt.dnd.DropTargetListener dropListener; /** Discover if the running JVM is modern enough to have drag and drop. */ private static Boolean supportsDnD; // Default border color private static java.awt.Color defaultBorderColor = new java.awt.Color(0f, 0f, 1f, 0.25f); /** * Constructs a {@link FileDrop} with a default light-blue border * and, if c is a {@link java.awt.Container}, recursively * sets all elements contained within as drop targets, though only * the top level container will change borders. * * @param c * Component on which files will be dropped. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.awt.Component c, final Listener listener) { this(null, // Logging stream c, // Drop target javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, defaultBorderColor), // Drag border true, // Recursive listener); } // end constructor /** * Constructor with a default border and the option to recursively set drop targets. * If your component is a java.awt.Container, then each of its children * components will also listen for drops, though only the parent will change borders. * * @param c * Component on which files will be dropped. * @param recursive * Recursively set children as drop targets. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.awt.Component c, final boolean recursive, final Listener listener) { this(null, // Logging stream c, // Drop target javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, defaultBorderColor), // Drag border recursive, // Recursive listener); } // end constructor /** * Constructor with a default border and debugging optionally turned on. * With Debugging turned on, more status messages will be displayed to out. A common way to use this constructor is with System.out or System.err. A null value for * the parameter out will result in no debugging output. * * @param out * PrintStream to record debugging info or null for no debugging. * @param out * @param c * Component on which files will be dropped. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.io.PrintStream out, final java.awt.Component c, final Listener listener) { this(out, // Logging stream c, // Drop target javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, defaultBorderColor), false, // Recursive listener); } // end constructor /** * Constructor with a default border, debugging optionally turned on * and the option to recursively set drop targets. * If your component is a java.awt.Container, then each of its children * components will also listen for drops, though only the parent will change borders. * With Debugging turned on, more status messages will be displayed to out. A common way to use this constructor is with System.out or System.err. A null value for * the parameter out will result in no debugging output. * * @param out * PrintStream to record debugging info or null for no debugging. * @param out * @param c * Component on which files will be dropped. * @param recursive * Recursively set children as drop targets. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.io.PrintStream out, final java.awt.Component c, final boolean recursive, final Listener listener) { this(out, // Logging stream c, // Drop target javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, defaultBorderColor), // Drag border recursive, // Recursive listener); } // end constructor /** * Constructor with a specified border * * @param c * Component on which files will be dropped. * @param dragBorder * Border to use on JComponent when dragging occurs. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.awt.Component c, final javax.swing.border.Border dragBorder, final Listener listener) { this( null, // Logging stream c, // Drop target dragBorder, // Drag border false, // Recursive listener); } // end constructor /** * Constructor with a specified border and the option to recursively set drop targets. * If your component is a java.awt.Container, then each of its children * components will also listen for drops, though only the parent will change borders. * * @param c * Component on which files will be dropped. * @param dragBorder * Border to use on JComponent when dragging occurs. * @param recursive * Recursively set children as drop targets. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.awt.Component c, final javax.swing.border.Border dragBorder, final boolean recursive, final Listener listener) { this( null, c, dragBorder, recursive, listener); } // end constructor /** * Constructor with a specified border and debugging optionally turned on. * With Debugging turned on, more status messages will be displayed to out. A common way to use this constructor is with System.out or System.err. A null value for * the parameter out will result in no debugging output. * * @param out * PrintStream to record debugging info or null for no debugging. * @param c * Component on which files will be dropped. * @param dragBorder * Border to use on JComponent when dragging occurs. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.io.PrintStream out, final java.awt.Component c, final javax.swing.border.Border dragBorder, final Listener listener) { this( out, // Logging stream c, // Drop target dragBorder, // Drag border false, // Recursive listener); } // end constructor /** * Full constructor with a specified border and debugging optionally turned on. * With Debugging turned on, more status messages will be displayed to out. A common way to use this constructor is with System.out or System.err. A null value for * the parameter out will result in no debugging output. * * @param out * PrintStream to record debugging info or null for no debugging. * @param c * Component on which files will be dropped. * @param dragBorder * Border to use on JComponent when dragging occurs. * @param recursive * Recursively set children as drop targets. * @param listener * Listens for filesDropped. * @since 1.0 */ public FileDrop( final java.io.PrintStream out, final java.awt.Component c, final javax.swing.border.Border dragBorder, final boolean recursive, final Listener listener) { if (supportsDnD()) { // Make a drop listener dropListener = new java.awt.dnd.DropTargetListener() { @Override public void dragEnter(java.awt.dnd.DropTargetDragEvent evt) { log(out, "FileDrop: dragEnter event."); // Is this an acceptable drag event? if (isDragOk(out, evt)) { // If it's a Swing component, set its border if (c instanceof javax.swing.JComponent) { javax.swing.JComponent jc = (javax.swing.JComponent) c; normalBorder = jc.getBorder(); log(out, "FileDrop: normal border saved."); jc.setBorder(dragBorder); log(out, "FileDrop: drag border set."); } // end if: JComponent // Acknowledge that it's okay to enter // evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE ); evt.acceptDrag(java.awt.dnd.DnDConstants.ACTION_COPY); log(out, "FileDrop: event accepted."); } // end if: drag ok else { // Reject the drag event evt.rejectDrag(); log(out, "FileDrop: event rejected."); } // end else: drag not ok } // end dragEnter @Override public void dragOver(java.awt.dnd.DropTargetDragEvent evt) { // This is called continually as long as the mouse is // over the drag target. } // end dragOver @Override public void drop(java.awt.dnd.DropTargetDropEvent evt) { log(out, "FileDrop: drop event."); try { // Get whatever was dropped java.awt.datatransfer.Transferable tr = evt.getTransferable(); // Is it a file list? if (tr.isDataFlavorSupported(java.awt.datatransfer.DataFlavor.javaFileListFlavor)) { // Say we'll take it. // evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE ); evt.acceptDrop(java.awt.dnd.DnDConstants.ACTION_COPY); log(out, "FileDrop: file list accepted."); // Get a useful list java.util.List fileList = (java.util.List) tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor); java.util.Iterator iterator = fileList.iterator(); // Convert list to array java.io.File[] filesTemp = new java.io.File[fileList.size()]; fileList.toArray(filesTemp); final java.io.File[] files = filesTemp; // Alert listener to drop. if (listener != null) listener.filesDropped(files); // Mark that drop is completed. evt.getDropTargetContext().dropComplete(true); log(out, "FileDrop: drop complete."); } // end if: file list else // this section will check for a reader flavor. { // Thanks, Nathan! // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. DataFlavor[] flavors = tr.getTransferDataFlavors(); boolean handled = false; for (int zz = 0; zz < flavors.length; zz++) { if (flavors[zz].isRepresentationClassReader()) { // Say we'll take it. // evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE ); evt.acceptDrop(java.awt.dnd.DnDConstants.ACTION_COPY); log(out, "FileDrop: reader accepted."); Reader reader = flavors[zz].getReaderForText(tr); BufferedReader br = new BufferedReader(reader); if (listener != null) listener.filesDropped(createFileArray(br, out)); // Mark that drop is completed. evt.getDropTargetContext().dropComplete(true); log(out, "FileDrop: drop complete."); handled = true; break; } } if (!handled) { log(out, "FileDrop: not a file list or reader - abort."); evt.rejectDrop(); } // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. } // end else: not a file list } // end try catch (java.io.IOException io) { log(out, "FileDrop: IOException - abort:"); io.printStackTrace(out); evt.rejectDrop(); } // end catch IOException catch (java.awt.datatransfer.UnsupportedFlavorException ufe) { log(out, "FileDrop: UnsupportedFlavorException - abort:"); ufe.printStackTrace(out); evt.rejectDrop(); } // end catch: UnsupportedFlavorException finally { // If it's a Swing component, reset its border if (c instanceof javax.swing.JComponent) { javax.swing.JComponent jc = (javax.swing.JComponent) c; jc.setBorder(normalBorder); log(out, "FileDrop: normal border restored."); } // end if: JComponent } // end finally } // end drop @Override public void dragExit(java.awt.dnd.DropTargetEvent evt) { log(out, "FileDrop: dragExit event."); // If it's a Swing component, reset its border if (c instanceof javax.swing.JComponent) { javax.swing.JComponent jc = (javax.swing.JComponent) c; jc.setBorder(normalBorder); log(out, "FileDrop: normal border restored."); } // end if: JComponent } // end dragExit @Override public void dropActionChanged(java.awt.dnd.DropTargetDragEvent evt) { log(out, "FileDrop: dropActionChanged event."); // Is this an acceptable drag event? if (isDragOk(out, evt)) { // evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE ); evt.acceptDrag(java.awt.dnd.DnDConstants.ACTION_COPY); log(out, "FileDrop: event accepted."); } // end if: drag ok else { evt.rejectDrag(); log(out, "FileDrop: event rejected."); } // end else: drag not ok } // end dropActionChanged }; // end DropTargetListener // Make the component (and possibly children) drop targets makeDropTarget(out, c, recursive); } // end if: supports dnd else { log(out, "FileDrop: Drag and drop is not supported with this JVM"); } // end else: does not support DnD } // end constructor private static boolean supportsDnD() { // Static Boolean if (supportsDnD == null) { boolean support = false; try { Class arbitraryDndClass = Class.forName("java.awt.dnd.DnDConstants"); support = true; } // end try catch (Exception e) { support = false; } // end catch supportsDnD = new Boolean(support); } // end if: first time through return supportsDnD.booleanValue(); } // end supportsDnD // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. private static String ZERO_CHAR_STRING = "" + (char) 0; private static File[] createFileArray(BufferedReader bReader, PrintStream out) { try { java.util.List list = new java.util.ArrayList(); java.lang.String line = null; while ((line = bReader.readLine()) != null) { try { // kde seems to append a 0 char to the end of the reader if (ZERO_CHAR_STRING.equals(line)) continue; java.io.File file = new java.io.File(new java.net.URI(line)); list.add(file); } catch (Exception ex) { log(out, "Error with " + line + ": " + ex.getMessage()); } } return (java.io.File[]) list.toArray(new File[list.size()]); } catch (IOException ex) { log(out, "FileDrop: IOException"); } return new File[0]; } // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. private void makeDropTarget(final java.io.PrintStream out, final java.awt.Component c, boolean recursive) { // Make drop target final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget(); try { dt.addDropTargetListener(dropListener); } // end try catch (java.util.TooManyListenersException e) { e.printStackTrace(); log(out, "FileDrop: Drop will not work due to previous error. Do you have another listener attached?"); } // end catch // Listen for hierarchy changes and remove the drop target when the parent gets cleared out. c.addHierarchyListener(new java.awt.event.HierarchyListener() { @Override public void hierarchyChanged(java.awt.event.HierarchyEvent evt) { log(out, "FileDrop: Hierarchy changed."); java.awt.Component parent = c.getParent(); if (parent == null) { c.setDropTarget(null); log(out, "FileDrop: Drop target cleared from component."); } // end if: null parent else { new java.awt.dnd.DropTarget(c, dropListener); log(out, "FileDrop: Drop target added to component."); } // end else: parent not null } // end hierarchyChanged }); // end hierarchy listener if (c.getParent() != null) new java.awt.dnd.DropTarget(c, dropListener); if (recursive && (c instanceof java.awt.Container)) { // Get the container java.awt.Container cont = (java.awt.Container) c; // Get it's components java.awt.Component[] comps = cont.getComponents(); // Set it's components as listeners also for (int i = 0; i < comps.length; i++) makeDropTarget(out, comps[i], recursive); } // end if: recursively set components as listener } // end dropListener /** Determine if the dragged data is a file list. */ private boolean isDragOk(final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt) { boolean ok = false; // Get data flavors being dragged java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors(); // See if any of the flavors are a file list int i = 0; while (!ok && (i < flavors.length)) { // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. // Is the flavor a file list? final DataFlavor curFlavor = flavors[i]; if (curFlavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor) || curFlavor.isRepresentationClassReader()) { ok = true; } // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. i++; } // end while: through flavors // If logging is enabled, show data flavors if (out != null) { if (flavors.length == 0) log(out, "FileDrop: no data flavors."); for (i = 0; i < flavors.length; i++) log(out, flavors[i].toString()); } // end if: logging enabled return ok; } // end isDragOk /** Outputs message to out if it's not null. */ private static void log(java.io.PrintStream out, String message) { // Log message if requested if (out != null) out.println(message); } // end log /** * Removes the drag-and-drop hooks from the component and optionally * from the all children. You should call this if you add and remove * components after you've set up the drag-and-drop. * This will recursively unregister all components contained within * c if c is a {@link java.awt.Container}. * * @param c * The component to unregister as a drop target * @since 1.0 */ public static boolean remove(java.awt.Component c) { return remove(null, c, true); } // end remove /** * Removes the drag-and-drop hooks from the component and optionally * from the all children. You should call this if you add and remove * components after you've set up the drag-and-drop. * * @param out * Optional {@link java.io.PrintStream} for logging drag and drop messages * @param c * The component to unregister * @param recursive * Recursively unregister components within a container * @since 1.0 */ public static boolean remove(java.io.PrintStream out, java.awt.Component c, boolean recursive) { // Make sure we support dnd. if (supportsDnD()) { log(out, "FileDrop: Removing drag-and-drop hooks."); c.setDropTarget(null); if (recursive && (c instanceof java.awt.Container)) { java.awt.Component[] comps = ((java.awt.Container) c).getComponents(); for (int i = 0; i < comps.length; i++) remove(out, comps[i], recursive); return true; } // end if: recursive else return false; } // end if: supports DnD else return false; } // end remove /* ******** I N N E R I N T E R F A C E L I S T E N E R ******** */ /** * Implement this inner interface to listen for when files are dropped. For example * your class declaration may begin like this:
	 *      public class MyClass implements FileDrop.Listener
	 *      ...
	 *      public void filesDropped( java.io.File[] files )
	 *      {
	 *          ...
	 *      }   // end filesDropped
	 *      ...
	 * 
* * @since 1.1 */ public static interface Listener { /** * This method is called when files have been successfully dropped. * * @param files * An array of Files that were dropped. * @since 1.0 */ public abstract void filesDropped(java.io.File[] files); } // end inner-interface Listener /* ******** I N N E R C L A S S ******** */ /** * This is the event that is passed to the {@link FileDropListener#filesDropped filesDropped(...)} method in * your {@link FileDropListener} when files are dropped onto * a registered drop target. *

* I'm releasing this code into the Public Domain. Enjoy. *

* * @author Robert Harder * @author rob@iharder.net * @version 1.2 */ public static class Event extends java.util.EventObject { /** * */ private static final long serialVersionUID = 1L; private java.io.File[] files; /** * Constructs an {@link Event} with the array * of files that were dropped and the {@link FileDrop} that initiated the event. * * @param files * The array of files that were dropped * @source The event source * @since 1.1 */ public Event(java.io.File[] files, Object source) { super(source); this.files = files; } // end constructor /** * Returns an array of files that were dropped on a * registered drop target. * * @return array of files that were dropped * @since 1.1 */ public java.io.File[] getFiles() { return files; } // end getFiles } // end inner class Event /* ******** I N N E R C L A S S ******** */ /** * At last an easy way to encapsulate your custom objects for dragging and dropping * in your Java programs! * When you need to create a {@link java.awt.datatransfer.Transferable} object, * use this class to wrap your object. * For example: * *
	 * 
	 *      ...
	 *      MyCoolClass myObj = new MyCoolClass();
	 *      Transferable xfer = new TransferableObject( myObj );
	 *      ...
	 * 
	 * 
* * Or if you need to know when the data was actually dropped, like when you're * moving data out of a list, say, you can use the {@link TransferableObject.Fetcher} inner class to return your object Just in Time. * For example: * *
	 * 
	 *      ...
	 *      final MyCoolClass myObj = new MyCoolClass();
	 * 
	 *      TransferableObject.Fetcher fetcher = new TransferableObject.Fetcher()
	 *      {   public Object getObject(){ return myObj; }
	 *      }; // end fetcher
	 * 
	 *      Transferable xfer = new TransferableObject( fetcher );
	 *      ...
	 * 
	 * 
* * The {@link java.awt.datatransfer.DataFlavor} associated with {@link TransferableObject} has the representation class net.iharder.dnd.TransferableObject.class and MIME type application/x-net.iharder.dnd.TransferableObject. * This data flavor is accessible via the static {@link #DATA_FLAVOR} property. *

* I'm releasing this code into the Public Domain. Enjoy. *

* * @author Robert Harder * @author rob@iharder.net * @version 1.2 */ public static class TransferableObject implements java.awt.datatransfer.Transferable { /** * The MIME type for {@link #DATA_FLAVOR} is application/x-net.iharder.dnd.TransferableObject. * * @since 1.1 */ public final static String MIME_TYPE = "application/x-net.iharder.dnd.TransferableObject"; /** * The default {@link java.awt.datatransfer.DataFlavor} for {@link TransferableObject} has the representation class net.iharder.dnd.TransferableObject.class and the MIME type application/x-net.iharder.dnd.TransferableObject. * * @since 1.1 */ public final static java.awt.datatransfer.DataFlavor DATA_FLAVOR = new java.awt.datatransfer.DataFlavor(FileDrop.TransferableObject.class, MIME_TYPE); private Fetcher fetcher; private Object data; private java.awt.datatransfer.DataFlavor customFlavor; /** * Creates a new {@link TransferableObject} that wraps data. * Along with the {@link #DATA_FLAVOR} associated with this class, * this creates a custom data flavor with a representation class * determined from data.getClass() and the MIME type application/x-net.iharder.dnd.TransferableObject. * * @param data * The data to transfer * @since 1.1 */ public TransferableObject(Object data) { this.data = data; this.customFlavor = new java.awt.datatransfer.DataFlavor(data.getClass(), MIME_TYPE); } // end constructor /** * Creates a new {@link TransferableObject} that will return the * object that is returned by fetcher. * No custom data flavor is set other than the default {@link #DATA_FLAVOR}. * * @see Fetcher * @param fetcher * The {@link Fetcher} that will return the data object * @since 1.1 */ public TransferableObject(Fetcher fetcher) { this.fetcher = fetcher; } // end constructor /** * Creates a new {@link TransferableObject} that will return the * object that is returned by fetcher. * Along with the {@link #DATA_FLAVOR} associated with this class, * this creates a custom data flavor with a representation class dataClass * and the MIME type application/x-net.iharder.dnd.TransferableObject. * * @see Fetcher * @param dataClass * The {@link java.lang.Class} to use in the custom data flavor * @param fetcher * The {@link Fetcher} that will return the data object * @since 1.1 */ public TransferableObject(Class dataClass, Fetcher fetcher) { this.fetcher = fetcher; this.customFlavor = new java.awt.datatransfer.DataFlavor(dataClass, MIME_TYPE); } // end constructor /** * Returns the custom {@link java.awt.datatransfer.DataFlavor} associated * with the encapsulated object or null if the {@link Fetcher} constructor was used without passing a {@link java.lang.Class}. * * @return The custom data flavor for the encapsulated object * @since 1.1 */ public java.awt.datatransfer.DataFlavor getCustomDataFlavor() { return customFlavor; } // end getCustomDataFlavor /* ******** T R A N S F E R A B L E M E T H O D S ******** */ /** * Returns a two- or three-element array containing first * the custom data flavor, if one was created in the constructors, * second the default {@link #DATA_FLAVOR} associated with {@link TransferableObject}, and third the {@link java.awt.datatransfer.DataFlavor.stringFlavor}. * * @return An array of supported data flavors * @since 1.1 */ @Override public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors() { if (customFlavor != null) return new java.awt.datatransfer.DataFlavor[] { customFlavor, DATA_FLAVOR, java.awt.datatransfer.DataFlavor.stringFlavor }; // end flavors array else return new java.awt.datatransfer.DataFlavor[] { DATA_FLAVOR, java.awt.datatransfer.DataFlavor.stringFlavor }; // end flavors array } // end getTransferDataFlavors /** * Returns the data encapsulated in this {@link TransferableObject}. * If the {@link Fetcher} constructor was used, then this is when * the {@link Fetcher#getObject getObject()} method will be called. * If the requested data flavor is not supported, then the {@link Fetcher#getObject getObject()} method will not be called. * * @param flavor * The data flavor for the data to return * @return The dropped data * @since 1.1 */ @Override public Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException { // Native object if (flavor.equals(DATA_FLAVOR)) return fetcher == null ? data : fetcher.getObject(); // String if (flavor.equals(java.awt.datatransfer.DataFlavor.stringFlavor)) return fetcher == null ? data.toString() : fetcher.getObject().toString(); // We can't do anything else throw new java.awt.datatransfer.UnsupportedFlavorException(flavor); } // end getTransferData /** * Returns true if flavor is one of the supported * flavors. Flavors are supported using the equals(...) method. * * @param flavor * The data flavor to check * @return Whether or not the flavor is supported * @since 1.1 */ @Override public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor) { // Native object if (flavor.equals(DATA_FLAVOR)) return true; // String if (flavor.equals(java.awt.datatransfer.DataFlavor.stringFlavor)) return true; // We can't do anything else return false; } // end isDataFlavorSupported /* ******** I N N E R I N T E R F A C E F E T C H E R ******** */ /** * Instead of passing your data directly to the {@link TransferableObject} constructor, you may want to know exactly when your data was received * in case you need to remove it from its source (or do anyting else to it). * When the {@link #getTransferData getTransferData(...)} method is called * on the {@link TransferableObject}, the {@link Fetcher}'s {@link #getObject getObject()} method will be called. * * @author Robert Harder * @copyright 2001 * @version 1.1 * @since 1.1 */ public static interface Fetcher { /** * Return the object being encapsulated in the {@link TransferableObject}. * * @return The dropped object * @since 1.1 */ public abstract Object getObject(); } // end inner interface Fetcher } // end class TransferableObject } // end class FileDrop umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/TabListener.java0000644000175000001440000000211411576116034025512 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JTabbedPane; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.gui.BaseGUI; public class TabListener implements MouseListener { private DiagramHandler handler; private JTabbedPane pane; public TabListener(DiagramHandler handler, JTabbedPane pane) { this.handler = handler; this.pane = pane; } @Override public void mouseClicked(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { this.pane.setSelectedComponent(handler.getDrawPanel().getScrollPane()); this.handler.getDrawPanel().getSelector().updateSelectorInformation(); BaseGUI gui = Main.getInstance().getGUI(); if (gui != null) gui.setValueOfZoomDisplay(handler.getGridSize()); } @Override public void mouseReleased(MouseEvent arg0) { } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/WindowListener.java0000644000175000001440000000132311576116034026254 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.event.WindowEvent; import com.baselet.control.Main; public class WindowListener implements java.awt.event.WindowListener { public WindowListener() {} @Override public void windowActivated(WindowEvent arg0) {} @Override public void windowClosed(WindowEvent arg0) {} @Override public void windowClosing(WindowEvent arg0) { Main.getInstance().getGUI().closeWindow(); } @Override public void windowDeactivated(WindowEvent arg0) {} @Override public void windowDeiconified(WindowEvent arg0) {} @Override public void windowIconified(WindowEvent arg0) {} @Override public void windowOpened(WindowEvent arg0) {} } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/standalone/StandaloneGUI.java0000644000175000001440000005752511576116034025753 0ustar benuserspackage com.baselet.gui.standalone; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.Hashtable; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.KeyStroke; import javax.swing.ToolTipManager; import javax.swing.WindowConstants; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Main; import com.baselet.control.Path; import com.baselet.control.Utils; import com.baselet.diagram.CustomPreviewHandler; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.PaletteHandler; import com.baselet.diagram.io.DiagramFileHandler; import com.baselet.gui.BaseGUI; import com.baselet.gui.MailPanel; import com.baselet.gui.MenuFactory; import com.baselet.gui.MenuFactorySwing; import com.baselet.gui.OwnSyntaxPane; import com.baselet.gui.TabComponent; import com.baselet.gui.listener.DividerListener; import com.baselet.gui.listener.GUIListener; import com.baselet.gui.listener.PaletteComboBoxListener; import com.umlet.custom.CustomElementHandler; import com.umlet.gui.CustomElementPanel; @SuppressWarnings("serial") public class StandaloneGUI extends BaseGUI { private final static Logger log = Logger.getLogger(Utils.getClassName()); private MenuFactorySwing menuFactory; private JComboBox zoomComboBox; private JFrame window; private JSplitPane customSplit; private JSplitPane rightSplit; private JSplitPane mainSplit; private JSplitPane mailSplit; private JPanel diagramspanel; private JPanel palettepanel; private JTabbedPane diagramtabs; private JMenu editMenu; private JMenuItem editUndo; private JMenuItem editRedo; private JMenuItem editDelete; private JMenuItem editSelectAll; private JMenuItem editGroup; private JMenuItem editUngroup; private JMenuItem editCut; private JMenuItem editCopy; private JMenuItem editPaste; private JMenuItem customMenu; private JMenu customTemplate; private JMenuItem customEdit; private JMenuItem customTutorial; private JTextField searchField; private OwnSyntaxPane propertyTextPane; private ZoomListener zoomListener; private JPanel rightPanel; private JPanel paletteControlsPanel; private JComboBox paletteList; protected String selected_palette; private CustomElementHandler customelementhandler; private CustomElementPanel customPanel; private boolean custom_element_selected; private boolean custom_panel_visible; private MailPanel mailPanel; private JToggleButton mailButton; private boolean mail_panel_visible; public StandaloneGUI(Main main) { super(main); custom_element_selected = false; custom_panel_visible = false; mail_panel_visible = false; selected_palette = ""; } private void onDiagramOpened() { DrawPanel p = this.getCurrentDiagram(); if (p != null) Main.getInstance().setCurrentDiagramHandler(p.getHandler()); else Main.getInstance().setCurrentDiagramHandler(null); } private void onDiagramClosed() { DrawPanel p = this.getCurrentDiagram(); if (p != null) Main.getInstance().setCurrentDiagramHandler(p.getHandler()); else Main.getInstance().setCurrentDiagramHandler(null); } @Override public void updateDiagramName(DiagramHandler diagram, String name) { int index = this.diagramtabs.indexOfComponent(diagram.getDrawPanel().getScrollPane()); if (index != -1) { this.diagramtabs.setTitleAt(index, name); } this.diagramtabs.updateUI(); } @Override public void setDiagramChanged(DiagramHandler diagram, boolean changed) { String change_string = ""; if (changed) change_string = " *"; this.updateDiagramName(diagram, diagram.getName() + change_string); } @Override public void setCustomElementChanged(CustomElementHandler handler, boolean changed) { } @Override public void closeWindow() { mailPanel.closePanel(); // We must close the mailpanel to save the input date if (Main.getInstance().askSaveIfDirty()) { this.main.closeProgram(); this.window.dispose(); System.exit(0); } } @Override protected void init() { this.addKeyListener(new GUIListener()); this.window = new JFrame(); this.window.setContentPane(this); this.window.addWindowListener(new WindowListener()); this.window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.window.setBounds(Constants.program_location.x, Constants.program_location.y, Constants.program_size.width, Constants.program_size.height); if (Program.PROGRAM_NAME.equals(ProgramName.UMLET)) this.window.setTitle("UMLet - Free UML Tool for Fast UML Diagrams"); else if (Program.PROGRAM_NAME.equals(ProgramName.PLOTLET)) this.window.setTitle("Plotlet - Free Tool for Fast Plots"); /************************ SET PROGRAM ICON ************************/ String iconPath = Path.homeProgram() + "img/" + Program.PROGRAM_NAME.toLowerCase() + "_logo.png"; this.window.setIconImage(new ImageIcon(iconPath).getImage()); /*************************************************************/ /************************ CREATE PROP PANE *****************/ this.propertyTextPane = this.createPropertyTextPane(); /*********** SET WINDOW BOUNDS **************/ if (Constants.start_maximized) { // If Main starts maximized we set fixed bounds and must set the frame visible // now to avoid a bug where the right sidebar doesn't have the correct size this.window.setExtendedState(this.window.getExtendedState() | Frame.MAXIMIZED_BOTH); this.window.setVisible(true); } /***************************************/ paletteList = new JComboBox(); paletteList.setMaximumRowCount(15); /*********** CREATE MENU *****************/ JMenuBar menu = new JMenuBar(); menuFactory = MenuFactorySwing.getInstance(); // Create Palettes and Edit Palette menuitem List palettenames = this.main.getPaletteNames(); for (String palette : palettenames) { this.paletteList.addItem(palette); } PaletteComboBoxListener pl = new PaletteComboBoxListener(); this.paletteList.addActionListener(pl); this.paletteList.addMouseWheelListener(pl); JMenu fileMenu = new JMenu(MenuFactory.FILE); fileMenu.setMnemonic(KeyEvent.VK_F); fileMenu.add(menuFactory.createNew()); fileMenu.add(menuFactory.createOpen()); fileMenu.add(menuFactory.createRecentFiles()); fileMenu.add(menuFactory.createSave()); fileMenu.add(menuFactory.createSaveAs()); fileMenu.add(menuFactory.createExportAs()); fileMenu.add(menuFactory.createMailTo()); fileMenu.addSeparator(); fileMenu.add(menuFactory.createEditCurrentPalette()); fileMenu.addSeparator(); fileMenu.add(menuFactory.createOptions()); fileMenu.addSeparator(); fileMenu.add(menuFactory.createPrint()); fileMenu.addSeparator(); fileMenu.add(menuFactory.createExit()); menu.add(fileMenu); editMenu = new JMenu(MenuFactory.EDIT); editMenu.setMnemonic(KeyEvent.VK_E); editMenu.add(editUndo = menuFactory.createUndo()); editMenu.add(editRedo = menuFactory.createRedo()); editMenu.add(editDelete = menuFactory.createDelete()); editMenu.addSeparator(); editMenu.add(editSelectAll = menuFactory.createSelectAll()); editMenu.add(editGroup = menuFactory.createGroup()); editMenu.add(editUngroup = menuFactory.createUngroup()); editMenu.addSeparator(); editMenu.add(editCut = menuFactory.createCut()); editMenu.add(editCopy = menuFactory.createCopy()); editMenu.add(editPaste = menuFactory.createPaste()); menu.add(editMenu); editDelete.setEnabled(false); editGroup.setEnabled(false); editCut.setEnabled(false); editPaste.setEnabled(false); editUngroup.setEnabled(false); // Custom Element Menu if (Program.PROGRAM_NAME == ProgramName.UMLET) { JMenu menu_custom = new JMenu(MenuFactory.CUSTOM_ELEMENTS); menu_custom.setMnemonic(KeyEvent.VK_C); menu_custom.add(customMenu = menuFactory.createNewCustomElement()); menu_custom.add(customTemplate = menuFactory.createNewCustomElementFromTemplate()); menu_custom.add(customEdit = menuFactory.createEditSelected()); menu_custom.addSeparator(); menu_custom.add(customTutorial = menuFactory.createCustomElementTutorial()); menu.add(menu_custom); customEdit.setEnabled(false); } // Help Menu JMenu helpMenu = new JMenu(MenuFactory.HELP); helpMenu.setMnemonic(KeyEvent.VK_H); helpMenu.add(menuFactory.createOnlineHelp()); if (Program.PROGRAM_NAME == ProgramName.UMLET) helpMenu.add(menuFactory.createOnlineSampleDiagrams()); helpMenu.addSeparator(); helpMenu.add(menuFactory.createProgramHomepage()); helpMenu.add(menuFactory.createRateProgram()); helpMenu.addSeparator(); helpMenu.add(menuFactory.createAboutProgram()); menu.add(helpMenu); // Search Field JPanel searchPanel = new JPanel(); searchPanel.setOpaque(false); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); JLabel searchLabel = new JLabel("Search: "); searchField = new JTextField(10); searchField.setMinimumSize(searchField.getPreferredSize()); searchField.setMaximumSize(searchField.getPreferredSize()); searchField.addKeyListener(new SearchListener()); // searchPanel.add(Box.createHorizontalGlue()); searchPanel.add(Box.createRigidArea(new Dimension(50, 0))); searchPanel.add(searchLabel); searchPanel.add(searchField); searchPanel.add(Box.createRigidArea(new Dimension(20, 0))); menu.add(searchPanel); /* Zoom field */ JPanel zoomPanel = new JPanel(); zoomPanel.setOpaque(false); zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.X_AXIS)); JLabel zoomLabel = new JLabel("Zoom: "); zoomComboBox = new JComboBox(); zoomComboBox.setPreferredSize(new Dimension(80, 24)); zoomComboBox.setMinimumSize(zoomComboBox.getPreferredSize()); zoomComboBox.setMaximumSize(zoomComboBox.getPreferredSize()); zoomListener = new ZoomListener(); zoomComboBox.addActionListener(zoomListener); zoomComboBox.addMouseWheelListener(zoomListener); zoomComboBox.setToolTipText("Use ± or Ctrl+mouse wheel to zoom"); String[] zoomValues = Constants.zoomValueList.toArray(new String[Constants.zoomValueList.size()]); zoomComboBox.setModel(new DefaultComboBoxModel(zoomValues)); zoomComboBox.setSelectedIndex(9); zoomPanel.add(zoomLabel); zoomPanel.add(zoomComboBox); zoomPanel.add(Box.createRigidArea(new Dimension(20, 0))); menu.add(zoomPanel); mailButton = new JToggleButton("Mail diagram"); mailButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMailPanelEnabled(!isMailPanelVisible()); } }); menu.add(mailButton); // Set the finished menu this.window.setJMenuBar(menu); /************************ CREATE SUB PANELS ******************/ // create custom element handler this.customelementhandler = new CustomElementHandler(); this.customPanel = this.customelementhandler.getPanel(); diagramspanel = new JPanel(); this.palettepanel = new JPanel(new CardLayout()); new FileDrop(diagramspanel, new FileDropListener()); // enable drag&drop from desktop into diagrampanel rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, palettepanel, this.propertyTextPane.getPanel()); rightSplit.setDividerSize(2); rightSplit.setDividerLocation(Constants.right_split_position); rightSplit.setResizeWeight(1); rightSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); rightSplit.setAlignmentX(Component.RIGHT_ALIGNMENT); paletteControlsPanel = new JPanel(); paletteControlsPanel.setLayout(new BoxLayout(paletteControlsPanel, BoxLayout.X_AXIS)); paletteControlsPanel.add(paletteList); rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); rightPanel.add(paletteControlsPanel); rightPanel.add(rightSplit); paletteList.setAlignmentX(Component.CENTER_ALIGNMENT); rightSplit.setAlignmentX(Component.CENTER_ALIGNMENT); mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, diagramspanel, rightPanel); mainSplit.setDividerSize(2); mainSplit.setDividerLocation(Constants.main_split_position); mainSplit.setResizeWeight(1); mainSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); customSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainSplit, customPanel); customSplit.setDividerSize(0); customSplit.setResizeWeight(1); customSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); customPanel.setVisible(false); mailPanel = this.createMailPanel(); mailSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mailPanel, customSplit); mailSplit.setDividerSize(0); mailSplit.setDividerLocation(Constants.mail_split_position); mailSplit.setResizeWeight(1); mailSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); mailPanel.setVisible(false); // Adding the DividerListener which refreshes Scrollbars here is enough for all dividers palettepanel.addComponentListener(new DividerListener()); /******************* ADD PALETTES ***************************/ Hashtable palettetable = main.getPalettes(); for (String palname : palettetable.keySet()) { DrawPanel panel = palettetable.get(palname).getDrawPanel(); palettepanel.add(panel.getScrollPane(), palname); } /***************** SETTING TABS AND TAB LAYOUT ***********************/ diagramtabs = new JTabbedPane(); diagramtabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); diagramspanel.setLayout(new GridLayout(1, 1)); diagramspanel.add(diagramtabs); /********************* ADD KEYBOARD ACTIONS ************************/ Action findaction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { Main.getInstance().getGUI().enableSearch(true); } }; this.getActionMap().put("focussearch", findaction); this.getInputMap().put(KeyStroke.getKeyStroke('/'), "focussearch"); /************************ ADD TOP COMPONENT ************************/ this.add(mailSplit); /************************** SET DEFAULT INITIALIZATION VALUES ******/ if (!palettenames.isEmpty()) this.selectPalette(palettenames.get(0)); ToolTipManager.sharedInstance().setInitialDelay(100); /*************************************************************/ this.window.setVisible(true); } @Override public void selectPalette(String palette) { if (this.selected_palette.equals(palette)) return; this.selected_palette = palette; paletteList.setSelectedItem(this.selected_palette); CardLayout cl = (CardLayout) (this.palettepanel.getLayout()); cl.show(this.palettepanel, this.getSelectedPalette()); } @Override public String getSelectedPalette() { return this.selected_palette + "." + Program.EXTENSION; } @Override public void close(DiagramHandler diagram) { diagramtabs.remove(diagram.getDrawPanel().getScrollPane()); this.onDiagramClosed(); } @Override public void open(DiagramHandler diagram) { diagramtabs.add(diagram.getName(), diagram.getDrawPanel().getScrollPane()); diagramtabs.setTabComponentAt(diagramtabs.getTabCount() - 1, new TabComponent(diagramtabs, diagram)); diagramtabs.setSelectedComponent(diagram.getDrawPanel().getScrollPane()); diagram.getDrawPanel().getSelector().updateSelectorInformation(); this.onDiagramOpened(); } @Override public DrawPanel getCurrentDiagram() { JScrollPane scr = (JScrollPane) this.diagramtabs.getSelectedComponent(); if (scr != null) return (DrawPanel) scr.getViewport().getView(); else return null; } @Override public void elementsSelected(int count) { super.elementsSelected(count); if (count > 0) { editDelete.setEnabled(true); editCut.setEnabled(true); if (count > 1) editGroup.setEnabled(true); else editGroup.setEnabled(false); } else { editDelete.setEnabled(false); editGroup.setEnabled(false); editCut.setEnabled(false); // menu_edit_copy must remain enabled even if no entity is selected to allow the export of the full diagram to the system clipboard. } } @Override public void setPaste(boolean value) { editPaste.setEnabled(value); } @Override public void setUngroupEnabled(boolean enabled) { editUngroup.setEnabled(enabled); } @Override public void setCustomPanelEnabled(boolean enable) { log.info("Set CustomPanel enabled=" + Boolean.toString(enable)); this.custom_panel_visible = enable; if (this.customPanel.isVisible() != enable) { int loc = this.mainSplit.getDividerLocation(); log.info("mainSplit Divider Location: " + loc); this.customPanel.setVisible(enable); if (enable) { int rightloc = this.rightSplit.getDividerLocation(); log.info("rightSplit Divider Location: " + rightloc); this.customSplit.setDividerSize(2); this.rightSplit.setDividerSize(0); this.customPanel.getLeftSplit().setLeftComponent(this.propertyTextPane.getPanel()); log.info("customPanel.leftSplit Divider Location: " + customPanel.getLeftSplit().getDividerLocation()); this.customSplit.setDividerLocation(rightloc); this.customPanel.getRightSplit().setDividerLocation(loc); this.customPanel.getLeftSplit().setDividerLocation(this.diagramspanel.getWidth() / 2); log.info("customPanel.leftSplit New Divider Location: " + customPanel.getLeftSplit().getDividerLocation()); this.customPanel.getLeftSplit().updateUI(); } else { int rightloc = this.customSplit.getDividerLocation(); log.info("customSplit Divider Location: " + rightloc); this.customSplit.setDividerSize(0); this.rightSplit.setDividerSize(2); this.rightSplit.setRightComponent(this.propertyTextPane.getPanel()); this.rightSplit.setDividerLocation(rightloc); } this.mainSplit.setDividerLocation(loc); log.info("mainSplit Divider Location: " + loc); this.customEdit.setEnabled(!enable && this.custom_element_selected); this.customMenu.setEnabled(!enable); this.customTemplate.setEnabled(!enable); } this.setDiagramsEnabled(!enable); } @Override public void setMailPanelEnabled(boolean enable) { if (enable) { mailSplit.setDividerSize(2); mailButton.setSelected(true); } if (!enable) { mailSplit.setDividerSize(0); mailButton.setSelected(false); } mailPanel.setVisible(enable); if (enable) mailSplit.setDividerLocation(Constants.mail_split_position); mail_panel_visible = enable; } @Override public boolean isMailPanelVisible() { return mail_panel_visible; } @Override public void setCustomElementSelected(boolean selected) { this.custom_element_selected = selected; if (customEdit != null) customEdit.setEnabled(selected && !this.custom_panel_visible); } @Override public void diagramSelected(DiagramHandler handler) { updateGrayedOutMenuItems(handler); } public void updateGrayedOutMenuItems(DiagramHandler handler) { // These menuitems only get changed if this is not the palette or custompreview if (!(handler instanceof PaletteHandler) && !(handler instanceof CustomPreviewHandler)) { menuFactory.updateDiagramDependendComponents(); if ((handler == null) || handler.getDrawPanel().getAllEntities().isEmpty()) { mailButton.setEnabled(false); } else { mailButton.setEnabled(true); } } // The menu_edit menuitems always work with the actual selected diagram (diagram, palette or custompreview), therefore we change it everytime if ((handler == null) || handler.getDrawPanel().getAllEntities().isEmpty()) { editCopy.setEnabled(false); editSelectAll.setEnabled(false); } else if (handler instanceof CustomPreviewHandler) { setCustomElementEditMenuEnabled(false); } else { editMenu.setEnabled(true); // must be set to enabled explicitely because it could be deactivated from CustomPreview setCustomElementEditMenuEnabled(true); } if ((handler == null) || !handler.getController().isUndoable()) editUndo.setEnabled(false); else editUndo.setEnabled(true); if ((handler == null) || !handler.getController().isRedoable()) editRedo.setEnabled(false); else editRedo.setEnabled(true); } @Override public void enableSearch(boolean enable) { this.searchField.requestFocus(); } private void setCustomElementEditMenuEnabled(boolean enabled) { editGroup.setEnabled(enabled); editUngroup.setEnabled(enabled); editDelete.setEnabled(enabled); editCut.setEnabled(enabled); editPaste.setEnabled(enabled); editCopy.setEnabled(enabled); editSelectAll.setEnabled(enabled); } private void setDiagramsEnabled(boolean enable) { this.palettepanel.setEnabled(enable); for (Component c : this.palettepanel.getComponents()) c.setEnabled(enable); this.diagramtabs.setEnabled(enable); for (Component c : this.diagramtabs.getComponents()) c.setEnabled(enable); for (int i = 0; i < this.diagramtabs.getTabCount(); i++) this.diagramtabs.getTabComponentAt(i).setEnabled(enable); this.searchField.setEnabled(enable); } @Override public int getMainSplitPosition() { return this.mainSplit.getDividerLocation(); } @Override public int getRightSplitPosition() { return this.rightSplit.getDividerLocation(); } @Override public int getMailSplitPosition() { return this.mailSplit.getDividerLocation(); } @Override public JFrame getTopContainer() { return this.window; } @Override public CustomElementHandler getCurrentCustomHandler() { return this.customelementhandler; } @Override public OwnSyntaxPane getPropertyPane() { return this.propertyTextPane; } @Override public String getPropertyPanelText() { if (this.propertyTextPane != null) return this.propertyTextPane.getText(); else return ""; } @Override public void setPropertyPanelText(String text) { if (this.propertyTextPane != null) { // needed because of convert function this.propertyTextPane.setText(text); // Reset the vertical and horizontal scrollbar position to the upper left corner this.propertyTextPane.setCaretPosition(0); } } @Override public String chooseFileName() { String fileName = null; int returnVal = DiagramFileHandler.getOpenFileChooser().showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { fileName = DiagramFileHandler.getOpenFileChooser().getSelectedFile().getAbsolutePath(); } return fileName; } @Override public void openDialog(String title, JComponent component) { JDialog dialog = (new JOptionPane(component, JOptionPane.PLAIN_MESSAGE)).createDialog(title); dialog.setVisible(true); } @Override public void setValueOfZoomDisplay(int i) { // This method should just set the value without ActionEvent therefore we remove the listener temporarily if (zoomComboBox != null) { zoomComboBox.removeActionListener(zoomListener); zoomComboBox.setSelectedIndex(i - 1); zoomComboBox.addActionListener(zoomListener); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/DiagramPopupMenu.java0000644000175000001440000000220711576116034024366 0ustar benuserspackage com.baselet.gui; import javax.swing.JPopupMenu; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import com.baselet.diagram.DiagramHandler; @SuppressWarnings("serial") public class DiagramPopupMenu extends JPopupMenu { public DiagramPopupMenu(final DiagramHandler handler, boolean extendedForStandaloneGUI) { final MenuFactorySwing menuFactory = MenuFactorySwing.getInstance(); if (extendedForStandaloneGUI) { // Extended is true for StandaloneGUI add(menuFactory.createNew()); add(menuFactory.createOpen()); add(menuFactory.createRecentFiles()); add(menuFactory.createSave()); add(menuFactory.createSaveAs()); } add(menuFactory.createExportAs()); add(menuFactory.createMailTo()); add(menuFactory.createPrint()); addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuCanceled(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { menuFactory.updateDiagramDependendComponents(); } }); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/NotificationRemoveTask.java0000644000175000001440000000211011576116034025571 0ustar benuserspackage com.baselet.gui; import java.util.TimerTask; import javax.swing.JComponent; import com.baselet.diagram.DrawPanel; public class NotificationRemoveTask extends TimerTask { private JComponent entityToRemove; private DrawPanel diagram; public NotificationRemoveTask(JComponent entityToRemove, DrawPanel diagram) { this.entityToRemove = entityToRemove; this.diagram = diagram; } @Override public void run() { // Controller controller = diagram.getHandler().getController(); // Vector toDelete = new Vector(); // toDelete.add(entityToRemove); // Command removeNotificationEntity = new RemoveElement(toDelete); // Vector selectedEntities = (Vector) Main.getInstance().getDiagramHandler().getDrawPanel().getSelector().getSelectedEntities().clone(); // controller.executeCommand(removeNotificationEntity); // for(Entity e : selectedEntities){ // diagram.getHandler().getDrawPanel().getSelector().select(e); // } diagram.getHandler().getDrawPanel().remove(entityToRemove); diagram.getHandler().getDrawPanel().repaint(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/gui/JMultiLineToolTip.java0000644000175000001440000000132711576116034024502 0ustar benuserspackage com.baselet.gui; import javax.swing.JComponent; import javax.swing.JToolTip; @SuppressWarnings("serial") public class JMultiLineToolTip extends JToolTip { String tipText; JComponent component; public JMultiLineToolTip() { updateUI(); } @Override public void updateUI() { setUI(MultiLineToolTipUI.createUI(this)); } public void setColumns(int columns) { this.columns = columns; this.fixedwidth = 0; } public int getColumns() { return columns; } public void setFixedWidth(int width) { this.fixedwidth = width; this.columns = 0; } public int getFixedWidth() { return fixedwidth; } protected int columns = 0; protected int fixedwidth = 0; } umlet-11.3.orig/sourcefiles/src/com/baselet/control/0000755000175000001440000000000011576116036021203 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/control/TemplateSorter.java0000644000175000001440000000116311576116034025017 0ustar benuserspackage com.baselet.control; import java.util.Comparator; public class TemplateSorter implements Comparator { @Override public int compare(String s1, String s2) { s1 = s1.toLowerCase(); s2 = s2.toLowerCase(); if (s1.equals("default")) if (s2.equals("default")) return 0; else return -1; if (s2.equals("default")) return 1; for (int i = 0; (i < s1.length()) && (i < s2.length()); i++) { if (s1.charAt(i) != s2.charAt(i)) return s1.charAt(i) - s2.charAt(i); } if (s1.length() > s2.length()) return 0; else if (s1.length() > s2.length()) return 1; else return -1; } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/BrowserLauncher.java0000644000175000001440000000324111576116034025151 0ustar benuserspackage com.baselet.control; import java.awt.Desktop; import java.lang.reflect.Method; import java.net.URI; import org.apache.log4j.Logger; import com.baselet.control.Constants.Os; import com.baselet.control.Constants.SystemInfo; public class BrowserLauncher { private final static Logger log = Logger.getLogger(Utils.getClassName()); public static void openURL(String url) { try { // Since Java6 this is a much easier method to open the browser if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); desktop.browse(new URI(url)); } // Only if desktop is not supported we try the old main specific code else { if (SystemInfo.OS == Os.MAC) { Class fileMgr = Class.forName("com.apple.eio.FileManager"); Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class }); openURL.invoke(null, new Object[] { url }); } else if (SystemInfo.OS == Os.WINDOWS) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); else { // assume Unix or Linux String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; String browser = null; for (int count = 0; (count < browsers.length) && (browser == null); count++) if (Runtime.getRuntime().exec( new String[] { "which", browsers[count] }).waitFor() == 0) browser = browsers[count]; if (browser == null) throw new Exception("Could not find web browser"); else Runtime.getRuntime().exec(new String[] { browser, url }); } } } catch (Exception e) { log.error("Error at opening the URL.", e); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/Config.java0000644000175000001440000002314511576116034023256 0ustar benuserspackage com.baselet.control; import java.awt.Dimension; import java.awt.Frame; import java.awt.Point; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.util.Arrays; import com.baselet.control.Constants.Program; import com.baselet.gui.BaseGUI; public class Config { private static final String PROGRAM_VERSION = "program_version = "; private static final String DEFAULT_FONTSIZE = "default_fontsize = "; private static final String DEFAULT_FONTFAMILY = "default_fontfamily = "; private static final String SHOW_STICKINGPOLYGON = "show_stickingpolygon = "; private static final String SHOW_GRID = "show_grid = "; private static final String ENABLE_CUSTOM_ELEMENTS = "enable_custom_elements = "; private static final String UI_MANAGER = "ui_manager = "; private static final String MAIN_SPLIT_POSITION = "main_split_position = "; private static final String RIGHT_SPLIT_POSITION = "right_split_position = "; private static final String START_MAXIMIZED = "start_maximized = "; private static final String MAIL_SPLIT_POSITION = "mail_split_position = "; private static final String PROGRAM_SIZE = "program_size = "; private static final String PROGRAM_LOCATION = "program_location = "; private static final String RECENT_FILES = "recent_files = "; private static final String MAIL_SMTP = "mail_smtp = "; private static final String MAIL_SMTP_AUTH = "mail_smtp_auth = "; private static final String MAIL_SMTP_USER = "mail_smtp_user = "; private static final String MAIL_SMTP_PW_STORE = "mail_smtp_pw_store = "; private static final String MAIL_SMTP_PW = "mail_smtp_pw = "; private static final String MAIL_FROM = "mail_from = "; private static final String MAIL_TO = "mail_to = "; private static final String MAIL_CC = "mail_cc = "; private static final String MAIL_BCC = "mail_bcc = "; private static final String MAIL_XML = "mail_xml = "; private static final String MAIL_GIF = "mail_gif = "; private static final String MAIL_PDF = "mail_pdf = "; private static File configfile; public static void loadConfig() { configfile = new File(Path.config()); if (configfile.exists()) { try { BufferedReader reader = new BufferedReader(new FileReader(configfile)); String line; while ((line = reader.readLine()) != null) { try { if (line.startsWith(DEFAULT_FONTSIZE)) { Constants.defaultFontsize = Integer.parseInt(line.substring(DEFAULT_FONTSIZE.length())); } else if (line.startsWith(DEFAULT_FONTFAMILY)) { Constants.defaultFontFamily = line.substring(DEFAULT_FONTFAMILY.length()); } else if (line.startsWith(SHOW_STICKINGPOLYGON)) { Constants.show_stickingpolygon = Boolean.parseBoolean(line.substring(SHOW_STICKINGPOLYGON.length())); } else if (line.startsWith(SHOW_GRID)) { Constants.show_grid = Boolean.parseBoolean(line.substring(SHOW_GRID.length())); } else if (line.startsWith(ENABLE_CUSTOM_ELEMENTS)) { Constants.enable_custom_elements = Boolean.parseBoolean(line.substring(ENABLE_CUSTOM_ELEMENTS.length())); } else if (line.startsWith(UI_MANAGER)) { Constants.ui_manager = line.substring(UI_MANAGER.length()); } else if (line.startsWith(MAIN_SPLIT_POSITION)) { Constants.main_split_position = Integer.parseInt(line.substring(MAIN_SPLIT_POSITION.length())); } else if (line.startsWith(RIGHT_SPLIT_POSITION)) { Constants.right_split_position = Integer.parseInt(line.substring(RIGHT_SPLIT_POSITION.length())); } else if (line.startsWith(MAIL_SPLIT_POSITION)) { Constants.mail_split_position = Integer.parseInt(line.substring(MAIL_SPLIT_POSITION.length())); } else if (line.startsWith(START_MAXIMIZED)) { Constants.start_maximized = Boolean.parseBoolean(line.substring(START_MAXIMIZED.length())); } // In case of start_maximized=true we don't store any size or location information else if (line.startsWith(PROGRAM_SIZE) && !Constants.start_maximized) { int x = Integer.parseInt(line.substring(PROGRAM_SIZE.length(), line.indexOf(","))); int y = Integer.parseInt(line.substring(line.indexOf(",") + 1)); Constants.program_size = new Dimension(x, y); } else if (line.startsWith(PROGRAM_LOCATION) && !Constants.start_maximized) { int x = Integer.parseInt(line.substring(PROGRAM_LOCATION.length(), line.indexOf(","))); int y = Integer.parseInt(line.substring(line.indexOf(",") + 1)); Constants.program_location = new Point(x, y); } else if (line.startsWith(RECENT_FILES)) { Main.getInstance().getRecentFiles().addAll(Arrays.asList(line.substring(RECENT_FILES.length()).split("\\|"))); } /** MAIL **/ else if (line.startsWith(MAIL_SMTP)) { Constants.mail_smtp = line.substring(MAIL_SMTP.length()); } else if (line.startsWith(MAIL_SMTP_AUTH)) { Constants.mail_smtp_auth = Boolean.parseBoolean(line.substring(MAIL_SMTP_AUTH.length())); } else if (line.startsWith(MAIL_SMTP_USER)) { Constants.mail_smtp_user = line.substring(MAIL_SMTP_USER.length()); } else if (line.startsWith(MAIL_SMTP_PW_STORE)) { Constants.mail_smtp_pw_store = Boolean.parseBoolean(line.substring(MAIL_SMTP_PW_STORE.length())); } else if (line.startsWith(MAIL_SMTP_PW)) { Constants.mail_smtp_pw = line.substring(MAIL_SMTP_PW.length()); } else if (line.startsWith(MAIL_FROM)) { Constants.mail_from = line.substring(MAIL_FROM.length()); } else if (line.startsWith(MAIL_TO)) { Constants.mail_to = line.substring(MAIL_TO.length()); } else if (line.startsWith(MAIL_CC)) { Constants.mail_cc = line.substring(MAIL_CC.length()); } else if (line.startsWith(MAIL_BCC)) { Constants.mail_bcc = line.substring(MAIL_BCC.length()); } else if (line.startsWith(MAIL_XML)) { Constants.mail_xml = Boolean.parseBoolean(line.substring(MAIL_XML.length())); } else if (line.startsWith(MAIL_GIF)) { Constants.mail_gif = Boolean.parseBoolean(line.substring(MAIL_GIF.length())); } else if (line.startsWith(MAIL_PDF)) { Constants.mail_pdf = Boolean.parseBoolean(line.substring(MAIL_PDF.length())); } } catch (Exception ex) { ex.printStackTrace(); } } reader.close(); } catch (Exception ex) { ex.printStackTrace(); } } } public static void saveConfig() { try { if (configfile != null) { configfile.delete(); configfile.createNewFile(); FileWriter writer = new FileWriter(configfile); writer.write(PROGRAM_VERSION + Program.VERSION + "\n"); writer.write(DEFAULT_FONTSIZE + Constants.defaultFontsize + "\n"); writer.write(DEFAULT_FONTFAMILY + Constants.defaultFontFamily + "\n"); writer.write(SHOW_STICKINGPOLYGON + Constants.show_stickingpolygon + "\n"); writer.write(SHOW_GRID + Constants.show_grid + "\n"); writer.write(ENABLE_CUSTOM_ELEMENTS + Constants.enable_custom_elements + "\n"); writer.write(UI_MANAGER + Constants.ui_manager + "\n"); BaseGUI gui = Main.getInstance().getGUI(); writer.write(MAIN_SPLIT_POSITION + gui.getMainSplitPosition() + "\n"); writer.write(RIGHT_SPLIT_POSITION + gui.getRightSplitPosition() + "\n"); if (gui.getMailSplitPosition() > Constants.MIN_MAIL_SPLIT_POSITION) writer.write(MAIL_SPLIT_POSITION + gui.getMailSplitPosition() + "\n"); if (gui.getTopContainer() != null) { // If the window is maximized in any direction this fact is written in the cfg if (((gui.getTopContainer().getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH)) { writer.write(START_MAXIMIZED + "true\n"); } // Otherwise the size and the location is written in the cfg else { writer.write(START_MAXIMIZED + "false\n"); writer.write(PROGRAM_SIZE + gui.getTopContainer().getSize().width + "," + gui.getTopContainer().getSize().height + "\n"); writer.write(PROGRAM_LOCATION + gui.getTopContainer().getLocation().x + "," + gui.getTopContainer().getLocation().y + "\n"); } } if (!Main.getInstance().getRecentFiles().isEmpty()) { String recentFileString =RECENT_FILES; for (String recentFile : Main.getInstance().getRecentFiles()) { recentFileString += recentFile + "|"; } writer.write(recentFileString.substring(0,recentFileString.length()-1) + "\n"); } /** MAIL **/ if (!Constants.mail_smtp.isEmpty()) writer.write(MAIL_SMTP + Constants.mail_smtp + "\n"); writer.write(MAIL_SMTP_AUTH + Constants.mail_smtp_auth + "\n"); if (!Constants.mail_smtp_user.isEmpty()) writer.write(MAIL_SMTP_USER + Constants.mail_smtp_user + "\n"); writer.write(MAIL_SMTP_PW_STORE + Constants.mail_smtp_pw_store + "\n"); if (!Constants.mail_smtp_pw.isEmpty()) writer.write(MAIL_SMTP_PW + Constants.mail_smtp_pw + "\n"); if (!Constants.mail_from.isEmpty()) writer.write(MAIL_FROM + Constants.mail_from + "\n"); if (!Constants.mail_to.isEmpty()) writer.write(MAIL_TO + Constants.mail_to + "\n"); if (!Constants.mail_cc.isEmpty()) writer.write(MAIL_CC + Constants.mail_cc + "\n"); if (!Constants.mail_bcc.isEmpty()) writer.write(MAIL_BCC + Constants.mail_bcc + "\n"); writer.write(MAIL_XML + Constants.mail_xml + "\n"); writer.write(MAIL_GIF + Constants.mail_gif + "\n"); writer.write(MAIL_PDF + Constants.mail_pdf + "\n"); writer.close(); } } catch (Exception ex) { ex.printStackTrace(); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/ClipBoard.java0000644000175000001440000000431611576116034023707 0ustar benuserspackage com.baselet.control; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.util.Vector; import com.baselet.control.Constants.SystemInfo; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.io.OutputHandler; import com.baselet.element.GridElement; /** Copies and Pastes images to the system clipboard. Requires Java 2, v1.4. */ public class ClipBoard implements Transferable { private Clipboard clipboard; private DiagramHandler copiedfrom; private Vector entities; public static ClipBoard _instance; public static ClipBoard getInstance() { if (_instance == null) { _instance = new ClipBoard(); } return _instance; } private ClipBoard() { this.entities = new Vector(); if (Float.parseFloat(SystemInfo.JAVA_VERSION) < 1.4) return; clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); } public DiagramHandler copiedFrom() { return this.copiedfrom; } public void copy(Vector entities, DiagramHandler handler) { this.copiedfrom = handler; this.entities = new Vector(entities); if (clipboard != null) clipboard.setContents(this, null); // AB: clipboard zooms entities to 100% // NOTE has to be done here because it doesn't fit with cut/copy and GenPic.getImageFromDiagram otherwise) DiagramHandler.zoomEntities(handler.getGridSize(), Constants.DEFAULTGRIDSIZE, this.entities); Main.getInstance().getGUI().setPaste(true); } public Vector paste() { return this.entities; } @Override public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[] { DataFlavor.imageFlavor }; } @Override public boolean isDataFlavorSupported(DataFlavor flavor) { return DataFlavor.imageFlavor.equals(flavor); } @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); return OutputHandler.createImageForClipboard(copiedfrom, entities); } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/Main.java0000644000175000001440000003714511576116034022742 0ustar benuserspackage com.baselet.control; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.List; import java.util.Properties; import java.util.Timer; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.filechooser.FileSystemView; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Constants.RuntimeType; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.PaletteHandler; import com.baselet.diagram.io.DiagramFileHandler; import com.baselet.element.GridElement; import com.baselet.gui.BaseGUI; import com.baselet.gui.standalone.StandaloneGUI; public class Main { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static Main instance; private static String tmp_file; private static String tmp_read_file; private static boolean file_created = false; private static Timer timer; private BaseGUI gui; private GridElement editedGridElement; private Hashtable palettes; private ArrayList diagrams = new ArrayList(); private DiagramHandler currentDiagramHandler; private DiagramHandler currentInfoDiagramHandler; private ClassLoader classLoader; private List recentFiles = new ArrayList(); public static Main getInstance() { if (instance == null) { instance = new Main(); } return instance; } public static void main(String args[]) { // System.setSecurityManager(new CustomElementSecurityManager()); Main main = Main.getInstance(); main.initOverallSettings(); tmp_file = Program.PROGRAM_NAME.toLowerCase() + ".tmp"; tmp_read_file = Program.PROGRAM_NAME.toLowerCase() + "_1.tmp"; try { if (args.length != 0) { String action = null; String format = null; String filename = null; String output = null; for (int i = 0; i < args.length; i++) { if (args[i].startsWith("-action=")) action = args[i].substring(8); else if (args[i].startsWith("-format=")) format = args[i].substring(8); else if (args[i].startsWith("-filename=")) filename = args[i].substring(10); else if (args[i].startsWith("-output=")) output = args[i].substring(8); } // Program started by double-click on diagram file if ((action == null) && (format == null) && (filename != null)) { if (!alreadyRunningChecker(false) || !sendFileNameToRunningApplication(filename)) { main.init(new StandaloneGUI(main)); main.doOpen(filename); } } else if ((action != null) && (format != null) && (filename != null)) { if (action.equals("convert")) { Program.RUNTIME_TYPE = RuntimeType.BATCH; doConvert(filename, format, output); } else printUsage(); } else printUsage(); } else { // no arguments specified alreadyRunningChecker(true); // start checker main.init(new StandaloneGUI(main)); main.doNew(); } } catch (Exception e) { log.error("Initialization or uncaught outer Exception", e); } } public void init(BaseGUI gui) throws Exception { this.gui = gui; Config.loadConfig(); // only load config after gui is set (because of homepath) ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE); // Tooltips should not hide after some time gui.initGUI(); // show gui } public void initOverallSettings() { readManifestInfo(); initLogger(); } private void initLogger() { String log4jFilePath = Path.homeProgram() + "log4j.properties"; try { // If no log4j.properties file exists, we create a simple one if (!new File(log4jFilePath).exists()) { log4jFilePath = Path.temp() + Program.PROGRAM_NAME.toLowerCase() + "_log4j.properties"; File tempLog4jFile = new File(log4jFilePath); tempLog4jFile.deleteOnExit(); Writer writer = new BufferedWriter(new FileWriter(tempLog4jFile)); writer.write( "log4j.rootLogger=ERROR, SYSTEM_OUT\n" + "log4j.appender.SYSTEM_OUT=org.apache.log4j.ConsoleAppender\n" + "log4j.appender.SYSTEM_OUT.layout=org.apache.log4j.PatternLayout\n" + "log4j.appender.SYSTEM_OUT.layout.ConversionPattern=%6r | %-5p | %-30c - \"%m\"%n\n"); writer.close(); } Properties props = new Properties(); props.put("PROJECT_PATH", Path.homeProgram()); // Put homepath as relative variable in properties file props.load(new FileInputStream(log4jFilePath)); PropertyConfigurator.configure(props); log.info("Logger configuration initialized"); } catch (IOException e) { log.error("Initialization of log4j.properties failed", e); } } private void readManifestInfo() { try { Manifest manifest; if (Path.executable().endsWith(".jar")) manifest = new JarFile(Path.executable()).getManifest(); else manifest = new Manifest(new FileInputStream(Path.homeProgram() + "META-INF" + File.separator + "MANIFEST.MF")); Attributes attributes = manifest.getMainAttributes(); String versionString = attributes.getValue("Bundle-Version"); String progNameString = attributes.getValue("Bundle-Name"); ProgramName programName = progNameString.equals("Umlet") ? ProgramName.UMLET : ProgramName.PLOTLET; Program.init(programName, versionString); } catch (Exception e) { log.error(null, e); } } public static void displayError(String error) { JOptionPane.showMessageDialog(null, error, "ERROR", JOptionPane.ERROR_MESSAGE); } private static void printToConsole(String text) { System.out.println(text); } private static void printUsage() { String formats = "pdf|svg|eps"; for (String format : ImageIO.getWriterFileSuffixes()) formats += "|" + format; printToConsole("USAGE: -action=convert -format=(" + formats + ") -filename=inputfile." + Program.EXTENSION + " [-output=outputfile[.extension]]"); } public static void doConvert(String fileName, String format, String outputfilename) { File file = new File(fileName); if (!file.exists()) { printToConsole("File '" + file.getAbsolutePath() + "' not found."); return; } DiagramHandler handler = new DiagramHandler(file); if (outputfilename == null) { if (fileName.contains("." + Program.EXTENSION)) fileName = fileName.substring(0, fileName.indexOf("." + Program.EXTENSION)); outputfilename = fileName + "." + format; } else if (!outputfilename.endsWith("." + format)) outputfilename += "." + format; try { if (format != null) handler.getFileHandler().doExportAs(format, new File(outputfilename)); } catch (Exception e) { printUsage(); } } private static boolean alreadyRunningChecker(boolean force) { try { File f = new File(Path.temp() + tmp_file); if (f.exists() && !force) return true; f.createNewFile(); file_created = true; timer = new Timer(true); timer.schedule(new RunningFileChecker(Path.temp() + tmp_file, Path.temp() + tmp_read_file), 0, 1000); } catch (Exception ex) { ex.printStackTrace(); return true; } return false; } private static boolean sendFileNameToRunningApplication(String filename) { // send the filename per file to the running application File f1 = new File(Path.temp() + tmp_file); boolean write_successful = true; try { PrintWriter writer = new PrintWriter(f1); writer.println(filename); writer.close(); } catch (Exception ex) { write_successful = false; } try { Thread.sleep(2000); } catch (Exception ex) {} File f2 = new File(Path.temp() + tmp_read_file); if (!f2.exists() || !write_successful) // if the ok file does not exist or the filename couldnt be written. { alreadyRunningChecker(true); return false; } else f2.delete(); return true; } // sets the current diagram the user works with - that may be a palette too public void setCurrentDiagramHandler(DiagramHandler handler) { this.setCurrentInfoDiagramHandler(handler); this.currentDiagramHandler = handler; if (gui != null) gui.diagramSelected(handler); } public DiagramHandler getCurrentInfoDiagramHandler() { return this.currentInfoDiagramHandler; } public void setCurrentInfoDiagramHandler(DiagramHandler handler) { log.debug("trying to setCurrentInfoDiagram"); log.debug("this.currentdiagram::"); log.debug(this.currentInfoDiagramHandler); log.debug("handler::"); log.debug(handler); if ((!(handler instanceof PaletteHandler)) && (handler != null)) { log.debug("SETTING currentInfoDiagram"); this.currentInfoDiagramHandler = handler; } } public void setPropertyPanelToCustomElement(GridElement e) { editedGridElement = e; } public void setPropertyPanelToGridElement(final GridElement e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { setPropertyPanelToGridElementHelper(e); } }); } private void setPropertyPanelToGridElementHelper(GridElement e) { editedGridElement = e; if (e != null) this.gui.setPropertyPanelText(e.getPanelAttributes()); else { DiagramHandler handler = this.getDiagramHandler(); if (handler == null) this.gui.setPropertyPanelText(""); else this.gui.setPropertyPanelText(handler.getHelpText()); } } public GridElement getGridElementFromPath(String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException { if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader(); // use classloader of current thread (not systemclassloader - important for eclipse) Class foundClass = null; String[] possiblePackages = new String[] {"com.umlet.element", "com.umlet.element.custom", "com.plotlet.element", "com.baselet.element"}; try { foundClass = classLoader.loadClass(path); } catch (ClassNotFoundException e) { String className = path.substring(path.lastIndexOf(".")); for (String possPackage : possiblePackages) { try { foundClass = classLoader.loadClass(possPackage + className); break; } catch (ClassNotFoundException e1) {/*do nothing; try next package*/} } } if (foundClass == null) { ClassNotFoundException ex = new ClassNotFoundException("class " + path + " not found"); log.error(null, ex); throw ex; } else return (GridElement) foundClass.newInstance(); } public void doNew() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { doNewHelper(); } }); } private void doNewHelper() { if (lastTabIsEmpty()) return; // If the last tab is empty do nothing (it's already new) DiagramHandler diagram = new DiagramHandler(null); this.diagrams.add(diagram); this.gui.open(diagram); if (this.diagrams.size() == 1) this.setPropertyPanelToGridElement(null); } public void doOpen() { String fn = DiagramFileHandler.chooseFileName(); if (fn != null) this.doOpen(fn); } public void doOpen(final String filename) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { doOpenHelper(filename); } }); } private void doOpenHelper(String filename) { if (lastTabIsEmpty()) (diagrams.get(diagrams.size() - 1)).doClose(); // If the last tab is empty close it (the opened diagram replaces the new one) File file = new File(filename); if (!file.exists()) return; DiagramHandler diagram = new DiagramHandler(file); this.diagrams.add(diagram); this.gui.open(diagram); if (this.diagrams.size() == 1) this.setPropertyPanelToGridElement(null); if (recentFiles.contains(filename)) recentFiles.remove(filename); recentFiles.add(0, filename); int maxRecentFiles = 10; if (recentFiles.size() > maxRecentFiles) recentFiles.remove(maxRecentFiles); } /** * If the last diagram tab and it's undo history (=controller) is empty return true, else return false */ private boolean lastTabIsEmpty() { if (!this.diagrams.isEmpty()) { DiagramHandler lastDiagram = this.diagrams.get(diagrams.size() - 1); if (lastDiagram.getController().isEmpty() && lastDiagram.getDrawPanel().getAllEntities().isEmpty()) { return true; } } return false; } // ask for save for all diagrams (if main is closed) public boolean askSaveIfDirty() { boolean ok = true; for (DiagramHandler d : this.getDiagrams()) { if (!d.askSaveIfDirty()) ok = false; } if (!this.getGUI().getCurrentCustomHandler().closeEntity()) ok = false; return ok; } // called by UI when main is closed public void closeProgram() { Config.saveConfig(); if (file_created) { timer.cancel(); (new File(Path.temp() + tmp_file)).delete(); } } public Hashtable getPalettes() { if (this.palettes == null) { this.palettes = new Hashtable(); // scan palettes List palettes = this.scanForPalettes(); for (File palette : palettes) this.palettes.put(palette.getName(), new PaletteHandler(palette)); } return this.palettes; } public List scanForPalettes() { // scan palettes directory... FileSystemView fileSystemView = FileSystemView.getFileSystemView(); File[] paletteFiles = fileSystemView.getFiles(new File(Path.homeProgram() + "palettes/"), false); List palettes = new ArrayList(); for (File palette : paletteFiles) { if (palette.getName().endsWith("." + Program.EXTENSION)) palettes.add(palette); } return palettes; } public List getPaletteNames() { return this.getPaletteNames(this.getPalettes()); } public List getPaletteNames(Hashtable palettes) { List palettenames = new ArrayList(); for (String palette : palettes.keySet()) palettenames.add(palette.substring(0, palette.length() - 4)); Collections.sort(palettenames, new PaletteSorter()); return palettenames; } public List getTemplateNames() { ArrayList templates = new ArrayList(); // scan palettes directory... FileSystemView fileSystemView = FileSystemView.getFileSystemView(); File[] templateFiles = fileSystemView.getFiles(new File(Path.customElements()), false); for (File template : templateFiles) { if (template.getName().endsWith(".java")) templates.add(template.getName().substring(0, template.getName().length() - 5)); } Collections.sort(templates, new TemplateSorter()); return templates; } public List getDiagrams() { return this.diagrams; } public BaseGUI getGUI() { return this.gui; } public GridElement getEditedGridElement() { return editedGridElement; } public String getPropertyString() { return this.gui.getPropertyPanelText(); } public PaletteHandler getPalette() { String name = this.gui.getSelectedPalette(); if (name != null) return this.getPalettes().get(name); return null; } public DrawPanel getPalettePanel() { return this.getPalette().getDrawPanel(); } // returns the current diagramhandler the user works with - may be a diagramhandler of a palette too public DiagramHandler getDiagramHandler() { return this.currentDiagramHandler; } public List getRecentFiles() { return recentFiles; } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/PaletteSorter.java0000644000175000001440000000116211576116034024641 0ustar benuserspackage com.baselet.control; import java.util.Comparator; public class PaletteSorter implements Comparator { @Override public int compare(String s1, String s2) { s1 = s1.toLowerCase(); s2 = s2.toLowerCase(); if (s1.equals("default")) if (s2.equals("default")) return 0; else return -1; if (s2.equals("default")) return 1; for (int i = 0; (i < s1.length()) && (i < s2.length()); i++) { if (s1.charAt(i) != s2.charAt(i)) return s1.charAt(i) - s2.charAt(i); } if (s1.length() > s2.length()) return 0; else if (s1.length() > s2.length()) return 1; else return -1; } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/Utils.java0000644000175000001440000002141411576116034023146 0ustar benuserspackage com.baselet.control; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Stroke; import java.io.File; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; import org.apache.log4j.Logger; import com.baselet.control.Constants.LineType; import com.baselet.diagram.DiagramHandler; import com.umlet.element.relation.DoubleStroke; public abstract class Utils { private final static Logger log = Logger.getLogger(Utils.getClassName()); private Utils() {} // private constructor to avoid instantiation /** * This method checks if the drawing of graphics should start at pixel (1,1) instead of (0,0) or not */ public static boolean displaceDrawingByOnePixel() { if (Constants.SystemInfo.JAVA_IMPL == Constants.JavaImplementation.OPEN) return true; else return false; } // Not used public static File createRandomFile(String extension) { File randomFile = new File(Path.homeProgram() + "tmp.diagram." + new Date().getTime() + "." + extension); randomFile.deleteOnExit(); return randomFile; } public static Point normalize(Point p, int pixels) { Point ret = new Point(); double d = Math.sqrt(p.x * p.x + p.y * p.y); ret.x = (int) (p.x / d * pixels); ret.y = (int) (p.y / d * pixels); return ret; } public static Vector decomposeStringsIncludingEmptyStrings(String s, String delimiter) { return decomposeStringsWFilter(s, delimiter, false, false); } public static Vector decomposeStringsWithEmptyLines(String s) { return Utils.decomposeStringsWFilter(s, Constants.NEWLINE, true, false); } public static Vector decomposeStringsWithComments(String s) { return Utils.decomposeStringsWFilter(s, Constants.NEWLINE, false, true); } public static Vector decomposeStrings(String s, String delimiter) { return Utils.decomposeStringsWFilter(s, delimiter, true, true); } public static Vector decomposeStrings(String s) { return decomposeStrings(s, Constants.NEWLINE); } private static Vector decomposeStringsWFilter(String fullString, String delimiter, boolean filterComments, boolean filterNewLines) { Vector returnVector = new Vector(); String compatibleFullString = fullString.replaceAll("\r\n", delimiter); // compatibility to windows \r\n for (String line : compatibleFullString.split("\\" + delimiter)) { if (filterComments && (line.matches("((//)|(fg=)|(bg=)|(autoresize=)).*"))) continue; else if (filterNewLines && line.isEmpty()) continue; else returnVector.add(line); } return returnVector; } public static List splitString(String text, int width) { DiagramHandler handler = Main.getInstance().getDiagramHandler(); StringBuilder stringBuilder = new StringBuilder(text); int lastEmptyChar = -1; // is -1 if there was no ' ' in this line int firstCharInLine = 0; for (int i = 0; i < text.length(); i++) { if (stringBuilder.charAt(i) == ' ') { lastEmptyChar = i; } else if (stringBuilder.charAt(i) == '\n') { lastEmptyChar = -1; firstCharInLine = i + 1; } if ((handler.getFontHandler().getTextWidth(text.substring(firstCharInLine, i)) + 15 * handler.getZoomFactor()) > width) { if (lastEmptyChar != -1) { stringBuilder.setCharAt(lastEmptyChar, '\n'); firstCharInLine = lastEmptyChar + 1; lastEmptyChar = -1; } else { stringBuilder.insert(i, '\n'); firstCharInLine = i+1; } } } return Arrays.asList(stringBuilder.toString().split("\\n")); } public static String composeStrings(Vector v, String delimiter) { String ret = null; if (v != null) { for (int i = 0; i < v.size(); i++) { if (ret == null) { ret = new String(v.elementAt(i)); } else { ret = ret + delimiter + v.elementAt(i); } } } if (ret == null) ret = ""; return ret; } public static Stroke getStroke(LineType lineType, int lineThickness) { // If the lineThickness is not supported, the default type is used if (lineThickness < 0) lineThickness = Constants.DEFAULT_LINE_THICKNESS; Stroke stroke = null; if (lineType == LineType.SOLID) stroke = new BasicStroke(lineThickness); else if (lineType == LineType.DASHED) stroke = new BasicStroke(lineThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 8.0f, 5.0f }, 0.0f); else if (lineType == LineType.DOTTED) stroke = new BasicStroke(lineThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 1.0f, 2.0f }, 0.0f); else if (lineType == LineType.DOUBLE) stroke = new DoubleStroke(lineThickness, 4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, null, 0.0f); else if (lineType == LineType.DOUBLE_DASHED) stroke = new DoubleStroke(lineThickness, 4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 8.0f, 5.0f }, 0.0f); else if (lineType == LineType.DOUBLE_DOTTED) stroke = new DoubleStroke(lineThickness, 3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 1.0f, 2.0f }, 0.0f); return stroke; } public static Map getUxRenderingQualityHigh(boolean subpixelRendering) { HashMap renderingHints = new HashMap(); renderingHints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); renderingHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); renderingHints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); if (subpixelRendering) renderingHints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); else renderingHints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); renderingHints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); renderingHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); renderingHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); return renderingHints; } /** * Calculates and returns the angle of the line defined by the coordinates */ public static double getAngle(double x1, double y1, double x2, double y2) { double res; double x = x2 - x1; double y = y2 - y1; res = Math.atan(y / x); if ((x >= 0.0) && (y >= 0.0)) res += 0.0; else if ((x < 0.0) && (y >= 0.0)) res += Math.PI; else if ((x < 0.0) && (y < 0.0)) res += Math.PI; else if ((x >= 0.0) && (y < 0.0)) res += 2.0 * Math.PI; return res; } /** * Converts colorString into a Color which is available in the colorMap or if not tries to decode the colorString * * @param colorString * String which describes the color * @return Color which is related to the String or null if it is no valid colorString */ public static Color getColor(String colorString) { Color returnColor = null; for (String color : Constants.colorMap.keySet()) { if (colorString.equals(color)) { returnColor = Constants.colorMap.get(color); break; } } if (returnColor == null) { try { returnColor = Color.decode(colorString); } catch (NumberFormatException e) { //only print for debugging because message would be printed, when typing the color log.debug("Invalid color:" + colorString); } } return returnColor; } public static String getClassName() { return Thread.currentThread().getStackTrace()[2].getClassName(); // return new RuntimeException().getStackTrace()[1].getClassName(); //ALSO POSSIBLE } /** * eg: createDoubleArrayFromTo(5, 6, 0.1) = [5, 5.1, 5.2, ..., 5.9, 6]
* eg: createDoubleArrayFromTo(10, 20, 3) = [10, 13, 16, 19, 22]
* * @param min first value of the result array * @param max if this value is reached (or passed if it's not dividable through "step") the array is finished * @param step the stepsize of the array */ public static Double[] createDoubleArrayFromTo(Double min, Double max, Double step) { if (min > max) return null; int range = (int) Math.ceil(((max-min)/step)+1); Double[] returnArray = new Double[range]; for (int i = 0; i < range; i++) { returnArray[i] = min + i*step; } return returnArray; } public static Double[] createDoubleArrayFromTo(Double min, Double max) { return createDoubleArrayFromTo(min, max, 1D); } public static Color darkenColor(String inColor, int factor) { return darkenColor(getColor(inColor), factor); } public static Color darkenColor(Color inColor, int factor) { int r = Math.max(0, inColor.getRed() - factor); int g = Math.max(0, inColor.getGreen() - factor); int b = Math.max(0, inColor.getBlue() - factor); return new Color(r,g,b); } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/Constants.java0000644000175000001440000003011611576116034024021 0ustar benuserspackage com.baselet.control; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.font.FontRenderContext; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; public abstract class Constants { private Constants() {} // private constructor to avoid instantiation public enum Os { WINDOWS, LINUX, UNIX, MAC, UNKNOWN } public enum JavaImplementation { OPEN, SUN } public enum RuntimeType { STANDALONE, ECLIPSE_PLUGIN, BATCH } public enum ProgramName { UMLET("UMLet"), PLOTLET("Plotlet"); private String name; private ProgramName(String n) { name = n; } @Override public String toString() { return name; } public String toLowerCase() { return name.toLowerCase(); } } public enum Metakey { CTRL, CMD; @Override public String toString() { if (this == CTRL) return "Ctrl"; else return "Cmd"; } // Use these masks as modifiers if you want to enforce ctrl or meta in addition to a keyevent public int getMask() { if (this == CTRL) return ActionEvent.CTRL_MASK; else return ActionEvent.META_MASK; } public int getMaskDown() { if (this == CTRL) return InputEvent.CTRL_DOWN_MASK; else return InputEvent.META_DOWN_MASK; } } /**** PROGRAM, PLATTFORM AND JAVA SPECIFIC SETTINGS ****/ public static class Program { // Basically the RUNTIME_TYPE is STANDALONE until it gets overwritten after program startup public static RuntimeType RUNTIME_TYPE = RuntimeType.STANDALONE; public static ProgramName PROGRAM_NAME; public static String CONFIG_NAME; public static String EXTENSION; public static String WEBSITE; public static Double VERSION; public static String[] GRID_ELEMENT_PACKAGES = new String[] {"com.umlet.element", "com.umlet.element.custom", "com.plotlet.element", "com.baselet.element"}; public static void init(ProgramName name, String version) { PROGRAM_NAME = name; WEBSITE = "http://www." + PROGRAM_NAME.toLowerCase() + ".com"; if (Program.RUNTIME_TYPE == RuntimeType.STANDALONE) CONFIG_NAME = Program.PROGRAM_NAME.toLowerCase() + ".cfg"; else CONFIG_NAME = Program.PROGRAM_NAME.toLowerCase() + "plugin.cfg"; if (Program.PROGRAM_NAME == ProgramName.UMLET) EXTENSION = "uxf"; else EXTENSION = "pxf"; VERSION = Double.valueOf(version); } } public static class SystemInfo { public static final Os OS; public static final JavaImplementation JAVA_IMPL; public static final String JAVA_VERSION = java.lang.System.getProperty("java.specification.version"); public final static Metakey META_KEY; static { String os = java.lang.System.getProperty("os.name").toUpperCase(); if (os.startsWith("WINDOWS")) OS = Os.WINDOWS; else if (os.startsWith("MAC")) OS = Os.MAC; else if (os.startsWith("LINUX")) OS = Os.LINUX; else if (os.contains("UNIX") || os.contains("BSD")) OS = Os.UNIX; else OS = Os.UNKNOWN; if (java.lang.System.getProperty("java.runtime.name").toUpperCase().contains("OPEN")) JAVA_IMPL = JavaImplementation.OPEN; else JAVA_IMPL = JavaImplementation.SUN; if (SystemInfo.OS == Os.MAC) META_KEY = Metakey.CMD; else META_KEY = Metakey.CTRL; } } /**** NEWLINE CHARACTER AND DEFAULT HELP- AND MAILTEXT ****/ public static final String NEWLINE = "\n"; public static final String COMMENT = "//"; public static String DEFAULT_HELPTEXT; public static String DEFAULT_MAILTEXT; static { DEFAULT_HELPTEXT = "// Uncomment the following line to change the fontsize and font:" + NEWLINE + "// fontsize=14" + NEWLINE + "// fontfamily=SansSerif //possible: SansSerif,Serif,Monospaced" + NEWLINE + "" + NEWLINE + "" + NEWLINE + "//////////////////////////////////////////////////////////////////////////////////////////////" + NEWLINE + "// Welcome to " + Program.PROGRAM_NAME + "!" + NEWLINE + "//" + NEWLINE + "// Double-click on elements to add them to the diagram, or to copy them" + NEWLINE + "// Edit elements by modifying the text in this panel" + NEWLINE + "// Hold " + SystemInfo.META_KEY + " to select multiple elements" + NEWLINE + "// Use " + SystemInfo.META_KEY + "+mouse to select via lasso" + NEWLINE + "//" + NEWLINE + "// Use +/- or " + SystemInfo.META_KEY + "+mouse wheel to zoom" + NEWLINE + "// Drag a whole relation at its central square icon" + NEWLINE + "//" + NEWLINE + "// Press " + SystemInfo.META_KEY + "+C to copy the whole diagram to the system clipboard (then just paste it to, eg, Word)" + NEWLINE + "// Edit the files in the \"palettes\" directory to create your own element palettes" + NEWLINE; if (Program.PROGRAM_NAME.equals(ProgramName.UMLET)) { DEFAULT_HELPTEXT += "//" + NEWLINE + "// Select \"Custom Elements > New...\" to create new element types" + NEWLINE; } DEFAULT_HELPTEXT += "//////////////////////////////////////////////////////////////////////////////////////////////" + NEWLINE + "" + NEWLINE + "" + NEWLINE + "// This text will be stored with each diagram; use it for notes."; DEFAULT_MAILTEXT = "Type your message here.." + NEWLINE + "" + NEWLINE + "__" + NEWLINE; DEFAULT_MAILTEXT += "To edit the diagram, open the attached " + Program.EXTENSION + "-file with the free editing tool " + Program.PROGRAM_NAME + " (" + Program.WEBSITE + ")"; } /**** AVAILABLE COLORS ****/ public static final HashMap colorMap = new HashMap(); static { colorMap.put("black", Color.BLACK); colorMap.put("blue", Color.BLUE); colorMap.put("cyan", Color.CYAN); colorMap.put("dark_gray", Color.DARK_GRAY); colorMap.put("gray", Color.GRAY); colorMap.put("green", Color.GREEN); colorMap.put("light_gray", Color.LIGHT_GRAY); colorMap.put("magenta", Color.MAGENTA); colorMap.put("orange", Color.decode("#FFA500")); colorMap.put("pink", Color.PINK); colorMap.put("red", Color.RED); colorMap.put("white", Color.WHITE); colorMap.put("yellow", Color.YELLOW); } public static final Color DEFAULT_SELECTED_COLOR = Color.BLUE; public static final Color DEFAULT_FOREGROUND_COLOR = Color.BLACK; public static final Color DEFAULT_BACKGROUND_COLOR = Color.WHITE; public static final float ALPHA_NO_TRANSPARENCY = 1.0f; public static final float ALPHA_MIDDLE_TRANSPARENCY = 0.5f; public static final float ALPHA_FULL_TRANSPARENCY = 0.0f; /**** EXPORT FORMATS ****/ public static final List exportFormatList = Arrays.asList(new String[] {"bmp", "eps", "gif", "jpg", "pdf", "png", "svg"}); /**** ZOOM VALUES ****/ public static final ArrayList zoomValueList = new ArrayList(); static { for (int i = 1; i <= 20; i++) { zoomValueList.add(i + "0%"); } } /**** OTHER CONSTANTS ****/ public static final String CUSTOM_ELEMENT_CLASSNAME = "CustomElementImpl"; public static final int DEFAULTGRIDSIZE = 10; public static final int PRINTPADDING = 20; public static final int INTERFACE_LINE_LENGTH = 40; public enum LineType {SOLID, DASHED, DOTTED, DOUBLE, DOUBLE_DASHED, DOUBLE_DOTTED}; public static final int DEFAULT_LINE_THICKNESS = 1; public static final int CUSTOM_ELEMENT_COMPILE_INTERVAL = 500; public enum AlignHorizontal {LEFT, CENTER, RIGHT}; public enum AlignVertical {TOP, CENTER, BOTTOM}; public static final int RESIZE_TOP = 1, RESIZE_RIGHT = 2, RESIZE_BOTTOM = 4, RESIZE_LEFT = 8; public static final int RESIZE_TOP_LEFT = RESIZE_TOP + RESIZE_LEFT; public static final int RESIZE_TOP_RIGHT = RESIZE_TOP + RESIZE_RIGHT; public static final int RESIZE_BOTTOM_LEFT = RESIZE_BOTTOM + RESIZE_LEFT; public static final int RESIZE_BOTTOM_RIGHT = RESIZE_BOTTOM + RESIZE_RIGHT; public static final String NOAUTORESIZE = "autoresize=false"; public static final String AUTORESIZE = "autoresize="; public static final Cursor LR_CURSOR = new Cursor(Cursor.E_RESIZE_CURSOR); public static final Cursor TB_CURSOR = new Cursor(Cursor.N_RESIZE_CURSOR); public static final Cursor NW_CURSOR = new Cursor(Cursor.NW_RESIZE_CURSOR); public static final Cursor NE_CURSOR = new Cursor(Cursor.NE_RESIZE_CURSOR); public static final Cursor HAND_CURSOR = new Cursor(Cursor.HAND_CURSOR); public static final Cursor MOVE_CURSOR = new Cursor(Cursor.MOVE_CURSOR); public static final Cursor DEFAULT_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR); public static final Cursor CROSS_CURSOR = new Cursor(Cursor.CROSSHAIR_CURSOR); public static final Cursor TEXT_CURSOR = new Cursor(Cursor.TEXT_CURSOR); public static final String DELIMITER_ENTITIES = "~~~~~|||||~~~~~|||||"; public static final String DELIMITER_STATE_AND_HIDDEN_STATE = "/////<<<< fontSizeList = new ArrayList(); static { for (int i = FONT_MIN; i <= FONT_MAX; i++) { fontSizeList.add(i); } } public static final List fontFamilyList = Arrays.asList(new String[] {Font.SANS_SERIF, Font.SERIF, Font.MONOSPACED}); public static final List lookAndFeels = Arrays.asList(UIManager.getInstalledLookAndFeels()); static { // The Eclipse Plugin doesn't work with GTKLookAndFeel, therefore we remove it from the choosable options if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) { lookAndFeels.remove("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } } public static final FontRenderContext FRC = new FontRenderContext(null, true, true); /**** VALUES LOADED FROM CONFIG ****/ public static int defaultFontsize = (Program.PROGRAM_NAME == ProgramName.UMLET ? 14 : 10); public static String defaultFontFamily = Font.SANS_SERIF; public static boolean start_maximized = false; public static boolean show_stickingpolygon = true; public static boolean show_grid = false; public static boolean enable_custom_elements = true; public static int main_split_position = 600; public static int right_split_position = 400; public static int mail_split_position = 250; public static Dimension program_size = new Dimension(960, 750); public static Point program_location = new Point(5, 5); public static String ui_manager; static { // The default MacOS theme looks ugly, therefore we set metal if (SystemInfo.OS == Os.MAC) ui_manager = "javax.swing.plaf.metal.MetalLookAndFeel"; // The GTKLookAndFeel crashes the eclipse plugin therefore we set metal as default instead else if ((Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) && UIManager.getSystemLookAndFeelClassName().equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) { ui_manager = "javax.swing.plaf.metal.MetalLookAndFeel"; } else ui_manager = UIManager.getSystemLookAndFeelClassName(); } public static String mail_smtp = ""; public static boolean mail_smtp_auth = false; public static String mail_smtp_user = ""; public static boolean mail_smtp_pw_store = false; public static String mail_smtp_pw = ""; public static String mail_from = ""; public static String mail_to = ""; public static String mail_cc = ""; public static String mail_bcc = ""; public static boolean mail_xml = true; public static boolean mail_gif = true; public static boolean mail_pdf = false; /**** ERROR MESSAGES ****/ public static final String ERROR_SAVING_FILE = "An error occured during saving. Please check the filename and your write access."; public static final String ERROR_SAVING_EMPTY_DIAGRAM = "You cannot save or export an empty diagram."; public static final String ERROR_PRINTING = "An error occured during printing."; } umlet-11.3.orig/sourcefiles/src/com/baselet/control/Path.java0000644000175000001440000000544211576116034022745 0ustar benuserspackage com.baselet.control; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import org.apache.log4j.Logger; import org.eclipse.core.runtime.FileLocator; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.plugin.MainPlugin; public class Path { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static String tempDir; private static String homeProgramDir; public static String config() { return Path.homeProgram() + Program.CONFIG_NAME; } public static String customElements() { return homeProgram() + "custom_elements/"; } public static String temp() { if (tempDir == null) { String tmp = System.getProperty("java.io.tmpdir"); if (!(tmp.endsWith(File.separator))) tmp = tmp + File.separator; tempDir = tmp; } return tempDir; } /** * STANDALONE NOJAR: * STANDALONE JAR: * ECLIPSE NOJAR: * ECLIPSE JAR: // */ public static String homeProgram() { if (homeProgramDir == null) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) { String path = null; try { URL homeURL = MainPlugin.getURL(); path = FileLocator.toFileURL(homeURL).toString().substring(new String("file:/").length()); if (File.separator.equals("/")) path = "/" + path; } catch (IOException e) { log.error("Cannot find location of Eclipse Plugin jar", e); } homeProgramDir = path; } else { String tempPath, realPath; tempPath = Path.executable(); tempPath = tempPath.substring(0, tempPath.length() - 1); tempPath = tempPath.substring(0, tempPath.lastIndexOf('/') + 1); realPath = new File(tempPath).getAbsolutePath() + "/"; homeProgramDir = realPath; } } return homeProgramDir; } /** * STANDALONE NOJAR: /bin/ * STANDALONE JAR: /.jar * ECLIPSE NOJAR: * ECLIPSE JAR: /.jar */ public static String executable() { String path; try { // We convert to an URI to avoid HTML problems with special characters like space,ä,ö,ü,... path = Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); } catch (URISyntaxException e) { // If the conversion fails, we don't convert to an URI but we have to manually replace those special characters later // WARNING: Only space will be replaced here, other special characters like ä,ö,ü,... won't (add them if needed) path = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath().replace("%20", " "); } return path; } } umlet-11.3.orig/sourcefiles/src/com/baselet/control/RunningFileChecker.java0000644000175000001440000000146111576116034025553 0ustar benuserspackage com.baselet.control; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.TimerTask; public class RunningFileChecker extends TimerTask { private File file; private File ok_file; public RunningFileChecker(String filename, String okfile) { file = new File(filename); ok_file = new File(okfile); } @Override public void run() { try { if (!file.exists()) file.createNewFile(); BufferedReader reader = new BufferedReader(new FileReader(file)); String filename = reader.readLine(); reader.close(); if (filename != null) { ok_file.createNewFile(); file.delete(); file.createNewFile(); Main.getInstance().doOpen(filename); } } catch (Exception ex) { ex.printStackTrace(); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/0000755000175000001440000000000011576116036021127 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/diagram/io/0000755000175000001440000000000011576116036021536 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/diagram/io/OutputHandler.java0000644000175000001440000001445511576116034025206 0ustar benuserspackage com.baselet.diagram.io; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.Vector; import javax.imageio.ImageIO; import org.apache.batik.dom.GenericDOMImplementation; import org.apache.batik.svggen.SVGGraphics2D; import org.sourceforge.jlibeps.epsgraphics.EpsGraphics2D; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Element; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.pdf.PdfWriter; public class OutputHandler { private OutputHandler() {} // private constructor to avoid instantiation public static void createAndOutputToFile(String extension, File file, DiagramHandler handler) throws Exception { OutputStream ostream = new FileOutputStream(file); createToStream(extension, ostream, handler); } public static void createToStream(String extension, OutputStream ostream, DiagramHandler handler) throws Exception { int oldZoom = handler.getGridSize(); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); // Zoom to the defaultGridsize before execution Vector entities = handler.getDrawPanel().getSelector().getSelectedEntities(); if (entities.isEmpty()) entities = handler.getDrawPanel().getAllEntities(); OutputHandler.exportToOutputStream(extension, ostream, handler, entities); handler.setGridAndZoom(oldZoom, false); // Zoom back to the oldGridsize after execution } public static BufferedImage createImageForClipboard(DiagramHandler handler, Vector entities) { int oldZoom = handler.getGridSize(); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); // Zoom to the defaultGridsize before execution if (entities.isEmpty()) entities = handler.getDrawPanel().getAllEntities(); BufferedImage returnImg = OutputHandler.getImageFromDiagram(handler, entities); handler.setGridAndZoom(oldZoom, false); // Zoom back to the oldGridsize after execution return returnImg; } private static void exportToOutputStream(String extension, OutputStream ostream, DiagramHandler handler, Vector entities) throws IOException { if (extension.equals("eps")) exportEps(ostream, handler, entities); else if (extension.equals("pdf")) exportPdf(ostream, handler, entities); else if (extension.equals("svg")) exportSvg(ostream, handler, entities); else if (isImageExtension(extension)) exportImg(extension, ostream, handler, entities); else throw new IllegalArgumentException(extension + " is an invalid format"); } private static void exportEps(OutputStream ostream, DiagramHandler handler, Vector entities) { PrintWriter bw = new PrintWriter(ostream); EpsGraphics2D grapics2d = new EpsGraphics2D(); handler.getDrawPanel().paintEntitiesIntoGraphics2D(grapics2d, entities); bw.print(grapics2d.toString()); bw.flush(); bw.close(); } private static void exportPdf(OutputStream ostream, DiagramHandler handler, Vector entities) throws IOException { try { Rectangle bounds = handler.getDrawPanel().getContentBounds(Constants.PRINTPADDING, entities); com.lowagie.text.Rectangle drawSpace = new com.lowagie.text.Rectangle((float) bounds.getWidth(), (float) bounds.getHeight()); com.lowagie.text.Document document = new Document(drawSpace); PdfWriter writer = PdfWriter.getInstance(document, ostream); document.open(); Graphics2D graphics2d = writer.getDirectContent().createGraphics(drawSpace.getWidth(), drawSpace.getHeight()); // We shift the diagram to the upper left corner, so we shift it by (minX,minY) of the contextBounds Dimension trans = new Dimension((int) bounds.getMinX(), (int) bounds.getMinY()); graphics2d.translate(-trans.getWidth(), -trans.getHeight()); handler.getDrawPanel().paintEntitiesIntoGraphics2D(graphics2d, entities); graphics2d.dispose(); document.close(); } catch (DocumentException e) { throw new IOException(e.getMessage()); } } private static void exportSvg(OutputStream ostream, DiagramHandler handler, Vector entities) throws IOException { Rectangle bounds = handler.getDrawPanel().getContentBounds(Constants.PRINTPADDING, entities); DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); org.w3c.dom.Document document = domImpl.createDocument(null, "svg", null); SVGGraphics2D graphics2d = new SVGGraphics2D(document); graphics2d.setSVGCanvasSize(bounds.getSize()); handler.getDrawPanel().paintEntitiesIntoGraphics2D(graphics2d, entities); Element root = graphics2d.getRoot(); root.setAttributeNS(null, "viewBox", String.format("%d %d %d %d", bounds.x, bounds.y, bounds.width, bounds.height)); Writer out = new OutputStreamWriter(ostream, "UTF-8"); // Stream out SVG to the standard output using UTF-8 character to byte encoding graphics2d.stream(root, out, false, false); } private static void exportImg(String imgType, OutputStream ostream, DiagramHandler handler, Vector entities) throws IOException { ImageIO.write(getImageFromDiagram(handler, entities), imgType, ostream); ostream.flush(); ostream.close(); } private static BufferedImage getImageFromDiagram(DiagramHandler handler, Vector entities) { Rectangle bounds = handler.getDrawPanel().getContentBounds(Constants.PRINTPADDING, entities); BufferedImage im = new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics2d = im.createGraphics(); graphics2d.setRenderingHints(Utils.getUxRenderingQualityHigh(true)); // tanslate needed for clipping graphics2d.translate(-bounds.x, -bounds.y); graphics2d.clipRect(bounds.x, bounds.y, bounds.width, bounds.height); graphics2d.setColor(Color.white); graphics2d.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); handler.getDrawPanel().paintEntitiesIntoGraphics2D(graphics2d, entities); return im; } private static boolean isImageExtension(String ext) { return ImageIO.getImageWritersBySuffix(ext).hasNext(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/io/DiagramFileHandler.java0000644000175000001440000003751711576116034026056 0ustar benuserspackage com.baselet.diagram.io; import java.awt.Component; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Path; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.umlet.custom.CustomElement; public class DiagramFileHandler { private final static Logger log = Logger.getLogger(Utils.getClassName()); private static JFileChooser openFileChooser; private static JFileChooser saveFileChooser; public static DiagramFileHandler createInstance(DiagramHandler diagramHandler, File file) { return new DiagramFileHandler(diagramHandler, file); } public static JFileChooser getOpenFileChooser() { if (openFileChooser == null) { openFileChooser = new JFileChooser(System.getProperty("user.dir")); openFileChooser.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return (f.getName().endsWith("." + Program.EXTENSION) || f.isDirectory()); } @Override public String getDescription() { return Program.PROGRAM_NAME + " diagram format (*." + Program.EXTENSION + ")"; } }); openFileChooser.setAcceptAllFileFilterUsed(false); } return openFileChooser; } private JFileChooser reloadSaveFileChooser() { // Set the initial target location for the fileChooser if (this.file != null) saveFileChooser = new JFileChooser(this.file); else saveFileChooser = new JFileChooser(System.getProperty("user.dir")); saveFileChooser.setAcceptAllFileFilterUsed(false); // We don't want "all files" as a choice // The input field should show the diagram name as preset saveFileChooser.setSelectedFile(new File(Main.getInstance().getDiagramHandler().getName())); return saveFileChooser; } public static String chooseFileName() { return Main.getInstance().getGUI().chooseFileName(); } private String fileName; private DiagramHandler handler; private File file; private HashMap filters; private HashMap fileextensions; private FileFilter filterxml = new OwnFileFilter(Program.EXTENSION, Program.PROGRAM_NAME + " diagram format"); private FileFilter filterbmp = new OwnFileFilter("bmp", "BMP"); private FileFilter filtereps = new OwnFileFilter("eps", "EPS"); private FileFilter filtergif = new OwnFileFilter("gif", "GIF"); private FileFilter filterjpg = new OwnFileFilter("jpg", "JPG"); private FileFilter filterpdf = new OwnFileFilter("pdf", "PDF"); private FileFilter filterpng = new OwnFileFilter("png", "PNG"); private FileFilter filtersvg = new OwnFileFilter("svg", "SVG"); protected DiagramFileHandler(DiagramHandler diagramHandler, File file) { this.handler = diagramHandler; if (file != null) this.fileName = file.getName(); else this.fileName = "new." + Program.EXTENSION; this.file = file; this.filters = new HashMap(); this.filters.put(Program.EXTENSION, filterxml); this.filters.put("bmp", filterbmp); this.filters.put("eps", filtereps); this.filters.put("gif", filtergif); this.filters.put("jpg", filterjpg); this.filters.put("pdf", filterpdf); this.filters.put("png", filterpng); this.filters.put("svg", filtersvg); this.fileextensions = new HashMap(); this.fileextensions.put(filterxml, Program.EXTENSION); this.fileextensions.put(filterbmp, "bmp"); this.fileextensions.put(filtereps, "eps"); this.fileextensions.put(filtergif, "gif"); this.fileextensions.put(filterjpg, "jpg"); this.fileextensions.put(filterpdf, "pdf"); this.fileextensions.put(filterpng, "png"); this.fileextensions.put(filtersvg, "svg"); // UNCOMMENTED BECAUSE WE DONT NEED ALL IMAGE FORMATS AND WE WANT TO SORT THEM ALPHABETICALLY /* * for(String format : ImageIO.getWriterFileSuffixes()) { * FileFilter filter = new OwnFileFilter(format, format.toUpperCase() + " Image"); * //We don't want to add "jpeg" which is redundant with "jpg" and "wbmp" because it doesn't work * if (format.toUpperCase().equals("JPEG") || format.toUpperCase().equals("WBMP")) continue; * this.fileChooser.addChoosableFileFilter(filter); * this.filters.put(format, filter); * this.fileextensions.put(filter, format); * } */ } public String getFileName() { return this.fileName; } public String getFullPathName() { if (this.file != null) return this.file.getAbsolutePath(); return ""; } private void setFileName(String fileName) { this.fileName = fileName; Main.getInstance().getGUI().updateDiagramName(this.handler, this.handler.getName()); } private void createXMLOutputDoc(Document doc, List entities, Element current, Group group) { // list of elements that are not inserted yet (to increase performance) List toBeCheckedAgain = new ArrayList(); List insert_groups = new ArrayList(); for (GridElement e : entities) { // only insert element in right grouping element boolean insert_here = false; if ((group == null) && (e.getGroup() == null)) insert_here = true; else if (group != null) if (group.equals(e.getGroup())) insert_here = true; if (insert_here) { if (e instanceof Group) insert_groups.add((Group) e); else { // insert normal entity element java.lang.Class c = e.getClass(); String sElType = c.getName(); int[] coor = e.getCoordinates(); String sElPanelAttributes = e.getPanelAttributes(); String sElAdditionalAttributes = e.getAdditionalAttributes(); Element el = doc.createElement("element"); current.appendChild(el); Element elType = doc.createElement("type"); elType.appendChild(doc.createTextNode(sElType)); el.appendChild(elType); Element elCoor = doc.createElement("coordinates"); el.appendChild(elCoor); Element elX = doc.createElement("x"); elX.appendChild(doc.createTextNode("" + coor[0])); elCoor.appendChild(elX); Element elY = doc.createElement("y"); elY.appendChild(doc.createTextNode("" + coor[1])); elCoor.appendChild(elY); Element elW = doc.createElement("w"); elW.appendChild(doc.createTextNode("" + coor[2])); elCoor.appendChild(elW); Element elH = doc.createElement("h"); elH.appendChild(doc.createTextNode("" + coor[3])); elCoor.appendChild(elH); Element elPA = doc.createElement("panel_attributes"); elPA.appendChild(doc.createTextNode(sElPanelAttributes)); el.appendChild(elPA); Element elAA = doc.createElement("additional_attributes"); elAA.appendChild(doc.createTextNode(sElAdditionalAttributes)); el.appendChild(elAA); if (e instanceof CustomElement) { Element elCO = doc.createElement("custom_code"); elCO.appendChild(doc.createTextNode(((CustomElement) e).getCode())); el.appendChild(elCO); } } } else toBeCheckedAgain.add(e); } for (Group g : insert_groups) { Element el = doc.createElement("group"); current.appendChild(el); createXMLOutputDoc(doc, toBeCheckedAgain, el, g); } } protected String createStringToBeSaved() { Component[] components = this.handler.getDrawPanel().getComponents(); List entities = new ArrayList(); for (int i = 0; i < components.length; i++) { if (components[i] instanceof GridElement) entities.add((GridElement) components[i]); } DocumentBuilder db = null; String returnString = null; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element root = doc.createElement("diagram"); root.setAttribute("program", Program.PROGRAM_NAME.toLowerCase()); root.setAttribute("version", String.valueOf(Program.VERSION)); doc.appendChild(root); // save helptext String helptext = this.handler.getHelpText(); if (!helptext.equals(Constants.DEFAULT_HELPTEXT)) { Element help = doc.createElement("help_text"); help.appendChild(doc.createTextNode(helptext)); root.appendChild(help); } // save zoom Element zoom = doc.createElement("zoom_level"); zoom.appendChild(doc.createTextNode(String.valueOf(this.handler.getGridSize()))); root.appendChild(zoom); // save elements (group = null = rootlayer) this.createXMLOutputDoc(doc, entities, root, null); // output the stuff... DOMSource source = new DOMSource(doc); StringWriter stringWriter = new StringWriter(); StreamResult result = new StreamResult(stringWriter); TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT,"yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); transformer.transform(source, result); returnString = stringWriter.toString(); } catch (Exception e) { log.error("Error saving XML.", e); } return returnString; } public void doOpen() { try { try { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); FileInputStream input = new FileInputStream(this.file); InputHandler xmlhandler = new InputHandler(this.handler); parser.parse(input, xmlhandler); } catch (SAXException e) { log.error("Error parsing the inputstream.", e); } /* * } catch (IOException e) { * log.error(null, e); */ } catch (Exception e) { log.error(null, e); } } public void doSaveAs(String fileextension) throws IOException { String fileName = this.chooseFileName(fileextension.equals(Program.EXTENSION), filters.get(fileextension)); String extension = this.fileextensions.get(saveFileChooser.getFileFilter()); if (fileName == null) return; // If the filechooser has been closed without saving if (!fileName.endsWith("." + extension)) fileName += "." + extension; File fileToSave = new File(fileName); if (extension.equals(Program.EXTENSION)) { this.file = fileToSave; this.setFileName(this.file.getName()); save(true); } else doExportAs(extension, fileToSave); } public File doSaveTempDiagram(String filename, String fileextension) throws IOException { File tempFile = new File(Path.temp() + filename + "." + fileextension); tempFile.deleteOnExit(); if (fileextension.equals(Program.EXTENSION)) save(tempFile, false); else doExportAs(fileextension, tempFile); return tempFile; } public void doSave() throws IOException { if ((file == null) || !file.exists()) doSaveAs(Program.EXTENSION); else save(true); } public void doExportAs(String extension, File file) throws IOException { // CustomElementSecurityManager.addThreadPrivileges(Thread.currentThread(), fileName); try { OutputHandler.createAndOutputToFile(extension, file, this.handler); } catch (Exception e) { throw new IOException(e.getMessage()); } // CustomElementSecurityManager.remThreadPrivileges(Thread.currentThread()); } private void save(boolean removeHandlerChanged) throws UnsupportedEncodingException, FileNotFoundException { save(file, removeHandlerChanged); // If save is called without a parameter it uses the class variable "file" } private void save(File saveToFile, boolean removeHandlerChanged) throws UnsupportedEncodingException, FileNotFoundException { String tmp = this.createStringToBeSaved(); PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(saveToFile), "UTF-8")); out.print(tmp); out.close(); if(removeHandlerChanged) handler.setChanged(false); } private String chooseFileName(boolean ownXmlFormat, FileFilter filefilter) { String fileName = null; // filechooser must be recreated to avoid a bug where getSelectedFile() was null (if a file is saved more than one time by doubleclicking on an existing file) reloadSaveFileChooser(); setAvailableFileFilters(ownXmlFormat); saveFileChooser.setFileFilter(filefilter); int returnVal = saveFileChooser.showSaveDialog(Main.getInstance().getGUI()); if (returnVal == JFileChooser.APPROVE_OPTION) { File selectedFileWithExt = new File(saveFileChooser.getSelectedFile().getName() + "." + fileextensions.get(saveFileChooser.getFileFilter())); // We must check for the file with and without extension (saving without adding the extension automatically adds the selected extension) if (saveFileChooser.getSelectedFile().exists() || selectedFileWithExt.exists()) { int overwriteQuestionResult = JOptionPane.showConfirmDialog(Main.getInstance().getGUI(), "File already exists! Overwrite?", "Overwrite File", JOptionPane.YES_NO_OPTION); if (overwriteQuestionResult == JOptionPane.NO_OPTION) return chooseFileName(ownXmlFormat, filefilter); } fileName = saveFileChooser.getSelectedFile().getAbsolutePath(); } return fileName; } /** * Updates the available FileFilter to "only uxf/pxf" or "all but uxf/pxf" * * @param ownXmlFormat * If this param is set, only uxf/pxf is visible, otherwise all but uxf/pxf is visible */ private void setAvailableFileFilters(boolean ownXmlFormat) { if (ownXmlFormat) { saveFileChooser.resetChoosableFileFilters(); saveFileChooser.addChoosableFileFilter(filterxml); } else { saveFileChooser.resetChoosableFileFilters(); saveFileChooser.addChoosableFileFilter(filterbmp); saveFileChooser.addChoosableFileFilter(filtereps); saveFileChooser.addChoosableFileFilter(filtergif); saveFileChooser.addChoosableFileFilter(filterjpg); saveFileChooser.addChoosableFileFilter(filterpdf); saveFileChooser.addChoosableFileFilter(filterpng); saveFileChooser.addChoosableFileFilter(filtersvg); } } protected class OwnFileFilter extends FileFilter { private String format; private String description; protected OwnFileFilter(String format, String description) { this.format = format; this.description = description; } @Override public boolean accept(File f) { return (f.getName().endsWith("." + this.format) || f.isDirectory()); } @Override public String getDescription() { return this.description + " (*." + this.format + ")"; } } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((file == null) ? 0 : file.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DiagramFileHandler other = (DiagramFileHandler) obj; if (file == null) { if (other.file != null) return false; } else if (!file.equals(other.file)) return false; return true; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/io/InputHandler.java0000644000175000001440000001012111576116034024767 0ustar benuserspackage com.baselet.diagram.io; import java.util.ArrayList; import java.util.List; import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.command.HelpPanelChanged; import com.baselet.element.ErrorOccurred; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.umlet.custom.CustomElementCompiler; /** * Describes what should happen with parsed elements from the input file * eg: set DiagramHandler variables, create GridElements etc. */ public class InputHandler extends DefaultHandler { private DrawPanel _p = null; private GridElement e = null; private String elementtext; private int x; private int y; private int w; private int h; private String entityname; private String code; private String panel_attributes; private String additional_attributes; private Group currentGroup; private DiagramHandler handler; // to be backward compatible - add list of old elements that were removed so that they are ignored when loading old files private List ignoreElements; public InputHandler(DiagramHandler handler) { this.handler = handler; _p = handler.getDrawPanel(); ignoreElements = new ArrayList(); ignoreElements.add("main.control.Group"); currentGroup = null; } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) { elementtext = ""; if (qName.equals("element")) { this.panel_attributes = ""; this.additional_attributes = ""; this.code = null; } if (qName.equals("group")) { Group g = new Group(); g.setHandler(this.handler); if (currentGroup != null) currentGroup.addMember(g); currentGroup = g; } } @Override public void endElement(String uri, String localName, String qName) { String elementname = qName; // [UB]: we are not name-space aware, so use the qualified name if (elementname.equals("help_text")) { handler.setHelpText(elementtext); handler.getFontHandler().setDiagramDefaultFontSize(HelpPanelChanged.getFontsize(elementtext)); } else if (elementname.equals("zoom_level")) { if (handler != null) handler.setGridSize(Integer.parseInt(elementtext)); } else if (elementname.equals("group")) { if (this.currentGroup != null) { this.currentGroup.adjustSize(false); _p.add(this.currentGroup); this.currentGroup = this.currentGroup.getGroup(); } } else if (elementname.equals("element")) { if (!this.ignoreElements.contains(this.entityname)) { // load classes try { if (this.code == null) e = Main.getInstance().getGridElementFromPath(this.entityname); else e = CustomElementCompiler.getInstance().genEntity(this.code); } catch (Exception ex) { e = new ErrorOccurred(); } e.setBounds(x, y, w, h); e.setPanelAttributes(this.panel_attributes); e.setAdditionalAttributes(this.additional_attributes); e.setHandler(this.handler); if (this.currentGroup != null) this.currentGroup.addMember(e); _p.add(e); } } else if (elementname.equals("type")) { this.entityname = elementtext; } else if (elementname.equals("x")) { Integer i = new Integer(elementtext); x = i.intValue(); } else if (elementname.equals("y")) { Integer i = new Integer(elementtext); y = i.intValue(); } else if (elementname.equals("w")) { Integer i = new Integer(elementtext); w = i.intValue(); } else if (elementname.equals("h")) { Integer i = new Integer(elementtext); h = i.intValue(); } else if (elementname.equals("panel_attributes")) this.panel_attributes = elementtext; else if (elementname.equals("additional_attributes")) this.additional_attributes = elementtext; else if (elementname.equals("custom_code")) this.code = elementtext; } @Override public void characters(char[] ch, int start, int length) { elementtext += (new String(ch)).substring(start, start + length); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/0000755000175000001440000000000011576116036022064 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/Text.java0000644000175000001440000000150711576116034023654 0ustar benusers/** * */ package com.baselet.diagram.draw; import com.baselet.control.Constants.AlignHorizontal; import com.baselet.control.Constants.AlignVertical; class Text { private String text; private int x; private int y; private AlignHorizontal horizontalAlignment; private AlignVertical verticalAlignment; Text(String text, int x, int y, AlignHorizontal align, AlignVertical valign) { this.text = text; this.x = x; this.y = y; this.horizontalAlignment = align; this.verticalAlignment = valign; } public String getText() { return text; } public int getX() { return x; } public int getY() { return y; } public AlignHorizontal getHorizontalAlignment() { return horizontalAlignment; } public AlignVertical getVerticalAlignment() { return verticalAlignment; } }umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/objects/0000755000175000001440000000000011576116036023515 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/objects/PlotGridDrawConfig.java0000644000175000001440000000254311576116034030052 0ustar benuserspackage com.baselet.diagram.draw.objects; import java.awt.Color; import java.awt.Dimension; import com.baselet.diagram.DiagramHandler; public class PlotGridDrawConfig { private final DiagramHandler diagramHandler; private final Dimension realSize; private final Dimension size; private final Color fgColor; private final Color bgColor; private final boolean isSelected; private final Double minValue; private final Double maxValue; public PlotGridDrawConfig(DiagramHandler diagramHandler, Dimension realSize, Dimension size, Color fgColor, Color bgColor, boolean isSelected, Double minValue, Double maxValue) { super(); this.diagramHandler = diagramHandler; this.realSize = realSize; this.size = size; this.fgColor = fgColor; this.bgColor = bgColor; this.isSelected = isSelected; this.minValue = minValue; this.maxValue = maxValue; } public DiagramHandler getDiagramHandler() { return diagramHandler; } public Dimension getRealSize() { return realSize; } public Dimension getSize() { return size; } public Color getFgColor() { return fgColor; } public Color getBgColor() { return bgColor; } public boolean isSelected() { return isSelected; } public Double getMinValue() { return minValue; } public Double getMaxValue() { return maxValue; } }umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/objects/Canvas.java0000644000175000001440000001165611576116034025602 0ustar benuserspackage com.baselet.diagram.draw.objects; import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle; import com.baselet.control.Constants; import com.baselet.diagram.draw.BaseDrawHandler; /** * GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG * G G * G OOOOOOOOOOOOOOO G * G O O G * G O IIIIIIIII O G * G O I I O G * G O I I O G * G O IIIIIIIII O G * G O O G * G OOOOOOOOOOOOOOO G * G G * G G * G G * G G * G G * G G * GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG */ public class Canvas { private int borderspace; private Rectangle outerBorder; // Nothing is drawn between outerBorder and the GridElement-Border private Rectangle innerBorder; // Only axis are drawn between outerBorder and innerBorder; inside the innerBorder the plot is drawn private Dimension gridElementSize; public Canvas(Dimension gridElementSize) { super(); this.gridElementSize = gridElementSize; this.outerBorder = new Rectangle(); this.innerBorder = new Rectangle(); setBorder(0,0,0,0,0); } public void setBorder(int x, int y, int width, int height, int borderspace) { this.borderspace = borderspace; outerBorder.setBounds(x, y, width, height); updateInnerBorder(); } public void setBorderX(int x) { outerBorder.setBounds(x, outerBorder.y, outerBorder.width, outerBorder.height); updateInnerBorder(); } public void setBorderY(int y) { outerBorder.setBounds(outerBorder.x, y, outerBorder.width, outerBorder.height); updateInnerBorder(); } public void setBorderWidth(int width) { outerBorder.setBounds(outerBorder.x, outerBorder.y, width, outerBorder.height); updateInnerBorder(); } public void setBorderHeight(int height) { outerBorder.setBounds(outerBorder.x, outerBorder.y, outerBorder.width, height); updateInnerBorder(); } private void updateInnerBorder() { innerBorder.setBounds(outerBorder.x + borderspace, outerBorder.y + borderspace, outerBorder.width + borderspace, outerBorder.height + borderspace); } /** * <-----> * G O I I O G */ public int getInnerLeftPos() { return innerBorder.x; } public int getInnerUpPos() { return innerBorder.y; } /** * <------------------> * G O I I O G */ public int getInnerRightBorderWidth() { return innerBorder.width; } public int getInnerDownBorderHeight() { return innerBorder.height; } /** * <-------------> * G O I I O G */ public int getInnerRightPos() { return gridElementSize.width - getInnerRightBorderWidth(); } public int getInnerDownPos() { return gridElementSize.height - getInnerDownBorderHeight(); } /** * <-----> <------------------> * G O I I O G */ public int getInnerHorizontalSum() { return getInnerLeftPos() + getInnerRightBorderWidth(); } public int getInnerVerticalSum() { return getInnerUpPos() + getInnerDownBorderHeight(); } /** * <-------> * G O I I O G */ public int getInnerHorizontalDrawspace() { return getInnerRightPos() - getInnerLeftPos(); } public int getInnerVerticalDrawspace() { return getInnerDownPos() - getInnerUpPos(); } public int getOuterLeftPos() { return outerBorder.x; } public int getOuterUpPos() { return outerBorder.y; } public int getOuterRightBorderWidth() { return outerBorder.width; } public int getOuterDownBorderHeight() { return outerBorder.height; } public int getOuterRightPos() { return gridElementSize.width - getOuterRightBorderWidth(); } public int getOuterDownPos() { return gridElementSize.height - getOuterDownBorderHeight(); } public int getOuterHorizontalSum() { return getOuterLeftPos() + getOuterRightBorderWidth(); } public int getOuterVerticalSum() { return getOuterUpPos() + getOuterDownBorderHeight(); } public boolean hasHorizontalDrawspace() { return (gridElementSize.width > getOuterHorizontalSum()); } public boolean hasVerticalDrawspace() { return (gridElementSize.width > getOuterHorizontalSum()); } public void draw(BaseDrawHandler baseDrawHandler) { baseDrawHandler.setBackgroundAlpha(Constants.ALPHA_FULL_TRANSPARENCY); baseDrawHandler.setForegroundAlpha(Constants.ALPHA_MIDDLE_TRANSPARENCY); baseDrawHandler.setForegroundColor(Color.RED); baseDrawHandler.drawRectangle(getOuterLeftPos(), getOuterUpPos(), getOuterRightPos() - getOuterLeftPos() -1, getOuterDownPos() - getOuterUpPos()); baseDrawHandler.setForegroundColor(Color.BLUE); baseDrawHandler.drawRectangle(getInnerLeftPos(), getInnerUpPos(), getInnerRightPos() - getInnerLeftPos(), getInnerDownPos() - getInnerUpPos()); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/objects/AxisConfig.java0000644000175000001440000001074511576116034026417 0ustar benuserspackage com.baselet.diagram.draw.objects; import java.util.List; import java.util.TreeSet; import com.plotlet.parser.PlotConstants; public class AxisConfig { private boolean descAxisLine, valueAxisLine; private boolean descAxisMarkers, valueAxisMarkers; private boolean descAxisText, valueAxisText; private boolean descAxisGray, valueAxisGray; private TreeSet valueAxisList; private boolean showRelevantValues; public static final int ARROW_SIZE = (int) (5 * 1f); // arrowLength * arrowEndAngle public static final int ARROW_DISTANCE = ARROW_SIZE*3; // Distance between outerBorder and innerBorder; plotarea where only axis are allowed to draw private boolean xIsDescription; private boolean drawAxis; private int descSegment; // The width of a bar (always the "shorter" side of the bar) private Double valueSegment; // How many pixels equal one valuesegment (eg: if values reach from 1 to 100000 it's very small, if they reach from 1 to 5 it's very high) private int descAxisPos; // If horizontal sourceAxisPos is the x value of the vertical axis, else it's the y value of the horizontal axis private int valueAxisPos; // If horizontal sourceAxisPos is the x value of the vertical axis, else it's the y value of the horizontal axis private int xAxisPos; private int yAxisPos; public AxisConfig() { super(); drawAxis = false; } public final void enableDescAxis(List showList/*, List valueList*/) { this.drawAxis = true; this.descAxisLine = showList.contains(PlotConstants.DESC_AXIS_SHOW_AXIS); this.descAxisGray = showList.contains(PlotConstants.DESC_AXIS_SHOW_LINE); this.descAxisMarkers = showList.contains(PlotConstants.DESC_AXIS_SHOW_MARKER); this.descAxisText = showList.contains(PlotConstants.DESC_AXIS_SHOW_TEXT); } public final void enableValueAxis(List showList, List valueList) { this.drawAxis = true; this.valueAxisLine = showList.contains(PlotConstants.VALUE_AXIS_SHOW_AXIS); this.valueAxisGray = showList.contains(PlotConstants.VALUE_AXIS_SHOW_LINE); this.valueAxisMarkers = showList.contains(PlotConstants.VALUE_AXIS_SHOW_MARKER); this.valueAxisText = showList.contains(PlotConstants.VALUE_AXIS_SHOW_TEXT); this.showRelevantValues = valueList.contains(PlotConstants.VALUE_AXIS_LIST_RELEVANT); this.valueAxisList = new TreeSet(); for (String v : valueList) { try { valueAxisList.add(Double.parseDouble(v)); } catch(Exception e) { } } } public boolean isxDescription() { return xIsDescription; } public void setxIsDescription(boolean xIsDescription) { this.xIsDescription = xIsDescription; } public boolean showAxis() { return drawAxis; } public boolean drawXAxis() { return isxDescription() && descAxisLine || !isxDescription() && valueAxisLine; } public boolean drawYAxis() { return isxDescription() && valueAxisLine || !isxDescription() && descAxisLine; } public boolean drawDescriptionAxisMarkers() { return descAxisMarkers; } public boolean drawDescriptionAxisMarkerText() { return descAxisText; } public boolean drawDescriptionAxisMarkerGrayline() { return descAxisGray; } public boolean drawValueAxis() { return valueAxisLine; } public boolean drawValueAxisMarkers() { return valueAxisMarkers; } public boolean drawValueAxisMarkerText() { return valueAxisText; } public boolean drawValueAxisMarkerGrayline() { return valueAxisGray; } public void setDescAxisPos(int pos) { this.descAxisPos = pos; if (xIsDescription) this.xAxisPos = pos; else this.yAxisPos = pos; } public int getxAxisPos() { return xAxisPos; } public void setValueAxisPos(int pos) { this.valueAxisPos = pos; if (!xIsDescription) this.xAxisPos = pos; else this.yAxisPos = pos; } public int getyAxisPos() { return yAxisPos; } public int getDescAxisPos() { return descAxisPos; } public int getValueAxisPos() { return valueAxisPos; } public int getDescSegment() { return descSegment; } public void setDescSegment(int descSegment) { this.descSegment = descSegment; } public Double getValueSegment() { return valueSegment; } public void setValueSegment(Double valueSegment) { this.valueSegment = valueSegment; } public TreeSet setValueAxisList(TreeSet valuesSorted) { if (showRelevantValues) { this.valueAxisList.addAll(valuesSorted); } return this.valueAxisList; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/Style.java0000644000175000001440000000352411576116034024031 0ustar benusers/** * */ package com.baselet.diagram.draw; import java.awt.Color; import com.baselet.control.Constants; import com.baselet.control.Constants.LineType; class Style { private LineType lineType; private int lineThickness; private Color fgColor; private Color bgColor; private float fgAlpha; private float bgAlpha; private int fontSize; private boolean applyZoom; public Style(Color foregroundColor, Color backgroundColor, int fontSize) { this.lineThickness = Constants.DEFAULT_LINE_THICKNESS; this.lineType = LineType.SOLID; this.fgColor = foregroundColor; this.bgColor = backgroundColor; this.fgAlpha = Constants.ALPHA_NO_TRANSPARENCY; this.bgAlpha = Constants.ALPHA_MIDDLE_TRANSPARENCY; this.fontSize = fontSize; this.applyZoom = true; } public void setLineType(LineType lineType) { this.lineType = lineType; } public LineType getLineType() { return lineType; } public void setLineThickness(int lineThickness) { this.lineThickness = lineThickness; } public int getLineThickness() { return lineThickness; } public void setFgColor(Color fgColor) { this.fgColor = fgColor; } public Color getFgColor() { return fgColor; } public void setBgColor(Color bgColor) { this.bgColor = bgColor; } public Color getBgColor() { return bgColor; } public void setFgAlpha(float fgAlpha) { this.fgAlpha = fgAlpha; } public float getFgAlpha() { return fgAlpha; } public void setBgAlpha(float bgAlpha) { this.bgAlpha = bgAlpha; } public float getBgAlpha() { return bgAlpha; } public void setFontSize(int fontSize) { this.fontSize = fontSize; } public int getFontSize() { return fontSize; } public void setApplyZoom(boolean applyZoom) { this.applyZoom = applyZoom; } public boolean isApplyZoom() { return applyZoom; } }umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/BaseDrawHandler.java0000644000175000001440000002212411576116034025714 0ustar benuserspackage com.baselet.diagram.draw; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.Arc2D; import java.awt.geom.CubicCurve2D; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.QuadCurve2D; import java.awt.geom.RoundRectangle2D; import com.baselet.control.Constants; import com.baselet.control.Constants.AlignHorizontal; import com.baselet.control.Constants.AlignVertical; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; public class BaseDrawHandler { private DiagramHandler handler; // Save some objects needed to draw the shapes private Graphics2D g2; private Style style; private Color bgColor ; private Color fgColor; private int width; private int height; private boolean isSelected; public BaseDrawHandler(Graphics g, DiagramHandler handler, Color fgColor, Color bgColor, Dimension size, boolean isSelected) { this.g2 = (Graphics2D) g; this.handler = handler; this.fgColor = fgColor; this.bgColor = bgColor; g2.setFont(handler.getFontHandler().getFont()); g2.setColor(fgColor); this.style = new Style(fgColor, bgColor, (int) handler.getFontHandler().getFontSize(false)); this.width = size.width; this.height = size.height; this.isSelected = isSelected; } private float getZoom() { return handler.getZoomFactor(); } private void drawShape(Shape s) { // Shapes Background g2.setColor(style.getBgColor()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.getBgAlpha())); this.g2.fill(s); // Shapes Foreground g2.setColor(style.getFgColor()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.getFgAlpha())); g2.setStroke(Utils.getStroke(style.getLineType(), style.getLineThickness())); this.g2.draw(s); } private void drawFilledShape(Shape s) { // Shapes Background g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.getFgAlpha())); g2.setColor(style.getFgColor()); g2.fillRoundRect(s.getBounds().x, s.getBounds().y, s.getBounds().width, s.getBounds().height, s.getBounds().width, s.getBounds().height); // Shapes Foreground g2.setColor(style.getFgColor()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.getFgAlpha())); this.g2.draw(s); } private void drawText(Text t) { g2.setColor(style.getFgColor()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, style.getFgAlpha())); handler.getFontHandler().setFontSize(style.getFontSize()); g2.setFont(handler.getFontHandler().getFont()); handler.getFontHandler().writeText(this.g2, t.getText(), t.getX(), t.getY(), t.getHorizontalAlignment(), t.getVerticalAlignment()); handler.getFontHandler().resetFontSize(); } /* * TEXT METHODS */ public final void print(String text, int x, int y) { drawText(new Text(text, (int) (x * getZoom()), (int) (y * getZoom()), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); } public final void print(String text, int x, int y, AlignHorizontal align) { drawText(new Text(text, (int) (x * getZoom()), (int) (y * getZoom()), align, AlignVertical.BOTTOM)); } public final void printLeft(String text, int y) { drawText(new Text(text, (int) handler.getFontHandler().getDistanceBetweenTexts(), (int) (y * getZoom()), AlignHorizontal.LEFT, AlignVertical.BOTTOM)); } public final void printRight(String text, int y) { drawText(new Text(text, (int) (width - handler.getFontHandler().getDistanceBetweenTexts()), (int) (y * getZoom()) + 20, AlignHorizontal.RIGHT, AlignVertical.BOTTOM)); } public final void printCenter(String text, int y) { drawText(new Text(text, width / 2, (int) (y * getZoom()), AlignHorizontal.CENTER, AlignVertical.BOTTOM)); } public final int textHeight() { return textDimension("dummy").height; } public final int textWidth(String text) { return textDimension(text).width; } private final Dimension textDimension(String text) { boolean specialFontSize = (style.getFontSize() != (int) handler.getFontHandler().getFontSize(false)); if (specialFontSize) { handler.getFontHandler().setFontSize(style.getFontSize()); } Dimension returnVal = handler.getFontHandler().getTextSize(text, false); if (specialFontSize) { handler.getFontHandler().resetFontSize(); } return returnVal; } /* * DRAW METHODS */ public final void drawArcOpen(float x, float y, float width, float height, float start, float extent) { drawShape(new Arc2D.Float(x * getZoom(), y * getZoom(), width * getZoom(), height * getZoom(), start, extent, Arc2D.OPEN)); } public final void drawArcChord(float x, float y, float width, float height, float start, float extent) { drawShape(new Arc2D.Float(x * getZoom(), y * getZoom(), width * getZoom(), height * getZoom(), start, extent, Arc2D.CHORD)); } public final void drawArcPie(float x, float y, float width, float height, float start, float extent) { drawShape(new Arc2D.Float(x * getZoom(), y * getZoom(), width * getZoom(), height * getZoom(), start, extent, Arc2D.PIE)); } public final void drawCircle(int x, int y, int radius) { drawFilledShape(new Ellipse2D.Float((int) ((x - radius) * getZoom()), (int) ((y - radius) * getZoom()), (int) (radius * 2 * getZoom()), (int) (radius * 2 * getZoom()))); } public final void drawCurveCubic(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) { drawShape(new CubicCurve2D.Float(x1 * getZoom(), y1 * getZoom(), ctrlx1 * getZoom(), ctrly1 * getZoom(), ctrlx2 * getZoom(), ctrly2 * getZoom(), x2 * getZoom(), y2 * getZoom())); } public final void drawCurveQuad(float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { drawShape(new QuadCurve2D.Float(x1 * getZoom(), y1 * getZoom(), ctrlx * getZoom(), ctrly * getZoom(), x2 * getZoom(), y2 * getZoom())); } public final void drawEllipse(int x, int y, int radiusX, int radiusY) { drawShape(new Ellipse2D.Float((int) ((x - radiusX) * getZoom()), (int) ((y - radiusY) * getZoom()), (int) (radiusX * 2 * getZoom()), (int) (radiusY * 2 * getZoom()))); } public final void drawLine(int x1, int y1, int x2, int y2) { drawShape(new Line2D.Float((int) (x1 * getZoom()), (int) (y1 * getZoom()), (int) (x2 * getZoom()), (int) (y2 * getZoom()))); } public final void drawLineHorizontal(int y) { drawShape(new Line2D.Float((int) (0 * getZoom()), (int) (y * getZoom()), handler.realignToGrid(false, width, true), (int) (y * getZoom()))); } public final void drawLineVertical(int x) { drawShape(new Line2D.Float((int) (x * getZoom()), (int) (0 * getZoom()), (int) (x * getZoom()), handler.realignToGrid(false, height, true))); } public final void drawPolygon(Polygon polygon) { for (int i = 0; i < polygon.xpoints.length; i++) { polygon.xpoints[i] *= getZoom(); } for (int i = 0; i < polygon.ypoints.length; i++) { polygon.ypoints[i] *= getZoom(); } drawShape(polygon); } public final void drawRectangle(int x, int y, int width, int height) { drawShape(new Rectangle((int) (x * getZoom()), (int) (y * getZoom()), (int) (width * getZoom()), (int) (height * getZoom()))); } public final void drawRectangleRound(int x, int y, int width, int height, float arcw, float arch) { drawShape(new RoundRectangle2D.Float((int) (x * getZoom()), (int) (y * getZoom()), (int) (width * getZoom()), (int) (height * getZoom()), arcw * getZoom(), arch * getZoom())); } /* * STYLING METHODS */ public final void setForeground(String color, float alpha) { setForegroundColor(color); setForegroundAlpha(alpha); } public final void setForeground(Color color, float alpha) { setForegroundColor(color); setForegroundAlpha(alpha); } public final void setBackground(String color, float alpha) { setBackgroundColor(color); setBackgroundAlpha(alpha); } public final void setBackground(Color color, float alpha) { setBackgroundColor(color); setBackgroundAlpha(alpha); } public final void setForegroundColor(String color) { if (color.equals("fg")) setForegroundColor(fgColor); else setForegroundColor(Utils.getColor(color)); // if fgColor is not a valid string null will be set } public final void setForegroundColor(Color color) { if (isSelected) style.setFgColor(Constants.DEFAULT_SELECTED_COLOR); else if (color == null) style.setFgColor(Constants.DEFAULT_FOREGROUND_COLOR); else style.setFgColor(color); } public final void setBackgroundColor(String color) { if (color.equals("bg")) setBackgroundColor(bgColor); else setBackgroundColor(Utils.getColor(color)); } public final void setBackgroundColor(Color color) { if (color == null) style.setBgColor(Constants.DEFAULT_BACKGROUND_COLOR); else style.setBgColor(color); } public final void setForegroundAlpha(float alpha) { style.setFgAlpha(alpha); } public final void setBackgroundAlpha(float alpha) { style.setBgAlpha(alpha); } public void resetColorSettings() { setForeground("fg", Constants.ALPHA_NO_TRANSPARENCY); setBackground("bg", Constants.ALPHA_FULL_TRANSPARENCY); } public final void setFontSize(int fontSize) { style.setFontSize(fontSize); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/draw/PlotDrawHandler.java0000644000175000001440000005561511576116034025773 0ustar benuserspackage com.baselet.diagram.draw; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.TreeSet; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.AlignHorizontal; import com.baselet.control.Utils; import com.baselet.diagram.draw.objects.AxisConfig; import com.baselet.diagram.draw.objects.Canvas; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; public class PlotDrawHandler { protected BaseDrawHandler base; public PlotDrawHandler(Graphics g, PlotGridDrawConfig plotDrawConfig) { base = new BaseDrawHandler(g, plotDrawConfig.getDiagramHandler(), plotDrawConfig.getFgColor(), plotDrawConfig.getBgColor(), plotDrawConfig.getSize(), plotDrawConfig.isSelected()); drawLegend = false; axisConfig = new AxisConfig(); canvas = new Canvas(plotDrawConfig.getRealSize()); } private final static Logger log = Logger.getLogger(Utils.getClassName()); // Enumerations public enum Position { LEFT, UP, DOWN, RIGHT } // Plot specific settings private String[] title; private String[] desc; private Double[][] values; private TreeSet valuesSorted; private TreeSet valuesShownOnAxisSorted; // private Double[][] valuesMinMaxCorrected; // if all values are >0 or all values are <0 the distance from 0 to the first real value will be subtracted private Double minVal = null; private Double maxVal = null; private List colors; private Canvas canvas; private AxisConfig axisConfig; // Legend Settings private boolean drawLegend; private Rectangle legendPos; // /** // * Abstracts the axis drawing from the type of variables on the axis (description or values) // * Methods called from this method don't know if they handle a description or value axis // * @param xAxis if true this is the method call for the x-axis // * @param valuesSorted the sorted list of values // */ // private void abstractValueDescFromAxisAndDraw(boolean xAxis) { // int segmentDisp, lastDrawnSegmentDisp; // // if /* thisIsDescAxis */ ((xAxis && axisConfig.isxDescription()) || (!xAxis && !axisConfig.isxDescription())) { // // if (axisConfig.drawDescriptionAxis()) drawAxisLine(xAxis); // if (true) { // lastDrawnSegmentDisp = -axisConfig.getDescSegment()/2; // for (int i = 0; i < desc.length; i++) { // segmentDisp = (i * axisConfig.getDescSegment()) + (axisConfig.getDescSegment()/2); // String value; // if (xAxis) value = desc[i]; // else value = desc[desc.length-i-1]; // yAxis is drawn from bottom to top, therefore invert computation direction // // axisConfig.activateDescriptionAxis(); // lastDrawnSegmentDisp = drawMarkerTextIfThereIsEnoughSpace(xAxis, segmentDisp, lastDrawnSegmentDisp, value); // } // } // } // else /* thisIsValueAxis */ { // // if (axisConfig.drawValueAxis()) drawAxisLine(xAxis); // if (true) { // Double[] valuesToDisplay; // if (axisConfig.drawValueAxisMarkersAll()) { // if (axisConfig.getValueSegment() < 1) valuesToDisplay = Utils.createDoubleArrayFromTo(minVal, maxVal, Math.ceil(1/axisConfig.getValueSegment())); // else valuesToDisplay = Utils.createDoubleArrayFromTo(minVal, maxVal); // } // else valuesToDisplay = valuesSorted; // // lastDrawnSegmentDisp = (int) (valuesToDisplay[0] * axisConfig.getValueSegment() - 100); // Start at the lowest possible number // for (Double v : valuesToDisplay) { // segmentDisp = (int) calculateValuePos(v, axisConfig.getValueSegment()); // // valueStringToDisplay is the String representation of the value (".0" should not be displayed) // String valueStringToDisplay = (Math.round(v) == v) ? String.valueOf(Math.round(v)) : String.valueOf(v); // if (axisConfig.drawValueAxisMarkersAll()) { // int oldLength = valueStringToDisplay.length(); // if (oldLength > 2) { // valueStringToDisplay = valueStringToDisplay.substring(0, 2); // for (int i = 0; i < oldLength-2; i++) valueStringToDisplay += "0"; // } // } // // if (value == 0) continue; // 0 is not displayed because it would overlap with the arrow end // // axisConfig.activateValueAxis(); // lastDrawnSegmentDisp = drawMarkerTextIfThereIsEnoughSpace(xAxis, segmentDisp, lastDrawnSegmentDisp, valueStringToDisplay); // } // } // } // } // // /** // * Draws text descriptions of axes only if there is enough space for it. // */ // private int drawMarkerTextIfThereIsEnoughSpace(boolean xAxis, int segmentDisp, int lastDrawnSegmentDisp, String valueAsString) { // boolean drawMarker = false; // // If text should be displayed markers where there would be no space for the text are not drawn // // if (axisConfig.drawActiveAxisMarkerText()) { // int textSpaceNeeded; // if (xAxis) textSpaceNeeded = base.textWidth(valueAsString); // else textSpaceNeeded = base.textHeight(); // if ((segmentDisp - lastDrawnSegmentDisp) >= textSpaceNeeded) { // drawMarker = true; // lastDrawnSegmentDisp = segmentDisp; // } // // } // else drawMarker = true; // // if (drawMarker) drawAxisMarker(xAxis, segmentDisp, valueAsString); // return lastDrawnSegmentDisp; // } // //TODO isnt working properly now // public void enableLegend(Position position) { // this.drawLegend = true; // this.legendPos = getLegendPosition(position); // } // // public void disableLegend() { // this.drawLegend = false; // } // // private void drawLegend() { // base.drawRectangle(legendPos.x, legendPos.y, legendPos.width, legendPos.height); // } // // private Rectangle getLegendPosition(Position position) { // // Calculate size of the legend // final Rectangle innerLegendBorder = new Rectangle(10, 10, 10, 10); // int legendWidth = innerLegendBorder.x + innerLegendBorder.width; // int legendHeight = innerLegendBorder.y + innerLegendBorder.height; // final int legendSpace = 10; // // int textWidth; // for (String v : desc) { // legendHeight += base.textHeight(); // textWidth = base.textWidth(v) + innerLegendBorder.x + innerLegendBorder.width; // if (textWidth > legendWidth) legendWidth = textWidth; // } // // // The outerBorder of the plot must be adjusted to free space for the legend // int borderX = canvas.getOuterLeftPos(); // int borderY = canvas.getOuterUpPos(); // int borderW = canvas.getOuterRightBorderWidth(); // int borderH = canvas.getOuterDownBorderHeight(); // // if (position == Position.LEFT) borderX += legendWidth + legendSpace; // else if (position == Position.RIGHT) borderW += legendWidth + legendSpace; // else if (position == Position.UP) borderY += legendHeight + legendSpace; // else if (position == Position.DOWN) borderH += legendHeight + legendSpace; // // canvas.setBorder(borderX, borderY, borderW, borderH, AxisConfig.ARROW_DISTANCE); // // // Calculate and return the position of the legend rectangle // final int x, y; // if (position == Position.LEFT || position == Position.RIGHT) { // y = (canvas.getInnerDownPos() - legendHeight) / 2; // if (position == Position.LEFT) { // x = 1; // } else { // x = canvas.getInnerRightPos() - legendWidth - legendSpace/2; // } // } else { // x = (canvas.getInnerRightPos() - legendWidth) / 2; // if (position == Position.UP) { // y = 1; // } else { // y = canvas.getInnerDownPos() - legendHeight - legendSpace/2; // } // } // return new Rectangle(x, y, legendWidth, legendHeight); // } public final void drawPlotAndDescValueAxis(boolean xIsDescription, boolean drawBars, boolean drawLines, boolean drawPoints) { axisConfig.setxIsDescription(xIsDescription); setupAxis(); calculateAdditionalSpaceForYAxisTextWidth(); // log.debug("yIsDescription: " + yIsDescription + ", descSegment: " + axisConfig.getDescSegment() + ", valueSegment: " + axisConfig.getValueSegment()); // log.debug("valueRange: " + valueRange + ", barsCount: " + elementCount + ", SourceAxisPos/DescAxisPos: " + axisConfig.getDescAxisPos() + ", BarStart/ValueAxisPos: " + axisConfig.getValueAxisPos()); if (drawBars) drawBars(xIsDescription, values, axisConfig.getDescAxisPos(), axisConfig.getValueAxisPos(), axisConfig.getValueSegment(), axisConfig.getDescSegment(), colors); if (drawLines) drawLineOrPoints(xIsDescription, values, axisConfig.getDescAxisPos(), axisConfig.getValueAxisPos(), axisConfig.getValueSegment(), axisConfig.getDescSegment(), colors, true); if (drawPoints) drawLineOrPoints(xIsDescription, values, axisConfig.getDescAxisPos(), axisConfig.getValueAxisPos(), axisConfig.getValueSegment(), axisConfig.getDescSegment(), colors, false); if (axisConfig.showAxis()) drawAxis(xIsDescription, axisConfig.getDescAxisPos(), axisConfig.getValueAxisPos(), axisConfig.getValueSegment(), axisConfig.getDescSegment()); // canvas.draw(base); } private void setupAxis() { final Double valueRange = Math.max(1.0, maxVal - minVal); // The range is >=1 (otherwise nothing will be drawn) Double negativeRange = 0.0; if (minVal > 0) negativeRange = 0.0; if (minVal < 0) { if (maxVal < 0) negativeRange = valueRange; else negativeRange = -minVal; } int elementCount = desc.length; // Amount of bars/lines/... for (Double[] vArray : values) { if (vArray.length > elementCount) elementCount = vArray.length; } // Calculate some necessary variables to draw the bars (these variables abstract from horizontal/vertical to a relative point of view) if (axisConfig.isxDescription()) { axisConfig.setDescSegment(canvas.getInnerHorizontalDrawspace() / elementCount); axisConfig.setValueSegment(canvas.getInnerVerticalDrawspace() / (valueRange)); axisConfig.setDescAxisPos((int) (canvas.getInnerDownPos() - axisConfig.getValueSegment() * negativeRange)); axisConfig.setValueAxisPos(canvas.getInnerLeftPos()); } else { axisConfig.setDescSegment(canvas.getInnerVerticalDrawspace() / elementCount); axisConfig.setValueSegment(canvas.getInnerHorizontalDrawspace() / (valueRange)); axisConfig.setDescAxisPos((int) (canvas.getInnerLeftPos() + axisConfig.getValueSegment() * negativeRange)); axisConfig.setValueAxisPos(canvas.getInnerUpPos()); } } private final void drawAxis(boolean xIsDescription, int sourceAxisPos, int valueAxisPos, Double valueSegment, int descSegment) { List xpoints = new ArrayList(); List xtext = new ArrayList(); List ypoints = new ArrayList(); List ytext = new ArrayList(); int lineIterator = valueAxisPos + descSegment / 2; for (String d : desc) { if (xIsDescription) { xpoints.add(lineIterator); xtext.add(d); } else { ypoints.add(lineIterator); ytext.add(d); } lineIterator += descSegment; } for (Double v : valuesShownOnAxisSorted) { int linePos = (int) calculateValuePos(v, valueSegment); if (xIsDescription) { ypoints.add(sourceAxisPos - linePos); ytext.add(String.valueOf(v)); } else { xpoints.add(sourceAxisPos + linePos); xtext.add(String.valueOf(v)); } } drawAxisLine(); drawGraylines(xpoints, ypoints); drawMarkers(xpoints, ypoints); drawMarkerTexts(xpoints, xtext, ypoints, ytext); } /** * Method to draw one line (which one is specified by the boolean xAxis variable) * @param xAxis * @param drawArrows */ private void drawAxisLine() { if (axisConfig.drawXAxis()) { final int x1 = canvas.getInnerLeftPos(); final int x2 = canvas.getInnerRightPos(); final int y = axisConfig.getxAxisPos(); base.drawLine(x1, y, x2, y); } if (axisConfig.drawYAxis()) { final int x = axisConfig.getyAxisPos(); final int y1 = canvas.getInnerUpPos(); final int y2 = canvas.getInnerDownPos(); base.drawLine(x, y1, x, y2); } } private void drawGraylines(List xpoints, List ypoints) { base.setForegroundAlpha(0.07f); boolean drawVerticalGraylines = axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkerGrayline() || !axisConfig.isxDescription() && axisConfig.drawValueAxisMarkerGrayline(); boolean drawHorizontalGraylines = !axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkerGrayline() || axisConfig.isxDescription() && axisConfig.drawValueAxisMarkerGrayline(); if (drawVerticalGraylines) { for (Integer x : xpoints) { base.drawLine(x, canvas.getInnerUpPos(), x, canvas.getInnerDownPos()); } } if (drawHorizontalGraylines) { for (Integer y : ypoints) { base.drawLine(canvas.getInnerLeftPos(), y, canvas.getInnerRightPos(), y); } } base.setForegroundAlpha(Constants.ALPHA_NO_TRANSPARENCY); } private void drawMarkers(List xpoints, List ypoints) { boolean drawVerticalMarkers = axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkers() || !axisConfig.isxDescription() && axisConfig.drawValueAxisMarkers(); boolean drawHorizontalMarkers = !axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkers() || axisConfig.isxDescription() && axisConfig.drawValueAxisMarkers(); if (drawVerticalMarkers) { for (Integer x : xpoints) { base.drawLine(x, axisConfig.getxAxisPos(), x, axisConfig.getxAxisPos() + AxisConfig.ARROW_SIZE); } } if (drawHorizontalMarkers) { for (Integer y : ypoints) { base.drawLine(axisConfig.getyAxisPos() - AxisConfig.ARROW_SIZE, y, axisConfig.getyAxisPos(), y); } } } private void drawMarkerTexts(List xpoints, List xtext, List ypoints, List ytext) { boolean drawVerticalMarkerTexts = axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkerText() || !axisConfig.isxDescription() && axisConfig.drawValueAxisMarkerText(); boolean drawHorizontalMarkerTexts = !axisConfig.isxDescription() && axisConfig.drawDescriptionAxisMarkerText() || axisConfig.isxDescription() && axisConfig.drawValueAxisMarkerText(); if (drawVerticalMarkerTexts) { for (int i = 0; i < xpoints.size(); i++) { base.print(xtext.get(i), xpoints.get(i), axisConfig.getxAxisPos() + AxisConfig.ARROW_DISTANCE, AlignHorizontal.CENTER); } } if (drawHorizontalMarkerTexts) { for (int i = 0; i < ypoints.size(); i++) { base.print(ytext.get(i), axisConfig.getyAxisPos() - 8, ypoints.get(i) + base.textHeight()/2, AlignHorizontal.RIGHT); } } } private final void drawLineOrPoints(boolean xIsDescription, Double[][] values, int sourceAxisPos, int valueAxisPos, Double valueSegment, int descSegment, List colors, boolean line) { int cIndex = 0; for (int valueIndex = 0; valueIndex < values.length; valueIndex++) { Double[] vArray = values[valueIndex]; int actualValPos; int lineIterator = valueAxisPos + descSegment / 2; List points = new ArrayList(); for (Double v : vArray) { actualValPos = (int) calculateValuePos(v, valueSegment); if (xIsDescription) { points.add(new Point(lineIterator, sourceAxisPos - actualValPos)); } else { points.add(new Point(sourceAxisPos + actualValPos, lineIterator)); } lineIterator += descSegment; } if (cIndex >= colors.size()) cIndex = 0; // Restart with first color if all colors in the array has been used base.setForegroundColor(colors.get(cIndex)); if (line) { for (int i = 0; i < points.size() - 1; i++) { Point point1 = points.get(i); Point point2 = points.get(i+1); base.drawLine(point1.x, point1.y, point2.x, point2.y); } } else { for (int i = 0; i < points.size(); i++) { Point point = points.get(i); base.drawCircle(point.x, point.y, 2); } } //print titleCol base.setForegroundColor(Utils.darkenColor(colors.get(cIndex), 75)); base.print(title[valueIndex], points.get(points.size()-1).x, points.get(points.size()-1).y, AlignHorizontal.CENTER); cIndex++; } base.resetColorSettings(); } private final void drawBars(boolean xIsDescription, Double[][] values, int sourceAxisPos, int valueAxisPos, Double valueSegment, int descSegment, List colors) { int barLength; int valueRowAmount = values.length; for(int vIndex = 0; vIndex < valueRowAmount; vIndex++) { int cIndex = 0; int subBarIterator = valueAxisPos; int titleIndex=0; for (Double v : values[vIndex]) { if (cIndex >= colors.size()) cIndex = 0; // Restart with first color if all colors in the array has been used base.setForegroundColor(colors.get(cIndex)); base.setForegroundAlpha(Constants.ALPHA_FULL_TRANSPARENCY); base.setBackgroundColor(colors.get(cIndex)); barLength = (int) calculateValuePos(v, valueSegment); int barWidth=0; int ownvar = vIndex*(int)Math.round((double)descSegment/valueRowAmount); //calculate last bar width, fixing rounding errors if(vIndex==valueRowAmount-1) barWidth=(subBarIterator+descSegment)-(subBarIterator+ownvar); else barWidth=(int)Math.round((double)descSegment/valueRowAmount); if (xIsDescription) { if (barLength > 0) base.drawRectangle(subBarIterator+ownvar, (sourceAxisPos - barLength), barWidth, barLength); else base.drawRectangle(subBarIterator+ownvar, sourceAxisPos, barWidth, -barLength); } else { if (barLength > 0) base.drawRectangle(sourceAxisPos, subBarIterator+ownvar, barLength, barWidth); else base.drawRectangle((sourceAxisPos + barLength), subBarIterator+ownvar, -barLength, barWidth); } subBarIterator += descSegment; titleIndex++; cIndex++; } } base.resetColorSettings(); } public final void drawPiePlot(boolean horizontal) { Double valueSum = 0.0; for (Double v : values[0]) { valueSum+=Math.abs(v); } final Point ulCorner; final int diameter; int height = canvas.getInnerVerticalDrawspace(); int width = canvas.getInnerHorizontalDrawspace(); diameter = height>width?width:height; ulCorner = new Point(canvas.getInnerLeftPos(), canvas.getInnerUpPos()); drawPieArcs(horizontal, values[0], desc, ulCorner, diameter, valueSum, colors); } private final void drawPieArcs(boolean horizontal, Double[] values, String[] desc, Point ulCorner, int diameter, Double valueSum, List colors) { int cIndex = 0; Double arcAngle = 0D; Double startAngle = 0D; for (int i = 0; i < values.length; i++) { if (cIndex >= colors.size()) cIndex = 0; // Restart with first color if all colors in the array has been used base.setForegroundAlpha(Constants.ALPHA_FULL_TRANSPARENCY); base.setBackgroundColor(colors.get(cIndex)); arcAngle = ((i < values.length - 1) ? Math.round(360.0/valueSum * Math.abs(values[i]) ) : 360 - startAngle); //System.out.println("val: "+values[i]+" winkel: "+arcAngle); int height = canvas.getInnerVerticalDrawspace(); int width = canvas.getInnerHorizontalDrawspace(); base.drawArcPie(ulCorner.x+width/2-diameter/2, ulCorner.y+height/2-diameter/2, diameter, diameter, startAngle.floatValue(), arcAngle.floatValue()); base.setForegroundAlpha(1); double radians=(360 - startAngle + (360 - arcAngle / 2)) * Math.PI / 180.0; int value_x = (int)((diameter / 2 ) * Math.cos(radians)) + ulCorner.x + diameter / 2 + width/2-diameter/2; int value_y = (int)((diameter / 2 ) * Math.sin(radians)) + ulCorner.y + diameter / 2 + height/2-diameter/2; base.setForegroundColor(Utils.darkenColor(colors.get(cIndex), 75)); base.setForegroundAlpha(Constants.ALPHA_NO_TRANSPARENCY); base.print(desc[i], value_x, value_y, AlignHorizontal.CENTER); //System.out.println("value_x: "+value_x+" / value_y:"+value_y); startAngle += arcAngle; cIndex++; } base.resetColorSettings(); } private void calculateAdditionalSpaceForYAxisTextWidth() { int maxWidth = 0; int valueWidth; if (axisConfig.isxDescription()) { // y-axis contains values if (axisConfig.drawValueAxisMarkerText()) { for (Double v : valuesShownOnAxisSorted) { valueWidth = base.textWidth(String.valueOf(v)); if (valueWidth > maxWidth) maxWidth = valueWidth; } } } else { // y-axis contains description if (axisConfig.drawDescriptionAxisMarkerText()) { for (String d : desc) { valueWidth = base.textWidth(d); if (valueWidth > maxWidth) maxWidth = valueWidth; } } } int adjustValue = maxWidth + canvas.getOuterLeftPos() - (axisConfig.getyAxisPos() - canvas.getInnerLeftPos()) - 5; if (adjustValue > canvas.getOuterLeftPos()) { canvas.setBorderX(adjustValue); setupAxis(); // If the y-axis is not exactly over the innerleft-border, it will be displaced by the last setupAxis() call and therefore the additional space for it must be recalculated again if ((axisConfig.getyAxisPos() - canvas.getInnerLeftPos()) != 0) { adjustValue = maxWidth + canvas.getOuterLeftPos() - (axisConfig.getyAxisPos() - canvas.getInnerLeftPos()) - 5; if (adjustValue > canvas.getOuterLeftPos()) { canvas.setBorderX(adjustValue); setupAxis(); } } } } /** * Calculated value * valueSegment but account for displacements of values if all values are positive or negativ (= positive minVal or negative maxVal) */ public double calculateValuePos(double value, double valueSegment) { if (value > 0 && minVal > 0) value -= minVal; else if (value < 0 && maxVal < 0) value -= maxVal; return value * valueSegment; } public void setValues(String[] desc, String[] title, Double[][] values, List colors) { this.desc = desc; this.title = title; this.colors = colors; this.values = values; valuesSorted = new TreeSet(); for (Double[] vArray : values) { for (Double v : vArray) { valuesSorted.add(v); } } valuesShownOnAxisSorted = axisConfig.setValueAxisList(valuesSorted); this.minVal = minRealOrShownValue(); this.maxVal = maxRealOrShownValue(); } public void setMinValue(Double minVal) throws IOException { Double limit = Math.min(minRealOrShownValue(), maxVal); if (minVal > limit) throw new IOException("minValue must be <= " + limit); else this.minVal = minVal; } public void setMaxValue(Double maxVal) throws IOException { Double limit = Math.max(maxRealOrShownValue(), minVal); if (maxVal < limit) throw new IOException("maxValue must be >= " + limit); else this.maxVal = maxVal; } private double minRealOrShownValue() { if (valuesShownOnAxisSorted.isEmpty()) return valuesSorted.first(); else return Math.min(valuesSorted.first(), valuesShownOnAxisSorted.first()); } private double maxRealOrShownValue() { if (valuesShownOnAxisSorted.isEmpty()) return valuesSorted.last(); else return Math.max(valuesSorted.last(), valuesShownOnAxisSorted.last()); } public Canvas getCanvas() { return canvas; } public AxisConfig getAxisConfig() { return axisConfig; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/0000755000175000001440000000000011576116036022545 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Macro.java0000644000175000001440000000313111576116034024445 0ustar benuserspackage com.baselet.diagram.command; import java.util.Vector; import com.baselet.diagram.DiagramHandler; public class Macro extends Command { private Vector _commands; public Vector getCommands() { return _commands; } public Macro(Vector v) { _commands = v; } @Override public void execute(DiagramHandler handler) { super.execute(handler); for (int i = 0; i < _commands.size(); i++) { Command c = _commands.elementAt(i); c.execute(handler); } } @Override public void undo(DiagramHandler handler) { super.undo(handler); for (int i = 0; i < _commands.size(); i++) { Command c = _commands.elementAt(i); c.undo(handler); } } @Override public boolean isMergeableTo(Command c) { if (!(c instanceof Macro)) return false; Macro m = (Macro) c; Vector v = m.getCommands(); if (this.getCommands().size() != v.size()) return false; for (int i = 0; i < this.getCommands().size(); i++) { Command c1 = this.getCommands().elementAt(i); Command c2 = v.elementAt(i); if (!(c1.isMergeableTo(c2))) return false; } return true; } @Override public Command mergeTo(Command c) { Macro m = (Macro) c; Vector v = m.getCommands(); Vector vectorOfCommands = new Vector(); Command ret = new Macro(vectorOfCommands); for (int i = 0; i < this.getCommands().size(); i++) { Command c1 = this.getCommands().elementAt(i); Command c2 = v.elementAt(i); Command c3 = c1.mergeTo(c2); vectorOfCommands.add(c3); } return ret; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Cut.java0000644000175000001440000000364011576116034024144 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.control.ClipBoard; import com.baselet.control.Constants; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class Cut extends Command { private Vector entities; private Point origin; public Cut() { } @Override public void execute(DiagramHandler handler) { super.execute(handler); if (this.entities == null) { this.entities = new Vector(); this.entities.addAll(handler.getDrawPanel().getSelector().getSelectedEntities()); } if (this.entities.isEmpty()) return; // AB: clipboard copy scales the entities to 100%, so we don't have to do it manually ClipBoard.getInstance().copy(this.entities, handler); (new RemoveElement(this.entities, false)).execute(handler); // AB: copy origin and zoom it to 100% origin = handler.getDrawPanel().getOriginAtDefaultZoom(); handler.getDrawPanel().updatePanelAndScrollbars(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); // We must zoom to the defaultGridsize before execution int oldZoom = handler.getGridSize(); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); int offsetX = origin.x - handler.getDrawPanel().getOriginAtDefaultZoom().x; int offsetY = origin.y - handler.getDrawPanel().getOriginAtDefaultZoom().y; for (GridElement e : this.entities) { (new AddElement(e, handler.realignToGrid(true, e.getX() + offsetX), handler.realignToGrid(true, e.getY() + offsetY))).execute(handler); } handler.getDrawPanel().repaint(); // And zoom back to the oldGridsize after execution handler.setGridAndZoom(oldZoom, false); handler.getDrawPanel().getSelector().select(entities); // undo selects the cutted entities handler.getDrawPanel().updatePanelAndScrollbars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/UnGroup.java0000644000175000001440000000145611576116034025013 0ustar benusers// Class by A.Mueller Oct.05 package com.baselet.diagram.command; import java.util.Vector; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.Selector; import com.baselet.element.GridElement; import com.baselet.element.Group; public class UnGroup extends Command { Group _group; Vector members; public UnGroup(Group group) { _group = group; members = new Vector(); members.addAll(_group.getMembers()); } @Override public void execute(DiagramHandler handler) { super.execute(handler); _group.ungroup(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); Selector s = handler.getDrawPanel().getSelector(); if (s == null) return; s.deselectAll(); _group.setHandler(handler); _group.group(this.members); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/ChangeState.java0000644000175000001440000000456111576116034025602 0ustar benuserspackage com.baselet.diagram.command; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; import com.baselet.gui.OwnSyntaxPane; public class ChangeState extends Command { private GridElement _entity; public GridElement getEntity() { return _entity; } private String _newState; private String _oldState; private int _oldCaret; private int _newCaret; public String getNewState() { return _newState; } public String getOldState() { return _oldState; } public int getOldCaret() { return _oldCaret; } public int getNewCaret() { return _newCaret; } public ChangeState(GridElement e, String oldState, String newState, int oldCaret, int newCaret) { _entity = e; _newState = newState; _oldState = oldState; _newCaret = newCaret; _oldCaret = oldCaret; } @Override public void execute(DiagramHandler handler) { super.execute(handler); _entity.setPanelAttributes(_newState); _entity.repaint(); GridElement gridElement = Main.getInstance().getEditedGridElement(); if (gridElement != null && gridElement.equals(_entity)) { OwnSyntaxPane pane = Main.getInstance().getGUI().getPropertyPane(); pane.setText(gridElement.getPanelAttributes()); if (pane.getText().length() >= _newCaret) { pane.setCaretPosition(_newCaret); } } } @Override public void undo(DiagramHandler handler) { //AB: Do not call super.undo() which would deselect the entity //super.undo(handler); _entity.setPanelAttributes(_oldState); _entity.repaint(); GridElement gridElement = Main.getInstance().getEditedGridElement(); if (gridElement != null && gridElement.equals(_entity)) { OwnSyntaxPane pane = Main.getInstance().getGUI().getPropertyPane(); pane.setText(gridElement.getPanelAttributes()); if (pane.getText().length() >= _oldCaret) { pane.setCaretPosition(_oldCaret); } } } @Override public boolean isMergeableTo(Command c) { //method is not mergeable (to allow undo of property changes) return false; } @Override public Command mergeTo(Command c) { ChangeState tmp = (ChangeState) c; ChangeState ret = new ChangeState(this.getEntity(), tmp.getOldState(), this.getNewState(), tmp.getOldCaret(), this.getNewCaret()); return ret; } @Override public String toString() { return "Changestate from " + getOldState() + " to " + getNewState(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/ChangeColor.java0000644000175000001440000000201511576116034025570 0ustar benuserspackage com.baselet.diagram.command; import java.util.HashMap; import java.util.Map; import java.util.Vector; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class ChangeColor extends Command { Map entities; String color; Boolean fg; public ChangeColor(String color, boolean fg) { this.color = color; this.fg = fg; } @Override public void execute(DiagramHandler handler) { super.execute(handler); if (this.entities == null) { Vector es = handler.getDrawPanel().getSelector().getSelectedEntities(); this.entities = new HashMap(); for (GridElement e : es) this.entities.put(e, e.getFGColorString()); } for (GridElement ent : entities.keySet()) { ent.setColor(color, fg); } } @Override public void undo(DiagramHandler handler) { super.undo(handler); for (GridElement ent : entities.keySet()) { ent.setColor(this.entities.get(ent), fg); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Align.java0000644000175000001440000000704111576116034024442 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.HashMap; import java.util.Map; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.baselet.element.Group; public class Align extends Command { private enum Edge { RIGHT, LEFT, TOP, BOTTOM; } private Point origin; private GridElement dominantEntity; private Vector entities; private Map orgLocations = new HashMap(); private Edge edge; public Align(Vector entities, GridElement dominantEntity, String edge) { this.dominantEntity = dominantEntity; this.entities = new Vector(entities); this.edge = Edge.valueOf(edge.toUpperCase()); } @Override public void execute(DiagramHandler handler) { super.execute(handler); if ((this.entities.size() == 0) || (dominantEntity == null)) return; // We must zoom to the defaultGridsize before execution int oldZoom = handler.getGridSize(); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); // AB: determine fix points first item (the "dominantly selected" item) GridElement entity = dominantEntity; int left = entity.getX(); int right = left + entity.getWidth(); int top = entity.getY(); int bottom = top + entity.getHeight(); DrawPanel p = handler.getDrawPanel(); for (GridElement e : this.entities) { int x = e.getX(); int y = e.getY(); switch (edge) { case LEFT: x = left; break; case RIGHT: x = right - e.getWidth(); break; case TOP: y = top; break; case BOTTOM: y = bottom - e.getHeight(); break; } // AB: update group members position if group has been adjusted if (e instanceof Group) { Point diff = new Point(x - e.getX(), y - e.getY()); moveGroupMembers((Group) e, diff, handler); } orgLocations.put(e, e.getLocation()); e.setLocation(handler.realignToGrid(true, x), handler.realignToGrid(true, y)); } // And zoom back to the oldGridsize after execution handler.setGridAndZoom(oldZoom, false); // AB: copy origin and zoom it to 100% origin = handler.getDrawPanel().getOriginAtDefaultZoom(); p.updatePanelAndScrollbars(); p.repaint(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); // We must zoom to the defaultGridsize before execution int oldZoom = handler.getGridSize(); handler.setGridAndZoom(Constants.DEFAULTGRIDSIZE, false); int offsetX = origin.x - handler.getDrawPanel().getOrigin().x; int offsetY = origin.y - handler.getDrawPanel().getOrigin().y; for (GridElement entity : entities) { Point orgLocation = orgLocations.get(entity); if (entity instanceof Group) { Point diff = new Point(orgLocation.x - entity.getX() + offsetX, orgLocation.y - entity.getY() + offsetY); moveGroupMembers((Group) entity, diff, handler); } entity.setLocation(handler.realignToGrid(true, orgLocation.x + offsetX), handler.realignToGrid(true, orgLocation.y + offsetY)); } // And zoom back to the oldGridsize after execution handler.setGridAndZoom(oldZoom, false); handler.getDrawPanel().updatePanelAndScrollbars(); handler.getDrawPanel().repaint(); } private void moveGroupMembers(Group g, Point diff, DiagramHandler handler) { Vector members = g.getMembers(); for (GridElement member : members) { member.changeLocation(handler.realignToGrid(true, diff.x), handler.realignToGrid(true, diff.y)); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Copy.java0000644000175000001440000000163211576116034024322 0ustar benuserspackage com.baselet.diagram.command; import java.util.Vector; import com.baselet.control.ClipBoard; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class Copy extends Command { private Vector entities; public Copy() { } @Override public void execute(DiagramHandler handler) { // dont execute super.execute() because no change of diagram is required. if (this.entities == null) { this.entities = new Vector(); for (GridElement e : handler.getDrawPanel().getSelector().getSelectedEntities()) this.entities.add(e.CloneFromMe()); } // if (entities.isEmpty()) return; UNCOMMENTED TO ALLOW COPY FULL DIAGRAM TO CLIPBOARD WITHOUT SELECTING ANYTHING ClipBoard.getInstance().copy(this.entities, handler); } @Override public void undo(DiagramHandler handler) { super.undo(handler); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/RemoveLinePoint.java0000644000175000001440000000224611576116034026471 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.diagram.DiagramHandler; import com.umlet.element.Relation; public class RemoveLinePoint extends Command { private Relation _relation; private int _where; private int _x; private int _y; public Relation getRelation() { return _relation; } public int getWhere() { return _where; } private int getX() { return _x * _relation.getHandler().getGridSize(); } private int getY() { return _y * _relation.getHandler().getGridSize(); } public RemoveLinePoint(Relation r, int i) { _relation = r; _where = i; Point p = r.getLinePoints().elementAt(i); _x = p.x / _relation.getHandler().getGridSize(); _y = p.y / _relation.getHandler().getGridSize(); } @Override public void execute(DiagramHandler handler) { super.execute(handler); Vector tmp = _relation.getLinePoints(); tmp.removeElementAt(_where); _relation.repaint(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); Vector tmp = _relation.getLinePoints(); tmp.insertElementAt(new Point(getX(), getY()), _where); _relation.repaint(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/RemoveElement.java0000644000175000001440000000454311576116034026163 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.control.Constants; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.baselet.element.Group; public class RemoveElement extends Command { private Vector _entities; private Point origin; private boolean _zoom; public RemoveElement(GridElement e) { this(e, true); } public RemoveElement(GridElement e, boolean zoom) { _entities = new Vector(); _entities.add(e); _zoom = zoom; handleGroups(); } public RemoveElement(Vector v) { this(v, true); } public RemoveElement(Vector v, boolean zoom) { _entities = new Vector(); _entities.addAll(v); _zoom = zoom; handleGroups(); } private void handleGroups() { for (int i = 0; i < _entities.size(); i++) { GridElement e = _entities.elementAt(i); if (e instanceof Group) { Group g = (Group) e; Vector groupElements = g.getMembers(); _entities.addAll(groupElements); } } } @Override public void execute(DiagramHandler handler) { super.execute(handler); if (this._entities.size() == 0) return; DrawPanel p = handler.getDrawPanel(); for (GridElement e : this._entities) handler.getDrawPanel().remove(e); origin = handler.getDrawPanel().getOriginAtDefaultZoom(); if (_zoom) DiagramHandler.zoomEntities(handler.getGridSize(), Constants.DEFAULTGRIDSIZE, _entities); p.updatePanelAndScrollbars(); p.repaint(); p.getSelector().deselectAll(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); if (_zoom) DiagramHandler.zoomEntities(Constants.DEFAULTGRIDSIZE, handler.getGridSize(), _entities); int offsetX = origin.x - handler.getDrawPanel().getOriginAtDefaultZoom().x; int offsetY = origin.y - handler.getDrawPanel().getOriginAtDefaultZoom().y; offsetX = offsetX * handler.getGridSize() / Constants.DEFAULTGRIDSIZE; offsetY = offsetY * handler.getGridSize() / Constants.DEFAULTGRIDSIZE; for (GridElement e : this._entities) { (new AddElement(e, handler.realignToGrid(e.getX() + offsetX), handler.realignToGrid(e.getY() + offsetY), _zoom)).execute(handler); } handler.getDrawPanel().updatePanelAndScrollbars(); handler.getDrawPanel().repaint(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Search.java0000644000175000001440000000337311576116034024621 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Color; import java.awt.Point; import java.awt.Rectangle; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.Selector; import com.baselet.element.GridElement; public class Search extends Command { static Color _failed = new Color(227, 127, 127); static Color _success = new Color(148, 172, 251); private String regex; private Pattern pattern; public Search(String regex) { this.regex = ".*(" + regex.toLowerCase() + ").*"; } @Override public void execute(DiagramHandler handler) { super.execute(handler); Selector s = handler.getDrawPanel().getSelector(); s.deselectAll(); DrawPanel d = handler.getDrawPanel(); Vector entities = d.getAllEntities(); pattern = Pattern.compile(regex); Matcher m; for (int i = 0; i < entities.size(); i++) { GridElement e = entities.get(i); m = pattern.matcher(e.getPanelAttributes().toLowerCase()); if (m.find()) { while (e.isPartOfGroup()) e = e.getGroup(); s.select(e); } } if (s.getSelectedEntities().size() == 0) return; Rectangle panelview = d.getVisibleRect(); Point p = null; for (GridElement e : s.getSelectedEntities()) { if (panelview.contains(e.getBounds())) { p = new Point(0, 0); break; } else if (p == null) p = new Point(e.getX() - panelview.x - 10, e.getY() - panelview.y - 10); } if (p != null) d.changeViewPosition(p.x, p.y); } @Override public void undo(DiagramHandler handler) { super.undo(handler); handler.getDrawPanel().getSelector().deselectAll(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Command.java0000644000175000001440000000101211576116034024756 0ustar benuserspackage com.baselet.diagram.command; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.Selector; public abstract class Command { public void execute(DiagramHandler handler) { } public void undo(DiagramHandler handler) { if (handler != null) { Selector selector = handler.getDrawPanel().getSelector(); if (selector != null) { selector.deselectAll(); } } } public boolean isMergeableTo(Command c) { return false; } public Command mergeTo(Command c) { return null; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/MoveLinePoint.java0000644000175000001440000000333411576116034026141 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import com.baselet.diagram.DiagramHandler; import com.umlet.element.Relation; public class MoveLinePoint extends Command { private Relation _relation; private int _linePointId, _diffx, _diffy; public int getLinePointId() { return _linePointId; } public Relation getRelation() { return _relation; } public int getDiffX() { return _diffx * _relation.getHandler().getGridSize(); } public int getDiffY() { return _diffy * _relation.getHandler().getGridSize(); } public MoveLinePoint(Relation rel, int i, int diffx, int diffy) { _relation = rel; _linePointId = i; _diffx = diffx / rel.getHandler().getGridSize(); _diffy = diffy / rel.getHandler().getGridSize(); } @Override public void execute(DiagramHandler handler) { super.execute(handler); Point p = _relation.getLinePoints().elementAt(_linePointId); p.x = p.x + getDiffX(); p.y = p.y + getDiffY(); _relation.repaint(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); Point p = _relation.getLinePoints().elementAt(_linePointId); p.x = p.x - getDiffX(); p.y = p.y - getDiffY(); _relation.repaint(); } @Override public boolean isMergeableTo(Command c) { if (!(c instanceof MoveLinePoint)) return false; MoveLinePoint mlp = (MoveLinePoint) c; if (this.getRelation() != mlp.getRelation()) return false; if (this.getLinePointId() != mlp.getLinePointId()) return false; return true; } @Override public Command mergeTo(Command c) { MoveLinePoint tmp = (MoveLinePoint) c; MoveLinePoint ret = new MoveLinePoint(this.getRelation(), this.getLinePointId(), this.getDiffX() + tmp.getDiffX(), this.getDiffY() + tmp.getDiffY()); return ret; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Move.java0000644000175000001440000000306711576116034024322 0ustar benuserspackage com.baselet.diagram.command; import org.apache.log4j.Logger; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class Move extends Command { private final static Logger log = Logger.getLogger(Utils.getClassName()); private GridElement entity; private int _x, _y; public GridElement getEntity() { return entity; } private int getX() { int zoomedX = _x * entity.getHandler().getGridSize(); log.debug("Zoomed x: " + zoomedX); return zoomedX; } private int getY() { int zoomedY = _y * entity.getHandler().getGridSize(); log.debug("Zoomed y: " + zoomedY); return zoomedY; } public Move(GridElement e, int x, int y) { entity = e; _x = x / e.getHandler().getGridSize(); _y = y / e.getHandler().getGridSize(); log.debug("Base for (x,y): (" + _x + "," + _y + ")"); } @Override public void execute(DiagramHandler handler) { super.execute(handler); this.entity.changeLocation(getX(), getY()); } @Override public void undo(DiagramHandler handler) { super.undo(handler); this.entity.changeLocation(-getX(), -getY()); Main.getInstance().getDiagramHandler().getDrawPanel().updatePanelAndScrollbars(); } @Override public boolean isMergeableTo(Command c) { if (!(c instanceof Move)) return false; Move m = (Move) c; return this.entity == m.entity; } @Override public Command mergeTo(Command c) { Move m = (Move) c; Move ret = new Move(this.entity, this.getX() + m.getX(), this.getY() + m.getY()); return ret; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/CreateGroup.java0000644000175000001440000000143211576116034025626 0ustar benusers// Class by A.Mueller Oct.05 package com.baselet.diagram.command; import java.util.Vector; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; import com.baselet.element.Group; public class CreateGroup extends Command { private Group _group; private Vector _entities; public CreateGroup() { _group = new Group(); } @Override public void execute(DiagramHandler handler) { super.execute(handler); if (this._entities == null) { this._entities = new Vector(); this._entities.addAll(handler.getDrawPanel().getSelector().getSelectedEntities()); } _group.setHandler(handler); _group.group(this._entities); } @Override public void undo(DiagramHandler handler) { super.undo(handler); _group.ungroup(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Paste.java0000644000175000001440000000573411576116034024473 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.control.ClipBoard; import com.baselet.control.Constants; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; public class Paste extends Command { private Point origin; private Vector entities; private int viewpX = 0; private int viewpY = 0; @Override public void execute(DiagramHandler handler) { super.execute(handler); if (this.entities == null) { this.entities = new Vector(); for (GridElement e : ClipBoard.getInstance().paste()) { GridElement clone = e.CloneFromMe(); clone.setHandler(handler); this.entities.add(clone); } } // AB: first execution of paste if (origin == null) { origin = handler.getDrawPanel().getOriginAtDefaultZoom(); // AB: Include viewport position to paste on visible area Point viewp = handler.getDrawPanel().getScrollPane().getViewport().getViewPosition(); viewpX = handler.realignToGrid(false, (int) viewp.getX()) / handler.getGridSize(); viewpY = handler.realignToGrid(false, (int) viewp.getY()) / handler.getGridSize(); } if (this.entities.isEmpty()) return; DiagramHandler.zoomEntities(Constants.DEFAULTGRIDSIZE, handler.getGridSize(), entities); // Calculate the rectangle around the copied entities int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; for (GridElement e : this.entities) { minX = Math.min(e.getX(), minX); minY = Math.min(e.getY(), minY); } for (GridElement e : this.entities) { e.setStickingBorderActive(false); // Must use changeLocation instead of setLocation to make sure that groups are placed correctly e.changeLocation( viewpX * handler.getGridSize() - minX + handler.getGridSize() * Constants.PASTE_DISPLACEMENT_GRIDS, viewpY * handler.getGridSize() - minY + handler.getGridSize() * Constants.PASTE_DISPLACEMENT_GRIDS); } int offsetX = origin.x - handler.getDrawPanel().getOriginAtDefaultZoom().x; int offsetY = origin.y - handler.getDrawPanel().getOriginAtDefaultZoom().y; offsetX = offsetX * handler.getGridSize() / Constants.DEFAULTGRIDSIZE; offsetY = offsetY * handler.getGridSize() / Constants.DEFAULTGRIDSIZE; for (GridElement e : this.entities) { (new AddElement(e, handler.realignToGrid(e.getX() + offsetX), handler.realignToGrid(e.getY() + offsetY), false)).execute(handler); } handler.getDrawPanel().getSelector().deselectAll(); for (GridElement e : this.entities) handler.getDrawPanel().getSelector().select(e); handler.getDrawPanel().updatePanelAndScrollbars(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); DiagramHandler.zoomEntities(handler.getGridSize(), Constants.DEFAULTGRIDSIZE, entities); (new RemoveElement(this.entities, false)).execute(handler); handler.getDrawPanel().updatePanelAndScrollbars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/AddElement.java0000644000175000001440000000674711576116034025426 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.element.GridElement; import com.baselet.element.Group; public class AddElement extends Command { private final static Logger log = Logger.getLogger(Utils.getClassName()); // AB: checked false after first execution private boolean firstCall = true; private Point origin; private GridElement _entity; private int _x; private int _y; private boolean _zoom; private int getX() { // AB: use default grid size since we zoom the whole entity on execution if (_zoom) return _x * Constants.DEFAULTGRIDSIZE;// _entity.getHandler().getGridSize(); else return _x; } private int getY() { // AB: use default grid size since we zoom the whole entity on execution if (_zoom) return _y * Constants.DEFAULTGRIDSIZE;// _entity.getHandler().getGridSize(); else return _y; } public AddElement(GridElement e, int x, int y) { this(e, x, y, true); } public AddElement(GridElement e, int x, int y, boolean zoom) { _entity = e; _zoom = zoom; if (_zoom) { _x = x / e.getHandler().getGridSize(); _y = y / e.getHandler().getGridSize(); DiagramHandler.zoomEntity(e.getHandler().getGridSize(), Constants.DEFAULTGRIDSIZE, e); } else { _x = x; _y = y; } } private void addentity(GridElement e, DrawPanel panel, int x, int y) { e.setHandler(panel.getHandler()); panel.add(e); if (e instanceof Group) { Group g = (Group) e; for (GridElement ent : g.getMembers()) addentity(ent, panel, ent.getX() - g.getX() + x, ent.getY() - g.getY() + y); g.removeMemberListeners(); // remove listeners from submembers of this group if (_zoom) g.adjustSize(false); // Adjust cause problems if _zoom == false because the wrong zoomlevel would be assumed } e.setLocation(x, y); } @Override public void execute(DiagramHandler handler) { super.execute(handler); // AB: set origin for the first execution; // NOTE this cannot be done in constructor since we cannot rely that the handler in the constructor is the same as here if (origin == null) { origin = handler.getDrawPanel().getOriginAtDefaultZoom(); } // AB: calculate offset so that we add it on the same position on redo // NOTE the first time the command is executed, the offset is 0 int offsetX = origin.x - handler.getDrawPanel().getOriginAtDefaultZoom().x; int offsetY = origin.y - handler.getDrawPanel().getOriginAtDefaultZoom().y; log.debug("Add Entity at " + getX() + "/" + getY()); addentity(_entity, handler.getDrawPanel(), getX() + offsetX, getY() + offsetY); if (_zoom) DiagramHandler.zoomEntity(Constants.DEFAULTGRIDSIZE, handler.getGridSize(), _entity); handler.getDrawPanel().getSelector().singleSelect(_entity); // AB: do this because updatePanelAndScrollbars messes up frequent calls of AddEntity in a loop if (!firstCall) { handler.getDrawPanel().updatePanelAndScrollbars(); } firstCall = false; } @Override public void undo(DiagramHandler handler) { super.undo(handler); if (_zoom) DiagramHandler.zoomEntity(handler.getGridSize(), Constants.DEFAULTGRIDSIZE, _entity); handler.getDrawPanel().remove(_entity); (new RemoveElement(_entity, false)).execute(handler); // zoom must be false otherwise groups don't work correctly handler.getDrawPanel().repaint(); handler.getDrawPanel().updatePanelAndScrollbars(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/CustomCodePropertyChanged.java0000644000175000001440000000563611576116034030504 0ustar benuserspackage com.baselet.diagram.command; import com.baselet.control.Main; import com.baselet.diagram.CustomPreviewHandler; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.Selector; import com.baselet.element.GridElement; import com.baselet.gui.OwnSyntaxPane; public class CustomCodePropertyChanged extends Command { //private GridElement _entity; private String _newState; private String _oldState; private int _oldCaret; private int _newCaret; public String getNewState() { return _newState; } public String getOldState() { return _oldState; } public int getOldCaret() { return _oldCaret; } public int getNewCaret() { return _newCaret; } public CustomCodePropertyChanged(String oldState, String newState, int oldCaret, int newCaret) { _newState = newState; _oldState = oldState; _newCaret = newCaret; _oldCaret = oldCaret; } @Override public void execute(DiagramHandler handler) { super.execute(handler); GridElement gridElement = Main.getInstance().getEditedGridElement(); //select grid element if nothing is selected if (gridElement == null) { Selector selector = Main.getInstance().getGUI().getCurrentCustomHandler().getPreviewHandler().getDrawPanel().getSelector(); selector.selectAll(); if (selector.getSelectedEntities().size() >= 1) { gridElement = selector.getSelectedEntities().firstElement(); } } if (gridElement != null && gridElement.getHandler() instanceof CustomPreviewHandler) { gridElement.setPanelAttributes(_newState); OwnSyntaxPane pane = Main.getInstance().getGUI().getPropertyPane(); pane.setText(gridElement.getPanelAttributes()); if (pane.getText().length() >= _newCaret) { pane.setCaretPosition(_newCaret); } gridElement.repaint(); } } @Override public void undo(DiagramHandler handler) { //AB: Do not call super.undo() which would deselect the entity //super.undo(handler); GridElement gridElement = Main.getInstance().getEditedGridElement(); //select grid element if (gridElement == null) { Selector selector = Main.getInstance().getGUI().getCurrentCustomHandler().getPreviewHandler().getDrawPanel().getSelector(); selector.selectAll(); if (selector.getSelectedEntities().size() >= 1) { gridElement = selector.getSelectedEntities().firstElement(); } } if (gridElement != null && gridElement.getHandler() instanceof CustomPreviewHandler) { gridElement.setPanelAttributes(_oldState); OwnSyntaxPane pane = Main.getInstance().getGUI().getPropertyPane(); pane.setText(gridElement.getPanelAttributes()); if (pane.getText().length() >= _oldCaret) { pane.setCaretPosition(_oldCaret); } gridElement.repaint(); } } @Override public String toString() { return "Changestate from " + getOldState() + " to " + getNewState(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/HelpPanelChanged.java0000644000175000001440000000474011576116034026535 0ustar benuserspackage com.baselet.diagram.command; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; public class HelpPanelChanged extends Command { private String changed_to; private String changed_from; public HelpPanelChanged(String text) { this.changed_to = text; } private HelpPanelChanged(String changed_from, String changed_to) { this.changed_from = changed_from; this.changed_to = changed_to; } public static Integer getFontsize(String text) { if (text == null) return null; Pattern p = Pattern.compile("fontsize=([0-9]+)( .*)?"); Vector txt = Utils.decomposeStrings(text); for (String t : txt) { Matcher m = p.matcher(t); if (m.matches()) { if (t.contains("//")) t = t.split("//")[0]; return Integer.parseInt(m.group(1)); } } return null; } public static String getFontfamily(String text) { if (text == null) return null; Pattern p = Pattern.compile("fontfamily\\=(\\w+).*"); Vector txt = Utils.decomposeStrings(text); for (String t : txt) { Matcher m = p.matcher(t); if (m.matches()) { if (t.contains("//")) t = t.split("//")[0]; return m.group(1); } } return null; } @Override public void execute(DiagramHandler handler) { super.execute(handler); this.changed_from = handler.getHelpText(); handler.setHelpText(changed_to); Integer fontsize = getFontsize(changed_to); if (fontsize != null) handler.getFontHandler().setDiagramDefaultFontSize(fontsize); else handler.getFontHandler().resetDiagramDefaultFontSize(); String fontfamily = getFontfamily(changed_to); if (fontfamily != null) handler.getFontHandler().setDiagramDefaultFontFamily(fontfamily); else handler.getFontHandler().resetDiagramDefaultFontFamily(); handler.getDrawPanel().repaint(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); handler.setHelpText(changed_from); handler.getFontHandler().setDiagramDefaultFontSize(getFontsize(changed_from)); handler.getDrawPanel().repaint(); } @Override public boolean isMergeableTo(Command c) { if ((c instanceof HelpPanelChanged)) return true; return false; } @Override public Command mergeTo(Command c) { HelpPanelChanged tmp = (HelpPanelChanged) c; HelpPanelChanged ret = new HelpPanelChanged(tmp.changed_from, this.changed_to); return ret; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/Resize.java0000644000175000001440000001040111576116034024643 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.control.Main; import com.baselet.diagram.DiagramHandler; import com.baselet.element.GridElement; import com.baselet.element.StickingPolygon; import com.umlet.element.Relation; import com.umlet.element.relation.RelationLinePoint; public class Resize extends Command { private static int current_id = 0; private int id; private int diffx, diffy, diffw, diffh; private Vector linepoints; private Vector move_commands; private GridElement entity; private int getDiffx() { return diffx * entity.getHandler().getGridSize(); } private int getDiffy() { return diffy * entity.getHandler().getGridSize(); } private int getDiffw() { return diffw * entity.getHandler().getGridSize(); } private int getDiffh() { return diffh * entity.getHandler().getGridSize(); } public Resize(GridElement entity, int diffx, int diffy, int diffw, int diffh) { this(entity, diffx, diffy, diffw, diffh, null); } // resize for merge private Resize(GridElement entity, int id, int diffx, int diffy, int diffw, int diffh, Vector move_commands, Vector move_commands2) { this.entity = entity; this.id = id; this.move_commands = move_commands; this.move_commands.addAll(move_commands2); this.diffx = diffx / entity.getHandler().getGridSize(); this.diffy = diffy / entity.getHandler().getGridSize(); this.diffw = diffw / entity.getHandler().getGridSize(); this.diffh = diffh / entity.getHandler().getGridSize(); } public Resize(GridElement entity, int diffx, int diffy, int diffw, int diffh, Resize first) { this.entity = entity; this.move_commands = new Vector(); this.diffx = diffx / entity.getHandler().getGridSize(); this.diffy = diffy / entity.getHandler().getGridSize(); this.diffw = (diffw - diffx) / entity.getHandler().getGridSize(); this.diffh = (diffh - diffy) / entity.getHandler().getGridSize(); StickingPolygon from = this.entity.generateStickingBorder(this.entity.getX(), this.entity.getY(), this.entity.getWidth(), this.entity.getHeight()); // AB: FIXED: Use this.diffw/this.diffh instead of diffw/diffh as calculation base StickingPolygon to = this.entity.generateStickingBorder(this.entity.getX() + diffx, this.entity.getY() + diffy, this.entity.getWidth() + getDiffw(), this.entity.getHeight() + this.getDiffh()); if (first != null) { this.id = first.id; this.linepoints = first.linepoints; } else { this.id = current_id; current_id++; this.linepoints = from.getStickingRelationLinePoints(this.entity.getHandler().getDrawPanel()); } Point diff, p; Relation r; for (RelationLinePoint lp : this.linepoints) { r = lp.getRelation(); p = r.getLinePoints().get(lp.getLinePointId()); diff = from.getLine(lp.getStickingLineId()).diffToLine(to.getLine(lp.getStickingLineId()), p.x + r.getX(), p.y + r.getY()); DiagramHandler handler = Main.getInstance().getDiagramHandler(); this.move_commands.add(new MoveLinePoint(lp.getRelation(), lp.getLinePointId(), handler.realignToGrid(diff.x), handler.realignToGrid(diff.y))); } } @Override public void execute(DiagramHandler handler) { super.execute(handler); entity.changeLocation(getDiffx(), getDiffy()); entity.changeSize(getDiffw(), getDiffh()); if (entity.isStickingBorderActive()) { for (MoveLinePoint c : this.move_commands) { c.execute(handler); } } } @Override public void undo(DiagramHandler handler) { super.undo(handler); entity.changeLocation(-getDiffx(), -getDiffy()); entity.changeSize(-getDiffw(), -getDiffh()); for (MoveLinePoint c : this.move_commands) c.undo(handler); Main.getInstance().getDiagramHandler().getDrawPanel().updatePanelAndScrollbars(); } @Override public boolean isMergeableTo(Command c) { if (!(c instanceof Resize)) return false; Resize r = (Resize) c; if (this.id == r.id) return true; return false; } @Override public Command mergeTo(Command c) { Resize tmp = (Resize) c; return new Resize(this.entity, Math.max(this.id, tmp.id), this.getDiffx() + tmp.getDiffx(), this.getDiffy() + tmp.getDiffy(), this.getDiffw() + tmp.getDiffw(), this.getDiffh() + tmp.getDiffh(), this.move_commands, tmp.move_commands); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/AddLinePoint.java0000644000175000001440000000217511576116034025725 0ustar benuserspackage com.baselet.diagram.command; import java.awt.Point; import java.util.Vector; import com.baselet.diagram.DiagramHandler; import com.umlet.element.Relation; public class AddLinePoint extends Command { private Relation _relation; private int _where; private int _x; private int _y; public Relation getRelation() { return _relation; } public int getWhere() { return _where; } private int getX() { return _x * _relation.getHandler().getGridSize(); } private int getY() { return _y * _relation.getHandler().getGridSize(); } public AddLinePoint(Relation r, int i, int x, int y) { _relation = r; _where = i; _x = x / _relation.getHandler().getGridSize(); _y = y / _relation.getHandler().getGridSize(); } @Override public void execute(DiagramHandler handler) { super.execute(handler); Vector tmp = _relation.getLinePoints(); tmp.insertElementAt(new Point(getX(), getY()), _where); _relation.repaint(); } @Override public void undo(DiagramHandler handler) { super.undo(handler); Vector tmp = _relation.getLinePoints(); tmp.removeElementAt(_where); _relation.repaint(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/command/CustomCodePanelChanged.java0000644000175000001440000000100111576116034027675 0ustar benuserspackage com.baselet.diagram.command; import javax.swing.undo.UndoableEdit; import com.baselet.diagram.DiagramHandler; public class CustomCodePanelChanged extends Command { private UndoableEdit _edit; public CustomCodePanelChanged(UndoableEdit edit) { this._edit = edit; } @Override public void execute(DiagramHandler handler) { if (_edit.canRedo()) _edit.redo(); } @Override public void undo(DiagramHandler handler) { if (_edit.canUndo()) _edit.undo(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/DrawPanel.java0000644000175000001440000004737311576116034023663 0ustar benuserspackage com.baselet.diagram; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.Vector; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.RepaintManager; import javax.swing.ScrollPaneConstants; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Utils; import com.baselet.element.DiagramNotification; import com.baselet.element.GridElement; import com.baselet.gui.StartUpHelpText; import com.baselet.gui.listener.ScrollbarListener; import com.umlet.element.Relation; @SuppressWarnings("serial") public class DrawPanel extends JPanel implements Printable { private final static Logger log = Logger.getLogger(Utils.getClassName()); private Point origin; private JScrollPane _scr; private Selector selector; private DiagramHandler handler; private List notifications; public DrawPanel(DiagramHandler handler) { this.handler = handler; // AB: Origin is used to track diagram movement in Cut Command this.origin = new Point(); this.setLayout(null); this.setBackground(Color.white); // If this is not a palette, create a StartupHelpText if (!(handler instanceof PaletteHandler)) this.add(new StartUpHelpText(this)); this.selector = new Selector(this); this.notifications = new ArrayList(); JScrollPane p = new JScrollPane() { @Override public void setEnabled(boolean en) { super.setEnabled(en); this.getViewport().getView().setEnabled(en); } }; p.getHorizontalScrollBar().setUnitIncrement(50); // Using mousewheel on bar or click on arrow p.getHorizontalScrollBar().setBlockIncrement(20); // click in area without bar p.getHorizontalScrollBar().setSize(0, 15); p.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); p.getVerticalScrollBar().setUnitIncrement(50); p.getVerticalScrollBar().setBlockIncrement(20); p.getVerticalScrollBar().setSize(15, 0); p.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); ScrollbarListener sbL = new ScrollbarListener(this); p.getHorizontalScrollBar().addMouseListener(sbL); p.getVerticalScrollBar().addMouseListener(sbL); p.setBorder(null); this.setScrollPanel(p); // Wait until drawpanel is valid (eg: after loading a diagramm) and then update panel and scrollbars if (Program.RUNTIME_TYPE != RuntimeType.BATCH) { new Timer().schedule(new TimerTask() { @Override public void run() { if (isValid()) { updatePanelAndScrollbars(); cancel(); } } }, 25, 25); } this.repaint(); // repaint the drawpanel to be sure everything is visible (startuphelp etc) } @Override public void setEnabled(boolean en) { super.setEnabled(en); this.handler.setEnabled(en); for (Component c : this.getComponents()) c.setEnabled(en); if (en) this.setBackground(new Color(255, 255, 255)); else this.setBackground(new Color(235, 235, 235)); } public DiagramHandler getHandler() { return this.handler; } private void setScrollPanel(JScrollPane scr) { _scr = scr; scr.setViewportView(this); } public JScrollPane getScrollPane() { return _scr; } /** * Returns the smalles possible rectangle which contains all entities and a border space around it * * @param borderSpace * the borderspace around the rectangle * @param entities * the entities which should be included * @return Rectangle which contains all entities with border space */ public Rectangle getContentBounds(int borderSpace, Vector entities) { if (entities.size() == 0) return new Rectangle(0, 0, 0, 0); int minx = Integer.MAX_VALUE; int miny = Integer.MAX_VALUE; int maxx = 0; int maxy = 0; for (int i = 0; i < entities.size(); i++) { GridElement e = entities.elementAt(i); minx = Math.min(minx, e.getX() - borderSpace); miny = Math.min(miny, e.getY() - borderSpace); maxx = Math.max(maxx, e.getX() + e.getWidth() + borderSpace); maxy = Math.max(maxy, e.getY() + e.getHeight() + borderSpace); } return new Rectangle(minx, miny, maxx - minx, maxy - miny); } public void paintEntitiesIntoGraphics2D(Graphics2D g2d, Vector entitiesToPaint) { boolean entityWasSelected = false; for (GridElement entity : entitiesToPaint) { if (entity.isSelected()) entityWasSelected = true; int x = entity.getX(); int y = entity.getY(); g2d.translate(x, y); if (entityWasSelected) entity.onDeselected(); // If entity was selected deselect it before painting entity.paint(g2d); if (entityWasSelected) { // and select it afterwards. Also reset boolean variable to false entity.onSelected(); entityWasSelected = false; } g2d.translate(-x, -y); } } @Override public int print(Graphics g, PageFormat pageFormat, int pageIndex) { if (pageIndex > 0) return (NO_SUCH_PAGE); else { Graphics2D g2d = (Graphics2D) g; RepaintManager currentManager = RepaintManager.currentManager(this); currentManager.setDoubleBufferingEnabled(false); Rectangle bounds = this.getContentBounds(Constants.PRINTPADDING, getAllEntities()); g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); AffineTransform t = g2d.getTransform(); double scale = Math.min(pageFormat.getImageableWidth() / bounds.width, pageFormat.getImageableHeight() / bounds.height); if (scale < 1) { t.scale(scale, scale); g2d.setTransform(t); } g2d.translate(-bounds.x, -bounds.y); this.paint(g2d); currentManager = RepaintManager.currentManager(this); currentManager.setDoubleBufferingEnabled(true); return (PAGE_EXISTS); } } public Vector getAllEntities() { Vector v = new Vector(); for (int i = 0; i < this.getComponentCount(); i++) { Component c = this.getComponent(i); if (c instanceof GridElement) v.add((GridElement) c); } return v; } public Vector getAllEntitiesNotInGroup() { Vector entities = new Vector(); for (GridElement e : getAllEntities()) { if (!e.isPartOfGroup()) entities.add(e); } return entities; } public Vector getAllRelations() { Component[] tmp = this.getComponents(); Vector ret = new Vector(); for (int i = 0; i < tmp.length; i++) { if (tmp[i] instanceof Relation) ret.add((Relation) tmp[i]); } return ret; } public Selector getSelector() { return this.selector; } /** * This method must be called after every "significant change" on the drawpanel. * This doesn't include every increment of dragging an grid element but it should be called after * the grid elements new location is set (= after the mousebutton is released) * It should be called only once after many grid elements have changed and not for each element! * This makes it very hard to call this method by using listeners, therefore it's called explicitly in specific cases. */ public void updatePanelAndScrollbars() { insertUpperLeftWhitespaceIfNeeded(); removeUnnecessaryWhitespaceAroundDiagram(); } /** * If entities are out of the visible drawpanel border on the upper left * corner this method enlarges the drawpanel and displays scrollbars */ private void insertUpperLeftWhitespaceIfNeeded() { Rectangle diaWithoutWhite = getContentBounds(0, getAllEntities()); // We must adjust the components and the view by a certain factor int adjustWidth = 0; if (diaWithoutWhite.getX() < 0) adjustWidth = (int) diaWithoutWhite.getX(); int adjustHeight = 0; if (diaWithoutWhite.getY() < 0) adjustHeight = (int) diaWithoutWhite.getY(); moveOrigin(adjustWidth, adjustHeight); // If any adjustment is needed we move the components and increase the view position if ((adjustWidth != 0) || (adjustHeight != 0)) { for (int i = 0; i < this.getComponents().length; i++) { Component c = this.getComponent(i); c.setLocation(handler.realignToGrid(false, c.getX() - adjustWidth), handler.realignToGrid(false, c.getY() - adjustHeight)); } } if (adjustWidth < 0) setHorizontalScrollbarVisibility(true); if (adjustHeight < 0) setVerticalScrollbarVisibility(true); int width = (int) (_scr.getHorizontalScrollBar().getValue() + getViewableDiagrampanelSize().getWidth() - adjustWidth); int height = (int) (_scr.getVerticalScrollBar().getValue() + getViewableDiagrampanelSize().getHeight() - adjustHeight); setPreferredSize(new Dimension(width, height)); changeViewPosition(-adjustWidth, -adjustHeight); } /** * Changes the viewposition of the drawpanel and recalculates the optimal drawpanelsize */ public void changeViewPosition(int incx, int incy) { Point viewp = _scr.getViewport().getViewPosition(); _scr.getViewport().setViewSize(getPreferredSize()); _scr.getViewport().setViewPosition(new Point(viewp.x + incx, viewp.y + incy)); } /** * If there is a scrollbar visible and a unnecessary whitespace on any border of the diagram * which is not visible (but possibly scrollable by scrollbars) we remove this whitespace */ private void removeUnnecessaryWhitespaceAroundDiagram() { Rectangle diaWithoutWhite = getContentBounds(0, getAllEntities()); Dimension viewSize = getViewableDiagrampanelSize(); int horSbPos = _scr.getHorizontalScrollBar().getValue(); int verSbPos = _scr.getVerticalScrollBar().getValue(); horSbPos = handler.realignToGrid(false, horSbPos); verSbPos = handler.realignToGrid(false, verSbPos); int newX = 0; if (_scr.getHorizontalScrollBar().isShowing()) { if (horSbPos > diaWithoutWhite.getX()) { newX = (int) diaWithoutWhite.getX(); } else { newX = horSbPos; } } int newY = 0; if (_scr.getVerticalScrollBar().isShowing()) { if (verSbPos > diaWithoutWhite.getY()) { newY = (int) diaWithoutWhite.getY(); } else { newY = verSbPos; } } int newWidth = (int) (horSbPos + viewSize.getWidth()); // If the diagram exceeds the right viewable border the width must be adjusted if (diaWithoutWhite.getX() + diaWithoutWhite.getWidth() > horSbPos + viewSize.getWidth()) { newWidth = (int) (diaWithoutWhite.getX() + diaWithoutWhite.getWidth()); } int newHeight = (int) (verSbPos + viewSize.getHeight()); // If the diagram exceeds the lower viewable border the width must be adjusted if (diaWithoutWhite.getY() + diaWithoutWhite.getHeight() > verSbPos + viewSize.getHeight()) { newHeight = (int) (diaWithoutWhite.getY() + diaWithoutWhite.getHeight()); } moveOrigin(newX, newY); for (int i = 0; i < this.getComponents().length; i++) { Component c = this.getComponent(i); if (c instanceof GridElement) // We remove whitespace only for entities c.setLocation(handler.realignToGrid(false, c.getX() - newX), handler.realignToGrid(false, c.getY() - newY)); } changeViewPosition(-newX, -newY); setPreferredSize(new Dimension(newWidth - newX, newHeight - newY)); checkIfScrollbarsAreNecessary(); } /** * Returns the visible size of the drawpanel */ public Dimension getViewableDiagrampanelSize() { return getVisibleRect().getSize(); } private void checkIfScrollbarsAreNecessary() { /** * Afterwards recheck if scrollbars are necessary * This is needed to avoid appearing scrollbars if the diagramm is on the bottom right */ Rectangle diaWithoutWhite = getContentBounds(0, getAllEntities()); Dimension viewSize = getViewableDiagrampanelSize(); boolean vertWasVisible = isVerticalScrollbarVisible(); boolean horWasVisible = isHorizontalScrollbarVisible(); // Only if the scrollbar is visible we must respect its size to calculate the visibility of the scrollbar int verSbWidth = 0; int horSbHeight = 0; if (vertWasVisible) verSbWidth = _scr.getVerticalScrollBar().getWidth(); if (horWasVisible) horSbHeight = _scr.getHorizontalScrollBar().getHeight(); // If the horizontal scrollbar is on the most left point && the the right end of the diagram without whitespace <= the viewable width incl. the width of the vertical scrollbar we hide the horizontal scrollbar if ((_scr.getHorizontalScrollBar().getValue() < handler.getGridSize()) && ((diaWithoutWhite.getX() + diaWithoutWhite.getWidth()) <= (viewSize.getWidth() + verSbWidth))) setHorizontalScrollbarVisibility(false); // This is needed to hide the scrollbar if it's only scrollable by a value lower than the gridsize. Otherwise this scrollbar would remain visible to avoid grid-jumps of the diagram (only on the lower right corner) // We also hide it if the horizontal scrollbar has lower than gridsize && the viewable diagrampanel width plus the horizontal scrollbar value is equal the right end of the diagram without whitespace else if ((_scr.getHorizontalScrollBar().getValue() < handler.getGridSize()) && (getViewableDiagrampanelSize().getWidth() + _scr.getHorizontalScrollBar().getValue() == diaWithoutWhite.getX() + diaWithoutWhite.getWidth())) setHorizontalScrollbarVisibility(false); else setHorizontalScrollbarVisibility(true); if ((_scr.getVerticalScrollBar().getValue() < handler.getGridSize()) && ((diaWithoutWhite.getY() + diaWithoutWhite.getHeight()) <= (viewSize.getHeight() + horSbHeight))) setVerticalScrollbarVisibility(false); else if ((_scr.getVerticalScrollBar().getValue() < handler.getGridSize()) && (getViewableDiagrampanelSize().getHeight() + _scr.getVerticalScrollBar().getValue() == diaWithoutWhite.getY() + diaWithoutWhite.getHeight())) setVerticalScrollbarVisibility(false); else setVerticalScrollbarVisibility(true); // REMOVED TO FIX JUMPING PALETTE ENTRIES AT COPYING/CUTTING // adjust x and y to avoid jumping diagram if both scrollbars were visible and one of them disappears (only in the upper left corner) int adx = 0; int ady = 0; if ((_scr.getHorizontalScrollBar().getValue() != 0) && vertWasVisible && !isVerticalScrollbarVisible()) adx = handler.realignToGrid(false, horSbHeight); if ((_scr.getVerticalScrollBar().getValue() != 0) && horWasVisible && !isHorizontalScrollbarVisible()) ady = handler.realignToGrid(false, verSbWidth); if ((adx != 0) || (ady != 0)) { setPreferredSize(new Dimension((int) (getPreferredSize().getWidth() + adx), (int) getPreferredSize().getHeight() + ady)); changeViewPosition(adx, ady); } } private void setHorizontalScrollbarVisibility(boolean visible) { if (visible) _scr.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); else _scr.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); } private void setVerticalScrollbarVisibility(boolean visible) { if (visible) _scr.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); else _scr.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); } private boolean isHorizontalScrollbarVisible() { if (_scr.getHorizontalScrollBarPolicy() == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) return true; else return false; } private boolean isVerticalScrollbarVisible() { if (_scr.getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) return true; else return false; } private void drawGrid(Graphics2D g2d) { g2d.setColor(Constants.GRID_COLOR); int gridSize = handler.getGridSize(); if (gridSize == 1) return; // Gridsize 1 would only make the whole screen grey int width = 2000 + (int) getPreferredSize().getWidth(); int height = 1000 + (int) getPreferredSize().getHeight(); for (int i = gridSize; i < width; i += gridSize) { g2d.drawLine(i, 0, i, height); } for (int i = gridSize; i < height; i += gridSize) { g2d.drawLine(0, i, width, i); } } // private void drawDevHelpLines(Graphics2D g2d) { // g2d.setStroke(Utils.getStroke(LineType.DASHED, 1)); // // g2d.setColor(Color.BLUE); // int w = handler.getDrawPanel().getScrollPane().getViewport().getViewPosition().x; // int h = handler.getDrawPanel().getScrollPane().getViewport().getViewPosition().y; // g2d.drawRect(w, h, w + 2, h + 2); // // g2d.setColor(Color.GRAY); // Dimension dim = getViewableDiagrampanelSize(); // g2d.drawRect(0, 0, (int) dim.getWidth(), (int) dim.getHeight()); // // g2d.setColor(Color.RED); // Dimension dim2 = getPreferredSize(); // g2d.drawRect(0, 0, (int) dim2.getWidth(), (int) dim2.getHeight()); // // g2d.setStroke(Utils.getStroke(LineType.SOLID, 1)); // } @Override protected void paintChildren(Graphics g) { // Possible Zoom of the drawpanel (not a real zoom because it doesn't resize anything) // Graphics2D g2 = (Graphics2D)g; // AffineTransform t = g2.getTransform(); // float scale = 0.5f; //this.getHandler().getGridSize() / 10 // t.scale(scale, scale); // g2.setTransform(t); // drawDevHelpLines((Graphics2D) g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHints(Utils.getUxRenderingQualityHigh(true)); if (Constants.show_grid) drawGrid(g2d); super.paintComponents(g); } public void showNotification(String message) { // There are no notifications on palette panels if (getHandler() instanceof PaletteHandler) return; if (!notifications.isEmpty()) { for (DiagramNotification n : notifications) this.remove(n); } DiagramNotification notification = new DiagramNotification(this.getHandler(), message); notifications.add(notification); this.add(notification); } /** * AB: Returns a copy of the actual origin zoomed to 100%. * Origin marks a point that tracks changes of the diagram panel size and can * be used to regenerate the original position of entities at the time they have been cut/copied, * etc... * * @return a point that marks the diagram origin at a zoom of 100%. */ public Point getOriginAtDefaultZoom() { Point originCopy = new Point(origin); originCopy.setLocation( (origin.x * Constants.DEFAULTGRIDSIZE) / handler.getGridSize(), (origin.y * Constants.DEFAULTGRIDSIZE) / handler.getGridSize()); return originCopy; } /** * AB: Returns a copy of the actual origin. * Origin marks a point that tracks changes of the diagram panel size and can * be used to regenerate the original position of entities at the time they have been cut/copied, * etc... * * @return a point that marks the diagram origin. */ public Point getOrigin() { log.debug("Diagram origin: " + origin); return new Point(origin); } /** * AB: Moves the origin around the given delta x and delta y * This method is mainly used by updatePanelAndScrollBars() to keep track of the panels size changes. */ public void moveOrigin(int dx, int dy) { log.debug("Move origin to: " + origin); this.origin.translate(handler.realignToGrid(false, dx), handler.realignToGrid(false, dy)); } /** * AB: Zoom the origin from the old grid size to the new grid size * this method is mainly used by the DiagramHandler classes setGridAndZoom method. * * @see DiagramHandler#setGridAndZoom(int) * @param oldGridSize * the old grid size * @param newGridSize * the new grid size */ public void zoomOrigin(int oldGridSize, int newGridSize) { log.debug("Zoom origin to: " + origin); origin.setLocation((origin.x * newGridSize) / oldGridSize, (origin.y * newGridSize) / oldGridSize); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/Selector.java0000644000175000001440000001206411576116034023553 0ustar benuserspackage com.baselet.diagram; import java.awt.Dimension; import java.awt.Point; import java.util.Vector; import com.baselet.control.Main; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.umlet.custom.CustomElement; public class Selector { private static Selector currentSelector;// to determin what selector is active right now (to set that element blue) private GridElement dominantEntity; private Vector selectedEntities = new Vector(); private DrawPanel panel; private boolean _selectorframeactive; private SelectorFrame _selectorframe; public Vector getSelectedEntities() { return selectedEntities; } public Selector(DrawPanel panel) { this.panel = panel; this._selectorframeactive = false; this._selectorframe = new SelectorFrame(); } // AB: usually this is the first selected entity // If a group has been selected this entity can be set explicitly public GridElement getDominantEntity() { if ((dominantEntity == null) && !selectedEntities.isEmpty()) { return selectedEntities.firstElement(); } return dominantEntity; } // AB: if you set this entity, make sure the selectedEntities Vector contains a group entity that contains the dominantEntity. public void setDominantEntity(GridElement dominantEntity) { this.dominantEntity = dominantEntity; } public SelectorFrame getSelectorFrame() { return this._selectorframe; } public void setSelectorFrameActive(boolean active) { this._selectorframeactive = active; if (!active) this._selectorframe.reset(); } public boolean isSelectorFrameActive() { return this._selectorframeactive; } public void deselectAll() { for (GridElement e : this.selectedEntities) e.onDeselected(); dominantEntity = null; selectedEntities.clear(); updateSelectorInformation(); } // needed for custom element exchange public void singleSelectWithoutUpdatePropertyPanel(GridElement e) { deselectAllWithoutUpdatePropertyPanel(); selectedEntities.add(e); e.onSelected(); if (Main.getInstance().getGUI() != null) updateGUIInformation(); Main.getInstance().setPropertyPanelToCustomElement(e); } public void deselectAllWithoutUpdatePropertyPanel() { for (GridElement e : this.selectedEntities) e.onDeselected(); dominantEntity = null; selectedEntities.clear(); } public void select(GridElement e) { Vector v = new Vector(); v.add(e); handleSelect(v); } public void select(Vector entities) { handleSelect(entities); } public void selectAll() { handleSelect(panel.getAllEntitiesNotInGroup()); } private void handleSelect(Vector entities) { for (GridElement e : entities) { if (selectedEntities.contains(e) || e.isPartOfGroup()) continue; e.onSelected(); selectedEntities.add(e); } updateSelectorInformation(); } public void deselect(GridElement e) { if (selectedEntities.contains(e)) { selectedEntities.removeElement(e); e.onDeselected(); updateSelectorInformation(); } } private void updateGUIInformation() { Main.getInstance().getGUI().elementsSelected(selectedEntities.size()); if ((selectedEntities.size() == 1) && (selectedEntities.get(0) instanceof Group)) { Main.getInstance().getGUI().setUngroupEnabled(true); } else { Main.getInstance().getGUI().setUngroupEnabled(false); } if ((selectedEntities.size() == 1) && (selectedEntities.get(0) instanceof CustomElement)) Main.getInstance().getGUI().setCustomElementSelected(true); else Main.getInstance().getGUI().setCustomElementSelected(false); } // updates the GUI with the current selector information (that includes the propertypanel public void updateSelectorInformation() { // update the current blue selected elements if (currentSelector == null) currentSelector = this; else if (currentSelector != this) { currentSelector.setElementsSelected(false); currentSelector = this; this.setElementsSelected(true); } // every time something is selected - update the current diagram to this element Main.getInstance().setCurrentDiagramHandler(this.panel.getHandler()); if (Main.getInstance().getGUI() != null) { updateGUIInformation(); if (selectedEntities.size() == 1) Main.getInstance().setPropertyPanelToGridElement(selectedEntities.elementAt(0)); else Main.getInstance().setPropertyPanelToGridElement(null); } } private void setElementsSelected(boolean selected) { if (selected) { for (GridElement e : this.selectedEntities) e.onSelected(); } else { for (GridElement e : this.selectedEntities) e.onDeselected(); } } public void singleSelect(GridElement e) { this.deselectAll(); this.select(e); } public void multiSelect(Point upperLeft, Dimension size) { Vector entities = this.panel.getAllEntities(); for (int i = 0; i < entities.size(); i++) { GridElement e = entities.get(i); if (e.isInRange(upperLeft, size)) select(e); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/FontHandler.java0000644000175000001440000001405311576116034024177 0ustar benuserspackage com.baselet.diagram; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics2D; import java.awt.font.TextAttribute; import java.awt.font.TextLayout; import java.text.AttributedString; import com.baselet.control.Constants; import com.baselet.control.Constants.AlignHorizontal; import com.baselet.control.Constants.AlignVertical; public class FontHandler { /**** TEXT FORMATTING LABELS ****/ public static class FormatLabels { public static final String UNDERLINE = "_"; public static final String BOLD = "*"; public static final String ITALIC = "/"; } private DiagramHandler handler; private Integer fontSize; private Integer diagramDefaultSize = null; // if "fontsize=..." is uncommented this variable is set private String diagramDefaultFontFamily = null; public FontHandler(DiagramHandler handler) { this.handler = handler; } public void setFontSize(Integer fontsize) { this.fontSize = fontsize; } public void setDiagramDefaultFontFamily(String fontfamily) { if (Constants.fontFamilyList.contains(fontfamily)) this.diagramDefaultFontFamily = fontfamily; } public void resetDiagramDefaultFontFamily() { diagramDefaultFontFamily = null; } private String getDiagramDefaultFontFamily() { String returnFontFamily; if (diagramDefaultFontFamily != null) returnFontFamily = diagramDefaultFontFamily; else returnFontFamily = Constants.defaultFontFamily; return returnFontFamily; } public void setDiagramDefaultFontSize(Integer diagramDefaultSize) { if (Constants.fontSizeList.contains(diagramDefaultSize)) this.diagramDefaultSize = diagramDefaultSize; } public void resetFontSize() { fontSize = null; } public void resetDiagramDefaultFontSize() { diagramDefaultSize = null; } public float getFontSize() { return getFontSize(true); } public float getFontSize(boolean applyZoom) { Integer returnFontSize; if (fontSize == null) { if (diagramDefaultSize != null) returnFontSize = diagramDefaultSize; else returnFontSize = Constants.defaultFontsize; } else returnFontSize = fontSize; if (applyZoom) return returnFontSize * handler.getGridSize() / Constants.DEFAULTGRIDSIZE; else return returnFontSize; } public Font getFont() { return getFont(true); } public Font getFont(boolean applyZoom) { return new Font(getDiagramDefaultFontFamily(), Font.PLAIN, (int) getFontSize(applyZoom)); } public float getDistanceBetweenTexts() { return getDistanceBetweenTexts(true); } public float getDistanceBetweenTexts(boolean applyZoom) { return getFontSize(applyZoom) / 4; } public Dimension getTextSize(String s) { return getTextSize(s, true); } public Dimension getTextSize(String s, boolean applyZoom) { if (s == null) return null; if (s.length() == 0) return new Dimension(0, 0); TextLayout tl = new TextLayout(s, getFont(applyZoom), Constants.FRC); return new Dimension((int) tl.getBounds().getWidth(), (int) tl.getBounds().getHeight()); } public int getTextWidth(String s) { return getTextWidth(s, true); } public int getTextWidth(String s, boolean applyZoom) { if (s == null) return 0; return (int) this.getTextSize(s, applyZoom).getWidth(); } public int getTextHeight(String s) { return getTextHeight(s, true); } public int getTextHeight(String s, boolean applyZoom) { if (s == null) return 0; else return (int) this.getTextSize(s, applyZoom).getHeight(); } public void writeText(Graphics2D g2, String s, int x, int y, boolean center) { if (center) this.writeText(g2, s, x, y, AlignHorizontal.CENTER, AlignVertical.BOTTOM); else this.writeText(g2, s, x, y, AlignHorizontal.LEFT, AlignVertical.BOTTOM); } public void writeText(Graphics2D g2, String s, int x, int y, AlignHorizontal align, AlignVertical valign) { writeText(g2, s, x, y, align, valign, true); } public void writeText(Graphics2D g2, String s, int x, int y, AlignHorizontal align, AlignVertical valign, boolean applyZoom) { for (String line : s.split("\n")) { this.write(g2, line, x, y, align, valign, applyZoom); y += g2.getFontMetrics().getHeight(); } } private static boolean underline; private static boolean bold; private static boolean italic; private void write(Graphics2D g2, String stringWithFormatLabels, int x, int y, AlignHorizontal align, AlignVertical valign, boolean applyZoom) { String s = setFormatAndRemoveLabels(stringWithFormatLabels); if (s == null || s.isEmpty()) return; s = s.replaceAll("<<", "\u00AB"); s = s.replaceAll(">>", "\u00BB"); AttributedString as = new AttributedString(s); as.addAttribute(TextAttribute.SIZE, getFontSize(applyZoom)); as.addAttribute(TextAttribute.FAMILY, getDiagramDefaultFontFamily()); if (bold) as.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); if (italic) as.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); if (underline) as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 0, s.length()); if (align == AlignHorizontal.CENTER) x = x - getTextWidth(s, applyZoom) / 2; else if (align == AlignHorizontal.RIGHT) x = x - getTextWidth(s, applyZoom); if (valign == AlignVertical.CENTER) y = y + getTextHeight(s, applyZoom) / 2; else if (valign == AlignVertical.TOP) y = y + getTextHeight(s, applyZoom); g2.drawString(as.getIterator(), x, y); } private static String setFormatAndRemoveLabels(String s) { underline = false; bold = false; italic = false; if (s == null || s.isEmpty()) return s; // As long as any text format applies the loop continues (any format type is only allowed once) while (true) { if (!underline && s.startsWith(FormatLabels.UNDERLINE) && s.endsWith(FormatLabels.UNDERLINE) && (s.length() > 2)) { underline = true; s = s.substring(1, s.length() - 1); } else if (!bold && s.startsWith(FormatLabels.BOLD) && s.endsWith(FormatLabels.BOLD) && (s.length() > 2)) { bold = true; s = s.substring(1, s.length() - 1); } else if (!italic && s.startsWith(FormatLabels.ITALIC) && s.endsWith(FormatLabels.ITALIC) && (s.length() > 2)) { italic = true; s = s.substring(1, s.length() - 1); } else break; } return s; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/Controller.java0000644000175000001440000000423111576116034024113 0ustar benuserspackage com.baselet.diagram; import java.util.Vector; import com.baselet.control.Main; import com.baselet.diagram.command.Command; import com.baselet.gui.standalone.StandaloneGUI; public class Controller { private Vector commands; private DiagramHandler handler; private int _cursor; private long commandCount; public Controller(DiagramHandler handler) { commands = new Vector(); _cursor = -1; this.handler = handler; this.commandCount = 0; } public void executeCommand(Command newCommand) { // Remove future commands for (int i = commands.size() - 1; i > _cursor; i--) { commands.removeElementAt(i); } commands.add(newCommand); newCommand.execute(this.handler); if (commands.size() >= 2) { Command c_n, c_nMinus1; c_n = commands.elementAt(commands.size() - 1); c_nMinus1 = commands.elementAt(commands.size() - 2); if (c_n.isMergeableTo(c_nMinus1)) { commands.removeElement(c_n); commands.removeElement(c_nMinus1); Command c = c_n.mergeTo(c_nMinus1); commands.add(c); } } _cursor = commands.size() - 1; this.handler.setChanged(true); //update undo/redo menu entries if (Main.getInstance().getGUI() instanceof StandaloneGUI) ((StandaloneGUI) Main.getInstance().getGUI()).updateGrayedOutMenuItems(this.handler); commandCount++; } public void undo() { if (isUndoable()) { Command c = commands.elementAt(_cursor); c.undo(this.handler); _cursor--; this.handler.setChanged(true); } } public void redo() { if (isRedoable()) { Command c = commands.elementAt(_cursor + 1); c.execute(this.handler); _cursor++; } } public boolean isEmpty() { if (commands.isEmpty()) return true; else return false; } public boolean isUndoable() { if (_cursor >= 0) return true; else return false; } public boolean isRedoable() { if (_cursor < commands.size() - 1) return true; else return false; } public long getCommandCount() { return this.commandCount; } public void clear() { commands = new Vector(); _cursor = -1; this.commandCount = 0; } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/DiagramHandler.java0000644000175000001440000003136711576116034024644 0ustar benuserspackage com.baselet.diagram; import java.awt.Point; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; import java.io.File; import java.io.IOException; import java.util.Vector; import javax.swing.JOptionPane; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.io.DiagramFileHandler; import com.baselet.element.GridElement; import com.baselet.element.Group; import com.baselet.gui.BaseGUI; import com.baselet.gui.DiagramPopupMenu; import com.baselet.gui.listener.DiagramListener; import com.baselet.gui.listener.GridElementListener; import com.baselet.gui.listener.RelationListener; import com.baselet.gui.standalone.StandaloneGUI; import com.umlet.element.Relation; public class DiagramHandler { private final static Logger log = Logger.getLogger(Utils.getClassName()); private boolean isChanged; private DiagramFileHandler fileHandler; private FontHandler fontHandler; protected DrawPanel drawpanel; private Controller controller; protected DiagramListener listener; private String helptext; private boolean enabled; private int gridSize; public DiagramHandler(File diagram) { this(diagram, false); } protected DiagramHandler(File diagram, boolean nolistener) { gridSize = Constants.DEFAULTGRIDSIZE; this.isChanged = false; this.enabled = true; this.drawpanel = new DrawPanel(this); this.controller = new Controller(this); this.fontHandler = new FontHandler(this); this.fileHandler = DiagramFileHandler.createInstance(this, diagram); if (!nolistener) this.setListener(new DiagramListener(this)); if (diagram != null) this.fileHandler.doOpen(); boolean extendedPopupMenu = false; BaseGUI gui = Main.getInstance().getGUI(); if (gui != null) { gui.setValueOfZoomDisplay(getGridSize()); if (gui instanceof StandaloneGUI) extendedPopupMenu = true; // AB: use extended popup menu on standalone gui only } if (!(this instanceof PaletteHandler)) drawpanel.setComponentPopupMenu(new DiagramPopupMenu(this, extendedPopupMenu)); } public void setEnabled(boolean en) { if (!en && enabled) { this.drawpanel.removeMouseListener(this.listener); this.drawpanel.removeMouseMotionListener(this.listener); enabled = false; } else if (en && !enabled) { this.drawpanel.addMouseListener(this.listener); this.drawpanel.addMouseMotionListener(this.listener); enabled = true; } } protected void setListener(DiagramListener listener) { this.listener = listener; this.drawpanel.addMouseListener(this.listener); this.drawpanel.addMouseMotionListener(this.listener); this.drawpanel.addMouseWheelListener(this.listener); } public DiagramListener getListener() { return this.listener; } public void setChanged(boolean changed) { if (this.isChanged != changed) { this.isChanged = changed; BaseGUI gui = Main.getInstance().getGUI(); if (gui != null) gui.setDiagramChanged(this, changed); } } public DrawPanel getDrawPanel() { return this.drawpanel; } public DiagramFileHandler getFileHandler() { return this.fileHandler; } public FontHandler getFontHandler() { return this.fontHandler; } public Controller getController() { return this.controller; } // returnvalue needed for eclipse plugin // returns true if the file is saved, else returns false public boolean doSave() { try { this.fileHandler.doSave(); this.reloadPalettes(); return true; } catch (IOException e) { Main.displayError(Constants.ERROR_SAVING_FILE); return false; } } public void doSaveAs(String extension) { if (this.drawpanel.getAllEntities().isEmpty()) Main.displayError(Constants.ERROR_SAVING_EMPTY_DIAGRAM); else { try { this.fileHandler.doSaveAs(extension); this.reloadPalettes(); } catch (IOException e) { Main.displayError(Constants.ERROR_SAVING_FILE); } } } public void doPrint() { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this.getDrawPanel()); if (printJob.printDialog()) try { printJob.print(); } catch (PrinterException pe) { Main.displayError(Constants.ERROR_PRINTING); } } // reloads the diagram from file + updates gui public void reload() { drawpanel.removeAll(); fileHandler.doOpen(); drawpanel.updatePanelAndScrollbars(); } // reloads palettes if the palette has been changed. private void reloadPalettes() { for (DiagramHandler d : Main.getInstance().getPalettes().values()) { if (d.getFileHandler().equals(this.getFileHandler()) && !d.equals(this)) d.reload(); } this.getDrawPanel().getSelector().updateSelectorInformation(); // Must be updated to remain in the current Property Panel } public void doClose() { if (this.askSaveIfDirty()) { Main.getInstance().getDiagrams().remove(this); Main.getInstance().getGUI().close(this); this.drawpanel.getSelector().deselectAll(); // update property panel to now selected diagram (or to empty if no diagram exists) DiagramHandler newhandler = Main.getInstance().getDiagramHandler(); // if (newhandler != null) newhandler.getDrawPanel().getSelector().updateSelectorInformation(); else Main.getInstance().setPropertyPanelToGridElement(null); } } public String getName() { String name = this.fileHandler.getFileName(); if (name.contains(".")) name = name.substring(0, name.lastIndexOf(".")); return name; } public String getFullPathName() { return this.fileHandler.getFullPathName(); } // function to be able to controll the entitylistener + diagramlistener from the handler public GridElementListener getEntityListener(GridElement e) { if (e instanceof Relation) return RelationListener.getInstance(this); return GridElementListener.getInstance(this); } public boolean askSaveIfDirty() { if (this.isChanged) { int ch = JOptionPane.showOptionDialog(Main.getInstance().getGUI(), "Save changes?", Program.PROGRAM_NAME + " - " + this.getName(), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); if (ch == JOptionPane.YES_OPTION) { this.doSave(); return true; } else if (ch == JOptionPane.NO_OPTION) { return true; } return false; } return true; } public void setHelpText(String helptext) { this.helptext = helptext; BaseGUI gui = Main.getInstance().getGUI(); if (gui != null && !this.helptext.equals(gui.getPropertyPanelText())) gui.setPropertyPanelText(this.helptext); } public String getHelpText() { if (this.helptext == null) return Constants.DEFAULT_HELPTEXT; else return this.helptext; } public boolean isChanged() { return this.isChanged; } public int getGridSize() { return gridSize; } public float getZoomFactor() { return (float) getGridSize() / (float) Constants.DEFAULTGRIDSIZE; } public void setGridSize(int gridSize) { this.gridSize = gridSize; } public int realignToGrid(int val) { return realignToGrid(true, val, false); } public int realignToGrid(boolean logRealign, int val) { return realignToGrid(logRealign, val, false); } /** * returns the integer which is nearest to val but on the grid (round down) * * @param logRealign * if true a realign is logged as an error * @param val * value which should be rounded to the grid * @param roundUp * if true the realign rounds up instead of down * @return value on the grid */ public int realignToGrid(boolean logRealign, int val, boolean roundUp) { if (val % gridSize != 0) { if (logRealign) log.error("realignToGrid"); val -= val % gridSize; if (roundUp) val += gridSize; } return val; } static public int realignTo(int val, int toVal) { if (val % toVal != 0) { val -= val % toVal; } return val; } static public void zoomEntity(int fromFactor, int toFactor, GridElement e) { Vector vec = new Vector(); vec.add(e); zoomEntities(fromFactor, toFactor, vec); } static public void zoomEntities(int fromFactor, int toFactor, Vector selectedEntities) { /** * The entities must be resized to the new factor */ for (GridElement entity : selectedEntities) { // Entities in groups are not part of the selectedEntities vector. therefore they must be zoomed explicitely if (entity instanceof Group) zoomEntities(fromFactor, toFactor, ((Group) entity).getMembers()); int newX = (entity.getX() * toFactor) / fromFactor; int newY = (entity.getY() * toFactor) / fromFactor; int newW = (entity.getWidth() * toFactor) / fromFactor; int newH = (entity.getHeight() * toFactor) / fromFactor; entity.setLocation(realignTo(newX, toFactor), realignTo(newY, toFactor)); // Normally there should be no realign here but relations and custom elements sometimes must be realigned therefore we don't log it as an error entity.setSize(realignTo(newW, toFactor), realignTo(newH, toFactor)); // Resize the coordinates of the points of the relations if (entity instanceof Relation) { for (Point point : ((Relation) entity).getLinePoints()) { newX = ((int) point.getX() * toFactor) / fromFactor; newY = ((int) point.getY() * toFactor) / fromFactor; point.setLocation(realignTo(newX, toFactor), realignTo(newY, toFactor)); } } } /** * After all location and size changes we must adjust the size of the * top level groups (groups who aren't part of other groups) */ for (GridElement entity : selectedEntities) { if ((entity instanceof Group) && !entity.isPartOfGroup()) { ((Group) entity).adjustSize(true); } } } public void setGridAndZoom(int factor) { setGridAndZoom(factor, true); } public void setGridAndZoom(int factor, boolean manualZoom) { /** * Store the old gridsize and the new one. Furthermore check if the zoom process must be made */ int oldGridSize = getGridSize(); if ((factor < 1) || (factor > 20)) return; // Only zoom between 10% and 200% is allowed if (factor == oldGridSize) return; // Only zoom if gridsize has changed setGridSize(factor); /** * Zoom entities to the new gridsize */ zoomEntities(oldGridSize, gridSize, getDrawPanel().getAllEntitiesNotInGroup()); // AB: Zoom origin getDrawPanel().zoomOrigin(oldGridSize, gridSize); /** * The zoomed diagram will shrink to the upper left corner and grow to the lower right * corner but we want to have the zoom center in the middle of the actual visible drawpanel * so we have to change the coordinates of the entities again */ if (manualZoom) { // Calculate the middle point of the actual diagramspanel size float x = ((float) getDrawPanel().getViewableDiagrampanelSize().getWidth() / 2); float y = ((float) getDrawPanel().getViewableDiagrampanelSize().getHeight() / 2); // And add any space on the upper left corner which is not visible but reachable by scrollbar x += getDrawPanel().getScrollPane().getViewport().getViewPosition().getX(); y += getDrawPanel().getScrollPane().getViewport().getViewPosition().getY(); // The result is the point where we want to center the zoom of the diagram float diffx, diffy; diffx = x - (x * gridSize / oldGridSize); diffy = y - (y * gridSize / oldGridSize); // AB: Move origin in opposite direction log.debug("diffX/diffY: " + diffx + "/" + diffy); log.debug("Manual Zoom Delta: " + realignToGrid(false, (int) diffx) + "/" + realignToGrid(false, (int) diffy)); getDrawPanel().moveOrigin(realignToGrid(false, -(int) diffx), realignToGrid(false, -(int) diffy)); for (GridElement e : getDrawPanel().getAllEntitiesNotInGroup()) { e.changeLocation(realignToGrid(false, (int) diffx), realignToGrid(false, (int) diffy)); } /** * Now we have to do some additional "clean up" stuff which is related to the zoom */ getDrawPanel().updatePanelAndScrollbars(); // Set the isChanged variable to allow saving in EclipsePlugin and to reflect the changes made by zooming setChanged(true); BaseGUI gui = Main.getInstance().getGUI(); if (gui != null) gui.setValueOfZoomDisplay(factor); float zoomFactor = Main.getInstance().getDiagramHandler().getZoomFactor() * 100; String zoomtext; if (Main.getInstance().getDiagramHandler() instanceof PaletteHandler) zoomtext = "Palette zoomed to " + (new Integer((int) zoomFactor).toString()) + "%"; else zoomtext = "Diagram zoomed to " + (new Integer((int) zoomFactor).toString()) + "%"; Main.getInstance().getCurrentInfoDiagramHandler().getDrawPanel().showNotification(zoomtext); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/CustomPreviewHandler.java0000644000175000001440000000127111576116034026103 0ustar benuserspackage com.baselet.diagram; import com.baselet.element.GridElement; import com.baselet.gui.listener.CustomPreviewEntityListener; import com.baselet.gui.listener.CustomPreviewListener; import com.baselet.gui.listener.GridElementListener; public class CustomPreviewHandler extends DiagramHandler { public CustomPreviewHandler() { super(null, true); this.setListener(new CustomPreviewListener(this)); } @Override public GridElementListener getEntityListener(GridElement e) { return CustomPreviewEntityListener.getInstance(this); } public void closePreview() { for (GridElement e : this.getDrawPanel().getAllEntities()) this.getDrawPanel().remove(e); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/SelectorFrame.java0000644000175000001440000000550211576116034024525 0ustar benusers package com.baselet.diagram; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; import org.apache.log4j.Logger; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; /** * @author unknown * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ @SuppressWarnings("serial") public class SelectorFrame extends JComponent { private final static Logger log = Logger.getLogger(Utils.getClassName()); // If the frame is drawn from the right to the left or from bottom to top the offset is // the distance from the drawing-start-point to the actual position of the mouse cursor private int offset_left; private int offset_top; // If the lasso is started on an entity the starting position must be displaced by the coordinates of the entity private int entity_displacement_x; private int entity_displacement_y; public SelectorFrame() { super(); reset(); } public void reset() { offset_left = 0; offset_top = 0; entity_displacement_x = 0; entity_displacement_y = 0; } public void setDisplacement(int x, int y) { entity_displacement_x = x; entity_displacement_y = y; } @Override public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.black); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); if (Utils.displaceDrawingByOnePixel()) g2.drawRect(1, 1, getWidth() - 1, getHeight() - 1); else g2.drawRect(0, 0, getWidth() - 1, getHeight() - 1); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } public void resizeTo(int x, int y) { int locx = this.getX(); int locy = this.getY(); int sizx = entity_displacement_x + x - this.getX(); int sizy = entity_displacement_y + y - this.getY(); if (sizx - this.offset_left < 0) { locx += sizx; sizx = sizx * (-1) + this.offset_left; this.offset_left = sizx; log.info("LEFT (offset: " + offset_left + "px)"); } else { sizx -= this.offset_left; locx += this.offset_left; this.offset_left = 0; log.info("RIGHT"); } if (sizy - this.offset_top < 0) { locy += sizy; sizy = sizy * (-1) + this.offset_top; this.offset_top = sizy; log.info("UP (offset: " + offset_top + "px)"); } else { sizy -= this.offset_top; locy += this.offset_top; this.offset_top = 0; log.info("DOWN"); } log.info("Starting point: (" + locx + "," + locy + ") Width: " + sizx + ", Height: " + sizy); this.setLocation(locx, locy); this.setSize(sizx, sizy); // TODO Uncomment to see the real lasso border -> remove after implementing lasso on entity // Main.getInstance().getGUI().getGraphics().drawRect(locx, locy, sizx, sizy); } } umlet-11.3.orig/sourcefiles/src/com/baselet/diagram/PaletteHandler.java0000644000175000001440000000121011576116034024656 0ustar benuserspackage com.baselet.diagram; import java.io.File; import com.baselet.element.GridElement; import com.baselet.gui.listener.GridElementListener; import com.baselet.gui.listener.PaletteEntityListener; import com.baselet.gui.listener.PaletteRelationListener; import com.umlet.element.Relation; public class PaletteHandler extends DiagramHandler { public PaletteHandler(File palettefile) { super(palettefile); } @Override public GridElementListener getEntityListener(GridElement e) { if (e instanceof Relation) return PaletteRelationListener.getInstance(this); return PaletteEntityListener.getInstance(this); } } umlet-11.3.orig/sourcefiles/src/com/baselet/element/0000755000175000001440000000000011576116036021154 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/element/DiagramNotification.java0000644000175000001440000000474111576116034025736 0ustar benuserspackage com.baselet.element; import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.Timer; import java.util.TimerTask; import javax.swing.JComponent; import org.apache.log4j.Logger; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.gui.NotificationRemoveTask; public class DiagramNotification extends JComponent { private static final long serialVersionUID = 1L; private final static Logger log = Logger.getLogger(Utils.getClassName()); private DiagramHandler handler; private String message; public DiagramNotification(DiagramHandler handler, String message) { this.handler = handler; this.message = message; TimerTask removeTask = new NotificationRemoveTask(this, Main.getInstance().getGUI().getCurrentDiagram()); new Timer().schedule(removeTask, 3000); this.setSize(100, 20); this.adaptDimensions(); } @Override public final void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; Composite old = g2.getComposite(); // Store non-transparent composite g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)); // 40% transparency g2.drawRect(0, 0, getWidth() - 1, getHeight() - 1); Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 10); g2.setFont(font); adaptDimensions(); log.debug("zoomFactor=" + handler.getZoomFactor()); log.debug("width=" + getWidth()); int textX = 5; int textY = (getHeight() / 2 + 3); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); // 70% transparency g2.drawString(message, textX, textY); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f)); // 5% transparency g2.setColor(java.awt.Color.blue); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(old); g2.setFont(handler.getFontHandler().getFont()); } private void adaptDimensions() { Rectangle currentView = this.handler.getDrawPanel().getScrollPane().getViewport().getViewRect(); Graphics2D g2 = (Graphics2D) this.handler.getDrawPanel().getGraphics(); int x = (int) (currentView.getMaxX() - g2.getFontMetrics().stringWidth(message)); int y = (int) (currentView.getMinY() + 10); this.setLocation(x, y); int width = g2.getFontMetrics().stringWidth(message); int height = g2.getFontMetrics().getHeight() + 10; this.setSize(width, height); } } umlet-11.3.orig/sourcefiles/src/com/baselet/element/StickingPolygon.java0000644000175000001440000001602311576116034025142 0ustar benusers package com.baselet.element; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Polygon; import java.awt.geom.Line2D; import java.util.List; import java.util.Vector; import com.baselet.control.Main; import com.baselet.diagram.DrawPanel; import com.umlet.element.Relation; import com.umlet.element.relation.RelationLinePoint; public class StickingPolygon { public class StickLine { private Point p1; private Point p2; // AB: important: tolerance <5 leads to zero tolerance at smaller zoom levels -> no sticking private int STICKING_TOLERANCE = 5; private StickLine(Point p1, Point p2) { this.p1 = p1; this.p2 = p2; } // calculates the difference between this line and the other line at the specified x or y coordinate (whichever fits better) public Point diffToLine(StickLine s, int x, int y) { Point diff = new Point(0, 0); if (p2.x == p1.x) { // AB: Fixed: use s.p1.x instead of p1.x diff.x = s.p1.x - (s.p2.x - s.p1.x) - x; // mitte der neuen linie if (s.p2.x == s.p1.x) { // vertical lines - no y difference except the line is at an end diff.y = 0; if (s.p1.y > s.p2.y) { if (s.p1.y < y) diff.y = s.p1.y - y; else if (s.p2.y > y) diff.y = s.p2.y - y; } else { if (s.p2.y < y) diff.y = s.p2.y - y; else if (s.p1.y > y) diff.y = s.p1.y - y; } return diff; } } else diff.x = (x - p1.x) * (s.p2.x - s.p1.x) / (p2.x - p1.x) + s.p1.x - x; if (p2.y == p1.y) { // AB: Fixed: use s.p1.x instead of p1.x diff.y = s.p1.y - (s.p2.y - s.p1.y) - y; if (s.p2.y == s.p1.y) { // horizontal lines - no x difference except the line is at an end diff.x = 0; if (s.p1.x > s.p2.x) { if (s.p1.x < x) diff.x = s.p1.x - x; else if (s.p2.x > x) diff.x = s.p2.x - x; } else { if (s.p2.x < x) diff.x = s.p2.x - x; else if (s.p1.x > x) diff.x = s.p1.x - x; } } } else diff.y = (y - p1.y) * (s.p2.y - s.p1.y) / (p2.y - p1.y) + s.p1.y - y; return diff; } private void draw(Graphics2D g2) { g2.drawLine(p1.x, p1.y, p2.x, p2.y); } private boolean isConnected(Point p) { Line2D line = new Line2D.Double(p1, p2); double d = line.ptLineDist(p); // calculate distance // AB: original this tolerance was 4 int delta = (int) (Main.getInstance().getDiagramHandler().getZoomFactor() * STICKING_TOLERANCE + 0.5); Polygon poly1 = new Polygon(); // create 2 rectangles with their size +/-4*zoom pixels poly1.addPoint(p1.x - delta, p2.y + delta); poly1.addPoint(p2.x + delta, p2.y + delta); poly1.addPoint(p2.x + delta, p1.y - delta); poly1.addPoint(p1.x - delta, p1.y - delta); Polygon poly2 = new Polygon(); poly2.addPoint(p1.x + delta, p2.y - delta); poly2.addPoint(p2.x - delta, p2.y - delta); poly2.addPoint(p2.x - delta, p1.y + delta); poly2.addPoint(p1.x + delta, p1.y + delta); // AB: original this tolerance was 5 return (d < delta) && ((poly1.contains(p) || (poly2.contains(p)))); // inside maximum distance AND inside one of the rectangles } } private Vector stick = new Vector(); private Point lastpoint = null; private Point firstpoint = null; public void addPoint(Point p) { // add a line with corresponding stickingInfo if (this.lastpoint != null) { stick.add(new StickLine(lastpoint, p)); } else this.firstpoint = p; this.lastpoint = p; } public StickLine getLine(int index) { return this.stick.get(index); } public void addPoint(Point p, boolean connect_to_first) { this.addPoint(p); if (connect_to_first && (this.firstpoint != null)) this.addPoint(this.firstpoint); } public void addLine(Point p1, Point p2) { stick.add(new StickLine(p1, p2)); } public final void draw(Graphics2D g2) { // LME: draw the sticking polygon for (StickLine l : this.stick) l.draw(g2); } private int isConnected(Point p) { int con = -1; for (int i = 0; i < this.stick.size(); i++) if (this.stick.get(i).isConnected(p)) return i; return con; } public Vector getStickingRelationLinePoints(DrawPanel panel) { Vector lpts = new Vector(); List rels = panel.getAllRelations(); for (Relation r : rels) { if (!r.isPartOfGroup()) { Point l1 = r.getAbsoluteCoorStart(); Point l2 = r.getAbsoluteCoorEnd(); int c1 = this.isConnected(l1); int c2 = this.isConnected(l2); if (c1 >= 0) lpts.add(new RelationLinePoint(r, 0, c1)); if (c2 >= 0) lpts.add(new RelationLinePoint(r, r.getLinePoints().size() - 1, c2)); } } return lpts; } /* * FROM ENTITY * public int doesCoordinateAppearToBeConnectedToMe(Point p) { * //LME: switched to sticking polygon * StickingPolygon sPoly = this.generateStickingBorder(); * if(sPoly != null) { * Point[][] lines = sPoly.getLines(); * int aX=this.getX(), aY=this.getY(); //absolute xy coords * Point p1,p2; * for(int i=0;i getAffectedRelationLinePoints(int action) { * Vector ret=new Vector(); * Vector allRelations=this.handler.getDrawPanel().getAllRelationsOnPanel(); * for (int i=0; i0){ * //L.Trescher start * if (tmpInt>0 && (!r.isPartOfGroup())){ * //L.Trescher end * int first=tmpInt%1000-1; * if (first>-1) { * ret.add(new RelationLinePoint(r,first)); * } * int last=tmpInt/1000-1; * if (last>-1) { * ret.add(new RelationLinePoint(r,last)); * } * } * } * return ret; * } * ------------------------------------------- * FROM RELATION * public int getConnectedLinePoint(Entity e, int action) { * int ret1 = -1; * int ret2 = -1; * Point p = this.getStartPoint(); * Point abs = new Point((int) (this.getX() + p.getX()), (int) (this * .getY() + p.getY())); * int where = e.doesCoordinateAppearToBeConnectedToMe(abs); * if ((where > 0) && ((where & action) > 0)) * ret1 = 0; * p = this.getEndPoint(); * abs = new Point((int) (this.getX() + p.getX()), (int) (this.getY() + p * .getY())); * where = e.doesCoordinateAppearToBeConnectedToMe(abs); * if ((where > 0) && ((where & action) > 0)) * ret2 = this.getLinePoints().size() - 1; * // A.Mueller start * if (clientServer != null && clientServer.equals("start")) * ret1 = -1; * if (clientServer != null && clientServer.equals("end")) * ret2 = -1; * // A.Mueller end * ret1++; * ret2++; * return ret1 + 1000 * ret2; * } */ } umlet-11.3.orig/sourcefiles/src/com/baselet/element/ErrorOccurred.java0000644000175000001440000000257311576116034024604 0ustar benuserspackage com.baselet.element; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.lang.reflect.Constructor; @SuppressWarnings("serial") public class ErrorOccurred extends GridElement { private String errorMessage; public ErrorOccurred() { errorMessage = "This Element has an Error!"; } public ErrorOccurred(String errorMessage) { super(); this.errorMessage = errorMessage; } @Override public void paintEntity(Graphics g) { float zoom = getHandler().getZoomFactor(); Graphics2D g2 = (Graphics2D) g; g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setColor(Color.red); g2.setFont(this.getHandler().getFontHandler().getFont()); this.getHandler().getFontHandler().writeText(g2, errorMessage, this.getWidth() / 2, this.getHeight() / 2 - (int) (10 * zoom), true); g2.setColor(fgColor); } @Override public GridElement CloneFromMe() { try { Constructor c = ErrorOccurred.class.getConstructor(new Class[]{String.class}); GridElement ge = c.newInstance(new Object[]{errorMessage}); ge.setPanelAttributes(this.getPanelAttributes()); // copy states ge.setBounds(this.getBounds()); ge.setHandler(this.getHandler()); return ge; } catch (Exception e) { log.error("Error at calling CloneFromMe() on entity", e); } return null; } } umlet-11.3.orig/sourcefiles/src/com/baselet/element/GridElement.java0000644000175000001440000003304011576116034024214 0ustar benuserspackage com.baselet.element; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Composite; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.Stroke; import java.awt.geom.Rectangle2D; import java.util.Vector; import javax.swing.JComponent; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Constants.LineType; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.umlet.element.Relation; public abstract class GridElement extends JComponent { private static final long serialVersionUID = 1L; protected final static Logger log = Logger.getLogger(Utils.getClassName()); private DiagramHandler handler; private boolean enabled; private boolean stickingBorderActive; private boolean autoresizeandmanualresizeenabled; private Group group = null; protected String panelAttributes = ""; protected boolean isSelected = false; // deselectedColor and fgColor must be stored separately because selection changes the actual fgColor but not the fgColorBase protected Color fgColorBase = Color.black; protected Color fgColor = fgColorBase; private String fgColorString = ""; protected Color bgColor = Color.white; private String bgColorString = ""; protected float alphaFactor; public GridElement() { this.allowResize = true; this.setSize(100, 100); this.setVisible(true); this.enabled = true; this.autoresizeandmanualresizeenabled = false; this.stickingBorderActive = true; } public DiagramHandler getHandler() { return handler; } public void setHandler(DiagramHandler handler) { if (this.getHandler() != null) { this.removeMouseListener(this.getHandler().getEntityListener(this)); this.removeMouseMotionListener(this.getHandler().getEntityListener(this)); } this.handler = handler; this.addMouseListener(this.getHandler().getEntityListener(this)); this.addMouseMotionListener(this.getHandler().getEntityListener(this)); } @Override public void setEnabled(boolean en) { super.setEnabled(en); if (!en && enabled) { this.removeMouseListener(this.getHandler().getEntityListener(this)); this.removeMouseMotionListener(this.getHandler().getEntityListener(this)); enabled = false; } else if (en && !enabled) { if (!this.isPartOfGroup()) { this.addMouseListener(this.getHandler().getEntityListener(this)); this.addMouseMotionListener(this.getHandler().getEntityListener(this)); } enabled = true; } } public boolean isStickingBorderActive() { return stickingBorderActive; } public void setStickingBorderActive(boolean stickingBordersActive) { this.stickingBorderActive = stickingBordersActive; } public boolean isManualResized() { autoresizeandmanualresizeenabled = true; return this.isManResized(); } private boolean isManResized() { Vector lines = Utils.decomposeStringsWithComments(this.getPanelAttributes()); for (String line : lines) { if (line.startsWith(Constants.NOAUTORESIZE)) return true; } return false; } protected boolean isAutoResizeandManualResizeEnabled() { return autoresizeandmanualresizeenabled; } public void setManualResized() { if (autoresizeandmanualresizeenabled) { if (!this.isManResized()) { this.setPanelAttributes(this.getPanelAttributes() + Constants.NEWLINE + Constants.NOAUTORESIZE); if (this.equals(Main.getInstance().getEditedGridElement())) Main.getInstance().setPropertyPanelToGridElement(this); } } } public Group getGroup() { return this.group; } protected void setGroup(Group group) { this.group = group; } public boolean isPartOfGroup() { if (this.group != null) return true; return false; } // returns true if the entity is part of group g // or if g = null and the entity is in no group // false otherwise public boolean isPartOfGroup(Group g) { if (g == null) { if (this.group == null) return true; else return false; } else if (g.equals(this.group)) return true; else return false; } // Some GridElements need additionalAttributes to be displayed correctly (eg: Relations need exact positions for edges) public String getAdditionalAttributes() { return ""; } public void setAdditionalAttributes(String s) { } public String getPanelAttributes() { return panelAttributes; } public Vector getPanelAttributesAsVector() { return Utils.decomposeStrings(panelAttributes); } public void setPanelAttributes(String panelAttributes) { this.panelAttributes = panelAttributes; } public boolean isSelected() { return isSelected; } public void onSelected() { isSelected = true; fgColor = Constants.DEFAULT_SELECTED_COLOR; this.repaint(); } public void onDeselected() { isSelected = false; fgColor = fgColorBase; this.setStickingBorderActive(true); this.repaint(); } public Color getFgColor() { return fgColor; } public String getFGColorString() { return fgColorString; } public Color getBgColor() { return bgColor; } public String getBGColorString() { return bgColorString; } public float getAlphaFactor() { return alphaFactor; } public void setColor(String colorString, boolean isForegroundColor) { String new_state = ""; Vector textlines = Utils.decomposeStringsWithComments(this.getPanelAttributes()); String prefix = (isForegroundColor ? "fg=" : "bg="); for (int i = 0; i < textlines.size(); i++) { if (!textlines.get(i).startsWith(prefix)) new_state += textlines.get(i) + "\n"; } if (!colorString.equals("default")) new_state += prefix + colorString; this.setPanelAttributes(new_state); this.getHandler().getDrawPanel().getSelector().updateSelectorInformation(); // update the property panel to display changed attributes this.repaint(); } public Composite[] colorize(Graphics2D g2) { bgColorString = ""; fgColorString = ""; bgColor = Constants.DEFAULT_BACKGROUND_COLOR; fgColorBase = Constants.DEFAULT_FOREGROUND_COLOR; Vector v = Utils.decomposeStringsWithComments(panelAttributes); for (int i = 0; i < v.size(); i++) { String line = v.get(i); if (line.indexOf("bg=") >= 0) { bgColorString = line.substring("bg=".length()); bgColor = Utils.getColor(bgColorString); if (bgColor == null) bgColor = Constants.DEFAULT_BACKGROUND_COLOR; } else if (line.indexOf("fg=") >= 0) { fgColorString = line.substring("fg=".length()); fgColorBase = Utils.getColor(fgColorString); if (fgColorBase == null) fgColorBase = Constants.DEFAULT_FOREGROUND_COLOR; if (!isSelected) fgColor = fgColorBase; } } alphaFactor = Constants.ALPHA_MIDDLE_TRANSPARENCY; if (bgColorString.equals("") || bgColorString.equals("default")) alphaFactor = Constants.ALPHA_FULL_TRANSPARENCY; Composite old = g2.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaFactor); Composite composites[] = { old, alpha }; return composites; } public int getRealWidth() { return getWidth() / handler.getGridSize() * Constants.DEFAULTGRIDSIZE; } public int getRealHeight() { return getHeight() / handler.getGridSize() * Constants.DEFAULTGRIDSIZE; } public int[] getCoordinates() { int[] ret = new int[4]; ret[0] = getX(); ret[1] = getY(); ret[2] = getWidth(); ret[3] = getHeight(); return ret; } public int getResizeArea(int x, int y) { int ret = 0; if ((x <= 5) && (x >= 0)) ret = Constants.RESIZE_LEFT; else if ((x <= this.getWidth()) && (x >= this.getWidth() - 5)) ret = Constants.RESIZE_RIGHT; if ((y <= 5) && (y >= 0)) ret = ret | Constants.RESIZE_TOP; else if ((y <= this.getHeight()) && (y >= this.getHeight() - 5)) ret = ret | Constants.RESIZE_BOTTOM; return ret; } public int getPossibleResizeDirections() { if (this.allowResize) return Constants.RESIZE_TOP | Constants.RESIZE_LEFT | Constants.RESIZE_BOTTOM | Constants.RESIZE_RIGHT; return 0; } public void changeSize(int diffx, int diffy) { this.setSize(this.getWidth() + diffx, this.getHeight() + diffy); } public void changeLocation(int diffx, int diffy) { this.setLocation(this.getX() + diffx, this.getY() + diffy); } @Override public boolean contains(Point p) { Rectangle bounds = this.getVisibleRect(); if (!bounds.contains(p)) return false; Vector entities = this.getHandler().getDrawPanel().getAllEntitiesNotInGroup(); for (GridElement other : entities) { if (other instanceof Relation) { // a relation is always on top // move point to coordinate system of other entity Point other_p = new Point(p.x + this.getX() - other.getX(), p.y + this.getY() - other.getY()); if (other.contains(other_p)) return false; } // If the this visibleRect is equal to the other VisibleRect, true will be returned. Otherwise we need to check further else if (!this.getVisibleRect().equals(other.getVisibleRect())) { Rectangle other_bounds = other.getVisibleRect(); // move bounds to coordinate system of this component other_bounds.x += other.getX() - this.getX(); other_bounds.y += other.getY() - this.getY(); if (other_bounds.contains(p)) { // the selected element has to be in front except if the other element is totally contained! if (bounds.contains(other_bounds) || (other.isSelected() && !other_bounds.contains(bounds))) return false; } } } return true; } @Override public boolean contains(int x, int y) { return this.contains(new Point(x, y)); } public boolean isInRange(Point upperLeft, Dimension size) { Rectangle2D rect1 = new Rectangle2D.Double(upperLeft.getX(), upperLeft.getY(), size.getWidth(), size.getHeight()); Rectangle2D rect2 = new Rectangle2D.Double(getX(), getY(), getWidth(), getHeight()); return (rect1.contains(rect2)); } public void setInProgress(Graphics g, boolean flag) { if (flag) { Graphics2D g2 = (Graphics2D) g; g2.setFont(this.getHandler().getFontHandler().getFont()); g2.setColor(Color.red); this.getHandler().getFontHandler().writeText(g2, "in progress...", this.getWidth() / 2 - 40, this.getHeight() / 2 + (int) this.getHandler().getFontHandler().getFontSize() / 2, false); } else { repaint(); } } public GridElement CloneFromMe() { try { java.lang.Class cx = this.getClass(); // get class of dynamic object GridElement c = cx.newInstance(); c.setPanelAttributes(this.getPanelAttributes()); // copy states c.setBounds(this.getBounds()); c.setHandler(this.getHandler()); return c; } catch (Exception e) { log.error("Error at calling CloneFromMe() on entity", e); } return null; } /** * Define and return the polygon on which relations stick on */ public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { StickingPolygon p = new StickingPolygon(); p.addPoint(new Point(x, y)); p.addPoint(new Point(x + width, y)); p.addPoint(new Point(x + width, y + height)); p.addPoint(new Point(x, y + height), true); return p; } public final void drawStickingPolygon(Graphics2D g2) { StickingPolygon poly; // The Java Implementations in the displaceDrawingByOnePixel list start at (1,1) to draw while any others start at (0,0) if (Utils.displaceDrawingByOnePixel()) poly = this.generateStickingBorder(1, 1, this.getWidth() - 1, this.getHeight() - 1); else poly = this.generateStickingBorder(0, 0, this.getWidth() - 1, this.getHeight() - 1); if (poly != null) { Color c = g2.getColor(); Stroke s = g2.getStroke(); g2.setColor(Constants.DEFAULT_SELECTED_COLOR); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); poly.draw(g2); g2.setColor(c); g2.setStroke(s); } } @Override public final void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; if (this.isSelected && Constants.show_stickingpolygon && !this.isPartOfGroup()) this.drawStickingPolygon(g2); // Zoom per transformation for certain elements. unused! // if (this instanceof SequenceDiagram) { // AffineTransform t = g2.getTransform(); // float scale = ((float) this.getHandler().getGridSize()) / 10; // t.scale(scale, scale); // g2.setTransform(t); // } this.paintEntity(g2); } public abstract void paintEntity(Graphics g); private boolean allowResize; protected final void allowResize(boolean allow) { this.allowResize = allow; } protected final void setAutoresize(int minWidth, int minHeight) { if (!isManualResized()) { int height = minHeight; // minimal height int width = minWidth; // minimal width // calculates the width and height of the component for (String textline : Utils.decomposeStrings(this.getPanelAttributes())) { height = height + textHeight(); width = Math.max(textWidth(textline, false) + 10, width); } if (height < minHeight) height = minHeight; if (width < minWidth) width = minWidth; this.setSize(width, height); } } protected final int textHeight() { return (int) ((int) this.getHandler().getFontHandler().getFontSize(false) + this.getHandler().getFontHandler().getDistanceBetweenTexts(false)); } protected final int textWidth(String text, boolean applyZoom) { return getHandler().getFontHandler().getTextSize(text, applyZoom).width + (int) getHandler().getFontHandler().getDistanceBetweenTexts(applyZoom); } } umlet-11.3.orig/sourcefiles/src/com/baselet/element/Group.java0000644000175000001440000001066211576116034023116 0ustar benusers// Class by A.Mueller Oct.05 package com.baselet.element; import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.Iterator; import java.util.Vector; import com.baselet.control.Constants.LineType; import com.baselet.control.Utils; import com.baselet.diagram.Selector; import com.baselet.diagram.command.AddElement; @SuppressWarnings("serial") public class Group extends GridElement { private Vector entities; // after adding all elements to a group the function adjustSize has to be called! public Group() { super(); this.entities = new Vector(); } /** * Erstellt einen neue Gruppe */ public void group(Vector ents) { if (ents.isEmpty()) return; Selector s = ents.get(0).getHandler().getDrawPanel().getSelector(); this.entities.clear(); for (Iterator it = ents.iterator(); it.hasNext();) this.addMember(it.next()); adjustSize(false); s.singleSelect(this); (new AddElement(this, this.getLocation().x, this.getLocation().y)).execute(this.getHandler()); } public void ungroup() { for (GridElement e : this.entities) { e.setGroup(null); e.addMouseListener(this.getHandler().getEntityListener(e)); e.addMouseMotionListener(this.getHandler().getEntityListener(e)); } this.getHandler().getDrawPanel().remove(this); this.getHandler().getDrawPanel().repaint(); } public Vector getMembers() { return entities; } public void addMember(GridElement member) { this.entities.add(member); member.setGroup(this); if (member.getHandler() != null) { member.removeMouseListener(member.getHandler().getEntityListener(member)); member.removeMouseMotionListener(member.getHandler().getEntityListener(member)); } } public void removeMemberListeners() { if (this.getHandler() != null) { for (GridElement e : this.entities) { e.removeMouseListener(this.getHandler().getEntityListener(e)); e.removeMouseMotionListener(this.getHandler().getEntityListener(e)); } } } @Override public void paintEntity(Graphics g) { if (this.isSelected() && !this.isPartOfGroup()) { Graphics2D g2 = (Graphics2D) g; g2.setColor(java.awt.Color.green); g2.setStroke(Utils.getStroke(LineType.DASHED, 1)); // Store non-transparent composite Composite old = g2.getComposite(); // Create a weak transparency effect for the group-border float alphaFactorStrong = 0.8f; AlphaComposite alphaStrong = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaFactorStrong); g2.setComposite(alphaStrong); g2.drawRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); // Create a strong transparency for the group background float alphaFactorLight = 0.05f; AlphaComposite alphaLight = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaFactorLight); g2.setComposite(alphaLight); g2.fillRect(0, 0, this.getWidth() - 1, this.getHeight() - 1); g2.setComposite(old); g2.setStroke(Utils.getStroke(LineType.SOLID, 1)); } } @Override public void onDeselected() { super.onDeselected(); for (GridElement e : this.entities) e.onDeselected(); } @Override public void onSelected() { super.onSelected(); for (GridElement e : this.entities) e.onSelected(); } public void adjustSize(boolean recursive) { if (entities.isEmpty()) return; int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; int maxX = 0; int maxY = 0; for (GridElement e : entities) { if (recursive && (e instanceof Group)) ((Group) e).adjustSize(true); maxX = Math.max(e.getX() + e.getWidth(), maxX); maxY = Math.max(e.getY() + e.getHeight(), maxY); minX = Math.min(e.getX(), minX); minY = Math.min(e.getY(), minY); } this.setLocation(minX, minY); this.setSize((maxX - minX), (maxY - minY)); } @Override public StickingPolygon generateStickingBorder(int x, int y, int width, int height) { return null; } @Override public GridElement CloneFromMe() { Group temp = new Group(); for (GridElement e : this.entities) { GridElement clone = e.CloneFromMe(); temp.addMember(clone); } temp.adjustSize(false); temp.setHandler(this.getHandler()); return temp; } @Override public void changeLocation(int diffx, int diffy) { super.changeLocation(diffx, diffy); for (GridElement e : this.entities) e.changeLocation(diffx, diffy); } @Override public int getPossibleResizeDirections() { // LME: deny resizing of groups return 0; } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/0000755000175000001440000000000011576116036021021 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/plugin/MainPlugin.java0000644000175000001440000000453211576116034023731 0ustar benuserspackage com.baselet.plugin; import java.net.URL; import org.apache.log4j.Logger; import org.eclipse.core.runtime.FileLocator; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.gui.eclipse.EclipseGUI; /** * The activator class controls the plug-in life cycle */ public class MainPlugin extends AbstractUIPlugin { private final static Logger log = Logger.getLogger(Utils.getClassName()); // The plug-in ID public static String PLUGIN_ID; // The shared instance private static MainPlugin plugin; private static EclipseGUI gui; public static EclipseGUI getGUI() { return gui; } /** * The constructor */ public MainPlugin() { Program.RUNTIME_TYPE = RuntimeType.ECLIPSE_PLUGIN; plugin = this; } /* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ @Override public void start(BundleContext context) throws Exception { super.start(context); try { Main.getInstance().initOverallSettings(); gui = new EclipseGUI(Main.getInstance()); Main.getInstance().init(gui); } catch (Exception e) { log.error("Initialization or uncaught outer Exception", e); } } /* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ @Override public void stop(BundleContext context) throws Exception { Main.getInstance().getGUI().closeWindow(); plugin = null; super.stop(context); } /** * Returns the shared instance * * @return the shared instance */ public static MainPlugin getDefault() { return plugin; } /** * Returns an image descriptor for the image file at the given * plug-in relative path * * @param path * the path * @return the image descriptor */ public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } public static URL getURL() { return FileLocator.find(MainPlugin.getDefault().getBundle(), new org.eclipse.core.runtime.Path("/"), null); } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/editor/0000755000175000001440000000000011576116036022307 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/plugin/editor/Contributor.java0000644000175000001440000002236511576116034025472 0ustar benuserspackage com.baselet.plugin.editor; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.part.EditorActionBarContributor; import com.baselet.control.Constants.Program; import com.baselet.control.Constants.ProgramName; import com.baselet.control.Constants.RuntimeType; import com.baselet.control.Main; import com.baselet.gui.MenuFactory; import com.baselet.gui.eclipse.EclipseGUI; import com.baselet.gui.eclipse.EclipseGUI.Pane; import com.baselet.gui.eclipse.MenuFactoryEclipse; import com.baselet.gui.eclipse.UpdateActionBars; import com.baselet.plugin.MainPlugin; public class Contributor extends EditorActionBarContributor { public enum ActionName { COPY, CUT, PASTE, SELECTALL } private MenuFactoryEclipse menuFactory = MenuFactoryEclipse.getInstance(); private IAction customnew; private IAction customedit; private IAction undoActionGlobal; private IAction redoActionGlobal; private IAction printActionGlobal; private IAction copyActionDiagram; private IAction cutActionDiagram; private IAction pasteActionDiagram; private IAction deleteActionDiagram; private IAction selectallActionDiagram; private IAction searchActionDiagram; private IAction copyActionPropPanel; private IAction cutActionPropPanel; private IAction pasteActionPropPanel; private IAction selectAllActionPropPanel; private IAction copyActionCustomPanel; private IAction cutActionCustomPanel; private IAction pasteActionCustomPanel; private IAction selectAllActionCustomPanel; private List exportAsActionList; private boolean customPanelEnabled; private boolean custom_element_selected; private IMenuManager zoomMenu; public Contributor() { this.customPanelEnabled = false; this.custom_element_selected = false; } private Action createPanelAction(final Pane pane, final ActionName action) { Action copyActionPropPanel = new Action() { @Override public void run() { ((EclipseGUI) Main.getInstance().getGUI()).panelDoAction(pane, action); } }; return copyActionPropPanel; } @Override public void init(IActionBars actionBars) { super.init(actionBars); customedit = menuFactory.createEditSelected(); customedit.setEnabled(false); undoActionGlobal = menuFactory.createUndo(); redoActionGlobal = menuFactory.createRedo(); printActionGlobal = menuFactory.createPrint(); cutActionDiagram = menuFactory.createCut(); cutActionDiagram.setEnabled(false); pasteActionDiagram = menuFactory.createPaste(); pasteActionDiagram.setEnabled(false); deleteActionDiagram = menuFactory.createDelete(); deleteActionDiagram.setEnabled(false); searchActionDiagram = menuFactory.createSearch(); copyActionDiagram = menuFactory.createCopy(); selectallActionDiagram = menuFactory.createSelectAll(); copyActionCustomPanel = createPanelAction(Pane.CUSTOMCODE, ActionName.COPY); cutActionCustomPanel = createPanelAction(Pane.CUSTOMCODE, ActionName.CUT); pasteActionCustomPanel = createPanelAction(Pane.CUSTOMCODE, ActionName.PASTE); selectAllActionCustomPanel = createPanelAction(Pane.CUSTOMCODE, ActionName.SELECTALL); copyActionPropPanel = createPanelAction(Pane.PROPERTY, ActionName.COPY); cutActionPropPanel = createPanelAction(Pane.PROPERTY, ActionName.CUT); pasteActionPropPanel = createPanelAction(Pane.PROPERTY, ActionName.PASTE); selectAllActionPropPanel = createPanelAction(Pane.PROPERTY, ActionName.SELECTALL); setGlobalActionHandlers(Pane.DIAGRAM); MainPlugin.getGUI().setContributor(this); } @Override public void contributeToMenu(IMenuManager manager) { if (Program.RUNTIME_TYPE == RuntimeType.ECLIPSE_PLUGIN) (MainPlugin.getGUI()).setContributor(this); IMenuManager menu = new MenuManager(Program.PROGRAM_NAME.toString()); IMenuManager custom = new MenuManager(MenuFactory.CUSTOM_ELEMENTS); IMenuManager help = new MenuManager(MenuFactory.HELP); manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu); custom.add(customnew = menuFactory.createNewCustomElement()); custom.add(menuFactory.createNewCustomElementFromTemplate(this)); custom.add(new Separator()); custom.add(menuFactory.createCustomElementsTutorial()); help.add(menuFactory.createOnlineHelp()); if (Program.PROGRAM_NAME == ProgramName.UMLET) help.add(menuFactory.createOnlineSampleDiagrams()); help.add(new Separator()); help.add(menuFactory.createProgramHomepage()); help.add(menuFactory.createRateProgram()); help.add(new Separator()); help.add(menuFactory.createAboutProgram()); zoomMenu = menuFactory.createZoom(); menu.add(zoomMenu); exportAsActionList = menuFactory.createExportAsActions(); IMenuManager export = new MenuManager("Export as"); for (IAction action: exportAsActionList) { export.add(action); } menu.add(export); menu.add(menuFactory.createEditCurrentPalette()); if (Program.PROGRAM_NAME == ProgramName.UMLET) menu.add(custom); menu.add(menuFactory.createMailTo()); menu.add(new Separator()); menu.add(help); menu.add(menuFactory.createOptions()); } public void setExportAsEnabled(boolean enabled) { //AB: We cannot disable the MenuManager, so we have to disable every entry in the export menu :P for (IAction action: exportAsActionList) { action.setEnabled(enabled); } } public void setPaste(boolean value) { this.pasteActionDiagram.setEnabled(value); } public void setCustomElementSelected(boolean selected) { this.custom_element_selected = selected; this.customedit.setEnabled(selected && !this.customPanelEnabled); } public void setElementsSelected(int count) { if (count > 0) { this.cutActionDiagram.setEnabled(true); this.deleteActionDiagram.setEnabled(true); } else { this.deleteActionDiagram.setEnabled(false); this.cutActionDiagram.setEnabled(false); } } public boolean isCustomPanelEnabled() { return customPanelEnabled; } public void setCustomPanelEnabled(boolean enable) { this.customPanelEnabled = enable; this.customedit.setEnabled(!enable && this.custom_element_selected); this.customnew.setEnabled(!enable); this.searchActionDiagram.setEnabled(!enable); } public void setGlobalActionHandlers(Pane focusedPane) { // Global actions which are always the same getActionBars().setGlobalActionHandler(ActionFactory.UNDO.getId(), undoActionGlobal); getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), redoActionGlobal); getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), printActionGlobal); // Specific actions depending on the active pane} if (focusedPane == Pane.DIAGRAM) { getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyActionDiagram); getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), cutActionDiagram); getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteActionDiagram); getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteActionDiagram); getActionBars().setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectallActionDiagram); getActionBars().setGlobalActionHandler(ActionFactory.FIND.getId(), searchActionDiagram); } else if (focusedPane == Pane.CUSTOMCODE) { getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyActionCustomPanel); getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), cutActionCustomPanel); getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteActionCustomPanel); getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), null); getActionBars().setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllActionCustomPanel); getActionBars().setGlobalActionHandler(ActionFactory.FIND.getId(), null); } else if (focusedPane == Pane.PROPERTY) { getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyActionPropPanel); getActionBars().setGlobalActionHandler(ActionFactory.CUT.getId(), cutActionPropPanel); getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteActionPropPanel); getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), null); getActionBars().setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllActionPropPanel); getActionBars().setGlobalActionHandler(ActionFactory.FIND.getId(), null); } org.eclipse.swt.widgets.Display.getDefault().asyncExec(new UpdateActionBars(this.getActionBars())); } public void updateZoomMenuRadioButton(int newGridSize) { for (IContributionItem item : zoomMenu.getItems()) { IAction action = ((ActionContributionItem) item).getAction(); int actionGridSize = Integer.parseInt(action.getText().substring(0, action.getText().length() - 2)); if (actionGridSize == newGridSize) action.setChecked(true); else action.setChecked(false); } } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/editor/DirtyAction.java0000644000175000001440000000040511576116034025400 0ustar benuserspackage com.baselet.plugin.editor; public class DirtyAction implements Runnable { private Editor editor; public DirtyAction(Editor editor) { this.editor = editor; } @Override public void run() { this.editor.fireDirtyProperty(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/editor/Editor.java0000644000175000001440000004075311576116034024407 0ustar benuserspackage com.baselet.plugin.editor; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; import java.awt.Panel; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.Hashtable; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComboBox; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTextField; import javax.swing.SwingUtilities; import org.apache.log4j.Logger; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; import org.eclipse.ui.part.FileEditorInput; import com.baselet.control.Constants; import com.baselet.control.Constants.Program; import com.baselet.control.Main; import com.baselet.control.Utils; import com.baselet.diagram.DiagramHandler; import com.baselet.diagram.DrawPanel; import com.baselet.diagram.PaletteHandler; import com.baselet.diagram.io.OutputHandler; import com.baselet.gui.MailPanel; import com.baselet.gui.OwnSyntaxPane; import com.baselet.gui.eclipse.CustomCodePaneFocusListener; import com.baselet.gui.eclipse.TextPaneFocusListener; import com.baselet.gui.listener.DividerListener; import com.baselet.gui.listener.GUIListener; import com.baselet.gui.listener.PaletteComboBoxListener; import com.baselet.gui.standalone.SearchListener; import com.baselet.plugin.MainPlugin; import com.umlet.custom.CustomElementHandler; import com.umlet.gui.CustomElementPanel; public class Editor extends EditorPart { private final static Logger log = Logger.getLogger(Utils.getClassName()); private DiagramHandler handler; private CustomElementHandler customhandler; private CustomElementPanel custompanel; private MailPanel mailpanel; private Hashtable palettes; private Panel embedded_panel; private OwnSyntaxPane propertyTextPane; private JTextField searchfield; private JPanel searchPanel; private JPanel palettePanel; private JPanel rightPanel; private JComboBox paletteList; private JSplitPane rightSplit; private JSplitPane mainSplit; private JSplitPane customSplit; private JSplitPane searchSplit; private JSplitPane mailSplit; private boolean mail_panel_visible; private static Editor currenteditor; public static Editor getCurrent() { return currenteditor; } public Editor() { log.info("Create new Editor()"); //we have to set this to false since multiple instances of Editor are created this.customhandler = new CustomElementHandler(); this.custompanel = this.customhandler.getPanel(); this.custompanel.getTextPane().addFocusListener(new CustomCodePaneFocusListener()); this.mailpanel = Main.getInstance().getGUI().createMailPanel(); this.propertyTextPane = Main.getInstance().getGUI().createPropertyTextPane(); this.propertyTextPane.addFocusListener(new TextPaneFocusListener()); this.palettes = Main.getInstance().getPalettes(); } @Override public void doSave(IProgressMonitor monitor) { //AB: This should also be made thread safe but the return value makes it difficulty. maybe this works anyway. log.info("Call editor.doSave()"); if (handler.doSave()) { log.debug("fireCleanProperty"); fireCleanProperty(); log.debug("monitor.done"); monitor.done(); } log.debug("doSave complete"); } @Override public void doSaveAs() {} @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { log.info("Call editor.init()"); this.setSite(site); this.setInput(input); this.setPartName(input.getName()); File inputFile = null; if (input instanceof IFileEditorInput) { // Files opened from workspace inputFile = ((IFileEditorInput) input).getFile().getLocation().toFile(); } else if (input instanceof org.eclipse.ui.ide.FileStoreEditorInput) { // Files from outside of the workspace (eg: edit current palette) inputFile = new File(((org.eclipse.ui.ide.FileStoreEditorInput) input).getURI()); } else throw new PartInitException("Editor input not supported."); final File file = inputFile; //AB: The eclipse plugin might hang sometimes if this section is not placed into an event queue, since swing or swt is not thread safe! //AB: Problem is...using invokeLater might lead to other NullPointerExceptions :P -> use invokeAndWait and hope this works try { SwingUtilities.invokeAndWait( new Runnable() { @Override public void run() { log.debug("Create new DiagramHandler"); handler = new DiagramHandler(file); log.debug("DiagramHandler created..."); } }); } catch (InterruptedException e) { log.error("Create DiagramHandler interrupted"); } catch (InvocationTargetException e) { log.error("Create DiagramHandler invocation exception"); } } @Override public boolean isDirty() { return this.handler.isChanged(); } @Override public boolean isSaveAsAllowed() { return false; } @Override public void createPartControl(Composite parent) { log.info("Call editor.createPartControl()"); Composite goodSWTComposite = new Composite(parent, SWT.EMBEDDED); // we need the embedded attribute set Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(goodSWTComposite); embedded_panel = new Panel(); embedded_panel.setLayout(new BorderLayout()); embedded_panel.add(createEditor()); embedded_panel.addKeyListener(new GUIListener()); frame.add(embedded_panel); } @Override public void setFocus() { log.info("Call editor.setFocus()"); currenteditor = this; MainPlugin.getGUI().setCurrentEditor(this); log.debug("setCurrentEditor complete"); //AB: The eclipse plugin might hang sometimes if this section is not placed into an event queue, since swing or swt is not thread safe! SwingUtilities.invokeLater( new Runnable() { @Override public void run() { log.debug("setFocus thread"); Main.getInstance().setCurrentDiagramHandler(handler); if (handler != null) handler.getDrawPanel().getSelector().updateSelectorInformation(); //when switching to another editor frame, check if palettePanel got lost if (palettePanel.getComponentCount()==0) { for (String palname : Main.getInstance().getPaletteNames(palettes)) { DrawPanel panel = palettes.get(palname + "." + Program.EXTENSION).getDrawPanel(); palettePanel.add(panel.getScrollPane(), palname); } } selectPalette(getSelectedPaletteName()); log.debug("editor.setFocus thread complete"); } }); Main.getInstance().getGUI().setValueOfZoomDisplay(handler.getGridSize()); log.debug("editor.setFocus complete"); } public DrawPanel getDiagram() { return this.handler.getDrawPanel(); } @Override public void dispose() { super.dispose(); log.info("Call editor.dispose()"); //AB: The eclipse plugin might hang sometimes if this section is not placed into an event queue, since swing or swt is not thread safe! final Editor editor = this; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (mailpanel.isVisible()) mailpanel.closePanel(); MainPlugin.getGUI().editorRemoved(editor); } }); } public void setCursor(Cursor cursor) { this.embedded_panel.setCursor(cursor); } public OwnSyntaxPane getPropertyPane() { return this.propertyTextPane; } public JEditorPane getCustomPane() { return custompanel.getTextPane(); } public void requestFocus() { this.embedded_panel.requestFocus(); } public void dirtyChanged() { org.eclipse.swt.widgets.Display.getDefault().asyncExec(new DirtyAction(this)); } public void diagramNameChanged() { org.eclipse.swt.widgets.Display.getDefault().asyncExec(new UpdateDiagramNameAction(this)); } protected void fireDiagramNameChanged() { this.firePropertyChange(PROP_TITLE); } // Adds the star right to the tab to show that there are some changes which have not been stored protected void fireDirtyProperty() { this.firePropertyChange(IEditorPart.PROP_DIRTY); } // Removes the star right to the tab to show that the changes have yet been stored protected void fireCleanProperty() { this.firePropertyChange(IEditorPart.PROP_INPUT); } private JPanel createEditor() { JPanel editor = new JPanel(); editor.setLayout(new BorderLayout()); palettePanel = new JPanel(new CardLayout()); paletteList = new JComboBox(); paletteList.setMaximumRowCount(15); for (String palname : Main.getInstance().getPaletteNames(palettes)) { DrawPanel panel = palettes.get(palname + "." + Program.EXTENSION).getDrawPanel(); palettePanel.add(panel.getScrollPane(), palname); paletteList.addItem(palname); } rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, palettePanel, propertyTextPane.getPanel()); rightSplit.setDividerSize(2); rightSplit.setDividerLocation(Main.getInstance().getGUI().getRightSplitPosition()); rightSplit.setResizeWeight(1); rightSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); paletteList.setAlignmentX(Component.CENTER_ALIGNMENT); rightSplit.setAlignmentX(Component.CENTER_ALIGNMENT); PaletteComboBoxListener pl = new PaletteComboBoxListener(); paletteList.addActionListener(pl); paletteList.addMouseWheelListener(pl); rightPanel.add(paletteList); rightPanel.add(rightSplit); selectPalette(this.getSelectedPaletteName()); this.searchPanel = new JPanel(); this.searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); JLabel searchlabel = new JLabel("Search:"); searchlabel.setFont(new Font("SansSerif", Font.BOLD, 11)); this.searchfield = new JTextField(); SearchListener listener = new SearchListener(); this.searchfield.addMouseMotionListener(listener); this.searchfield.addKeyListener(listener); this.searchfield.addFocusListener(new TextPaneFocusListener()); this.searchfield.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, Color.darkGray)); this.searchPanel.add(Box.createRigidArea(new Dimension(10, 20))); this.searchPanel.add(searchlabel); this.searchPanel.add(Box.createRigidArea(new Dimension(10, 20))); this.searchPanel.add(this.searchfield); this.searchSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, searchPanel, handler.getDrawPanel().getScrollPane()); this.searchSplit.setDividerSize(0); this.searchSplit.setResizeWeight(1); this.searchSplit.setEnabled(false); this.searchSplit.setBorder(null); this.searchPanel.setVisible(false); mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, searchSplit, rightPanel); mainSplit.setDividerSize(2); mainSplit.setDividerLocation(Main.getInstance().getGUI().getMainSplitPosition()); mainSplit.setResizeWeight(1); mainSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); customSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainSplit, custompanel); customSplit.setDividerSize(0); customSplit.setResizeWeight(1); customSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); custompanel.setVisible(false); mailSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mailpanel, customSplit); mailSplit.setDividerSize(0); mailSplit.setDividerLocation(Constants.mail_split_position); mailSplit.setResizeWeight(0); mailSplit.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 0)); mailpanel.setVisible(false); // Adding the DividerListener which refreshes Scrollbars here is enough for all dividers palettePanel.addComponentListener(new DividerListener()); editor.add(mailSplit); return editor; } public Panel getPanel() { return this.embedded_panel; } public CustomElementHandler getCustomElementHandler() { return this.customhandler; } public void exportToFormat(String format) { try { this.setFocus(); ByteArrayOutputStream outdata = new ByteArrayOutputStream(); try { OutputHandler.createToStream(format.toLowerCase(), outdata, this.handler); } catch (Exception e) { log.error(null, e); } IFile selFile = (IFile) ((FileEditorInput) getEditorInput()).getStorage(); IContainer targetFolder = selFile.getParent(); IPath newFilePath = targetFolder.getFullPath().append("/" + selFile.getName().substring(0, selFile.getName().length() - 4) + "." + format.toLowerCase()); // [UB]: changed WorkspacePlugin to ResourcesPlugin for eclipse3.0 compatibility IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath); if (!newFile.exists()) { newFile.create(new ByteArrayInputStream(outdata.toByteArray()), false, null); } else { newFile.setContents(new ByteArrayInputStream(outdata.toByteArray()), false, true, null); } } catch (CoreException e) { throw new RuntimeException(e.getMessage()); } } public void setCustomPanelEnabled(boolean enable) { if (this.custompanel.isVisible() != enable) { int loc = this.mainSplit.getDividerLocation(); this.custompanel.setVisible(enable); if (enable) { int rightloc = this.rightSplit.getDividerLocation(); this.customSplit.setDividerSize(2); this.rightSplit.setDividerSize(0); this.custompanel.getLeftSplit().setLeftComponent(this.propertyTextPane.getPanel()); this.customSplit.setDividerLocation(rightloc); this.custompanel.getRightSplit().setDividerLocation(loc); this.custompanel.getLeftSplit().setDividerLocation(this.handler.getDrawPanel().getScrollPane().getWidth() / 2); this.custompanel.getLeftSplit().updateUI(); } else { int rightloc = this.customSplit.getDividerLocation(); this.customSplit.setDividerSize(0); this.rightSplit.setDividerSize(2); this.rightSplit.setRightComponent(this.propertyTextPane.getPanel()); this.rightSplit.setDividerLocation(rightloc); } this.mainSplit.setDividerLocation(loc); } this.setDiagramsEnabled(!enable); } public void setMailPanelEnabled(boolean enable) { mailpanel.setVisible(enable); if (enable) { mailSplit.setDividerLocation(Constants.mail_split_position); mailSplit.setDividerSize(2); } else { mailSplit.setDividerSize(0); } mail_panel_visible = enable; } public boolean isMailPanelVisible() { return mail_panel_visible; } private void setDiagramsEnabled(boolean enable) { // this.palettetabs.setEnabled(enable); // for (Component c : this.palettetabs.getComponents()) // c.setEnabled(enable); this.handler.getDrawPanel().getScrollPane().setEnabled(enable); } public void repaint() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { embedded_panel.repaint(); } }); } public void enableSearch(boolean enable) { this.searchPanel.setVisible(enable); if (enable) { this.searchSplit.setDividerSize(1); this.searchSplit.setDividerLocation(20); this.searchfield.requestFocus(); } else { this.searchfield.setText(""); this.searchSplit.setDividerSize(0); this.requestFocus(); } } public String getSelectedPaletteName() { return this.paletteList.getSelectedItem().toString(); } public int getMainSplitLocation() { return mainSplit.getDividerLocation(); } public int getRightSplitLocation() { return rightSplit.getDividerLocation(); } public int getMailSplitLocation() { return mailSplit.getDividerLocation(); } public void selectPalette(String paletteName) { CardLayout palettePanelLayout = (CardLayout) palettePanel.getLayout(); palettePanelLayout.show(palettePanel, paletteName); } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/editor/UpdateDiagramNameAction.java0000644000175000001440000000044211576116034027616 0ustar benuserspackage com.baselet.plugin.editor; public class UpdateDiagramNameAction implements Runnable { private Editor editor; public UpdateDiagramNameAction(Editor editor) { this.editor = editor; } @Override public void run() { this.editor.fireDiagramNameChanged(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/wizard/0000755000175000001440000000000011576116036022321 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/plugin/wizard/NewWizardPage.java0000644000175000001440000001261711576116034025700 0ustar benuserspackage com.baselet.plugin.wizard; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.ContainerSelectionDialog; import com.baselet.control.Constants.Program; /** * The "New" wizard page allows setting the container for the new file as well * as the file name. The page will only accept file name without the extension * OR with the extension that matches the expected one (uxf/pxf). */ public class NewWizardPage extends WizardPage { private Text containerText; private Text fileText; private ISelection selection; /** * Constructor for SampleNewWizardPage. */ public NewWizardPage(ISelection selection) { super(Program.PROGRAM_NAME + " wizard"); setTitle(Program.PROGRAM_NAME + " diagram"); setDescription("This wizard creates a " + Program.PROGRAM_NAME + " diagram."); this.selection = selection; } /** * @see IDialogPage#createControl(Composite) */ @Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText("&Container:"); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { dialogChanged(); } }); Button button = new Button(container, SWT.PUSH); button.setText("Browse..."); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowse(); } }); label = new Label(container, SWT.NULL); label.setText("&Diagram name:"); fileText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { dialogChanged(); } }); initialize(); dialogChanged(); setControl(container); } /** * Tests if the current workbench selection is a suitable container to use. */ private void initialize() { if ((selection != null) && (selection.isEmpty() == false) && (selection instanceof IStructuredSelection)) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 1) return; Object obj = ssel.getFirstElement(); if (obj instanceof IResource) { IContainer container; if (obj instanceof IContainer) container = (IContainer) obj; else container = ((IResource) obj).getParent(); containerText.setText(container.getFullPath().toString()); } } fileText.setText("new_diagram." + Program.EXTENSION); } /** * Uses the standard container selection dialog to choose the new value for * the container field. */ private void handleBrowse() { ContainerSelectionDialog dialog = new ContainerSelectionDialog( getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container"); if (dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if (result.length == 1) { containerText.setText(((Path) result[0]).toString()); } } } /** * Ensures that both text fields are set. */ private void dialogChanged() { IResource container = ResourcesPlugin.getWorkspace().getRoot() .findMember(new Path(getContainerName())); String fileName = getFileName(); if (getContainerName().length() == 0) { updateStatus("File container must be specified"); return; } if ((container == null) || ((container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0)) { updateStatus("File container must exist"); return; } if (!container.isAccessible()) { updateStatus("Project must be writable"); return; } if (fileName.length() == 0) { updateStatus("File name must be specified"); return; } if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { updateStatus("File name must be valid"); return; } int dotLoc = fileName.lastIndexOf('.'); if (dotLoc != -1) { String ext = fileName.substring(dotLoc + 1); if (ext.equalsIgnoreCase(Program.EXTENSION) == false) { updateStatus("File extension must be \"" + Program.EXTENSION + "\""); return; } } updateStatus(null); } private void updateStatus(String message) { setErrorMessage(message); setPageComplete(message == null); } public String getContainerName() { return containerText.getText(); } public String getFileName() { return fileText.getText(); } } umlet-11.3.orig/sourcefiles/src/com/baselet/plugin/wizard/NewWizard.java0000644000175000001440000001241711576116034025101 0ustar benuserspackage com.baselet.plugin.wizard; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWizard; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; import com.baselet.control.Constants.Program; import com.baselet.plugin.MainPlugin; /** * This is a sample new wizard. Its role is to create a new file * resource in the provided container. If the container resource * (a folder or a project) is selected in the workspace * when the wizard is opened, it will accept it as the target * container. The wizard creates one file with the extension * "uxf/pxf". If a sample multi-page editor (also available * as a template) is registered for the same extension, it will * be able to open it. */ public class NewWizard extends Wizard implements INewWizard { private NewWizardPage page; private ISelection selection; /** * Constructor for SampleNewWizard. */ public NewWizard() { super(); setNeedsProgressMonitor(true); } /** * Adding the page to the wizard. */ @Override public void addPages() { page = new NewWizardPage(selection); addPage(page); } /** * This method is called when 'Finish' button is pressed in * the wizard. We will create an operation and run it * using wizard as execution context. */ @Override public boolean performFinish() { final String containerName = page.getContainerName(); String fn = page.getFileName(); int dotLoc = fn.lastIndexOf('.'); if (dotLoc == -1) fn += "." + Program.EXTENSION; final String fileName = fn; IRunnableWithProgress op = new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException { try { doFinish(containerName, fileName, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }; try { getContainer().run(true, false, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { Throwable realException = e.getTargetException(); MessageDialog.openError(getShell(), "Error", realException.getMessage()); return false; } return true; } /** * The worker method. It will find the container, create the * file if missing or just replace its contents, and open * the editor on the newly created file. */ private void doFinish( String containerName, String fileName, IProgressMonitor monitor) throws CoreException { // create a sample file monitor.beginTask("Creating " + fileName, 2); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember(new Path(containerName)); if (!resource.exists() || !(resource instanceof IContainer)) { throwCoreException("Container \"" + containerName + "\" does not exist."); } IContainer container = (IContainer) resource; final IFile file = container.getFile(new Path(fileName)); try { InputStream stream = openContentStream(); if (file.exists()) { file.setContents(stream, true, true, monitor); } else { file.create(stream, true, monitor); } stream.close(); } catch (IOException e) {} monitor.worked(1); monitor.setTaskName("Opening file for editing..."); getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(page, file, true); } catch (PartInitException e) { } } }); monitor.worked(1); } /** * We will initialize file contents with a sample text. */ private InputStream openContentStream() { String progName = Program.PROGRAM_NAME.toLowerCase(); String contents = "<" + progName + "_diagram>"; return new ByteArrayInputStream(contents.getBytes()); } private void throwCoreException(String message) throws CoreException { IStatus status = new Status(IStatus.ERROR, MainPlugin.PLUGIN_ID, IStatus.OK, message, null); throw new CoreException(status); } /** * We will accept the selection in the workbench to see if * we can initialize from it. * * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.selection = selection; } } umlet-11.3.orig/sourcefiles/src/com/baselet/shared/0000755000175000001440000000000011576116036020771 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/baselet/shared/Matrix.java0000644000175000001440000000300411576116034023073 0ustar benuserspackage com.baselet.shared; import java.util.ArrayList; import java.util.List; public class Matrix { private List> matrix = new ArrayList>(); /** * @return the row size */ public int rows() { return matrix.size(); } /** * @return the column size */ public int cols() { int longestCol = 0; for (List row : matrix) { if (row.size() > longestCol) longestCol = row.size(); } return longestCol; } public List row(int index) { return matrix.get(index); } public List col(int index) { List result = new ArrayList(cols()); for (List row : matrix) { if (index < row.size()) result.add(row.get(index)); else result.add(null); } return result; } public T cell(int row, int col) { return row(row).get(col); } public boolean hasMoreRowsThanCols() { return rows() > cols(); } public void invert() { List> result = new ArrayList>(cols()); for (int i = 0; i < cols(); i++) { result.add(col(i)); } matrix = result; } public void addLine(List line) { matrix.add(line); } public boolean isEmpty() { for (List row : matrix) { if (!row.isEmpty()) return false; } return true; } @Override public String toString() { String returnString = ""; for (List row : matrix) { for (T value : row) { returnString += (value != null ? value : "null") + "\t"; } returnString += "\n"; } return returnString; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/0000755000175000001440000000000011576116036017567 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/plotlet/gui/0000755000175000001440000000000011576116036020353 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/plotlet/gui/PlotletSyntaxKit.java0000644000175000001440000000631511576116034024523 0ustar benuserspackage com.plotlet.gui; import java.lang.reflect.Field; import java.util.HashMap; import java.util.regex.Pattern; import jsyntaxpane.DefaultSyntaxKit; import jsyntaxpane.lexers.SimpleRegexLexer; import org.apache.log4j.Logger; import com.baselet.control.Utils; import com.plotlet.parser.PlotConstants; @SuppressWarnings("serial") public class PlotletSyntaxKit extends DefaultSyntaxKit { protected final static Logger log = Logger.getLogger(Utils.getClassName()); private static final HashMap regExMap = new HashMap(); static { // The regex are matched anywhere in the whole text (not only at the beginning of a line) // If more than 1 RegEx match, the longest has the priority (eg: "plot" overrules "plo") regExMap.put("KEYWORD", Pattern.compile(PlotConstants.PLOT)); // regExMap.put("KEYWORD2", Pattern.compile(PlotConstants.REGEX_COLOR_BASE)); regExMap.put("COMMENT", Pattern.compile(PlotConstants.REGEX_COMMENT)); regExMap.put("TYPE", Pattern.compile(PlotConstants.REGEX_VALUE_ASSIGNMENT)); } public PlotletSyntaxKit() { super(new SimpleRegexLexer(regExMap)); } public static String createAutocompletionList(String listSep) { String outString = "plot" + listSep + "data" + listSep + "data=" + /*"" +*/ listSep; String fieldName = "", fieldContent = "", keyName = "", keyContent = "", keyType = ""; try { Field[] fs = PlotConstants.class.getFields(); for (Field f : fs) { fieldName = f.getName(); fieldContent = String.valueOf(f.get(String.class)); if (fieldName.startsWith("KEY_")) { if (keyType.equals("LIST")) { if (outString.lastIndexOf(PlotConstants.VALUE_LIST_SEPARATOR) != outString.length()-1) { // If no list values are listed outString += /*"" + PlotConstants.VALUE_LIST_SEPARATOR + "" + PlotConstants.VALUE_LIST_SEPARATOR + "..." + */listSep; } else { outString = outString.substring(0, outString.length()-PlotConstants.VALUE_LIST_SEPARATOR.length()) + listSep; } } String[] keySplit = fieldName.split("_"); keyType = keySplit[1]; keyName = keySplit[2]; keyContent = fieldContent; if (keyType.equals("BOOL")) { outString += keyContent + "=" + "true" + listSep; outString += keyContent + "=" + "false" + listSep; } else if (keyType.equals("INT")) { outString += keyContent + "=" + /*"" + */listSep; } else if (keyType.equals("LIST")) { outString += keyContent + "="; } } else if (!keyName.isEmpty() && fieldName.startsWith(keyName) && !fieldName.endsWith("DEFAULT") && !fieldContent.isEmpty()) { if (keyType.equals("LIST")) outString += fieldContent + PlotConstants.VALUE_LIST_SEPARATOR; else outString += keyContent + "=" + fieldContent + listSep; } } if (outString.lastIndexOf(PlotConstants.VALUE_LIST_SEPARATOR) == outString.length()-1) { outString = outString.substring(0, outString.length()-PlotConstants.VALUE_LIST_SEPARATOR.length()) + listSep; } } catch (Exception e) { log.error("Error at creating keyValueMap", e); } return outString; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/0000755000175000001440000000000011576116036021220 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/0000755000175000001440000000000011576116036023044 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/AbstractPlot.java0000644000175000001440000001177511576116034026322 0ustar benuserspackage com.plotlet.element.plotgrid; import java.awt.Color; import java.awt.Graphics; import java.util.List; import org.apache.log4j.Logger; import com.baselet.control.Constants; import com.baselet.control.Utils; import com.baselet.diagram.draw.PlotDrawHandler; import com.baselet.diagram.draw.objects.AxisConfig; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.plotlet.parser.DataSet; import com.plotlet.parser.ParserException; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public abstract class AbstractPlot { protected final static Logger log = Logger.getLogger(Utils.getClassName()); protected PlotDrawHandler plot; protected PlotGridDrawConfig plotDrawConfig; protected PlotState plotState; private Integer xPosition; private Integer yPosition; protected Integer maxDatasetRows = Integer.MAX_VALUE; public AbstractPlot(Graphics g, PlotGridDrawConfig plotDrawConfig, PlotState plotState, int xPosition, int yPosition) { this.plotDrawConfig = plotDrawConfig; this.plotState = plotState; this.xPosition = xPosition; this.yPosition = yPosition; plot = new PlotDrawHandler(g,plotDrawConfig); setupAxis(); setupAbstractPlot(); } public Integer getPlotLineNr() { return plotState.getPlotLineNr(); } public Integer getXPosition() { return xPosition; } public Integer getYPosition() { return yPosition; } private void setupAxis() { plot.getAxisConfig().enableDescAxis( plotState.getValueListValidated(PlotConstants.KEY_LIST_DESC_AXIS_SHOW, defaultDescAxisShow(), PlotConstants.getValuesForKey(PlotConstants.KEY_LIST_DESC_AXIS_SHOW), false)); plot.getAxisConfig().enableValueAxis( plotState.getValueListValidated(PlotConstants.KEY_LIST_VALUE_AXIS_SHOW, defaultValueAxisShow(), PlotConstants.getValuesForKey(PlotConstants.KEY_LIST_VALUE_AXIS_SHOW), false), plotState.getValueListValidated(PlotConstants.KEY_LIST_VALUE_AXIS_LIST, defaultValueAxisList(), PlotConstants.getValuesForKey(PlotConstants.KEY_LIST_VALUE_AXIS_LIST), true)); } private void setupAbstractPlot() { DataSet ds = plotState.getDataSet(); ds.setInvert(plotState.getValueAsBoolean(PlotConstants.KEY_BOOL_DATA_INVERT, PlotConstants.DATA_INVERT_DEFAULT)); String[] desc = ds.titleRow(); String[] title = ds.titleCol(); // System.out.print("\ntitle of ds " + ds.getLineNr() + " :"); // for (String t : title) System.out.print("<" + t + ">"); Double[][] values = ds.data(); List colors = plotState.getValueList(PlotConstants.KEY_LIST_COLORS, PlotConstants.COLORS_DEFAULT); for (String color : colors) { if (!Constants.colorMap.containsKey(color)) { try { // If the color is decodable, it's valid Color.decode(color); } catch(NumberFormatException e) { throw new ParserException("Unknown color: " + color + "(line: " + plotState.getLine(PlotConstants.KEY_LIST_COLORS) + ")"); } } } if (values.length > getMaxAllowedValueRows()) throw new ParserException("The dataset (line: " + plotState.getDataSet().getLineNr() + ") has too many rows for the plot (line: " + plotState.getPlotLineNr() + ")"); plot.setValues(desc, title, values, colors); setMinMaxValue(PlotConstants.KEY_INT_MIN_VALUE); setMinMaxValue(PlotConstants.KEY_INT_MAX_VALUE); } private void setMinMaxValue(String key) { String stringValue = plotState.getValue(key, null); if (stringValue != null) { try { if (key.equals(PlotConstants.KEY_INT_MIN_VALUE)) { if (stringValue.equals(PlotConstants.MIN_VALUE_ALL)) plot.setMinValue(plotDrawConfig.getMinValue()); else plot.setMinValue(Double.valueOf(stringValue)); } else if (key.equals(PlotConstants.KEY_INT_MAX_VALUE)) { if (stringValue.equals(PlotConstants.MAX_VALUE_ALL)) plot.setMaxValue(plotDrawConfig.getMaxValue()); else plot.setMaxValue(Double.valueOf(stringValue)); } } catch (Exception e) { throw new ParserException(key, stringValue, plotState.getLine(key), e.getMessage()); } } } protected void setPlotPosition(int columnCount, int rowCount) { if (xPosition > columnCount) throw new ParserException("The x coordinate is invalid. PlotGrid width is too small"); if (yPosition > rowCount) throw new ParserException("The y coordinate is invalid. PlotGrid height is too small"); double segmentWidth = ((double) plotDrawConfig.getRealSize().width / columnCount); double segmentHeight = ((double) plotDrawConfig.getRealSize().height / rowCount); int spaceLeft = (int) (segmentWidth * xPosition); int spaceRight = (int) (segmentWidth * (columnCount -xPosition - 1)); int spaceTop = (int) (segmentHeight * yPosition); int spaceBottom = (int) (segmentHeight * (rowCount - yPosition - 1)); plot.getCanvas().setBorder(spaceLeft, spaceTop, spaceRight, spaceBottom, AxisConfig.ARROW_DISTANCE); } public abstract void plot(int columnCount, int rowCount); protected abstract List defaultDescAxisShow(); protected abstract List defaultValueAxisShow(); protected abstract List defaultValueAxisList(); protected abstract int getMaxAllowedValueRows(); } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/PiePlot.java0000644000175000001440000000222611576116034025263 0ustar benuserspackage com.plotlet.element.plotgrid; import java.awt.Graphics; import java.util.Arrays; import java.util.List; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public class PiePlot extends AbstractPlot { public PiePlot(Graphics g, PlotGridDrawConfig plotDrawConfig, PlotState plotState, int xPos, int yPos) { super(g,plotDrawConfig, plotState, xPos, yPos); } @Override public void plot(int columnCount, int rowCount) { setPlotPosition(columnCount, rowCount); Boolean tilt = plotState.getValueAsBoolean(PlotConstants.KEY_BOOL_PLOT_TILT, PlotConstants.PLOT_TILT_DEFAULT); plotState.checkIfAllValuesUsed(); plot.drawPiePlot(tilt); } @Override protected List defaultDescAxisShow() { return Arrays.asList(new String[] {}); } @Override protected List defaultValueAxisShow() { return Arrays.asList(new String[] {}); } @Override protected List defaultValueAxisList() { return Arrays.asList(new String[] {}); } @Override protected int getMaxAllowedValueRows() { return 1; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/ScatterPlot.java0000644000175000001440000000271111576116034026152 0ustar benuserspackage com.plotlet.element.plotgrid; import java.awt.Graphics; import java.util.Arrays; import java.util.List; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public class ScatterPlot extends AbstractPlot { public ScatterPlot(Graphics g, PlotGridDrawConfig plotDrawConfig, PlotState plotState, int xPos, int yPos) { super(g,plotDrawConfig, plotState, xPos, yPos); } @Override public void plot(int columnCount, int rowCount) { setPlotPosition(columnCount, rowCount); Boolean tilt = plotState.getValueAsBoolean(PlotConstants.KEY_BOOL_PLOT_TILT, PlotConstants.PLOT_TILT_DEFAULT); plotState.checkIfAllValuesUsed(); plot.drawPlotAndDescValueAxis(!tilt, false, false, true); } @Override protected List defaultDescAxisShow() { return Arrays.asList(new String[] {PlotConstants.DESC_AXIS_SHOW_AXIS, PlotConstants.DESC_AXIS_SHOW_MARKER, PlotConstants.DESC_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisShow() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_SHOW_AXIS, PlotConstants.VALUE_AXIS_SHOW_MARKER, PlotConstants.VALUE_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisList() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_LIST_RELEVANT}); } @Override protected int getMaxAllowedValueRows() { return Integer.MAX_VALUE; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/BarPlot.java0000644000175000001440000000345411576116034025256 0ustar benuserspackage com.plotlet.element.plotgrid; import java.awt.Graphics; import java.io.IOException; import java.util.Arrays; import java.util.List; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public class BarPlot extends AbstractPlot { public BarPlot(Graphics g, PlotGridDrawConfig plotDrawConfig, PlotState plotState, int xPos, int yPos) { super(g,plotDrawConfig, plotState, xPos, yPos); } @Override public void plot(int columnCount, int rowCount) { setPlotPosition(columnCount, rowCount); // The barplot should always start at 0 even if there are only values which are > 0 or only values < 0 try { if (!plotState.containsKey(PlotConstants.KEY_INT_MIN_VALUE)) plot.setMinValue(0.0); } catch (IOException e) { } try { if (!plotState.containsKey(PlotConstants.KEY_INT_MAX_VALUE)) plot.setMaxValue(0.0); } catch (IOException e) { } Boolean tilt = plotState.getValueAsBoolean(PlotConstants.KEY_BOOL_PLOT_TILT, PlotConstants.PLOT_TILT_DEFAULT); plotState.checkIfAllValuesUsed(); plot.drawPlotAndDescValueAxis(!tilt, true, false, false); } @Override protected List defaultDescAxisShow() { return Arrays.asList(new String[] {PlotConstants.DESC_AXIS_SHOW_AXIS, PlotConstants.DESC_AXIS_SHOW_MARKER, PlotConstants.DESC_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisShow() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_SHOW_AXIS, PlotConstants.DESC_AXIS_SHOW_LINE, PlotConstants.VALUE_AXIS_SHOW_MARKER, PlotConstants.VALUE_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisList() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_LIST_RELEVANT}); } @Override protected int getMaxAllowedValueRows() { return Integer.MAX_VALUE; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/plotgrid/LinePlot.java0000644000175000001440000000301311576116034025430 0ustar benuserspackage com.plotlet.element.plotgrid; import java.awt.Graphics; import java.util.Arrays; import java.util.List; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public class LinePlot extends AbstractPlot { public LinePlot(Graphics g, PlotGridDrawConfig plotDrawConfig, PlotState plotState, int xPos, int yPos) { super(g,plotDrawConfig, plotState, xPos, yPos); } @Override public void plot(int columnCount, int rowCount) { setPlotPosition(columnCount, rowCount); Boolean tilt = plotState.getValueAsBoolean(PlotConstants.KEY_BOOL_PLOT_TILT, PlotConstants.PLOT_TILT_DEFAULT); plotState.checkIfAllValuesUsed(); plot.drawPlotAndDescValueAxis(!tilt, false, true, false); } @Override protected List defaultDescAxisShow() { return Arrays.asList(new String[] {PlotConstants.DESC_AXIS_SHOW_AXIS, PlotConstants.DESC_AXIS_SHOW_LINE, PlotConstants.DESC_AXIS_SHOW_MARKER, PlotConstants.DESC_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisShow() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_SHOW_AXIS, PlotConstants.VALUE_AXIS_SHOW_LINE, PlotConstants.VALUE_AXIS_SHOW_MARKER, PlotConstants.VALUE_AXIS_SHOW_TEXT}); } @Override protected List defaultValueAxisList() { return Arrays.asList(new String[] {PlotConstants.VALUE_AXIS_LIST_RELEVANT}); } @Override protected int getMaxAllowedValueRows() { return Integer.MAX_VALUE; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/element/PlotGrid.java0000644000175000001440000002204111576116034023604 0ustar benuserspackage com.plotlet.element; import java.awt.Dimension; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import com.baselet.control.Constants; import com.baselet.diagram.draw.BaseDrawHandler; import com.baselet.diagram.draw.objects.PlotGridDrawConfig; import com.baselet.element.GridElement; import com.baselet.shared.Matrix; import com.plotlet.element.plotgrid.AbstractPlot; import com.plotlet.element.plotgrid.BarPlot; import com.plotlet.element.plotgrid.LinePlot; import com.plotlet.element.plotgrid.PiePlot; import com.plotlet.element.plotgrid.ScatterPlot; import com.plotlet.parser.Parser; import com.plotlet.parser.ParserException; import com.plotlet.parser.ParserResult; import com.plotlet.parser.PlotConstants; import com.plotlet.parser.PlotState; public class PlotGrid extends GridElement { private Matrix> matrix; private static final long serialVersionUID = 1L; private Integer gridWidth; private Double minValue; private Double maxValue; @Override public void paintEntity(Graphics g) { try { matrix = new Matrix>(); ParserResult parserState = new Parser().parse(getPanelAttributes()); log.debug(parserState.toString()); gridWidth = Integer.parseInt(parserState.getPlotGridValue(PlotConstants.KEY_INT_GRID_WIDTH, PlotConstants.GRID_WIDTH_DEFAULT)); fillWithPlots(parserState.getPlotStateList(), g); drawPlots(); } catch (ParserException e) { // log.error(null, e); BaseDrawHandler draw = new BaseDrawHandler(g, getHandler(), fgColor, bgColor, getSize(), isSelected); draw.setForegroundColor("red"); draw.setBackgroundColor("white"); draw.setBackgroundAlpha(Constants.ALPHA_NO_TRANSPARENCY); draw.drawRectangle(0, 0, getWidth()-1, getHeight()-1); draw.printCenter(e.getMessage(), getRealHeight()/2); } } private void fillWithPlots(ArrayList plotStateList, Graphics g) { setOverallMinMaxValue(plotStateList); for (PlotState plotState : plotStateList) { Integer xPos = plotState.getValueAsInt(PlotConstants.KEY_INT_X_POSITION, null); Integer yPos = plotState.getValueAsInt(PlotConstants.KEY_INT_Y_POSITION, null); // 1 is subtracted from the values because the user counts from 1 to x; java counts from 0 to x-1 if (xPos != null) xPos -= 1; if (yPos != null) yPos -= 1; // case1: x and y are specified if (xPos != null && yPos != null) { setMatrixHeightMinimum(yPos); List> xCoordinateList = matrix.row(yPos); setMinimumListSize(xPos, xCoordinateList); xCoordinateList.set(xPos, createPlots(g, plotState, xPos, yPos, "x and y are specified")); } // case2: only x is specified else if (xPos != null) { putPlotInFirstFreeVerticalSpaceOrAddPlot(xPos, g, plotState, "only x is specified -> space replaced"); } // case3: only y is specified else if (yPos != null) { setMatrixHeightMinimum(yPos); List> xCoordinateList = matrix.row(yPos); putPlotInFirstFreeHorizontalSpaceOrAddPlot(xCoordinateList, yPos, g, plotState, "only y specified -> "); } // case4: no coordinate is specified else { putPlotInFirstFreeMatrixSpace(g, plotState); } } gridWidth = matrix.cols(); // Recalculate grid width log.info("\n" + this.toString() + "\n"); } private void setOverallMinMaxValue(List plotStateList) { minValue = Double.MAX_VALUE; maxValue = Double.MIN_VALUE; Double[][] data; for (PlotState state : plotStateList) { data = state.getDataSet().data(); for (Double[] dArray : data) { for (Double d : dArray) { if (d > maxValue) maxValue = d; if (d < minValue) minValue = d; } } } } private void setMatrixHeightMinimum(Integer minHeight) { while (minHeight > matrix.rows()-1) { matrix.addLine(new ArrayList>()); } } private void setMinimumListSize(Integer minWidth, List> lineToSet) { while (minWidth > lineToSet.size()-1) { lineToSet.add(null); } } private void putPlotInFirstFreeVerticalSpaceOrAddPlot(Integer xFix, Graphics g, PlotState plotState, String info) { boolean plotFilledInFreeSpace = false; for (int ySeq = 0; ySeq < matrix.rows(); ySeq++) { List> xCoordinateList = matrix.row(ySeq); if (xFix >= xCoordinateList.size()) setMinimumListSize(xFix, xCoordinateList); if (xCoordinateList.get(xFix) == null) { xCoordinateList.set(xFix, createPlots(g, plotState, xFix, ySeq, info)); plotFilledInFreeSpace = true; break; } } // If there is no free space available for the plot, a new line must be added if (!plotFilledInFreeSpace) { ArrayList> newColumn = new ArrayList>(); setMinimumListSize(xFix, newColumn); newColumn.set(xFix, createPlots(g, plotState, xFix, matrix.rows(), "only x is specified -> expanded y-list")); matrix.addLine(newColumn); } } private void putPlotInFirstFreeHorizontalSpaceOrAddPlot(List> xCoordinateList, Integer yFix, Graphics g, PlotState plotState, String info) { for (int xSeq = 0; true; xSeq++) { if (xSeq == xCoordinateList.size()) { xCoordinateList.add(createPlots(g, plotState, xSeq, yFix, info + "added new x-entry")); return; } if (xCoordinateList.get(xSeq) == null) { xCoordinateList.set(xSeq, createPlots(g, plotState, xSeq, yFix, info + "replaced x-entry")); return; } } } private void putPlotInFirstFreeMatrixSpace(Graphics g, PlotState plotState) { // Go through all lines and all values in each line for (int ySeq = 0; ySeq < matrix.rows(); ySeq++) { List> oneLine = matrix.row(ySeq); for (int xSeq = 0; xSeq < oneLine.size(); xSeq++) { List oneValue = oneLine.get(xSeq); // If a free space is found use it if (oneValue == null) { oneLine.set(xSeq, createPlots(g, plotState, xSeq, ySeq, "no coordinate specified -> free space found")); return; } } // If the actual x-coordinates line is < than the default grid width add a new value if (oneLine.size() < gridWidth) { oneLine.add(createPlots(g, plotState, oneLine.size(), ySeq, "no coordinate specified -> expanded x-list")); return; } } // If every space in the matrix is occupied and the position is still not found add a new line and fill its first place List> newLine = new ArrayList>(); newLine.add(createPlots(g, plotState, 0, matrix.rows(), "no coordinate specified -> every matrix space occupied, expanded y-list")); matrix.addLine(newLine); } private List createPlots(Graphics g, PlotState plotState, Integer xPos, Integer yPos, String info) { List plotList = new ArrayList(); //create and add base plot plotList.add(createPlot(g, plotState, xPos, yPos, info)); //create and add sub plots for (PlotState subPlotState: plotState.getSubplots()) { plotList.add(createPlot(g, subPlotState, xPos, yPos, info)); } return plotList; } private AbstractPlot createPlot(Graphics g, PlotState plotState, int xPos, int yPos, String info) { String type = plotState.getValueValidated(PlotConstants.KEY_STRING_TYPE, PlotConstants.TYPE_BAR, PlotConstants.getValuesForKey(PlotConstants.KEY_STRING_TYPE)); log.info("PlotGrid insert : " + type + " (" + xPos + ";" + yPos + ") " + info); PlotGridDrawConfig plotDrawConfig = new PlotGridDrawConfig(this.getHandler(), this.getRealSize(), this.getSize(), this.getFgColor(), this.getBgColor(), this.isSelected, this.minValue, this.maxValue); if (PlotConstants.TYPE_PIE.equals(type)) return new PiePlot(g,plotDrawConfig, plotState, xPos, yPos); else if (PlotConstants.TYPE_LINE.equals(type)) return new LinePlot(g,plotDrawConfig, plotState, xPos, yPos); else if (PlotConstants.TYPE_SCATTER.equals(type)) return new ScatterPlot(g,plotDrawConfig, plotState, xPos, yPos); else return new BarPlot(g,plotDrawConfig, plotState, xPos, yPos); } private Dimension getRealSize() { return new Dimension(getRealWidth(), getRealHeight()); } public void drawPlots() { for (int row = 0; row < matrix.rows(); row++) { for (int col = 0; col < matrix.row(row).size(); col++) { List oneCell = matrix.cell(row,col); for (AbstractPlot onePlot: oneCell) { if (onePlot != null) { if (col != onePlot.getXPosition()) log.error("Plot contains wrong coordinates: " + col + " != " + onePlot.getXPosition()); if (row != onePlot.getYPosition()) log.error("Plot contains wrong coordinates: " + row + " != " + onePlot.getYPosition()); onePlot.plot(matrix.cols(), matrix.rows()); } } } } } @Override public String toString() { String returnString = "------------------------------\n"; for (int i = 0; i < matrix.rows(); i++) { List> row = matrix.row(i); for (List oneCell: row) { for (AbstractPlot onePlot : oneCell) { if (onePlot == null) returnString += "null" + "\t"; else returnString += onePlot.getPlotLineNr() + "\t"; } } returnString += "\n"; } return returnString + "------------------------------"; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/0000755000175000001440000000000011576116036021063 5ustar benusersumlet-11.3.orig/sourcefiles/src/com/plotlet/parser/Parser.java0000644000175000001440000002007611576116034023165 0ustar benuserspackage com.plotlet.parser; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.ListIterator; import org.apache.log4j.Logger; public class Parser { private static final Logger log = Logger.getLogger(Parser.class); // The parserResult contains every information which is relevant after input parsing is finished private ParserResult parserResult; // The following fields are only used during parsing but never referenced after parsing is finished // The values HashsMap contains the actual state of key->value assignments which is copied to every plot at its time of creation private HashMap tempPlotValuesCache; // The datasetNr is used for sequential naming of not explicitly named datasets private int datasetNr = 1; // The datasetlist is filled during parsing. After parsing every plot gets its dataset injected private ArrayList datasetList; public Parser() { parserResult = new ParserResult(); datasetList = new ArrayList(); tempPlotValuesCache = new HashMap(); } public ParserResult parse(String source) { List inputList = Arrays.asList(source.split("\n")); ListIterator inputIterator = inputList.listIterator(); while (inputIterator.hasNext()) { String line = inputIterator.next(); if (line.isEmpty() || line.matches(PlotConstants.REGEX_COMMENT)) /* ignore empty lines and comments */; else if (line.matches(PlotConstants.REGEX_PLOT)) parserResult.addPlotState(createPlotStateObject(line.split(" "), inputIterator)); else if (line.matches(PlotConstants.REGEX_PLOT_ADD)) { List plotStates = parserResult.getPlotStateList(); if (plotStates.isEmpty()) { //if no plotStates, create a new one parserResult.addPlotState(createPlotStateObject(line.split(" "), inputIterator)); } else { //if plots exist, add new plotState to last plotState PlotState last = plotStates.get(plotStates.size()-1); last.addSubPlot(createPlotStateObject(line.split(" "), inputIterator)); } } else if (line.matches(PlotConstants.REGEX_DATA)) createDatasetObject(line.split(" "), inputIterator); // else if (line.matches(PlotConstants.REGEX_KEY + "=?") && inputIterator.next().isEmpty()) { // // A single key (with or without following =) with an empty line afterwards should not be guessed as a dataset // throw new ParserException("The key \"" + line + "\" needs an associated value (line: " + inputIterator.previousIndex() + ")"); // } else if (line.matches(PlotConstants.REGEX_DATA_GUESS)) { inputIterator.previous(); // Must go 1 step back to avoid skipping the first line in createDatasetObject createDatasetObject(new String[] {PlotConstants.DATA}, inputIterator); } else if (line.matches(PlotConstants.REGEX_VALUE_ASSIGNMENT)) createKeyValueAssignment(line, inputIterator.nextIndex()); else throw new ParserException("Invalid line: " + line + "(line: " + inputIterator.nextIndex() + ")"); } analyseDatasets(); addDatasetsToPlotStates(); return parserResult; } /** * Is called after parsing everything to analyse the dataset content */ private void analyseDatasets() { for (DataSet dataset : datasetList) { dataset.analyseMatrix(); } } /** * Is called after parsing everything to fill datasets in each plotState Object */ private void addDatasetsToPlotStates() { if (datasetList.isEmpty()) throw new ParserException("You must specify at least one dataset."); int actualAutoDatasetNr = 0; for (PlotState plotState : parserResult.getPlotStateList()) { actualAutoDatasetNr = addDataset(plotState, actualAutoDatasetNr); //also add datasets to subplots for (PlotState subPlotState: plotState.getSubplots()) { log.info("Add dataset for subplot"); actualAutoDatasetNr = addDataset(subPlotState, actualAutoDatasetNr); } } } private int addDataset(PlotState plotState, int actualAutoDatasetNr) { String datasetId = plotState.getValue(PlotConstants.KEY_STRING_DATA, null); if (datasetId == null) { if (actualAutoDatasetNr >= datasetList.size()) actualAutoDatasetNr = 0; plotState.setDataSet(datasetList.get(actualAutoDatasetNr++)); } else { DataSet dataset = null; if (datasetId.startsWith("#")) { String datasetNr = datasetId.substring(1); for (DataSet tempDataset : datasetList) { if (datasetNr.equals(String.valueOf(tempDataset.getNr()))) dataset = tempDataset; } } else { for (DataSet tempDataset : datasetList) { if (datasetId.equals(tempDataset.getId())) dataset = tempDataset; } } if (dataset != null) plotState.setDataSet(dataset); else throw new ParserException(PlotConstants.KEY_STRING_DATA, datasetId, plotState.getLine(PlotConstants.KEY_STRING_DATA)); } return actualAutoDatasetNr; } /** * Creates a dataset with the second argument as its id (if it has no such parameter it gets a generated id) * This method is called if the input string starts with "data" or if the input string contains a tab (then a dataset is assumed) * All lines until the next empty line are part of the dataset * * @param args any parameters to the data command including the command itself as first parameter */ private void createDatasetObject(String[] args, ListIterator inputIterator) { int lineNr = inputIterator.nextIndex(); String datasetId = null; if (args != null) { if (args.length > 1) datasetId = args[1]; /* handle further parameters here */ } DataSet newDataset = new DataSet(datasetId, datasetNr++, lineNr); while(inputIterator.hasNext()) { String nextLine = inputIterator.next(); if (nextLine.matches(PlotConstants.REGEX_COMMENT)) continue; else if (nextLine.trim().isEmpty()) break; else newDataset.addLine(nextLine.split(PlotConstants.REGEX_DATA_SEPARATOR)); } if (datasetId != null) { for (DataSet ds : datasetList) { if (datasetId.equals(ds.getId())) throw new ParserException("The dataset name \"" + datasetId + "\" (line: " + lineNr + ") already exists"); } } datasetList.add(newDataset); } /** * Creates a plotValues Object which contains the dataset as its second argument (if it has no such parameter it cycles through all datasets) * This method is called if the input string starts with "plot". All values which are stored in the parser are copied to the plot * * @param args any parameters to the data command including the command itself as first parameter */ private PlotState createPlotStateObject(String[] args, ListIterator inputIterator) { int lineNr = inputIterator.nextIndex(); HashMap localCopyOfValuesCache = copyHashMap(tempPlotValuesCache); if (args != null) { // Arguments are handled as any other key->value assignment but are only valid for this plot for (int i = 1; i < args.length; i++) { String[] split = args[i].split("="); if (split.length == 2) localCopyOfValuesCache.put(split[0], new KeyValue(split[0], split[1], lineNr)); } } // If no dataset is specified the data-value is set to auto if (localCopyOfValuesCache.get(PlotConstants.KEY_STRING_DATA) == null) { localCopyOfValuesCache.put(PlotConstants.KEY_STRING_DATA, new KeyValue(PlotConstants.KEY_STRING_DATA, PlotConstants.DEFAULT_VALUE, lineNr)); } PlotState newPlotState = new PlotState(lineNr, localCopyOfValuesCache); return newPlotState; } /** * Adds a key->value assignment to the values HashMap */ private void createKeyValueAssignment(String line, int lineNr) { String[] split = line.split("="); if (split.length == 1) split = new String[] {split[0], ""}; if (split[0].matches(PlotConstants.KEY_INT_GRID_WIDTH)) { parserResult.addPlotGridValue(split[0], new KeyValue(split[0],split[1],lineNr)); } else { tempPlotValuesCache.put(split[0], new KeyValue(split[0],split[1],lineNr)); } } private HashMap copyHashMap(HashMap inputHashMap) { HashMap returnHashMap = new HashMap(); for (String key : inputHashMap.keySet()) { returnHashMap.put(key, inputHashMap.get(key)); } return returnHashMap; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/ParserResult.java0000644000175000001440000000331311576116034024357 0ustar benuserspackage com.plotlet.parser; import java.util.ArrayList; import java.util.HashMap; public class ParserResult { private ArrayList plotStateList; // These are few variables which influence the plotgrid private HashMap plotGridValues; public ParserResult() { plotStateList = new ArrayList(); plotGridValues = new HashMap(); } public ArrayList getPlotStateList() { return plotStateList; } public String getPlotGridValue(String key, String defaultValue) { KeyValue keyValue = plotGridValues.get(key); if (keyValue != null) keyValue.setUsed(true); if (keyValue == null || keyValue.getValue().equals(PlotConstants.DEFAULT_VALUE)) return defaultValue; else return keyValue.getValue(); } protected void addPlotState(PlotState plotState) { plotStateList.add(plotState); } protected void addPlotGridValue(String key, KeyValue value) { plotGridValues.put(key, value); } protected void removePlotGridValue(String key) { plotGridValues.remove(key); } @Override public String toString() { String returnString = "\n-----------------------------\n"; returnString += "--------PARSER CONTENT-------\n"; returnString += "-----------------------------\n\n"; returnString += ("##########PlotStates#########\n\n"); for (PlotState plotState : plotStateList) { returnString += plotState.toString() + "\n"; } returnString += ("#########PlotGridValues########\n\n"); for (String key : plotGridValues.keySet()) { returnString += ("\t" + key + " -> " + plotGridValues.get(key) + "\n"); } returnString += "\n-----------------------------\n"; returnString += "-----------------------------\n"; return returnString; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/KeyValue.java0000644000175000001440000000146611576116034023460 0ustar benuserspackage com.plotlet.parser; public class KeyValue { private String key; private String value; private int line; private boolean used; public KeyValue(String key, String value, int line) { super(); this.key = key; this.value = value; this.line = line; this.used = false; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } public boolean isUsed() { return used; } public void setUsed(boolean used) { this.used = used; } @Override public String toString() { return key + "\t-> " + value + " (line " + line + ")"; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/DataSet.java0000644000175000001440000001152211576116034023252 0ustar benuserspackage com.plotlet.parser; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.baselet.shared.Matrix; public class DataSet { private String id; private Integer nr; private int lineNr; private boolean isInverted; private List titleRow = null; private List titleCol = null; private Matrix valueMatrix; private Matrix analyseMatrix; public static final Double VALUE_DEFAULT = 0.0; // used for invalid value fields or missing fields protected DataSet(String id, int nr, int lineNr) { this.id = id; this.nr = nr; this.lineNr = lineNr; analyseMatrix = new Matrix(); } public String getId() { return id; } public Integer getNr() { return nr; } public int getLineNr() { return lineNr; } /** * @return the row size */ public int rows() { return valueMatrix.rows(); } /** * @return the column size */ public int cols() { return valueMatrix.cols(); } public boolean isEmpty() { return valueMatrix.isEmpty(); } /** * @param index * the index of the row * @return a Double[] containing the cells of the row */ public Double[] row(int index) { List list = valueMatrix.row(index); return list.toArray(new Double[list.size()]); } public Double[][] data() { if (valueMatrix.isEmpty()) throw new ParserException("The dataset (line: " + getLineNr() + ") has no values"); Double[][] returnArray = new Double[rows()][]; for (int i = 0; i < rows(); i++) { returnArray[i] = row(i); } return returnArray; } /** * Changed the manual inversion of the dataset. The dataset must only be inverted if the value has changed because * it is only referenced from plots, therefore the last inversion will be dragged to further plot-calls without a problem */ public void setInvert(boolean shouldBeInverted) { if (isInverted == !shouldBeInverted) { analyseMatrix.invert(); separateTitleRowColFromContent(); isInverted = shouldBeInverted; } } public String[] titleRow() { return titleRow.toArray(new String[titleRow.size()]); } public String[] titleCol() { return titleCol.toArray(new String[titleCol.size()]); } @Override public String toString() { return "Dataset (" + id + ")\n" + analyseMatrix; } protected void addLine(String[] line) { analyseMatrix.addLine(new ArrayList(Arrays.asList(line))); } protected void analyseMatrix() { separateTitleRowColFromContent(); // If the valuematrix has more rows than cols the analyseMatrix must be inverted and analysed again // if (!valueMatrix.isEmpty() && valueMatrix.hasMoreRowsThanCols()) analyseMatrix.invert(); // separateTitleRowColFromContent(); } private void separateTitleRowColFromContent() { if (analyseMatrix.isEmpty()) throw new ParserException("The dataset (line: " + getLineNr() + ") has no content"); List firstRow = analyseMatrix.row(0); List firstCol = analyseMatrix.col(0); boolean hasTitleRow = isTitleLine(firstRow); boolean hasTitleCol = isTitleLine(firstCol); if (hasTitleRow && hasTitleCol) { titleRow = firstRow.subList(1, firstRow.size()); // ignore first cell titleCol = firstCol.subList(1, firstCol.size()); // ignore first cell } else if (hasTitleRow && !hasTitleCol) { titleRow = firstRow; titleCol = createEmptyList(firstCol.size()-1); } else if (!hasTitleRow && hasTitleCol) { titleRow = createEmptyList(firstRow.size()-1); titleCol = firstCol; } else /*if (!hasTitleRow && !hasTitleCol)*/ { titleRow = createEmptyList(firstRow.size()); titleCol = createEmptyList(firstCol.size()); } valueMatrix = new Matrix(); for (int r = (hasTitleRow ? 1 : 0); r < analyseMatrix.rows(); r++) { List row = analyseMatrix.row(r); List rowDouble = new ArrayList(); for (int c = (hasTitleCol ? 1 : 0); c < row.size(); c++) { String val = row.get(c); try { if (val == null) throw new NumberFormatException(); else rowDouble.add(Double.parseDouble(val)); } catch (NumberFormatException ex) { throw new ParserException("The Dataset (line: " + getLineNr() + ") contains invalid values"); } } valueMatrix.addLine(rowDouble); } } private boolean isTitleLine(List row) { int numbersInRow = 0; for (String cell : row) { if (cell == null) continue; try { Double.parseDouble(cell); numbersInRow++; } catch (NumberFormatException ex) {/*do nothing*/} } return (row.size()-numbersInRow) > numbersInRow; } private List createEmptyList(int size) { List returnList = new ArrayList(); for (int i = 0; i < size; i++) { returnList.add(""); } return returnList; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/PlotState.java0000644000175000001440000001105211576116034023642 0ustar benuserspackage com.plotlet.parser; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class PlotState { private List subPlots; private DataSet dataset; private HashMap values; private int plotLineNr; protected PlotState(int plotLineNr, HashMap values) { this.subPlots = new ArrayList(); this.plotLineNr = plotLineNr; this.values = values; } /** * Is only called once by the parser to calculate the dataset. */ protected void setDataSet(DataSet dataset) { this.dataset = dataset; } public void addSubPlot(PlotState plotState) { subPlots.add(plotState); } public List getSubplots() { return subPlots; } public DataSet getDataSet() { return dataset; } public boolean containsKey(String key) { return values.containsKey(key); } public int getLine(String key) { if (values.get(key) != null) return values.get(key).getLine(); else return -1; } public int getPlotLineNr() { return plotLineNr; } public String getValue(String key, String defaultValue) { KeyValue keyValue = values.get(key); if (keyValue != null) keyValue.setUsed(true); if (keyValue == null || keyValue.getValue().equals(PlotConstants.DEFAULT_VALUE)) return defaultValue; else return keyValue.getValue(); } public String getValueValidated(String key, String defaultValue, List validValues) { String value = getValue(key, defaultValue); if (!validValues.contains(value)) throw new ParserException(key, value, getLine(key)); return value; } public Double getValueAsDouble(String key, Double defaultValue) { try { String value = this.getValue(key, null); if (value == null) return defaultValue; else return Double.parseDouble(value); } catch (Exception e) { throw new ParserException(key, values.get(key).getValue(), values.get(key).getLine()); } } public Integer getValueAsInt(String key, Integer defaultValue) { try { String value = this.getValue(key, null); if (value == null) return defaultValue; else return Integer.parseInt(value); } catch (Exception e) { throw new ParserException(key, values.get(key).getValue(), values.get(key).getLine()); } } public Boolean getValueAsBoolean(String key, Boolean defaultValue) { String value = this.getValue(key, null); if (value == null) return defaultValue; //Boolean.parseBoolean() cannot be used because it doesn't throw an Exception else if (value.equals("true")) return true; else if (value.equals("false")) return false; else throw new ParserException(key, values.get(key).getValue(), values.get(key).getLine()); } public List getValueList(String key, List defaultValue) { List returnArray; String value = this.getValue(key, null); if (value == null) returnArray = defaultValue; else returnArray = Arrays.asList(value.split(PlotConstants.VALUE_LIST_SEPARATOR)); return returnArray; } public List getValueListValidated(String key, List defaultValue, List validValues, boolean doubleValuesAllowed) { List valueList = getValueList(key, defaultValue); for (String value : valueList) { boolean intAllowedAndValueIsInt = doubleValuesAllowed && isDoubleValue(value); if (!validValues.contains(value) && !intAllowedAndValueIsInt) throw new ParserException(key, value, getLine(key)); } return valueList; } private boolean isDoubleValue(String value) { try { Double.parseDouble(value); return true; } catch (Exception e) { return false; } } /** * Checks if all declared values are used. It throws an error for declarations which are not used by the plot (=they are invalid) */ public void checkIfAllValuesUsed() { String unusedVariables = ""; for (KeyValue keyValue : values.values()) { if (!keyValue.isUsed()) unusedVariables += "\"" + keyValue.getKey() + "=" + keyValue.getValue() + "\" (line " + keyValue.getLine() + ") "; } if (!unusedVariables.isEmpty()) throw new ParserException("Invalid variables: " + unusedVariables); } @Override public String toString() { String returnString = ""; returnString += "PlotState (" + plotLineNr + ")\n"; if (dataset != null) returnString += "\tdataset -> " + dataset.getLineNr() + "\n"; for (KeyValue keyValue : values.values()) { returnString += "\t" + keyValue + "\n"; } if (!subPlots.isEmpty()) { returnString += "---Begin Subplots---\n"; for (PlotState subPlot: subPlots) { returnString += subPlot.toString(); } returnString += "---End Subplots---\n"; } return returnString; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/PlotConstants.java0000644000175000001440000001366611576116034024553 0ustar benuserspackage com.plotlet.parser; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.Logger; import com.baselet.control.Utils; public class PlotConstants { protected final static Logger log = Logger.getLogger(Utils.getClassName()); /** Shared Value Constants **/ // Some key->value assignments have a list as value and the following separator is used to separate the list entries public static final String VALUE_LIST_SEPARATOR = ","; // If a variable is set to DEFAULT_VALUE, it gets removed from the parsers plotValuesCache, therefore the DEFAULT is used again public static final String DEFAULT_VALUE = "auto"; /** Parser Constants **/ public static final String PLOT = "plot"; public static final String DATA = "data"; public static final String REGEX_COMMENT = "(//.*)"; public static final String REGEX_KEY = "([(\\w)\\.]+)"; //a value is a comma separated list of word characters or "-" (for negative int eg: min_val=-3) or # (for color decoding) or . (for hierarchies) public static final String REGEX_VALUE = "([-(\\w)#\\." + VALUE_LIST_SEPARATOR + "]*)"; public static final String REGEX_VALUE_ASSIGNMENT = "(" + REGEX_KEY + "=" + REGEX_VALUE + ")"; //plot followed by an optional space or plot followed by 1 or more value assignments (values which are only valid for the plot) public static final String REGEX_PLOT = "((" + PLOT + " ?)|(" + PLOT + " (" + REGEX_VALUE_ASSIGNMENT + " )*" + REGEX_VALUE_ASSIGNMENT + "))"; //+plot (overlap plots) followed by an optional space or plot followed by 1 or more value assignments (values which are only valid for the plot) public static final String REGEX_PLOT_ADD = "(\\+" + REGEX_PLOT + ")"; //data followed by an optional space or by space and a name which consists of word characters public static final String REGEX_DATA = "((" + DATA + " ?)|(" + DATA + " (\\w)+))"; // 1 non-comment-line which contains at least 1 Tab is an interpreted dataset public static final String REGEX_DATA_SEPARATOR = "(\t)"; public static final String REGEX_DATA_GUESS = "((?!(" + REGEX_COMMENT + "))(([^=]+)|(.*" + REGEX_DATA_SEPARATOR + ".*)))"; // The following line is needed to color everything which doesn't match another RegEx // public static final String REGEX_COLOR_BASE = "(?!((" + REGEX_COMMENT + ")|(" + PLOT + ")|(" + REGEX_VALUE_ASSIGNMENT + "))).*"; /* The following variables are automatically parsed for the autocompletion. Therefore some conventions must be made: * 1.) The possible values of a key must be listed in the following lines or they will not be recognized by the autocompletion * 2.) Every key is separated in 3 parts: KEY__. can be STRING,INT,LIST,BOOL (in future there may be more types) * 3.) If there is a limited number of possible values it must be named: _ where must match the tag in the key * 4.) values with _DEFAULT at the end are ignored by the autocompletion. */ /** Plotgrid Value Constants **/ public static final String KEY_INT_GRID_WIDTH = "grid.width"; public static final String GRID_WIDTH_DEFAULT = "3"; /** Plot Value Constants **/ public static final String KEY_STRING_DATA = DATA; //DEFAULT: cycling through datasets public static final String KEY_STRING_TYPE = "type"; //DEFAULT: TYPE_BAR public static final String TYPE_BAR = "bar"; public static final String TYPE_LINE = "line"; public static final String TYPE_PIE = "pie"; public static final String TYPE_SCATTER = "scatter"; public static final String KEY_BOOL_DATA_INVERT = "data.invert"; public static final Boolean DATA_INVERT_DEFAULT = false; public static final String KEY_BOOL_PLOT_TILT = "tilt"; public static final Boolean PLOT_TILT_DEFAULT = false; public static final String KEY_INT_X_POSITION = "pos.x"; //DEFAULT: filling grid from upper left to lower right corner public static final String KEY_INT_Y_POSITION = "pos.y"; public static final String KEY_INT_MIN_VALUE = "value.min"; //DEFAULT: the lowest/highest value in the plot public static final String MIN_VALUE_ALL = "all"; public static final String KEY_INT_MAX_VALUE = "value.max"; public static final String MAX_VALUE_ALL = "all"; public static final String KEY_LIST_COLORS = "colors"; //DEFAULT: cycling through colors-list public static final List COLORS_DEFAULT = Arrays.asList(new String[] {"red", "blue", "green", "orange", "cyan", "magenta", "pink"}); public static final String KEY_LIST_DESC_AXIS_SHOW = "axis.desc.show"; public static final String DESC_AXIS_SHOW_AXIS = "axis"; public static final String DESC_AXIS_SHOW_LINE = "line"; public static final String DESC_AXIS_SHOW_MARKER = "marker"; public static final String DESC_AXIS_SHOW_TEXT = "text"; public static final String DESC_AXIS_SHOW_NOTHING = ""; public static final String KEY_LIST_VALUE_AXIS_SHOW = "axis.value.show"; public static final String VALUE_AXIS_SHOW_AXIS = "axis"; public static final String VALUE_AXIS_SHOW_LINE = "line"; public static final String VALUE_AXIS_SHOW_MARKER = "marker"; public static final String VALUE_AXIS_SHOW_TEXT = "text"; public static final String VALUE_AXIS_SHOW_NOTHING = ""; public static final String KEY_LIST_VALUE_AXIS_LIST = "axis.value.list"; public static final String VALUE_AXIS_LIST_RELEVANT = "relevant"; public static final String VALUE_AXIS_LIST_NOTHING = ""; public static List getValuesForKey(String key) { String fieldContent; List returnList = null; try { Field[] fs = PlotConstants.class.getFields(); returnList = new ArrayList(); boolean startReadingValues = false; for (Field f : fs) { fieldContent = String.valueOf(f.get(String.class)); if (startReadingValues) { if (!f.getName().startsWith("KEY_")) returnList.add(fieldContent); else break; } if (fieldContent.equals(key)) startReadingValues = true; } } catch (Exception e) { log.error("Error at creating valuelist from key " + key, e); } return returnList; } } umlet-11.3.orig/sourcefiles/src/com/plotlet/parser/ParserException.java0000644000175000001440000000146311576116034025043 0ustar benuserspackage com.plotlet.parser; import java.util.Arrays; public class ParserException extends RuntimeException { private static final long serialVersionUID = 1L; public ParserException() { super("Unknown Error"); } public ParserException(String message) { super(message); } public ParserException(String key, String value, int line) { this("Invalid assignment: \"" + key + "=" + value + "\" (line: " + line + ")"); } public ParserException(String key, String value, int line, String additionalInfo) { this("Invalid assignment: \"" + key + "=" + value + "\" (line: " + line + ") [" + additionalInfo + "]"); } public ParserException(String key, String[] values, int line) { this("The following values are colliding: \"" + key + "=" + Arrays.asList(values) + "\" (line: " + line + ")"); } } umlet-11.3.orig/sourcefiles/html/0000755000175000001440000000000011576116036015503 5ustar benusersumlet-11.3.orig/sourcefiles/html/about.html.generic0000644000175000001440000000141011576116034021110 0ustar benusers

*******************************************

*******************************************


umlet-11.3.orig/sourcefiles/html/about.html0000644000175000001440000000132411576116034017501 0ustar benusers

*******************************************

*******************************************


umlet-11.3.orig/sourcefiles/html/startuphelp.html0000644000175000001440000000163111576116034020743 0ustar benusers

Umlet 11.3 -- check for new versions -- read the FAQ

Double-click on a element to add it to the diagram

Lasso with Ctrl+Mouse -- zoom with Ctrl+MouseWheel


Advanced: "Custom Elements > New..." lets you create entirely new element types


If you like Umlet, please "star" it at Eclipse Marketplace. Thanks!

umlet-11.3.orig/sourcefiles/html/startuphelp.html.generic0000644000175000001440000000167611576116034022367 0ustar benusers

@project.name.uc@ @release.version@ -- check for new versions -- read the FAQ

Double-click on a element to add it to the diagram

Lasso with Ctrl+Mouse -- zoom with Ctrl+MouseWheel


Advanced: "Custom Elements > New..." lets you create entirely new element types


If you like @project.name.uc@, please "star" it at Eclipse Marketplace. Thanks!

umlet-11.3.orig/sourcefiles/test/0000755000175000001440000000000011576116036015516 5ustar benusersumlet-11.3.orig/sourcefiles/test/com/0000755000175000001440000000000011576116036016274 5ustar benusersumlet-11.3.orig/sourcefiles/test/com/baselet/0000755000175000001440000000000011576116036017713 5ustar benusersumlet-11.3.orig/sourcefiles/test/com/baselet/MainTest.java0000644000175000001440000000026711576116034022305 0ustar benuserspackage com.baselet; import static org.junit.Assert.assertEquals; import org.junit.Test; public class MainTest { @Test public void dummyTest() { assertEquals(true,true); } } umlet-11.3.orig/sourcefiles/test/com/plotlet/0000755000175000001440000000000011576116036017757 5ustar benusersumlet-11.3.orig/sourcefiles/test/com/plotlet/parser/0000755000175000001440000000000011576116036021253 5ustar benusersumlet-11.3.orig/sourcefiles/test/com/plotlet/parser/DataSetTest.java0000644000175000001440000001172011576116034024302 0ustar benusers package com.plotlet.parser; public class DataSetTest { // // private Parser parser; // // @Before // public void initParser() // { // parser = new Parser(); // } // // @Test // public void plainDataTest() // { // String input; // // input = "data\n" // + "1\t2\t3\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(3, dataSet.cols()); // // assertNull(dataSet.titleCol()); // assertNull(dataSet.titleRow()); // // assertArrayEquals(new Double[]{1.0,2.0,3.0}, dataSet.row(0)); // // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // assertArrayEquals(new Double[]{2.0}, dataSet.col(1)); // assertArrayEquals(new Double[]{3.0}, dataSet.col(2)); // } // // @Test // public void plainDataTestWithTitleRow() // { // String input; // // input = "data\n" // + "A\tB\tC\n" // + "1\t2\t3\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(3, dataSet.cols()); // // assertArrayEquals(new String[]{"A","B","C"}, dataSet.titleRow()); // assertNull(dataSet.titleCol()); // // assertArrayEquals(new Double[]{1.0,2.0,3.0}, dataSet.row(0)); // // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // assertArrayEquals(new Double[]{2.0}, dataSet.col(1)); // assertArrayEquals(new Double[]{3.0}, dataSet.col(2)); // } // // @Test // public void plainDataTestWithTitleColumn() // { // String input; // // input = "data\n" // + "A\t1\t2\t3\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(3, dataSet.cols()); // // assertArrayEquals(new String[]{"A"}, dataSet.titleCol()); // assertNull(dataSet.titleRow()); // // assertArrayEquals(new Double[]{1.0,2.0,3.0}, dataSet.row(0)); // // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // assertArrayEquals(new Double[]{2.0}, dataSet.col(1)); // assertArrayEquals(new Double[]{3.0}, dataSet.col(2)); // } // // @Test // public void plainDataTestWithTitleRowAndColumn() // { // String input; // // input = "data\n" // + "X\tA\tB\tC\n" // + "Z\t1\t2\t3\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(3, dataSet.cols()); // // assertArrayEquals(new String[]{"A","B","C"}, dataSet.titleRow()); // assertArrayEquals(new String[]{"Z"}, dataSet.titleCol()); // // assertArrayEquals(new Double[]{1.0,2.0,3.0}, dataSet.row(0)); // // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // assertArrayEquals(new Double[]{2.0}, dataSet.col(1)); // assertArrayEquals(new Double[]{3.0}, dataSet.col(2)); // } // // @Test // public void edgeDataTestWithTitleRow() // { // String input; // // input = "data\n" // + "A\n" // + "1\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(1, dataSet.cols()); // // assertArrayEquals(new String[]{"A"}, dataSet.titleRow()); // assertNull(dataSet.titleCol()); // // assertArrayEquals(new Double[]{1.0}, dataSet.row(0)); // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // } // // @Test // public void edgeDataTestWithTitleColumn() // { // String input; // // input = "data\n" // + "A\t1\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(1, dataSet.cols()); // // assertArrayEquals(new String[]{"A"}, dataSet.titleCol()); // assertNull(dataSet.titleRow()); // // assertArrayEquals(new Double[]{1.0}, dataSet.row(0)); // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // } // // @Test // public void edgeDataTestWithTitleRowAndColumn() // { // String input; // // input = "data\n" // + "X\tA\n" // + "Z\t1\n" // + "\n" // + "plot"; // // ParserResult result = parser.parse(input); // DataSet dataSet = result.getPlotStateList().get(0).getDataSet(); // // assertEquals(1, dataSet.rows()); // assertEquals(1, dataSet.cols()); // // assertArrayEquals(new String[]{"A"}, dataSet.titleRow()); // assertArrayEquals(new String[]{"Z"}, dataSet.titleCol()); // // assertArrayEquals(new Double[]{1.0}, dataSet.row(0)); // assertArrayEquals(new Double[]{1.0}, dataSet.col(0)); // } // } umlet-11.3.orig/sourcefiles/custom_elements/0000755000175000001440000000000011576116036017745 5ustar benusersumlet-11.3.orig/sourcefiles/custom_elements/WordWrap.java0000644000175000001440000000136111576116034022354 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is an element with activated wordwrap //If a line would exceed the elements border, instead //the exceeding part is written into the next line int y=textHeight(); drawRectangle(0,0,width,height); setWordWrap(true); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } } umlet-11.3.orig/sourcefiles/custom_elements/RectangleRound.java0000644000175000001440000000111311576116034023516 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ int y=textHeight(); drawRectangleRound(0,0,width,height,20,20); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } }umlet-11.3.orig/sourcefiles/custom_elements/Default.java0000644000175000001440000000142011576116034022167 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //Modify the code below to define the element's behavior. // //Example: Change the line // y += printCenter(textline,y); //to // y += 2*printCenter(textline,y); //and observe the element preview. int y=textHeight(); drawRectangle(0,0,width,height); for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } }umlet-11.3.orig/sourcefiles/custom_elements/AutoResize1.java0000644000175000001440000000143211576116034022761 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is a tutorial for a self resizing component //In addition you are able to resize at manually //As soon as it is resized manually a new text is //added to the property panel allowResize(false); setAutoresize(30,40,10); drawCircle(width/2,15,10); int y=45; for(String textline : textlines) { y += printCenter(textline,y); } /****CUSTOM_CODE END****/ } } umlet-11.3.orig/sourcefiles/custom_elements/AutoResize2.java0000644000175000001440000000215511576116034022765 0ustar benusersimport java.awt.*; import java.util.*; import com.baselet.control.Constants; import com.baselet.control.Utils; @SuppressWarnings("serial") public class extends com.umlet.custom.CustomElement { public CustomElementImpl() { } @Override public void paint() { Vector textlines = Utils.decomposeStrings(this.getPanelAttributes()); /****CUSTOM_CODE START****/ //This is a tutorial for a self resizing component //In addition you are able to resize at manually //As soon as it is resized manually a new text is //added to the property panel setAutoresize(20,20,10); int y=textHeight(); boolean center = true; for(int i = 0; i < textlines.size(); i++) { String textline = textlines.get(i); if(textline.equals("--")) { drawLineHorizontal((int) (y-textHeight()*0.7)); center = false; if (!isManualResized()) height -= (int) (textHeight()*0.75); y += textHeight()*0.3; } else { if (center) y += printCenter(textline,y); else y += printLeft(textline,y); } } drawRectangle(0,0,onGrid(width),onGrid(height)); /****CUSTOM_CODE END****/ } }umlet-11.3.orig/sourcefiles/palettes/0000755000175000001440000000000011576116036016360 5ustar benusersumlet-11.3.orig/sourcefiles/palettes/Structure and Deployment.uxf0000644000175000001440000000747711576116034023745 0ustar benusers 8 com.umlet.element.custom.Node 16 8 88 40 center:Node com.umlet.element.custom.Node 128 8 88 40 center:<<device>> center:Name com.umlet.element.Relation 0 24 224 56 lt=- _Link_ 24;40;208;40 com.umlet.element.custom.Node 16 80 200 64 center:<<execution environment>> center:Name com.umlet.element.custom.Node 16 152 200 64 center:<<Deployment Descriptor>> center:Name com.umlet.element.custom.Component 16 224 104 64 Component com.umlet.element.custom.Artefact 128 224 88 64 Artefact com.umlet.element.Class 16 296 104 32 <<component>> Name com.umlet.element.Class 128 296 88 32 <<artefact>> Name com.umlet.element.custom.SimpleComponent 16 336 152 56 Component com.umlet.element.custom.Database 16 480 88 32 Database com.umlet.element.Class 72 424 88 40 <<artefact>> Name com.umlet.element.custom.Node 16 400 200 72 center:Deployment umlet-11.3.orig/sourcefiles/palettes/EER.uxf0000644000175000001440000001324311576116034017520 0ustar benusers 8 com.umlet.element.custom.EER_Entity 232 248 80 72 department -- _prid_ name address bg=black com.umlet.element.custom.EER_Entity 160 160 80 40 ##employee department bg=orange com.umlet.element.custom.EER_Entity 304 160 80 40 ##member department bg=yellow com.umlet.element.Relation 288 176 72 96 lt=<EER 24;80;56;80;56;24 com.umlet.element.custom.EER_Entity 304 80 104 72 member -- id contribution date bg=green com.umlet.element.custom.EER_Entity 160 80 80 72 employee -- id responsibility salary bg=blue com.umlet.element.custom.EER_Entity 240 16 80 56 person -- first name family name bg=gray com.umlet.element.Relation 0 216 160 40 lt=<EER> 24;24;144;24 com.umlet.element.Relation 0 176 160 40 lt=<EER 144;24;24;24 com.umlet.element.Relation 0 136 160 40 lt=EER> 144;24;24;24 com.umlet.element.custom.EER_Entity 16 16 80 40 entity -- attribute com.umlet.element.custom.EER_Entity 16 64 80 24 entity com.umlet.element.custom.EER_Entity 16 96 80 24 ##weak entity com.umlet.element.Relation 360 64 80 128 lt=EER> 24;112;64;112;64;24;48;24 com.umlet.element.Relation 216 72 56 120 lt=EER> 24;104;40;104;40;24;24;24 com.umlet.element.Relation 176 176 72 96 lt=<EER 56;80;24;80;24;24 com.umlet.element.Relation 176 0 80 96 lt=EER 24;80;24;24;64;24 com.umlet.element.Relation 296 0 80 96 lt=EER 64;80;64;24;24;24 com.umlet.element.custom.EER_Rel_Diamond 40 264 80 40 relation umlet-11.3.orig/sourcefiles/palettes/Barplot.pxf0000644000175000001440000000171311576116034020502 0ustar benusers 10 com.plotlet.element.PlotGrid 10 0 660 460 data a b c -5 5.5 18.3 3 1.2 -4 data a b c 30 50 120 grid.width=2 type=bar plot plot tilt=true plot plot data=#1 tilt=true com.plotlet.element.PlotGrid 10 470 660 460 data a b c -16 5.5 18.3 data a b c 30 50 120 grid.width=2 type=bar value.min=-16 value.max=120 plot plot tilt=true plot plot data=#1 tilt=true umlet-11.3.orig/sourcefiles/palettes/Composite Structure.uxf0000644000175000001440000000620411576116034023027 0ustar benusers 8 com.umlet.element.Relation 152 40 72 200 lt=<[>] - [>]> 24;24;56;24;56;184;24;184 com.umlet.element.Relation 72 240 114 160 lt=<[]<.)- <<delegate>> 32;24;64;64;64;144 com.umlet.element.Relation 88 72 40 120 lt=<[v]-(()-[^]> 24;24;24;104 com.umlet.element.Relation 64 72 40 120 lt=<[^][v]> 24;24;24;104 com.umlet.element.Relation 40 72 40 120 lt=<[=][<]> 24;24;24;104 com.umlet.element.Relation 16 72 40 120 lt=<[SQL][GUI]> 24;104;24;24 com.umlet.element.custom.Component 16 176 160 88 'Component com.umlet.element.Relation 0 240 120 160 lt=<[].>()- <<delegate>> 104;24;64;64;64;144 com.umlet.element.custom.Component 16 384 160 48 'Component com.umlet.element.custom.Component 16 16 160 80 'Component umlet-11.3.orig/sourcefiles/palettes/Activity.uxf0000644000175000001440000002310311576116034020675 0ustar benusers 8 com.umlet.element.custom.FinalState 216 440 16 16 i com.umlet.element.Relation 200 400 40 56 lt=<- 24;40;24;24 com.umlet.element.custom.State 168 392 96 32 leave for airport bg=green com.umlet.element.custom.SynchBarHorizontal 192 360 64 16 com.umlet.element.Relation 216 304 56 80 lt=<- 24;64;24;32;40;32;40;24 com.umlet.element.Relation 144 280 80 104 lt=<- 64;88;64;56;24;56;24;24 com.umlet.element.custom.SendSignal 216 248 80 32 call taxi bg=yellow com.umlet.element.custom.ReceiveSignal 216 296 80 32 taxi arrived bg=yellow com.umlet.element.custom.State 128 272 80 32 grab bags bg=blue com.umlet.element.Relation 144 184 80 104 lt=<- 24;88;24;64;64;64;64;24 com.umlet.element.custom.SynchBarHorizontal 120 160 144 96 {joinSpec= date is on or after July 1st and the exam is passed} com.umlet.element.Relation 216 184 56 80 lt=<- 40;64;40;48;24;48;24;24 com.umlet.element.Relation 144 112 72 112 lt=<- 56;96;56;24;24;24 com.umlet.element.Relation 200 136 88 88 lt=<- m2=[exam passed] 48;72;48;24 com.umlet.element.custom.Decision 232 128 32 32 bg=green com.umlet.element.Relation 224 80 40 64 lt=<- 24;48;24;24 com.umlet.element.custom.State 208 72 80 32 study bg=red com.umlet.element.Relation 224 24 40 64 lt=<- 24;48;24;24 com.umlet.element.custom.InitialState 240 32 16 16 i com.umlet.element.custom.Systemborder 112 8 248 456 topcenter:System com.umlet.element.Relation 0 112 112 40 lt=<- 24;24;96;24 com.umlet.element.custom.Decision 16 72 32 32 com.umlet.element.custom.ReceiveSignal 16 160 80 32 receive signal com.umlet.element.custom.SendSignal 16 216 80 32 send signal com.umlet.element.custom.State 16 16 80 32 state com.umlet.element.custom.Systemborder 16 328 80 32 center:DataObject com.umlet.element.custom.InitialState 64 72 16 16 i com.umlet.element.custom.FinalState 64 96 16 16 i com.umlet.element.custom.TimeSignal 24 264 64 48 time signal com.umlet.element.custom.SynchBarVertical 88 64 16 56 com.umlet.element.custom.SynchBarHorizontal 24 48 64 16 com.umlet.element.custom.TimeSignal 136 120 64 48 July 1st bg=black com.umlet.element.Relation 200 344 40 64 lt=<- 24;48;24;24 com.umlet.element.Relation 208 120 152 344 lt=<- m2=[exam missed] 24;328;136;328;136;24;56;24 umlet-11.3.orig/sourcefiles/palettes/Axis Settings.pxf0000644000175000001440000000246711576116034021573 0ustar benusers 10 com.plotlet.element.PlotGrid 20 470 660 460 data a b c -5 7 13 grid.width=2 axis.desc.show=axis,line,marker,text axis.value.show=axis,line,marker,text plot type=line plot type=bar plot type=pie plot type=scatter com.plotlet.element.PlotGrid 20 0 660 460 data a b c -5 7 13 type=line axis.desc.show= axis.value.show= axis.value.list=relevant plot axis.desc.show=axis plot axis.value.show=axis plot axis.desc.show=axis,line plot axis.value.show=axis,line plot axis.desc.show=axis,line,marker plot axis.value.show=axis,line,marker plot axis.desc.show=axis,line,marker,text plot axis.value.show=axis,line,marker,text plot axis.value.list= plot axis.value.list=-8,-1,3.5,17 plot axis.value.list=-8,-1,3.5,17,relevant plot umlet-11.3.orig/sourcefiles/palettes/Class.uxf0000644000175000001440000002013211576116034020145 0ustar benusers 8 com.umlet.element.Relation 0 424 152 40 lt=()) 24;24;136;24 com.umlet.element.Relation 0 400 136 40 lt=<() r1=provide 120;24;24;24 com.umlet.element.Relation 8 376 144 40 lt=<( r1=require 24;24;128;24 com.umlet.element.Relation 0 352 152 40 lt=- m1=0..n q1=key m2=0..1 24;24;136;24 com.umlet.element.Relation 0 336 152 40 lt=<x 24;24;136;24 com.umlet.element.Relation 0 320 152 40 lt=<<<- 24;24;136;24 com.umlet.element.Relation 0 304 152 40 lt=<<<<- 24;24;136;24 com.umlet.element.Relation 0 280 152 40 lt=<- m1=0..n r1=Role 24;24;136;24 com.umlet.element.Relation 0 240 152 56 lt=- m1=0..n m2=0..1 teaches to> 24;40;136;40 com.umlet.element.Relation 0 240 152 40 lt=<. 24;24;136;24 com.umlet.element.Relation 0 224 152 40 lt=<- 24;24;136;24 com.umlet.element.Relation 0 208 152 40 lt=<<. 24;24;136;24 com.umlet.element.Relation 0 192 152 40 lt=<<- 24;24;136;24 com.umlet.element.Note 160 272 112 56 Note.. com.umlet.element.UseCase 168 336 96 32 lt=. Collaboration com.umlet.element.Class 160 208 128 56 template=0: Object TemplateClass -- com.umlet.element.Class 160 408 48 16 Rose com.umlet.element.Class 288 16 136 104 OuterClass {innerclass InnerClass innerclass} {innerclass InnerClass {innerclass InnerInnerClass -- field innerclass} innerclass} com.umlet.element.Interface 288 128 64 72 Interface -- Operation1 Operation2 com.umlet.element.custom.ThreeWayRelation 216 160 48 32 com.umlet.element.Relation 168 352 138 80 lt=>> a rose is a rose is a rose 24;56;24;32;80;40;80;64;40;64 com.umlet.element.Class 192 16 88 32 {active} ActiveClass com.umlet.element.Class 104 16 80 24 /AbstractClass/ com.umlet.element.Class 16 48 168 152 <<Stereotype>> Package::FatClass {Some Properties} -- -id: Long {composite} _-ClassAttribute: Long_ -- #Operation(i: int): int /+AbstractOperation()/ -- Responsibilities -- Resp1 -- Resp2 com.umlet.element.Class 16 16 80 24 SimpleClass com.umlet.element.Class 192 64 88 32 bt=* ActiveClass com.umlet.element.Class 192 112 88 32 bt=. Class with dashed border umlet-11.3.orig/sourcefiles/palettes/Activity - All in one.uxf0000644000175000001440000000205511576116034022637 0ustar benusers 8 com.umlet.element.ActivityDiagramText 8 8 64 84 title:start Start End com.umlet.element.ActivityDiagramText 104 8 561 656 title:Example Hotline Start Telephone\ rings While[open\calls] [free] Fork If [responsible] take call help caller [not responsible] forward call\(with subactions).. EndIf | | | document call~id1 Sync [busy] record\call wait until\ free> >free playback\recorded cal->id1 [no open calls] End umlet-11.3.orig/sourcefiles/palettes/Sequence.uxf0000644000175000001440000002027211576116034020655 0ustar benusers 8 com.umlet.element.custom.SeqObjectActive 208 64 16 80 bg=yellow com.umlet.element.Relation 192 120 40 96 lt=. 24;24;24;80 com.umlet.element.custom.SeqObjectActive 208 200 16 24 bg=yellow com.umlet.element.custom.InteractionFrame 184 160 184 80 optional com.umlet.element.Relation 200 168 144 56 lt=< async. destroy 128;40;24;40 com.umlet.element.custom.InteractionFrame 16 184 144 56 interaction frame com.umlet.element.custom.SeqDestroyMark 320 200 16 16 com.umlet.element.Relation 192 200 40 48 lt=. 24;24;24;32 com.umlet.element.custom.SeqObjectActive 320 80 16 48 bg=red com.umlet.element.Class 288 16 80 24 _:O2_ bg=red com.umlet.element.Class 176 16 80 24 _:O1_ bg=orange com.umlet.element.Note 16 456 240 64 This is a preliminary version of UMLet's sequence diagrams; we are currently working on a more efficient, text-based way of creating them. com.umlet.element.Class 16 16 80 24 _:Instance_ com.umlet.element.Relation 304 16 40 80 lt=. 24;24;24;64 com.umlet.element.Relation 192 16 40 64 lt=. 24;24;24;48 com.umlet.element.Relation 200 40 136 56 lt=<<- sync. call 120;40;24;40 com.umlet.element.Relation 200 88 136 56 lt=< async. return 24;40;120;40 com.umlet.element.Relation 0 104 128 56 lt=< asyncMsg 24;40;112;40 com.umlet.element.Relation 0 72 128 40 lt=< 24;24;112;24 com.umlet.element.custom.SeqDestroyMark 136 88 16 16 com.umlet.element.custom.SeqObjectActive 136 16 16 48 com.umlet.element.Relation 0 128 128 56 lt=<<- syncMsg 24;40;112;40 com.umlet.element.Relation 0 96 128 40 lt=<<<<<- 24;24;112;24 com.umlet.element.Relation 32 16 40 72 lt=. 24;24;24;56 com.umlet.element.Relation 304 104 40 120 lt=. 24;24;24;104 com.umlet.element.custom.InteractionFrame 16 248 360 200 interaction frame -- with inner frames -. -. com.umlet.element.custom.InteractionFrame 48 304 312 40 interaction frame com.umlet.element.custom.InteractionFrame 48 368 312 72 interaction frame -- inner umlet-11.3.orig/sourcefiles/palettes/Colors.pxf0000644000175000001440000000121511576116034020335 0ustar benusers 10 com.plotlet.element.PlotGrid 10 10 660 580 data a b c d e f g h -3 2 5 10 7 6 3 2 grid.width=2 plot data=#1 colors=#3c7a00,#50,red plot data=#1 colors=black,blue,cyan,dark_gray,green plot data=#1 colors=gray,light_gray,magenta,orange,pink,red,white,yellow plot data=#1 umlet-11.3.orig/sourcefiles/palettes/Colors.uxf0000644000175000001440000000747511576116034020360 0ustar benusers 8 com.umlet.element.UseCase 8 8 88 32 red bg=red com.umlet.element.UseCase 8 48 88 32 green bg=green com.umlet.element.UseCase 8 88 88 32 blue bg=blue com.umlet.element.UseCase 8 128 88 32 yellow bg=yellow com.umlet.element.UseCase 112 8 88 32 white bg=white com.umlet.element.UseCase 112 168 88 32 black bg=black fg=white com.umlet.element.UseCase 112 88 88 32 gray bg=gray com.umlet.element.UseCase 112 48 88 32 light_gray bg=light_gray com.umlet.element.UseCase 112 128 88 32 dark_gray bg=dark_gray com.umlet.element.UseCase 8 168 88 32 orange bg=orange com.umlet.element.UseCase 112 208 88 32 pink bg=pink com.umlet.element.UseCase 8 208 88 32 magenta bg=magenta com.umlet.element.UseCase 8 248 88 32 cyan bg=cyan com.umlet.element.UseCase 112 248 88 32 #3c7a00 bg=#3c7a00 umlet-11.3.orig/sourcefiles/palettes/State Machine.uxf0000644000175000001440000000641411576116034021514 0ustar benusers 8 com.umlet.element.custom.StateSubDiagram 32 304 96 32 state with substates com.umlet.element.Relation 0 224 120 80 lt=<- self 64;24;32;24;32;64;104;64;104;40 com.umlet.element.custom.State 64 232 80 32 state com.umlet.element.custom.State 24 120 144 88 complex state -- some more... -. com.umlet.element.custom.Decision 120 72 32 32 com.umlet.element.custom.State 24 72 72 32 state com.umlet.element.Relation 0 32 168 40 lt=<- 152;24;24;24 com.umlet.element.custom.SeqDestroyMark 128 16 16 16 com.umlet.element.custom.FinalState 104 16 16 16 com.umlet.element.custom.InitialState 80 16 16 16 com.umlet.element.custom.RegionEndState 56 16 16 16 com.umlet.element.custom.HistoryState 32 16 16 16 umlet-11.3.orig/sourcefiles/palettes/Scatterplot.pxf0000644000175000001440000000271411576116034021405 0ustar benusers 10 com.plotlet.element.PlotGrid 170 0 660 460 data a b c x -16 5.5 18.3 y 3 5 1 z 5 9 -3 data a b c 30 50 120 20 10 30 grid.width=2 type=scatter plot data=#1 plot data=#1 data.invert=true plot tilt=true plot colors=blue com.plotlet.element.PlotGrid 90 480 660 460 data a b c -16 5.5 18.3 data a b c 30 50 120 grid.width=2 type=scatter value.min=-16 value.max=120 plot plot tilt=true plot colors=blue plot data=#1 tilt=true com.plotlet.element.PlotGrid 60 990 930 830 data '75' '82' '83' '85' '86' '87' '90' '91' '92' '93' '94' '97' '98' '99' 16 18 20 25 27 28 30 31 32 33 44 46 48 49 grid.width=1 type=scatter plot plot tilt=true umlet-11.3.orig/sourcefiles/palettes/Lineplot.pxf0000644000175000001440000000201111576116034020655 0ustar benusers 10 com.plotlet.element.PlotGrid 10 0 660 460 data a b c x -16 5.5 18.3 y 3 5 1 z 5 9 -3 data a b c 30 50 120 20 10 30 grid.width=2 type=line plot data=#1 plot data=#1 data.invert=true plot tilt=true plot colors=blue com.plotlet.element.PlotGrid 10 470 660 460 data a b c -16 5.5 18.3 data a b c 30 50 120 grid.width=2 type=line value.min=-16 value.max=120 plot plot tilt=true plot colors=blue plot data=#1 tilt=true umlet-11.3.orig/sourcefiles/palettes/Sequence - All in one.uxf0000644000175000001440000000123211576116034022607 0ustar benusers 8 com.umlet.element.SequenceDiagram 16 16 304 280 title: sample _alpha:A~id1_|_beta:B~id2_|_gamma:G~id3_ id1->>id2:id1,id2 id2-/>id1:async Msg. id3->>>id1:id1,id3 id1.>id3:id1,id3:async return Msg id1->id1:id1:self iframe{:interaction frame id2->id3:id1,id3:async Msg. iframe} umlet-11.3.orig/sourcefiles/palettes/Pieplot.pxf0000644000175000001440000000170311576116034020512 0ustar benusers 10 com.plotlet.element.PlotGrid 20 0 660 460 data a b c -16 5.5 18.3 data a b c 3 5 12 grid.width=2 type=pie plot plot tilt=true plot plot data=#1 tilt=true com.plotlet.element.PlotGrid 20 470 660 460 data a b c -16 5.5 18.3 data a b c 30 50 120 grid.width=2 type=pie value.min=-16 value.max=120 colors=red,blue,yellow plot plot plot plot data=#1 umlet-11.3.orig/sourcefiles/palettes/Package.uxf0000644000175000001440000000701711576116034020442 0ustar benusers 8 com.umlet.element.Package 152 128 80 56 -- Name bg=green com.umlet.element.Package 152 16 80 56 -- Name bg=blue com.umlet.element.custom.PackageAggregationHierarchy 152 200 136 184 root name name name name root name com.umlet.element.Package 16 80 80 56 -- Name com.umlet.element.Relation 168 48 40 112 lt=<(+)- 24;24;24;96 com.umlet.element.Package 16 144 80 56 Name -- left:Text Text com.umlet.element.Relation 0 336 144 56 lt=<. <<merge>> 128;40;24;40 com.umlet.element.Relation 0 312 144 56 lt=<. <<import>> 128;40;24;40 com.umlet.element.Relation 0 288 144 56 lt=<. <<access>> 128;40;24;40 com.umlet.element.Package 16 16 80 56 Name com.umlet.element.Package 16 208 120 88 com.umlet.element.Package 40 232 80 56 umlet-11.3.orig/sourcefiles/palettes/Default.pxf0000644000175000001440000000402411576116034020461 0ustar benusers 10 com.plotlet.element.PlotGrid 10 480 660 460 data a b c d 1 3 1 6 data a b c 2 -4 4 // variables which are on the same line as "plot" are only set for this plot plot type=pie colors=blue,yellow,black,red // A variable which is on it's own line is valid for every following plot type=line colors=blue plot plot plot type=scatter plot type=scatter // auto resets the variable to it's default value (in this case "bar") type=auto colors=auto plot // to use the highest/lowest value of all datasets, set value.min/max to all value.min=all value.max=all plot plot plot com.plotlet.element.PlotGrid 10 0 660 460 // Comments start with // and are ignored by the program //Shortcuts: Ctrl+F ... Quickfind // Ctrl+Space ... Autocompletion // A dataset can be introduced by "data" data a b c 1 0 0 // A dataset can have a name (eg: "set_positive") for later references data set_positive a b c 0 1 0 // Anything which is not "plot" or a "key=value" assignment is also guessed as a dataset a b c 0 0 1 // A vertical dataset is automatically interpreted in the right way a 1 b 2 c 3 d 4 // A dataset is also valid if there is no title row data set_noname 1 3 1 3 // Usually "plot" is cycling through all datasets plot plot plot plot plot // It is also possible to reference a dataset by it's number or it's name (if declared) plot data=#2 plot data=#1 plot data=set_positive plot data=set_noname umlet-11.3.orig/sourcefiles/palettes/Default.uxf0000644000175000001440000002270011576116034020467 0ustar benusers 8 com.umlet.element.Relation 176 128 168 40 lt=<. 24;24;152;24 com.umlet.element.Relation 176 112 168 40 lt=<- 24;24;152;24 com.umlet.element.Relation 176 96 168 40 lt=<<. 24;24;152;24 com.umlet.element.Note 208 336 112 56 Note.. bg=blue com.umlet.element.Relation 176 128 168 56 lt=- m1=0..n m2=0..1 teaches to> 24;40;152;40 com.umlet.element.Package 208 464 112 56 Package 1 -- -Content 1 +Content 2 bg=gray fg=red com.umlet.element.Relation 176 152 172 56 lt=<.> <<someStereotype>> 24;40;152;40 com.umlet.element.Relation 176 184 168 40 lt=<- m1=0..n r1=Role 24;24;152;24 com.umlet.element.Actor 120 408 80 96 Actor com.umlet.element.UseCase 104 328 96 32 *Use case 3* com.umlet.element.Package 208 400 112 56 EmptyPackage bg=orange com.umlet.element.UseCase 16 448 96 32 lt=. Collaboration fg=red bg=yellow com.umlet.element.UseCase 16 304 96 32 Use case 1 com.umlet.element.UseCase 16 376 96 32 Use case 2 bg=blue com.umlet.element.Relation 176 248 168 40 lt=<- q1=Qualification m1=1..5,6,7 24;24;152;24 com.umlet.element.Relation 176 224 168 40 lt=<<<<- 24;24;152;24 com.umlet.element.Relation 176 208 168 40 lt=<<<- 24;24;152;24 com.umlet.element.Class 288 56 48 16 Rose bg=red com.umlet.element.Interface 200 16 64 72 Interface -- Operation1 Operation2 com.umlet.element.Relation 64 336 126 72 lt=<. <<extends>> 48;56;80;24 com.umlet.element.Relation 296 0 130 80 lt=>> a rose is a rose is a rose 24;56;24;40;72;40;72;64;40;64 com.umlet.element.Class 16 240 168 56 _object: Class_ -- id: Long="36548" [waiting for message] com.umlet.element.Relation 24 176 140 80 lt=<. <<instanceOf>> 72;24;72;64 com.umlet.element.Class 104 16 80 24 /AbstractClass/ com.umlet.element.Relation 72 384 80 64 24;24;64;48 com.umlet.element.Class 16 48 168 152 <<Stereotype>> Package::FatClass {Some Properties} -- -id: Long _-ClassAttribute: Long_ -- #Operation(i: int): int /+AbstractOperation()/ -- Responsibilities -- Resp1 *-- Resp2* com.umlet.element.Class 16 16 80 24 SimpleClass com.umlet.element.Relation 40 384 40 80 lt=<<. 24;24;24;64 com.umlet.element.Relation 0 312 122 80 lt=<. <<include>> 64;24;64;64 com.umlet.element.Relation 176 80 168 40 lt=<<- 24;24;152;24 com.umlet.element.custom.Text 336 168 80 80 This is a text element to place text anywhere. com.umlet.element.Relation 184 280 160 40 lt== 24;24;144;24 com.umlet.element.Relation 184 296 160 40 lt=: 24;24;144;24 umlet-11.3.orig/sourcefiles/palettes/Use Case.uxf0000644000175000001440000001071311576116034020474 0ustar benusers 8 com.umlet.element.Note 152 176 104 56 Note.. bg=blue com.umlet.element.custom.Taxonomy_of_Workprocesses 8 320 360 216 Workprocess1 Workprocess2 Workprocess3 Workprocess4 Workprocess5 com.umlet.element.Relation 0 112 112 40 lt=<(). 96;24;24;24 com.umlet.element.Relation 0 96 128 40 112;24;24;24 com.umlet.element.Relation 0 80 128 40 lt=<<. 112;24;24;24 com.umlet.element.Relation 0 48 128 56 lt=<. <<extends>> 112;40;24;40 com.umlet.element.Relation 0 24 128 56 lt=<. <<includes>> 112;40;24;40 com.umlet.element.custom.Systemborder 152 120 104 32 center:Neighboursystem com.umlet.element.custom.AlternativeUseCase 128 256 128 56 Alt. Use Case -- extension points com.umlet.element.UseCase 8 176 128 72 Use Case -- extension points com.umlet.element.custom.Taxonomy_of_Actors 264 16 160 296 Actor1 Actor2 Actor3 Actor4 Actor5 Actor6 com.umlet.element.custom.Systemborder 176 16 80 80 System com.umlet.element.Actor 112 16 64 96 Actor com.umlet.element.UseCase 16 16 96 32 Use case 1 com.umlet.element.Relation 0 136 128 40 lt=<<- 112;24;24;24 umlet-11.3.orig/sourcefiles/.classpath0000644000175000001440000000240611576116034016522 0ustar benusers umlet-11.3.orig/sourcefiles/build.properties0000644000175000001440000000100211576116034017743 0ustar benusers#Wed Jun 15 13:39:17 CEST 2011 output..=bin project.path.source=src bin.includes=.,META-INF/,plugin.xml,html/,img/,palettes/,lib/baselet_*.jar,lib/umlet_*.jar,custom_elements/ src.includes=.classpath,.project,src/ project.path.output=bin project.name.shared=baselet project.website.marketplace=http\://marketplace.eclipse.org/content/umlet-uml-tool-fast-uml-diagrams source..=src/ project.eclipse=Baselet project.path.prefix=com project.name.uc=Umlet project.file.extension=uxf project.name.lc=umlet umlet-11.3.orig/sourcefiles/LICENCE.txt0000644000175000001440000010451311576116034016344 0ustar benusers GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . umlet-11.3.orig/sourcefiles/plugin.xml0000644000175000001440000000140411576116034016554 0ustar benusers umlet-11.3.orig/sourcefiles/README.txt0000644000175000001440000000305511576116034016236 0ustar benusers Question: How do I import the sourcefiles into Eclipse? Answer: 1.) Create a new folder in your Eclipse Workspace. 2.) Copy the content of "sourcefiles" into your project directory. Also copy the "lib" folder into your project directory. 3.) Click "Import..." -> "Existing Projects into Workspace" and select the project folder ----------------------- Question: What are all those variable names like "project.name.uc"? Answer: UMLet and Plotlet use a shared program base called Baselet. We are using those variables to avoid manual adjustment of many files before every release. ----------------------- Question: Some classes in the "com.baselet.plugin" package have errors. Answer: The classes in this package represent the sourcecode of the eclipse plugin version of the program. It seems that your Eclipse version has no Eclipse Plug-In development support. To avoid these errors please download an Eclipse version with Eclipse Plug-In development support like "Eclipse for RCP/Plug-in Developers" or "Eclipse Classic" ----------------------- Question: How do I start the program from Eclipse? Answer: You can use the "start" target from the ant-script "ant.xml" or you can use "Run as Application" -> "Main.java" ----------------------- Question: The ant-script "ant.xml" isn't working. Answer: The ant file is only working in Eclipse and only if it running in the same JRE as the workspace. Therefore right click on the target to run and select "Run As" -> "External Tools Configurations" Click on the "JRE" tab and select "Run in the same JRE as the workspace"umlet-11.3.orig/sourcefiles/META-INF/0000755000175000001440000000000011576116036015677 5ustar benusersumlet-11.3.orig/sourcefiles/META-INF/MANIFEST.MF0000644000175000001440000000266211576116034017335 0ustar benusersManifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 14.0-b16 (Sun Microsystems Inc.) Bundle-ManifestVersion: 2 Bundle-Name: Umlet Bundle-SymbolicName: com.umlet.plugin;singleton:=true Bundle-Version: 11.3 Bundle-Activator: com.baselet.plugin.MainPlugin Bundle-Vendor: http://www.umlet.com Require-Bundle: org.eclipse.ui,org.eclipse.ui.ide,org.eclipse.core.res ources,org.eclipse.core.runtime Bundle-ClassPath: ., lib/baselet_batik-awt-util.jar, lib/baselet_batik -dom.jar, lib/baselet_batik-ext.jar, lib/baselet_batik-svggen.jar, li b/baselet_batik-util.jar, lib/baselet_batik-xml.jar, lib/baselet_iTex t.jar, lib/baselet_jlibeps.jar, lib/baselet_jsyntaxpane-0.9.5-b29_cus tomized.jar, lib/baselet_log4j-1.2.15.jar, lib/baselet_mailapi.jar, l ib/baselet_smtp.jar, lib/umlet_org.eclipse.jdt.core_3.5.1.v_972_R35x. jar Main-Class: com.baselet.control.Main Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-LazyStart: true Import-Package: org.eclipse.core.filesystem Class-Path: lib/baselet_batik-awt-util.jar lib/baselet_batik-dom.jar l ib/baselet_batik-ext.jar lib/baselet_batik-svggen.jar lib/baselet_bat ik-util.jar lib/baselet_batik-xml.jar lib/baselet_iText.jar lib/basel et_jlibeps.jar lib/baselet_jsyntaxpane-0.9.5-b29_customized.jar lib/b aselet_log4j-1.2.15.jar lib/baselet_mailapi.jar lib/baselet_smtp.jar lib/umlet_org.eclipse.jdt.core_3.5.1.v_972_R35x.jar umlet-11.3.orig/sourcefiles/.project0000644000175000001440000000120011576116034016175 0ustar benusers Baselet org.eclipse.jdt.core.javabuilder org.eclipse.pde.ManifestBuilder org.eclipse.pde.SchemaBuilder org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature umlet-11.3.orig/sourcefiles/ant.xml0000644000175000001440000003414311576116034016046 0ustar benusers umlet-11.3.orig/sourcefiles/log4j.properties0000644000175000001440000000235711576116034017701 0ustar benusers # Logger setup for all loggers (all loggers inherit from rootLogger) log4j.rootLogger=ERROR, SYSTEM_OUT, FILE # Appender SYSTEM_OUT writes to the console log4j.appender.SYSTEM_OUT=org.apache.log4j.ConsoleAppender log4j.appender.SYSTEM_OUT.layout=org.apache.log4j.PatternLayout log4j.appender.SYSTEM_OUT.layout.ConversionPattern=%d{ISO8601} | %6r | %-5p | %-30c | %m%n # Appender FILE writes to the file "log4j.log". log4j.appender.FILE=org.apache.log4j.FileAppender log4j.appender.FILE.File=${PROJECT_PATH}/log4j.log log4j.appender.FILE.Append=true log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=%d{ISO8601} | %6r | %-5p | %-30c | %m%n # Appender SYSTEM_OUT_SLOW writes to the console and links to the exact calling method (This is SLOW!) log4j.appender.SYSTEM_OUT_SLOW=org.apache.log4j.ConsoleAppender log4j.appender.SYSTEM_OUT_SLOW.layout=org.apache.log4j.PatternLayout log4j.appender.SYSTEM_OUT_SLOW.layout.ConversionPattern=%6r | %-5p | %-60l - "%m"%n # Individual activation/deactivation of loggers # use log4j.logger(.PACKAGE)+(.CLASSNAME)? -> eg: log4j.logger.main.control.Main=INFO log4j.logger.com.baselet.control.DiagramHandler=INFO log4j.logger.com.baselet.diagram.draw.PlotDrawHandler=DEBUGumlet-11.3.orig/sourcefiles/plugin.xml.generic0000644000175000001440000000200511576116034020165 0ustar benusers