You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Eric Roberts <er...@austin.tacc.utexas.edu> on 2003/05/21 01:02:04 UTC

Velocity Parameter Styles

I am trying to use Velocity Parameter Styles with my Velocity portlet.
I have a list of machine names that I want to make a link menu portlet
out of.  However, when I click on the customize button, make changes
(uncheck some checkboxes) and click update, the portlet doesn't seem to
update. It lists the default number of links that I define in the
portlet registry entry.   I am trying to model how the Stock Quote
example does this type of parameter style customization.  Below is the
code for my registry entry, action class and velocity template.  Note
that the individual hostname parameters in the registry are used for
something else.  I've renamed the hostnames of the links for the sake of
simplicity.

 

 

###### Action class #######

public class ComputeSystemsMenu extends VelocityPortletAction {

 

    private static final String LINKS = "links";

    private static final String AVAILABLE_LINKS = "available-links";

 

    private static final String[] ALL_LINKS = {"a", "b", "c", "d", "e",
"f", "g"};

 

    protected void buildNormalContext(VelocityPortlet portlet,

                                      Context context,

                                      RunData rundata) {

        try {

            String links = PortletConfigState.getParameter(portlet,
rundata, LINKS,

                    StringUtils.arrayToString(ALL_LINKS, ","));

            String[] availableLinksArray =
StringUtils.stringToArray(links, ",");

 

            context.put(AVAILABLE_LINKS, availableLinksArray);

        } catch (Exception e) {

            Log.error(e);

 

            rundata.setMessage("Error in Compute Systems: " +
e.toString());

 
rundata.setStackTrace(org.apache.turbine.util.StringUtils.stackTrace(e),
e);

 
rundata.setScreenTemplate(JetspeedResources.getString("template.error",
"Error"));

        }

    }

}

 

 

###### velocity template #########

#foreach ($link in $available-links)

    <a href=$jslink?name=$link>$link<br></a>

#end

 

 

 

########registry entry #######

<?xml version="1.0" encoding="UTF-8"?>

<registry>

    <portlet-entry name="ComputeSystemsMenu" hidden="false" type="ref"

        parent="Velocity" application="false">

        <meta-info>

                <title>Compute Systems</title>

                <description>Compute Systems Links</description>

        </meta-info>

 
<classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classnam
e>

        <parameter name="template" value="compute-systems-menu"
hidden="true"

            cachedOnName="true" cachedOnValue="true"/>

        <parameter name="action" value="portlets.ComputeSystemsMenu"
hidden="true"

            cachedOnName="true" cachedOnValue="true"/>

        <parameter name="links" value="a,c,b,d,e,f,g"

            type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">

            <meta-info>

                <title>Machines</title>

            </meta-info>

        </parameter>

        <parameter name="links.style.items" value="a,c,b,d,e,f,g"

            hidden="true" cachedOnName="true" cachedOnValue="true"/>

        <parameter name="links.style.layout" value="$northsouth"
hidden="true"

            cachedOnName="true" cachedOnValue="true"/>

        <parameter name="links.style" value="CheckBoxGroup"
hidden="true"

            cachedOnName="true" cachedOnValue="true"/>

        <parameter name="a" value="a.com" hidden="true"/>

        <parameter name="b" value="b.com" hidden="true"/>

        <parameter name="c" value="c.com" hidden="true"/>

        <parameter name="d" value="d.com" hidden="true"/>

        <parameter name="e" value="e.com" hidden="true"/>

        <parameter name="f" value="f.com" hidden="true"/>

        <parameter name="g" value="g.com" hidden="true"/>

        <media-type ref="html"/>

        <url cachedOnURL="true"/>

    </portlet-entry>

</registry>

 

Thanks in advance

 

Eric

 

----------------------------------------------------

Eric Roberts

Grid Technology Developer

Texas Advanced Computing Center

Office: (512) 471-6785

Email: ericrobe@tacc.utexas.edu

 

 


RE: Velocity Parameter Styles

Posted by Mark Orciuch <ma...@ngsltd.com>.
Eric,

I tried your code and all seems to work as expected (I made no changes). For
example, I unchecked all machines but "b", clicked Update and the portlet
reflected only "b" link. I tried it using the CVS head but I don't think
there were any changes to this feature for a while (especially since the
Stock Quote example works for you).

Best regards,

Mark C. Orciuch
Next Generation Solutions, Ltd.
e-Mail: mark_orciuch@ngsltd.com
web: http://www.ngsltd.com


