dynamic page building...

Hello ~

I've previously posted a topic about building dynamic tabs base on data from a database rowset... got that figured out... now would like to put a *different* dynamic tree on each page based on a different rowset.. and not sure how to accomplish this...

Currently I have a page of say 10 tabs, and a dynamic tree based on a known 'status', but when I deploy my tree shows up the same on all the pages...

do I need a layout panel on each tab I create to keep the tabs individual, or ? Do I need to somehow 'switch' or specify which tab page I'm dynamically building each tree onto in the java code? And if so, any ideas how? Examples appreciated...

Structure is thus: Product Tab/Status Tree/Issue.Maybe Creator isn't designed to do so many things dynamically...

Thanks in advance ~

[835 byte] By [yukhntr] at [2007-11-26 8:42:41]
# 1

By default the tabs in the tab set component have a layout panel in them. If you add another tab, you get a seperate layout panel for that tab. If you want a different tree to be displayed for each tab, you could put a seperate tree in each layout panel... so 10 tabs, 10 trees.

Do you have a seperate page for each tab with a different tree in it? Or have you just got 1 page and are dynamically changing the same tree depending on which tab is pressed? If this is the case does your code populate the tree correctly when you press a tab? You can check this by dropping a message group component on the page, and putting using info("Tree: " + tree1); after you use setTree1(newTree); in your code. When you run ur app you should see a unique ID in the messages group everytime you press a tab.

If you get a unique ID for each tab, you have got as far as I have, and your problem is the page is not rendering properly. The very first time a page is loaded a view of the page is saved. Any subsequent time the page is loaded it loads the saved view with the original tree data. It has something to with the JSF lifecycle (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSFIntro10.html).

I'm not entirely sure how to get round this this. I may have a similar problem to you. See post: http://forum.sun.com/jive/thread.jspa?threadID=101769

Sorry if this is abit confusing, hope it helps

NievO at 2007-7-6 22:22:33 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks for your quick reply... I think you're farther along than me and have a better grasp of how things are tying together. I feel like I'm stumbling along... Questions: if I create a tab dynamically, does it automatically create its own layout panel? Is this the 'page' you are referring to? I have 10 tabs, and I assumed 10 pages, but maybe I don't... and how can I tell what tab is clicked? I haven't gotten that figured out. Can you share an example of how you did the above with your code? My plan was to do 10 pages (or how many ever) with a different page and each with its own tree, but is using one tree and refreshing it based on what tab is clicked easier? Thanks much for your thoughts and info!

yukhntr at 2007-7-6 22:22:33 > top of Java-index,Development Tools,Java Tools...
# 3

One question is: Do you have 1 page with 10 tabs on it or do you have 10 pages with a tab set in a page fragment that controls navigation from one page to another. That makes a difference in how to answer some of your questions. If you created 1 page and put 10 tabs on it, then you don't have 10 pages, you have 10 views on the same page, each view showing a different set of components.

I believe that when you build your tabset dynamically, you need to add a layout panel or a grid panel yourself. I haven't tried this so I can't say for sure.

You use tabSet1.getSelected() to figure out what tab was selected.

Here are some resources for learning about how to use tabs:

http://blogs.sun.com/roller/page/divas?entry=tabbing_thru_the_tulips

http://developers.sun.com/prodtech/javatools/jscreator/reference/code/sampleapp s/2/JumpStartCycles.zip

http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/abo ut_components.html#action

jetsons at 2007-7-6 22:22:33 > top of Java-index,Development Tools,Java Tools...
# 4

Oh, now I see... I have one page w/tabset on it, and am trying to put a different treeview on each dynamically created tabpage within that one tabset that I've built on the one page. I'm not sure how to 'embed' the dynamic treeview onto the layout panel on the tabpage in the tabset on the one page... and to do this via java code dynamically.I have the tabs and tree working, just not 'independently'.

Is there not any type of 'selectionchanged' event that fires for the tabset after deployment that I can use to find which tab has focus? Perhaps the tabSet1.getSelected() code will do that, but I'm not sure what method to put it in on my page... I will check out the links you provided.

Thanks!

yukhntr at 2007-7-6 22:22:33 > top of Java-index,Development Tools,Java Tools...