| 
						 Nun wird das TreeListControl innerhalb unserer Action instanziiert und mit den Anzeigedaten gefüllt. Das Datenmodell wird dem Kontrollelement über die setDataModel()-Methode zugeordnet. Die Methode nimmt als Argument ein Objekt vom Typ TreeGroupDataModel entgegen. Dabei handelt es sich um ein Interface welches den Zugriff auf die Anzeigedaten des Baumes bereitstellt. Es ist die Aufgabe des Anwendungsentwicklers eine entsprechende Implementierung zur Verfügung zu stellen. 
						
						import java.io.IOException; 
import javax.servlet.ServletException; 
 
import com.cc.framework.adapter.struts.ActionContext; 
import com.cc.framework.adapter.struts.FWAction; 
import com.cc.framework.ui.control.TreeListControl; 
 
public class RegionBrowseAction extends FWAction { 
 
    /** 
     * @see com.cc.framework.adapter.struts.FWAction#doExecute(ActionContext) 
     */ 
    public void doExecute(ActionContext ctx) 
         throws IOException, ServletException { 
 
            try { 
                // first get the Displaydata for our TreeList 
                RegionGroupDsp dspData = DBRegion.fetchDspOutline(); 
 
                // Create the TreeListControl an populate it 
                // withe the Data to display 
                TreelistControl regionList = new TreelistControl(); 
                regionList.setDataModel(dspData); 
 
                // third put the TreeListControl into the Session-Object. 
                // Our TreeListControl is a statefull Object. 
                // Normaly  you can use an Objectmanager or an other 
                // workflow Component that manage the Livecyle of the Object 
                ctx.session().setAttribute("regions", regionList); 
            } 
 
        catch (Throwable t) { 
            ctx.addGlobalError("Error: ", t); 
        } 
 
        // Display the Page with the TreeList 
        ctx.forwardToInput(); 
    } 
} 
						 
                   
                    zurück   |  
                    weiter zu Schritt 4   
								 |