decorator class is not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

decorator class is not working

Raaja G
Hi,

I am using decorator class to display a column basing on condition but the else part is not working. The console messages in the else part were displaying but the column will not display an empty cell is displayed.

My table is:

 <% int x = 0; %>
        <display:table id="data" name="documentsList" requestURI="/populateDocumentCheckOut.do"
                                pagesize="10" cellpadding="2" cellspacing="2" decorator="com.documents.DownloadDecorator">
                               
                <display:column property="profileName" title="Profile" sortable="true" style="text-align:center;" />
                <display:column property="docName1" title="Doc Name" sortable="true" style="text-align:left;" />
                <display:column property="createdBy" title="Owner" sortable="true" style="text-align:center;" />
                <display:column property="departmentName" title="Department" sortable="true" style="text-align:center;" />
                <%Integer ckout = ((DocumentProfileIO)
                   (((List)request.getAttribute("documentsList")).get(x))).getIsCheckedOut();
                String createdBy=((DocumentProfileIO)      
              (((List)request.getAttribute("documentsList")).get(x))).getCreatedBy();
                System.out.println("ckout   "+ckout);
                System.out.println("ckout createdBy   "+createdBy);
                if(ckout!=1 ){
                        System.out.println(" checking usernamee   "+userName +x);
                %>
                <display:column  title="Action" sortable="true" style="text-align:center;" value="Checkout"></display:column> 
                <%}else{
                System.out.println("in else");%>
                <display:column  title="Action" property="checkout" sortable="true" style="text-
                        align:center;"/>
                <%System.out.println("in else end");} %>
                <display:column  title="View" property="view" sortable="true" style="text-align:center;" />
                <display:column  title="Track" property="track" sortable="true" style="text-align:center;"/>
               
                <display:setProperty name="paging.banner.placement" value="bottom"/> 
                <display:setProperty name="export.xml" value="false" />
                <display:setProperty name="export.csv" value="false" />
                <display:setProperty name="export.pdf" value="false" />
        <% x++; %>
        </display:table>

My decorator class is

public class DownloadDecorator extends TableDecorator {

public String getCheckout(){
                DocumentProfileIO documentProfileIO= (DocumentProfileIO)getCurrentRowObject();
               
                Integer docId = documentProfileIO.getDocId();
                System.out.println("decorator docId"+docId);
                String checkout="Checkout";
                //return checkout;
                        return "a target='_new' href=\"../documentCheckOut.do?docId="+docId+"\">"+checkout+"/a";
        }

}

Where I am wrong please guide me.

Thanking you.

--regards,
raaja. g