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 relations.*; 10 11 import interactionHandler.*; 12 import interactionGraphics.*; 13 import cve.osservatori.servizioOACesec.*; 14 15 import cve.staticLayout.*; 16 import cve.util.*; 17 18 import java.util.*; 19 import javax.swing.*; 20 21 22 29 final public class Make_env_Genial extends Make_env 30 { 31 32 36 public Make_env_Genial() {} 37 38 43 public void createEnv(){ 44 Class ese=null,oss=null, oss1=null,pre=null, pre1=null, unit=null; 45 ist=new IstanziaElement(); 47 env=new Environment(2); 49 env.setDescription("Genial prototype"); 50 System.out.println(); 51 System.out.println("****** COSTRUISCO AMBIENTE LDL ******"); 52 System.out.println(" Creo i descrittori LDL degli elementi cve e delle loro relazioni"); 53 try { 55 ese = Class.forName("cve.esecutori.EACesec"); 56 oss = Class.forName("cve.osservatori.OACesec"); 57 oss1 = Class.forName("cve.osservatori.OACesec"); 58 pre1=Class.forName("cve.core.elementEEL.Presenter"); 61 62 unit=Class.forName("cve.core.elementEEL.Unit"); 63 } catch (ClassNotFoundException e) { 64 System.err.println("Caught classe non trovata: " + 65 e.getMessage()); 66 } 67 69 IElementoCve eleCveE=ist.crea("esecutore","1",ese); 71 IElementoCve eleCveO=ist.crea("osservatore","2",oss); 73 JTool tool=new JTool(); 75 JCanvasLevel can=new JCanvasLevel(); 76 Vector component=new Vector(); 77 component.add(tool); 78 component.add(can); 79 eleCveO.setParameters(component); 80 IElementoCve eleCveO1=ist.crea("osservatore","3",oss1); 81 JTool tool1=new JTool(); 84 JCanvasFree can1=new JCanvasFree(); 85 Vector component1=new Vector(); 86 component1.add(tool1); 87 component1.add(can1); 88 eleCveO1.setParameters(component1); 89 DescrCveToolBar cveTB=creaTB(); 92 IElementoCveVis eleCveP=ist.crea("presenter","4",pre,cveTB); 93 eleCveP.setDescription("Free view"); 94 eleCveP.setIcon(iconPath); 96 97 DescrCveMenu cveM=creaMenu(); 99 DescrCveMenu cveM1=creaMenu1(); 100 DescrCveMenu cveMH=creaMenuHelp(); 101 eleCveP.addMenu(cveM); 102 eleCveP.addMenu(cveM1); 103 eleCveP.addMenu(cveMH); 104 Vector parTitolo1=new Vector(); 107 parTitolo1.add(titleEnv + " - Level Observer"); 108 eleCveP.setParameters(parTitolo1); 109 Vector parTitolo2=new Vector(); 112 parTitolo2.add(titleEnv + " - Free Observer"); 113 IElementoCveVis eleCveP1=ist.crea("presenter","5",pre1,cveTB); 114 eleCveP1.setDescription("Free view"); 115 eleCveP1.addMenu(cveM); 116 eleCveP1.addMenu(cveM1); 117 eleCveP1.addMenu(cveMH); 118 eleCveP1.setParameters(parTitolo2); 119 eleCveP1.setIcon(iconPath); 121 122 Vector members=new Vector(); 124 members.add(eleCveP1); 126 IElementoCveVis eleCveUnit=ist.crea("unit","6",unit,null); 127 eleCveUnit.setParameters(members); 128 eleCveUnit.setDescription(titleEnv + " view unit "); 129 env.addElement(eleCveE); 131 env.addElement(eleCveO1); 133 env.addElement(eleCveP1); 135 env.addElement(eleCveUnit); 136 System.out.println(" la dimensione dell'insieme di elementi ldl non relazione e' "+env.getSizeEleLdl()); 137 IMemberRel membro1A=new MemberRel("esecutore",eleCveE); 148 IMemberRel membro2A=new MemberRel("osservatore",eleCveO1); 149 RelInterlayerCve interlayerA=new RelInterlayerCve("EsempioInterA"); 150 Vector appA=new Vector(); 152 appA.add(membro1A); 153 appA.add(membro2A); 154 interlayerA.setMembers(appA); 155 164 IMemberRel memb1A=new MemberRel("presenter",eleCveP1); 166 IMemberRel memb2A=new MemberRel("osservatore",eleCveO1); 167 RelInterlayerCve interlayer2B=new RelInterlayerCve("EsempioInterB"); 168 Vector app1A=new Vector(); 170 app1A.add(memb1A); 171 app1A.add(memb2A); 172 interlayer2B.setMembers(app1A); 173 env.addRel((IRelazione)interlayerA); 178 env.addRel((IRelazione)interlayer2B); 180 System.out.println(" la dimensione dell'insieme delle relazioni e'"+env.getSizeRelLdl()); 181 System.out.println(""); 182 System.out.println("****** COSTRUISCO AMBIENTE EEL ******"); 183 ldl_to_eel= new Ldl_to_Edl(env); 185 System.out.println( " Creato insieme elementi Edl (osservatori e esecutori) "); 186 System.out.println( " Create e riempite strutture dedicate alla comunicazione (gruppi,... ) "); 187 System.out.println( " "); 188 System.out.println( " "); 189 } 191 192 196 public EnvironmentEEL getEnvironmentEEL(){ 197 envEEL=ldl_to_eel.getEnvironmentEEL(); 199 return envEEL; 200 } 201 202 207 public void setIconEnv(String iconPath){ 208 this.iconPath = iconPath; 209 } 210 211 216 public void setTitle(String title){ 217 this.titleEnv = title; 218 } 219 220 221 222 223 227 231 private DescrCveToolBar creaTB(){ 232 DescrCveToolBar cveT=new DescrCveToolBar(); 233 234 DescrCveButton cveB1=new DescrCveButton(); 235 cveB1.setAction("getLinguaggio"); 236 cveB1.setIcon(ConfigurationRead.getCveRoot()+"/resource/LOADAUT.gif"); 237 238 DescrCveButton cveB2=new DescrCveButton(); 239 cveB2.setAction("cancSentenza"); 240 cveB2.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCSENT.gif"); 241 242 DescrCveButton cveB3=new DescrCveButton(); 243 cveB3.setAction("cancLinguaggio"); 244 cveB3.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCAUT.gif"); 245 246 DescrCveButton cveB4=new DescrCveButton(); 247 cveB4.setAction("saveSentence"); 248 cveB4.setIcon(ConfigurationRead.getCveRoot()+"/resource/SAVESENT.gif"); 249 250 DescrCveButton cveB5=new DescrCveButton(); 251 cveB5.setAction("loadSentence"); 252 cveB5.setIcon(ConfigurationRead.getCveRoot()+"/resource/LOADSENT.gif"); 253 254 cveT.addDescrCveB(cveB1); 255 cveT.addDescrCveB(cveB2); 256 cveT.addDescrCveB(cveB3); 257 cveT.addDescrCveB(cveB4); 258 cveT.addDescrCveB(cveB5); 259 return cveT; 260 } 261 262 268 private DescrCveMenu creaMenu(){ 269 DescrCveMenu cveM=new DescrCveMenu(); 270 cveM.setName("Language"); 271 272 DescrCveItem cveI1=new DescrCveItem(); 273 cveI1.setName("Get Language"); 274 cveI1.setAction("getLinguaggio"); 275 276 DescrCveItem cveI2=new DescrCveItem(); 277 cveI2.setName("Reset sentence"); 278 cveI2.setAction("cancSentenza"); 279 280 DescrCveItem cveI3=new DescrCveItem(); 281 cveI3.setName("Reset Language"); 282 cveI3.setAction("cancLinguaggio"); 283 284 cveM.addItem(cveI1); 285 cveM.addItem(cveI2); 286 cveM.addItem(cveI3); 287 return cveM; 288 } 289 290 291 292 298 private DescrCveMenu creaMenu1(){ 299 DescrCveMenu cveM=new DescrCveMenu(); 300 cveM.setName("Setting"); 301 302 DescrCveItem cveI1=new DescrCveItem(); 303 cveI1.setName("Interaction modality"); 304 cveI1.setAction("changeEventAction"); 305 306 DescrCveItem cveI2=new DescrCveItem(); 307 cveI2.setName("Color select"); 308 cveI2.setAction("colorSelect"); 309 310 DescrCveItem cveI3=new DescrCveItem(); 311 cveI3.setName("Color dummy"); 312 cveI3.setAction("colorDummy"); 313 314 318 DescrCveItem cveI5=new DescrCveItem(); 322 cveI5.setName("Advanced.."); 323 cveI5.setAction("advancedFeature"); 324 325 cveM.addItem(cveI1); 326 cveM.addItem(cveI2); 327 cveM.addItem(cveI3); 328 cveM.addItem(cveI5); 330 Collection prova=cveM.getAll(); 331 return cveM; 332 } 333 334 338 private DescrCveMenu creaMenuHelp(){ 339 DescrCveMenu cveM=new DescrCveMenu(); 340 cveM.setName("Help"); 341 342 345 346 347 351 355 return cveM; 359 } 360 } 361 362 363 | Popular Tags |