beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "严衍平" <supermanya...@gmail.com>
Subject please help me
Date Tue, 14 Nov 2006 09:30:12 GMT
i'm the user of beehive.
And in the process of developing, i came up with this question.

i want to make a taglib of repeater.

and i write code like these.

package com.jumpintl.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;

import org.apache.beehive.netui.tags.databinding.repeater.Repeater;
import org.apache.beehive.netui.tags.databinding.repeater.RepeaterHeader;
import org.apache.beehive.netui.tags.databinding.repeater.RepeaterItem;
import org.apache.beehive.netui.tags.rendering.TableTag;

import com.mockrunner.mock.web.MockBodyContent;

public class Datagrid extends Repeater {

    /**
     *
     */
    private static final long serialVersionUID = 9132424393043653581L;

    private String tagId;

    private String query;

    private String sharedController;

    private String xmlPath;

    //private TableController tableController;

    public Datagrid(){
        //XMLDatagrid datagrid = tableController.getDatagrid();
    }

     public int doStartTag() {

        RepeaterHeader repeaterHeader = new RepeaterHeader();
        repeaterHeader.setPageContext(pageContext);
        repeaterHeader.setParent(this);

        RepeaterItem repeaterItem = new RepeaterItem();
        repeaterItem.setPageContext(pageContext);
        repeaterItem.setParent(this);


        //repeaterHeader.doInitBody();
        try {
            super.setDataSource("sharedFlow.tableFlow.tableDatas");
            super.doStartTag();
            super.doInitBody();

            int retRepeaterBody = 2;
            while (retRepeaterBody!=0) {

                repeaterHeader.doStartTag();
                repeaterHeader.doInitBody();

                MockBodyContent body = new MockBodyContent(
pageContext.getOut());
                body.write("<table>"
                            + "<tr>"
                            +    "<td width='50%' align='center'>ID
Code</td>"
                            +    "<td width='50%'
align='center'>Parent</td>"
                            + "</tr>"
                            + "</table>");
                repeaterHeader.setBodyContent(body);
                repeaterHeader.doAfterBody();
                repeaterHeader.doEndTag();


                body.clearBody();
                body.write("<table><tr>"
                        + "<td width='50%' align='center'><netui:label
value=\"{container.item.id.idcode}\" /></td>"
                        + "<td width='50%' align='center'><netui:label
value=\"{container.item.id.idcode}\" /></td>"
                        + "</tr></table>");
                repeaterItem.setBodyContent(body);

                repeaterItem.doStartTag();
                repeaterItem.doInitBody();
                repeaterItem.doAfterBody();
                repeaterItem.doEndTag();

                retRepeaterBody = super.doAfterBody();
            }

        } catch (IOException e) {
            e.printStackTrace();
        } catch (JspException e) {
            e.printStackTrace();
        }

        return EVAL_BODY_BUFFERED;


//        GetDataGridState dataGridState = new GetDataGridState();
//        dataGridState.setGridName("gridDatas");
//        dataGridState.setVar("dataGridState");

//        Button button = new Button();
//        button.setValue("test");
//        button.setPageContext(pageContext);
//        button.doStartTag();
//        button.doEndTag();

        //DataGridTagModel dataGridTagModel =
//        JspContext pageContext = getJspContext();
//        setDataSource("sharedFlow.tableFlow.tableDatas");
//        setName("gridDatas");
//        setStyleClassPrefix("customers");
//        setJspContext(pageContext);
//        JspFragment fragment = new MockJspFragment(pageContext);
//        setJspBody(fragment);

//        DataGridConfig dataGridConfig = DataGridConfigFactory.getInstance
();
//        DataGridTagModel dataGridTagModel = new
DataGridTagModel("dataGrid", dataGridConfig, pageContext);
//        pageContext.setAttribute("dataGrid", dataGridTagModel);

//        ConfigurePager pager = new ConfigurePager();
//        pager.setDisableDefaultPager(true);
//        pager.setParent(this);
//        pager.setJspContext(pageContext);
//
//        Header header = new Header();
//        header.setJspContext(pageContext);
//        header.setParent(this);
//
//        HeaderCell headerCell = new HeaderCell();
//        headerCell.setJspContext(pageContext);
//        headerCell.setSortAction("sortGrid");
//        headerCell.setSortExpression("codeSort");
//        headerCell.setParent(header);
//
//        HeaderCell headerCell2 = new HeaderCell();
//        headerCell2.setJspContext(pageContext);
//        headerCell2.setSortAction("sortGrid");
//        headerCell2.setSortExpression("parentSort");
//        headerCell2.setParent(header);
//
//        HeaderCell headerCell3 = new HeaderCell();
//        headerCell3.setJspContext(pageContext);
//        headerCell3.setSortAction("sortGrid");
//        headerCell3.setSortExpression("labelSort");
//        headerCell3.setParent(header);
//
//        HeaderCell headerCell4 = new HeaderCell();
//        headerCell4.setJspContext(pageContext);
//        headerCell4.setParent(header);
//
//        Rows rows = new Rows();
//        SpanCell spanCell = new SpanCell();
//        spanCell.setValue("");
//        spanCell.setSortExpression("");
//
//        SpanCell spanCell2 = new SpanCell();
//        spanCell2.setValue("");
//        spanCell2.setSortExpression("");
//
//        SpanCell spanCell3 = new SpanCell();
//        spanCell3.setValue("");
//        spanCell3.setSortExpression("");

        //dataGridState.doTag();
        //dataGridTag.doStartTag();
        //dataGridTag.doInitBody();

//        try {
//
//
//            super.doTag();
//        } catch (JspException e) {
//            System.out.println("jsp dataGrid exception = " + e.getMessage
());
//        } catch (IOException e) {
//            System.out.println("jsp dataGrid exception1 = " + e.getMessage
());
//        }

        //return EVAL_BODY_TAG;
    }


    /**
     * @return Returns the query.
     */
    public String getQuery() {
        return query;
    }

    /**
     * @param query The query to set.
     */
    public void setQuery(String query) {
        this.query = query;
    }

    /**
     * @return Returns the sharedController.
     */
    public String getSharedController() {
        return sharedController;
    }

    /**
     * @param sharedController The sharedController to set.
     */
    public void setSharedController(String sharedController) {
        this.sharedController = sharedController;
    }

    /**
     * @return Returns the tagId.
     */
    public String getTagId() {
        return tagId;
    }

    /**
     * @param tagId The tagId to set.
     */
    public void setTagId(String tagId) {
        this.tagId = tagId;
    }

    /**
     * @return Returns the xmlPath.
     */
    public String getXmlPath() {
        return xmlPath;
    }

    /**
     * @param xmlPath The xmlPath to set.
     */
    public void setXmlPath(String xmlPath) {
        this.xmlPath = xmlPath;
    }
}



when it works. it seems the repeater is useless.

is there sth wrong with my code?

how can i modify?

pls help me.

hope you can return this as soon as possible

thanks

sincerely yan
from china

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message