Products
About Guided Tour Online Demo Trial Version Requirements
Resources
Documents Configuration examples TagLib Reference Useful Links
Customer Support
Updates Forums Contact Services
Sales
Licensing Sales FAQ Buy Online
 
 
 
buy online   |   about us   |   german version  

» 3. Instancing of the TreeListControl

Now, the TreeListControl is instanced within our action and filled with the display data. The data model is assigned to the control element through the setDataModel()-method. The method takes, as the argument, an object of type TreeGroupDataModel. What this involves is an interface which provides access to the display data of the tree. It is the job of the application developer to provide a corresponding implementation.

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();
    }
}

back   |   continue to step 4

Impressum | This product includes software developed by the Java Apache Project
Tours
ListControl TreeControl TreeListControl TabSetControl Form Tags MenuControl Print version Live demo Configuration