> -----Original Message-----
> From: Eric Roberts [mailto:ericrobe@austin.tacc.utexas.edu]
> Sent: Tuesday, May 20, 2003 6:02 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Velocity Parameter Styles
>
>
> I am trying to use Velocity Parameter Styles with my Velocity portlet.
> I have a list of machine names that I want to make a link menu portlet
> out of.  However, when I click on the customize button, make changes
> (uncheck some checkboxes) and click update, the portlet doesn't seem to
> update. It lists the default number of links that I define in the
> portlet registry entry.   I am trying to model how the Stock Quote
> example does this type of parameter style customization.  Below is the
> code for my registry entry, action class and velocity template.  Note
> that the individual hostname parameters in the registry are used for
> something else.  I've renamed the hostnames of the links for the sake of
> simplicity.
>
>
>
>
>
> ###### Action class #######
>
> public class ComputeSystemsMenu extends VelocityPortletAction {
>
>
>
>     private static final String LINKS = "links";
>
>     private static final String AVAILABLE_LINKS = "available-links";
>
>
>
>     private static final String[] ALL_LINKS = {"a", "b", "c", "d", "e",
> "f", "g"};
>
>
>
>     protected void buildNormalContext(VelocityPortlet portlet,
>
>                                       Context context,
>
>                                       RunData rundata) {
>
>         try {
>
>             String links = PortletConfigState.getParameter(portlet,
> rundata, LINKS,
>
>                     StringUtils.arrayToString(ALL_LINKS, ","));
>
>             String[] availableLinksArray =
> StringUtils.stringToArray(links, ",");
>
>
>
>             context.put(AVAILABLE_LINKS, availableLinksArray);
>
>         } catch (Exception e) {
>
>             Log.error(e);
>
>
>
>             rundata.setMessage("Error in Compute Systems: " +
> e.toString());
>
>
> rundata.setStackTrace(org.apache.turbine.util.StringUtils.stackTrace(e),
> e);
>
>
> rundata.setScreenTemplate(JetspeedResources.getString("template.error",
> "Error"));
>
>         }
>
>     }
>
> }
>
>
>
>
>
> ###### velocity template #########
>
> #foreach ($link in $available-links)
>
>     <a href=$jslink?name=$link>$link<br></a>
>
> #end
>
>
>
>
>
>
>
> ########registry entry #######
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <registry>
>
>     <portlet-entry name="ComputeSystemsMenu" hidden="false" type="ref"
>
>         parent="Velocity" application="false">
>
>         <meta-info>
>
>                 <title>Compute Systems</title>
>
>                 <description>Compute Systems Links</description>
>
>         </meta-info>
>
>
> <classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classnam
> e>
>
>         <parameter name="template" value="compute-systems-menu"
> hidden="true"
>
>             cachedOnName="true" cachedOnValue="true"/>
>
>         <parameter name="action" value="portlets.ComputeSystemsMenu"
> hidden="true"
>
>             cachedOnName="true" cachedOnValue="true"/>
>
>         <parameter name="links" value="a,c,b,d,e,f,g"
>
>             type="style" hidden="false" cachedOnName="true"
> cachedOnValue="true">
>
>             <meta-info>
>
>                 <title>Machines</title>
>
>             </meta-info>
>
>         </parameter>
>
>         <parameter name="links.style.items" value="a,c,b,d,e,f,g"
>
>             hidden="true" cachedOnName="true" cachedOnValue="true"/>
>
>         <parameter name="links.style.layout" value="$northsouth"
> hidden="true"
>
>             cachedOnName="true" cachedOnValue="true"/>
>
>         <parameter name="links.style" value="CheckBoxGroup"
> hidden="true"
>
>             cachedOnName="true" cachedOnValue="true"/>
>
>         <parameter name="a" value="a.com" hidden="true"/>
>
>         <parameter name="b" value="b.com" hidden="true"/>
>
>         <parameter name="c" value="c.com" hidden="true"/>
>
>         <parameter name="d" value="d.com" hidden="true"/>
>
>         <parameter name="e" value="e.com" hidden="true"/>
>
>         <parameter name="f" value="f.com" hidden="true"/>
>
>         <parameter name="g" value="g.com" hidden="true"/>
>
>         <media-type ref="html"/>
>
>         <url cachedOnURL="true"/>
>
>     </portlet-entry>
>
> </registry>
>
>
>
> Thanks in advance
>
>
>
> Eric
>
>
>
> ----------------------------------------------------
>
> Eric Roberts
>
> Grid Technology Developer
>
> Texas Advanced Computing Center
>
> Office: (512) 471-6785
>
> Email: ericrobe@tacc.utexas.edu
>
>
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org