dev@javaserverfaces.java.net

Re: More Component Design Questions

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Sat, 20 Jan 2007 18:07:23 -0800

Jason Lee wrote:
> I'm trying to hammer out a flexible and usable design for the context
> menu component. The current incarnation in tree is not context-aware,
> which makes it pretty useless as a context menu. :) To that end, I
> wrote the following mock up, just to get some thoughts on "paper." I
> would appreciate any feedback anyone would care to give. I've not
> written any code yet, as I'd like to nail down what the markup would
> look like before I get to excited about changing source code. :) You
> can view the mock up here (paying particular attention to lines
> 19-32): http://papernapkin.org/pastebin/view/4126. In case that gets
> deleted (which I'm sure it will at some point), here's a not-as-pretty
> copy.
>
> Thanks! :)
>
>
> 1. <?xml version='1.0' encoding='UTF-8'?>
> 2. <%@ page contentType="text/html" language="java"%>
> 3. <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> 4. <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> 5. <%@ taglib uri="http://java.sun.com/jsf/ri/sandbox" prefix="risb"%>
> 6. <html>
> 7. <f:view>
> 8. <h:dataTable id="books"
> 9. columnClasses="list-column-center,list-column-right,list-column-center,list-column-right"
> 10. headerClass="list-header"
> 11. rowClasses="list-row"
> 12. styleClass="list-background"
> 13. value="#{BookStore.items}"
> 14. var="store">
> 15. <h:column>
> 16. <f:facet name="header">
> 17. <h:outputText value="#{msg.storeNameLabel}" />
> 18. </f:facet>
> 19. <h:outputText value="#{store.name}">
> 20. <risb:contextMenu>
> 21. <risb:menuItem>
> 22. <h:commandLink action="#{testBean.edit}" value="Edit">
> 23. <f:setPropertyActionListener value="#{store.id}" target="#{testBean.id}" />
> 24. </h:commandLink>
> 25. </risb:menuItem>
> 26. <risb:menuItem>
> 27. <h:commandLink action="#{testBean.delete}" value="Delete">
> 28. <f:setPropertyActionListener value="#{store.id}" target="#{testBean.id}" />
> 29. </h:commandLink>
> 30. </risb:menuItem>
> 31. </risb:contextMenu>
> 32. </h:outputText>
> 33. </h:column>
> 34.
> 35. <h:column>
> 36. <f:facet name="header">
> 37. <Subject
> 38. </f:facet>
> 39. <h:outputText value="#{store.subject}" />
> 40. </h:column>
> 41.
> 42. <h:column>
> 43. <f:facet name="header">
> 44. <h:outputText value="#{msg.storePriceLabel}" />
> 45. </f:facet>
> 46. <h:outputText value="#{store.price}" />
> 47. </h:column>
> 48. </h:dataTable>
> 49. </f:view>
> 50. </html>
>

I'm not a component designer, but what you have mocked up seems
reasonable to me.
Hopefully someone with more experience in this area will chime in.
>
> -----
> Jason Lee, SCJP
> Programmer/Analyst
> http://www.iec-okc.com <http://www.iec-okc.com/>
>