[prev in list] [next in list] [prev in thread] [next in thread] 

List:       spacewalk-devel
Subject:    [Spacewalk-devel] Re: java/code
From:       jason.dobies () redhat ! com (Jason Dobies)
Date:       2009-03-27 23:28:21
Message-ID: 49CD6115.2000904 () redhat ! com
[Download RAW message or body]

I've been updating the wiki from the errata pages I ported this week, 
I'll send out the link for review when I'm done.

Mike McCune wrote:
> the below is a good example of how to convert a simple page to the new LT.
> 
> Nice!
> 
> Justin Sherrill wrote:
> > java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/ProbesListSetupAction.java \
> >  |   55 +++++-
> > java/code/webapp/WEB-INF/pages/systems/probes/index.jsp                           \
> >  |   79 +++++++---
> > 2 files changed, 99 insertions(+), 35 deletions(-)
> > 
> > New commits:
> > commit 98c6b6f4c4698aef8bfe2a70a827a46eb5ae9b47
> > Author: Justin Sherrill <jsherril at redhat.com>
> > Date:   Fri Mar 27 15:54:19 2009 -0400
> > 
> > 144325 - converting system probe list to the new list tag, 
> > featuring all the bells and whistles the new list tag has to offer
> > 
> > diff --git 
> > a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/ProbesListSetupAction.java \
> >  b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/ProbesListSetupAction.java \
> >  
> > index 4c43361..deeb922 100644
> > --- 
> > a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/ProbesListSetupAction.java \
> >  
> > +++ 
> > b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/ProbesListSetupAction.java \
> >  
> > @@ -14,34 +14,59 @@
> > */
> > package com.redhat.rhn.frontend.action.systems.monitoring;
> > 
> > -import com.redhat.rhn.common.db.datasource.DataResult;
> > import com.redhat.rhn.domain.server.Server;
> > -import com.redhat.rhn.frontend.listview.PageControl;
> > -import com.redhat.rhn.frontend.struts.BaseListAction;
> > import com.redhat.rhn.frontend.struts.RequestContext;
> > +import com.redhat.rhn.frontend.struts.RhnAction;
> > +import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
> > +import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
> > import com.redhat.rhn.manager.monitoring.MonitoringManager;
> > 
> > +import org.apache.struts.action.ActionForm;
> > +import org.apache.struts.action.ActionForward;
> > +import org.apache.struts.action.ActionMapping;
> > +
> > +import java.util.List;
> > +
> > +import javax.servlet.http.HttpServletRequest;
> > +import javax.servlet.http.HttpServletResponse;
> > +
> > /**
> > * ProbesListSetupAction
> > * @version $Rev: 59372 $
> > */
> > -public class ProbesListSetupAction extends BaseListAction {
> > -    -    protected DataResult getDataResult(RequestContext rctx, 
> > PageControl pc) {
> > -        DataResult dr;
> > -        Server server = rctx.lookupAndBindServer();
> > -        // Null page control, we dont paginate this list.
> > -        dr = MonitoringManager.getInstance().
> > -            probesForSystem(rctx.getCurrentUser(), server, null);
> > -        return dr;
> > +public class ProbesListSetupAction extends RhnAction implements 
> > Listable {
> > +
> > +    /**
> > +     *
> > +     * {@inheritDoc}
> > +     */
> > +    public ActionForward execute(ActionMapping mapping,
> > +            ActionForm formIn,
> > +            HttpServletRequest request,
> > +            HttpServletResponse response) {
> > +
> > +        ListHelper helper = new ListHelper(this, request);
> > +        helper.execute();
> > +
> > +        RequestContext requestContext = new RequestContext(request);
> > +        Server server = requestContext.lookupAndBindServer();
> > +
> > +        request.setAttribute("sid", server.getId());
> > +        return mapping.findForward("default");
> > }
> > 
> > +
> > +
> > +
> > /**
> > +     *
> > * {@inheritDoc}
> > */
> > -    protected void processRequestAttributes(RequestContext rctx) {
> > -        super.processRequestAttributes(rctx);
> > -        rctx.lookupAndBindServer();
> > +    public List getResult(RequestContext rctx) {
> > +        Server server = rctx.lookupAndBindServer();
> > +        return MonitoringManager.getInstance().
> > +            probesForSystem(rctx.getCurrentUser(), server, null);
> > }
> > +
> > }
> > 
> > diff --git a/java/code/webapp/WEB-INF/pages/systems/probes/index.jsp 
> > b/java/code/webapp/WEB-INF/pages/systems/probes/index.jsp
> > index ba623b5..82993f6 100644
> > --- a/java/code/webapp/WEB-INF/pages/systems/probes/index.jsp
> > +++ b/java/code/webapp/WEB-INF/pages/systems/probes/index.jsp
> > @@ -4,6 +4,7 @@
> > <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" 
> > prefix="html" %>
> > <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" 
> > prefix="bean" %>
> > <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
> > +<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
> > 
> > <html:xhtml/>
> > <html>
> > @@ -31,26 +32,64 @@
> > </p>
> > </div>
> > 
> > -<rhn:list pageList="${requestScope.pageList}" 
> > noDataText="probes.index.jsp.noprobes" legend="probes-list">
> > -  <rhn:listdisplay set="${requestScope.set}" 
> > exportColumns="id,description,stateString,stateOutputString" -        
> > hiddenvars="${requestScope.newset}">
> > -    <%@ include 
> > file="/WEB-INF/pages/common/fragments/probes/probe-state-column.jspf" %>
> > -    <rhn:column header="probes.index.jsp.description" nowrap="nowrap">
> > -      <a 
> > href="ProbeDetails.do?probe_id=${current.id}&sid=${system.id}">${current.description}</A> \
> >  
> > -    </rhn:column>
> > -    <rhn:column header="probes.index.jsp.status" 
> > sortProperty="stateOutputString">  -      ${current.stateOutputString}
> > -    </rhn:column>
> > -    <rhn:column header="probes.index.jsp.type">
> > -        <c:if test="${current.isSuiteProbe}">
> > -          <a title='<bean:message key="probes.index.jsp.suiteedit"/>' 
> > href="/rhn/monitoring/config/ProbeSuiteProbeEdit.do?suite_id=${current.probeSuiteId}&probe_id=${current.id}"><bean:message \
> >  key="probes.index.jsp.suite"/></a>
> > -        </c:if>
> > -        <c:if test="${not current.isSuiteProbe}">
> > -          <a title='<bean:message 
> > key="probes.index.jsp.systemedit"/>' 
> > href="ProbeEdit.do?probe_id=${current.id}&sid=${system.id}"><bean:message 
> > key="probes.index.jsp.system"/></a>
> > -        </c:if>
> > -    </rhn:column>
> > - </rhn:listdisplay>
> > -</rhn:list>
> > +
> > +<rl:listset name="probeSet">
> > +
> > +<rl:list emptykey="probes.index.jsp.noprobes"
> > +        alphabarcolumn="description"
> > +        styleclass="list"
> > +        >
> > +            <rl:decorator name="PageSizeDecorator"/>
> > +                <rl:decorator name="ElaborationDecorator"/>
> > +
> > +            <%@ include 
> > file="/WEB-INF/pages/common/fragments/probes/probe-state-column-new.jspf" 
> > %>
> > +
> > +
> > +                <rl:column sortable="true"
> > +                                   bound="false"
> > +                           headerkey="probes.index.jsp.description"
> > +                           sortattr="description"
> > +                           defaultsort="asc"
> > +                           filterattr="description"
> > +                           >
> > +                        <a 
> > href="ProbeDetails.do?probe_id=${current.id}&sid=${system.id}">${current.description}</a> \
> >  
> > +                </rl:column>
> > +
> > +                <rl:column sortable="true"
> > +                                   bound="false"
> > +                           headerkey="probes.index.jsp.status"
> > +                           sortattr="stateOutputString">
> > +                        ${current.stateOutputString}
> > +                </rl:column>
> > +
> > +                <rl:column sortable="false"
> > +                                   bound="false"
> > +                           headerkey="probes.index.jsp.type"
> > +                           styleclass="last-column"
> > +                           >
> > +                        <c:if test="${current.isSuiteProbe}">
> > +                          <a title='<bean:message 
> > key="probes.index.jsp.suiteedit"/>' 
> > href="/rhn/monitoring/config/ProbeSuiteProbeEdit.do?suite_id=${current.probeSuiteId}&probe_id=${current.id}"><bean:message \
> >  key="probes.index.jsp.suite"/></a>
> > +                        </c:if>
> > +                        <c:if test="${not current.isSuiteProbe}">
> > +                          <a title='<bean:message 
> > key="probes.index.jsp.systemedit"/>' 
> > href="ProbeEdit.do?probe_id=${current.id}&sid=${system.id}"><bean:message 
> > key="probes.index.jsp.system"/></a>
> > +                        </c:if>
> > +                </rl:column>
> > +
> > +
> > +
> > +</rl:list>
> > +    <input type="hidden" name="sid" value="${sid}" />
> > + <rl:csv  exportColumns="id,description,stateString,stateOutputString"/>
> > +</rl:listset>
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > 
> > </body>
> > 
> > 
> > _______________________________________________
> > spacewalk-commits mailing list
> > spacewalk-commits at lists.fedorahosted.org
> > https://fedorahosted.org/mailman/listinfo/spacewalk-commits
> 
> 
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel


-- 
Jason Dobies
RHN Satellite / Spacewalk
RHCE# 805008743336126
Freenode: jdob @ #spacewalk #spacewalk-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic