1 package cve.environment; 2 3 import cve.core.comunicazione.*; 4 import cve.core.costruttori.*; 5 import cve.core.elementLDL.*; 6 import cve.core.elementEEL.*; 7 import cve.esecutori.*; 8 import cve.staticLayout.*; 9 import cve.util.*; 10 11 import relations.*; 12 13 import java.util.*; 14 import javax.swing.*; 15 16 24 final public class Make_env_specification extends Make_env{ 25 26 30 public Make_env_specification() {} 31 32 37 public void createEnv(){ 38 Class ese=null,oss=null, pre=null,unit=null; 39 ist=new IstanziaElement(); 41 env=new Environment(1); 43 env.setDescription("Maker of WIPPOG specifications "); 44 ViewLog.writeInLog("\n"); 45 ViewLog.writeInLog("****** COSTRUISCO AMBIENTE LDL SPECIFICATION ******"+"\n"); 46 ViewLog.writeInLog("Creo i descrittori LDL degli elementi cve e delle loro relazioni"+"\n"); 48 try { 50 ese = Class.forName("cve.esecutori.EACBuild"); 52 oss = Class.forName("cve.osservatori.OACBuild"); 53 pre = Class.forName("cve.core.elementEEL.Presenter"); 54 unit=Class.forName("cve.core.elementEEL.Unit"); 55 } catch (ClassNotFoundException e) { 56 System.err.println("Problemi nella costruzione dell'ambiente " +e.getMessage()); 57 } 58 IElementoCve eleCveE=ist.crea("esecutore"," 1",ese); 61 IElementoCve eleCveO=ist.crea("osservatore"," 2",oss); 64 DescrCveToolBar cveTB=creaTB(); 67 IElementoCveVis eleCveP=ist.crea("presenter"," 3",pre,cveTB); 68 eleCveP.setDescription("Specification view"); 69 DescrCveMenu cveML=creaMenuLang(); 71 DescrCveMenu cveMH=creaMenuHelp(); 72 eleCveP.addMenu(cveML); 73 eleCveP.addMenu(cveMH); 74 Vector parTitolo1=new Vector(); 77 parTitolo1.add(titleEnv); 78 eleCveP.setParameters(parTitolo1); 79 80 eleCveP.setIcon(iconPath); 82 83 Vector members=new Vector(); 85 members.add(eleCveP); 86 IElementoCveVis eleCveUnit=ist.crea("unit","4",unit,null); 87 eleCveUnit.setParameters(members); 88 eleCveUnit.setDescription(titleEnv + " view unit"); 89 90 env.addElement(eleCveE); 92 env.addElement(eleCveO); 93 env.addElement(eleCveP); 94 env.addElement(eleCveUnit); 95 ViewLog.writeInLog(" la dimensione dell'insieme di elementi ldl non relazione e' "+env.getSizeEleLdl()+"\n"); 96 IMemberRel membro1=new MemberRel("osservatore",eleCveE); 98 IMemberRel membro2=new MemberRel("esecutore",eleCveO); 99 RelInterlayerCve interlayerA=new RelInterlayerCve("EsempioInterA"); 100 Vector app=new Vector(); 101 app.add(membro1); 102 app.add(membro2); 103 interlayerA.setMembers(app); 104 IMemberRel memb1=new MemberRel("osservatore",eleCveO); 106 IMemberRel memb2=new MemberRel("presenter",eleCveP); 107 RelInterlayerCve interlayerB=new RelInterlayerCve("EsempioInterB"); 108 Vector app1=new Vector(); 109 app1.add(memb1); 110 app1.add(memb2); 111 interlayerB.setMembers(app1); 112 env.addRel((IRelazione)interlayerA); 114 env.addRel((IRelazione)interlayerB); 115 ViewLog.writeInLog(" la dimensione dell'insieme delle relazioni e' "+env.getSizeRelLdl()+"\n"); 116 ldl_to_eel= new Ldl_to_Edl(env); 118 ViewLog.writeInLog( "AMBIENTE EEL CREATO CORRETTAMENTE "+"\n"); 119 ViewLog.writeInLog( " "+"\n"); 120 ViewLog.writeInLog( "******* ESECUZIONE AMBIENTE EEL CREATO ************ "+"\n"); 121 ViewLog.writeInLog( " "+"\n"); 122 } 123 124 127 public EnvironmentEEL getEnvironmentEEL(){ 128 envEEL=ldl_to_eel.getEnvironmentEEL(); 130 return envEEL; 131 } 132 133 134 139 public void setIconEnv(String iconPath){ 140 this.iconPath = iconPath; 141 } 142 143 148 public void setTitle(String title){ 149 this.titleEnv = title; 150 } 151 152 153 154 158 162 private DescrCveToolBar creaTB(){ 163 DescrCveToolBar cveT=new DescrCveToolBar(); 164 165 DescrCveButton cveB1=new DescrCveButton(); 166 cveB1.setAction("getAlfabeto"); 167 cveB1.setIcon(ConfigurationRead.getCveRoot()+"/resource/LOADALF.gif"); 168 169 DescrCveButton cveB2=new DescrCveButton(); 170 cveB2.setAction("cancAlfabeto"); 171 cveB2.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCALF.gif"); 172 173 DescrCveButton cveB3=new DescrCveButton(); 174 cveB3.setAction("getRegole"); 175 cveB3.setIcon(ConfigurationRead.getCveRoot()+"/resource/LOADREG.gif"); 176 177 DescrCveButton cveB4=new DescrCveButton(); 178 cveB4.setAction("cancRegole"); 179 cveB4.setIcon(ConfigurationRead.getCveRoot()+"/resource/CANCREG.gif"); 180 181 DescrCveButton cveB5=new DescrCveButton(); 182 cveB5.setAction("creaLing"); 183 cveB5.setIcon(ConfigurationRead.getCveRoot()+"/resource/CREAAC.gif"); 184 185 189 cveT.addDescrCveB(cveB1); 190 cveT.addDescrCveB(cveB2); 191 cveT.addDescrCveB(cveB3); 192 cveT.addDescrCveB(cveB4); 193 cveT.addDescrCveB(cveB5); 194 return cveT; 196 } 197 198 204 private DescrCveMenu creaMenuLang(){ 205 DescrCveMenu cveM=new DescrCveMenu(); 206 cveM.setName("Language"); 207 208 DescrCveItem cveI1=new DescrCveItem(); 209 cveI1.setName("Get visual alphabet"); 210 cveI1.setAction("getAlfabeto"); 211 212 DescrCveItem cveI2=new DescrCveItem(); 213 cveI2.setName("Reset visual alphabet"); 214 cveI2.setAction("cancAlfabeto"); 215 216 DescrCveItem cveI3=new DescrCveItem(); 217 cveI3.setName("Get rewrite rules"); 218 cveI3.setAction("getRegole"); 219 220 DescrCveItem cveI4=new DescrCveItem(); 221 cveI4.setName("Reset rewrite rules"); 222 cveI4.setAction("cancRegole"); 223 224 DescrCveItem cveI5=new DescrCveItem(); 225 cveI5.setName("Generate language"); 226 cveI5.setAction("creaLing"); 227 228 cveM.addItem(cveI1); 229 cveM.addItem(cveI2); 230 cveM.addItem(cveI3); 231 cveM.addItem(cveI4); 232 cveM.addItem(cveI5); 233 return cveM; 234 } 235 236 240 private DescrCveMenu creaMenuHelp(){ 241 DescrCveMenu cveM=new DescrCveMenu(); 242 cveM.setName("Help"); 243 244 260 return cveM; 261 } 262 263 } | Popular Tags |