1 package cve.environment; 2 3 import cve.core.comunicazione.*; 4 import cve.core.costruttori.*; 5 import cve.core.elementEEL.*; 6 import cve.core.elementLDL.*; 7 import cve.esecutori.*; 8 import cve.presenter.*; 9 import cve.osservatori.servizioOACesec.*; 10 import cve.staticLayout.*; 11 import interactionHandler.*; 12 import interactionGraphics.*; 13 import cve.util.*; 14 15 import relations.*; 16 17 import java.util.*; 18 import javax.swing.*; 19 20 30 final public class Make_env_VS extends Make_env 31 { 32 33 36 public Make_env_VS() {} 37 38 39 44 public void createEnv(){ 45 Class ese=null,oss=null, oss1=null,pre=null, pre1=null, unit=null; 46 ist=new IstanziaElement(); 48 env=new Environment(2); 50 env.setDescription("Cve multi view example"); 51 ViewLog.writeInLog("\n"); 52 ViewLog.writeInLog(" ****** COSTRUISCO AMBIENTE LDL ******"+"\n"); 53 ViewLog.writeInLog(" Creo i descrittori LDL degli elementi cve e delle loro relazioni"+"\n"); 54 try { 56 ese = Class.forName("cve.esecutori.EACesec"); 57 oss = Class.forName("cve.osservatori.OACesec"); 58 oss1 = Class.forName("cve.osservatori.OACesec"); 59 pre=Class.forName("cve.presenter.PresenterA"); 60 pre1=Class.forName("cve.presenter.PresenterB"); 61 unit=Class.forName("cve.core.elementEEL.Unit"); 62 } catch (ClassNotFoundException e) { 63 System.err.println("Caught classe non trovata: " + 64 e.getMessage()); 65 } 66 68 IElementoCve eleCveE=ist.crea("esecutore","1",ese); 70 IElementoCve eleCveO=ist.crea("osservatore","2",oss); 72 JTool tool=new JTool(); 74 JCanvasLevel can=new JCanvasLevel(); 75 Vector component=new Vector(); 76 component.add(tool); 77 component.add(can); 78 eleCveO.setParameters(component); 79 IElementoCve eleCveO1=ist.crea("osservatore","3",oss1); 80 JTool tool1=new JTool(); 83 JCanvasFree can1=new JCanvasFree(); 84 Vector component1=new Vector(); 85 component1.add(tool1); 86 component1.add(can1); 87 eleCveO1.setParameters(component1); 88 DescrCveToolBar cveTB=creaTB(); 91 IElementoCveVis eleCveP=ist.crea("presenter","4",pre,cveTB); 92 eleCveP.setDescription("Level view"); 93 DescrCveMenu cveM=creaMenu(); 95 DescrCveMenu cveM1=creaMenu1(); 96 DescrCveMenu cveMH=creaMenuHelp(); 97 eleCveP.addMenu(cveM); 98 eleCveP.addMenu(cveM1); 99 eleCveP.addMenu(cveMH); 100 Vector parTitolo1=new Vector(); 103 parTitolo1.add(titleEnv + " - Levels view"); 104 eleCveP.setParameters(parTitolo1); 105 eleCveP.setIcon(iconPath); 107 108 Vector parTitolo2=new Vector(); 111 parTitolo2.add(titleEnv + " - Free view"); 112 IElementoCveVis eleCveP1=ist.crea("presenter","5",pre1,cveTB); 113 eleCveP1.setDescription("Free view"); 114 eleCveP1.addMenu(cveM); 115 eleCveP1.addMenu(cveM1); 116 eleCveP1.addMenu(cveMH); 117 eleCveP1.setParameters(parTitolo2); 118 eleCveP1.setIcon(iconPath); 120 121 Vector members=new Vector(); 123 members.add(eleCveP); 124 members.add(eleCveP1); 125 IElementoCveVis eleCveUnit=ist.crea("unit","6",unit,null); 126 eleCveUnit.setParameters(members); 127 eleCveUnit.setDescription(titleEnv + " view unit "); 128 env.addElement(eleCveE); 130 env.addElement(eleCveO); 131 env.addElement(eleCveO1); 132 env.addElement(eleCveP); 133 env.addElement(eleCveP1); 134 env.addElement(eleCveUnit); 135 ViewLog.writeInLog(" la dimensione dell'insieme di elementi ldl non relazione e' "+env.getSizeEleLdl()+"\n"); 136 IMemberRel membro1=new MemberRel("esecutore",eleCveE); 138 IMemberRel membro2=new MemberRel("osservatore",eleCveO); 139 RelInterlayerCve interlayer=new RelInterlayerCve("EsempioInterA"); 140 Vector app=new Vector(); 142 app.add(membro1); 143 app.add(membro2); 144 interlayer.setMembers(app); 145 IMemberRel membro1A=new MemberRel("esecutore",eleCveE); 147 IMemberRel membro2A=new MemberRel("osservatore",eleCveO1); 148 RelInterlayerCve interlayerA=new RelInterlayerCve("EsempioInterA"); 149 Vector appA=new Vector(); 151 appA.add(membro1A); 152 appA.add(membro2A); 153 interlayerA.setMembers(appA); 154 IMemberRel memb1=new MemberRel("presenter",eleCveP); 156 IMemberRel memb2=new MemberRel("osservatore",eleCveO); 157 RelInterlayerCve interlayerB=new RelInterlayerCve("EsempioInterB"); 158 Vector app1=new Vector(); 160 app1.add(memb1); 161 app1.add(memb2); 162 interlayerB.setMembers(app1); 163 IMemberRel memb1A=new MemberRel("presenter",eleCveP1); 165 IMemberRel memb2A=new MemberRel("osservatore",eleCveO1); 166 RelInterlayerCve interlayer2B=new RelInterlayerCve("EsempioInterB"); 167 Vector app1A=new Vector(); 169 app1A.add(memb1A); 170 app1A.add(memb2A); 171 interlayer2B.setMembers(app1A); 172 env.addRel((IRelazione)interlayer); 176 env.addRel((IRelazione)interlayerA); 177 env.addRel((IRelazione)interlayerB); 178 env.addRel((IRelazione)interlayer2B); 179 ViewLog.writeInLog(" la dimensione dell'insieme delle relazioni e'"+env.getSizeRelLdl()+"\n"); 180 ViewLog.writeInLog(""+"\n"); 181 ViewLog.writeInLog(" ****** COSTRUISCO AMBIENTE EEL ******"+"\n"); 182 ldl_to_eel= new Ldl_to_Edl(env); 184 ViewLog.writeInLog( " Creato insieme elementi Edl (osservatori e esecutori) "+"\n"); 185 ViewLog.writeInLog( " Create e riempite strutture dedicate alla comunicazione (gruppi,... ) "+"\n"); 186 ViewLog.writeInLog( " "+"\n"); 187 } 189 190 194 public EnvironmentEEL getEnvironmentEEL(){ 195 envEEL=ldl_to_eel.getEnvironmentEEL(); 197 return envEEL; 198 } 199 200 205 public void setIconEnv(String iconPath){ 206 this.iconPath = iconPath; 207 } 208 209 214 public void setTitle(String title){ 215 this.titleEnv = title; 216 } 217 218 219 220 224 228 private DescrCveToolBar creaTB(){ 229 DescrCveToolBar cveT=new DescrCveToolBar(); 230 231 DescrCveButton cveB1=new DescrCveButton(); 232 cveB1.setAction("getLinguaggio"); 233 cveB1.setIcon(ConfigurationRead.getCveRoot()+"/resource/LOADAUT.gif"); 234 235 DescrCveButton cveB2=new DescrCveButton(); 236 cveB2.setAction("cancSentenza"); 237 cveB2.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCSENT.gif"); 238 239 DescrCveButton cveB3=new DescrCveButton(); 240 cveB3.setAction("cancLinguaggio"); 241 cveB3.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCAUT.gif"); 242 243 cveT.addDescrCveB(cveB1); 244 cveT.addDescrCveB(cveB2); 245 cveT.addDescrCveB(cveB3); 246 return cveT; 247 } 248 249 255 private DescrCveMenu creaMenu(){ 256 DescrCveMenu cveM=new DescrCveMenu(); 257 cveM.setName("Language"); 258 259 DescrCveItem cveI1=new DescrCveItem(); 260 cveI1.setName("Get Language"); 261 cveI1.setAction("getLinguaggio"); 262 263 DescrCveItem cveI2=new DescrCveItem(); 264 cveI2.setName("Reset sentence"); 265 cveI2.setAction("cancSentenza"); 266 267 DescrCveItem cveI3=new DescrCveItem(); 268 cveI3.setName("Reset Language"); 269 cveI3.setAction("cancLinguaggio"); 270 271 cveM.addItem(cveI1); 272 cveM.addItem(cveI2); 273 cveM.addItem(cveI3); 274 return cveM; 275 } 276 277 278 284 private DescrCveMenu creaMenu1(){ 285 DescrCveMenu cveM=new DescrCveMenu(); 286 cveM.setName("Setting"); 287 288 292 DescrCveItem cveI2=new DescrCveItem(); 293 cveI2.setName("Color select"); 294 cveI2.setAction("colorSelect"); 295 296 DescrCveItem cveI3=new DescrCveItem(); 297 cveI3.setName("Color dummy"); 298 cveI3.setAction("colorDummy"); 299 300 304 DescrCveItem cveI5=new DescrCveItem(); 308 cveI5.setName("Advanced.."); 309 cveI5.setAction("advancedFeature"); 310 311 cveM.addItem(cveI2); 313 cveM.addItem(cveI3); 314 cveM.addItem(cveI5); 316 Collection prova=cveM.getAll(); 317 return cveM; 318 } 319 320 324 private DescrCveMenu creaMenuHelp(){ 325 DescrCveMenu cveM=new DescrCveMenu(); 326 cveM.setName("Help"); 327 328 331 332 333 337 341 return cveM; 345 } 346 } 347 348 349 | Popular Tags |