You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jake123 <ja...@gmail.com> on 2006/09/05 15:48:32 UTC
Custom Component - best solution?
Hi, I am trying to create a custom component that will create a menu and
submenus to that menu on a completly dynamic web page. The entire site are
build up with "components" and I get the entire structure from the database.
In the web layer I have a Object called SiteDTO that looks like this:
/* PRIVATE MEMBERS */
private List<RegionDTO> regionDTOList = new ArrayList<RegionDTO>();
private List<Long> menuIdList = new ArrayList<Long>();
private Map<Long, MenuItem> menuItemMap = new HashMap<Long, MenuItem>();
private Map<Long, MenuDTO> menuDTOMap = new HashMap<Long, MenuDTO>();
private Map<Long, Article> articleMap = new HashMap<Long, Article>();
private Map<Long, ArticleListDTO> articleListDTOMap = new HashMap<Long,
ArticleListDTO>();
private Map<Long, Portlet> portletMap = new HashMap<Long, Portlet>();
all have getters and setters. My menuIdList contains the id value that is
the key in my menuDTOMap.
my MenuDTO.java is much simpler and looks like this
/* PRIVATE MEMBERS */
private Menu menu;
private List<Long> menuItemIdList = new ArrayList<Long>();
each menuDTO have a menuItemIdList containing the id that is the key value
in SiteDTO.menuItemMap.
I need to iterate through the first menuIdList and for each menuId pull the
MenuDTO from MenuDTOMap. For each menuDTO I need to take the menuItemList
and iterate over that list to pull the MenuItem object that I need to
desplay in the html page along with the corresponding menu object.
How do I solve this the best way? I am thinking of creating a custom
component for this but I am kind of new to Tapestry and I could really need
some good pointers. Should I try to iterate through this structure in the
page file or shall I do it in my component.java file? Is there any pros and
cons for the different approach?
Thanks
Jacob
--
View this message in context: http://www.nabble.com/Custom-Component---best-solution--tf2220888.html#a6152304
Sent from the Tapestry - User forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Custom Component - best solution?
Posted by jake123 <ja...@gmail.com>.
Thank you Ed for your fast answer. This looks like it solve all my problems
//Jacob
--
View this message in context: http://www.nabble.com/Custom-Component---best-solution--tf2220888.html#a6156680
Sent from the Tapestry - User forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Custom Component - best solution?
Posted by Ed Ross <ed...@gmail.com>.
you might want to take a look at
http://www.tapestrycomponents.org/Tassel/app?service=external/ViewComponent&sp=SJSCookMenu
for some existing menus and how this could be accomplished.
On 9/5/06, jake123 <ja...@gmail.com> wrote:
>
>
> Hi, I am trying to create a custom component that will create a menu and
> submenus to that menu on a completly dynamic web page. The entire site are
> build up with "components" and I get the entire structure from the
> database.
> In the web layer I have a Object called SiteDTO that looks like this:
>
> /* PRIVATE MEMBERS */
> private List<RegionDTO> regionDTOList = new
> ArrayList<RegionDTO>();
> private List<Long> menuIdList = new ArrayList<Long>();
>
> private Map<Long, MenuItem> menuItemMap = new HashMap<Long,
> MenuItem>();
> private Map<Long, MenuDTO> menuDTOMap = new HashMap<Long,
> MenuDTO>();
> private Map<Long, Article> articleMap = new HashMap<Long,
> Article>();
> private Map<Long, ArticleListDTO> articleListDTOMap = new
> HashMap<Long,
> ArticleListDTO>();
> private Map<Long, Portlet> portletMap = new HashMap<Long,
> Portlet>();
>
> all have getters and setters. My menuIdList contains the id value that is
> the key in my menuDTOMap.
>
> my MenuDTO.java is much simpler and looks like this
>
> /* PRIVATE MEMBERS */
> private Menu menu;
> private List<Long> menuItemIdList = new ArrayList<Long>();
>
> each menuDTO have a menuItemIdList containing the id that is the key value
> in SiteDTO.menuItemMap.
>
> I need to iterate through the first menuIdList and for each menuId pull
> the
> MenuDTO from MenuDTOMap. For each menuDTO I need to take the menuItemList
> and iterate over that list to pull the MenuItem object that I need to
> desplay in the html page along with the corresponding menu object.
>
> How do I solve this the best way? I am thinking of creating a custom
> component for this but I am kind of new to Tapestry and I could really
> need
> some good pointers. Should I try to iterate through this structure in the
> page file or shall I do it in my component.java file? Is there any pros
> and
> cons for the different approach?
>
> Thanks
> Jacob
>
> --
> View this message in context:
> http://www.nabble.com/Custom-Component---best-solution--tf2220888.html#a6152304
> Sent from the Tapestry - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Ed Ross
edross15057@gmail.com