1 package cve.staticLayout; 2 3 import javax.swing.JInternalFrame ; 4 import javax.swing.tree.*; 5 import javax.swing.*; 6 7 import java.awt.event.*; 8 import java.awt.*; 9 import java.util.*; 10 11 import cve.core.elementLDL.*; 12 import cve.core.elementEEL.*; 13 import cve.util.ConfigurationRead; 14 15 import org.apache.log4j.Logger; 16 17 24 public class ViewEnvironment extends JInternalFrame { 25 static int openFrameCount = 0; 26 static final int xOffset = 0, yOffset = 50; 27 private IEnvironmentEEL envEEL; 28 29 33 public ViewEnvironment(IEnvironmentEEL envEEL) { 34 super(" View cve environment", 35 true, true, false, true); Cve.errLog.debug(""); 40 setFrameIcon(new ImageIcon(ConfigurationRead.getCveRoot()+"/resource/cve/bkmrk_nav.gif")); 41 this.envEEL=envEEL; 42 setLocation(xOffset, yOffset); 44 if (envEEL==null) { 45 System.out.println(" Attenzione l'ambiente e' stato trovato nullo"); 46 } 47 viewTreeEnv(); 48 } 49 50 53 void viewTreeEnv() { 54 Cve.errLog.debug(""); 55 DefaultMutableTreeNode root=new DefaultMutableTreeNode (envEEL.getDescription()); 56 JTree jt=new JTree(root); 57 DefaultTreeCellRenderer envR=new DefaultTreeCellRenderer (); 58 envR.setOpenIcon(new ImageIcon(ConfigurationRead.getCveRoot()+"/resource/cve/metaphor/elements_obj.gif")); 59 envR.setClosedIcon(new ImageIcon(ConfigurationRead.getCveRoot()+"/resource/cve/metaphor/elements_obj.gif")); 60 envR.setLeafIcon(new ImageIcon(ConfigurationRead.getCveRoot()+"/resource/cve/metaphor/default_persp.gif")); 61 jt.setCellRenderer(envR); 62 Collection units=envEEL.getAllUnit(); 63 Iterator itEle=units.iterator(); 64 while (itEle.hasNext()){ 65 IUnit eleUnit=(IUnit)itEle.next(); 66 DefaultTreeCellRenderer unitR=new DefaultTreeCellRenderer (); 68 DefaultMutableTreeNode unit= new DefaultMutableTreeNode(eleUnit.getDescription()); 70 Collection presenters=eleUnit.getPresenters(); 72 Iterator itPre=presenters.iterator(); 73 while (itPre.hasNext()){ 74 Presenter pre=(Presenter)itPre.next(); 75 DefaultTreeCellRenderer preR=new DefaultTreeCellRenderer (); 76 DefaultMutableTreeNode presenter= new DefaultMutableTreeNode(pre.getDescription()); 78 unit.add(presenter); 81 } 82 root.add(unit); 83 } 84 this.getContentPane().add(jt,BorderLayout.CENTER); 85 pack(); 86 setSize(200,200); 87 setVisible(true); 88 } 89 90 118 } 119 | Popular Tags |