PDA

View Full Version : Window/Dialog inside a tab



qwikso
10 Dec 2009, 2:46 AM
Hi people, please can you help me with this problem? I'm newbie and I'm trying to create a simple prototype application based on the ExtGWT.

My application is like a browser - a big tabpanel with tabs. The each one contains a grid. I'd like to see a row detail after double-click on a grid-row. I can't create it and open inside an actual tab only. How can I attach the window to the actual tab item? It's opened always across the whole application/all tabs.

I've something like this:



TabItem tabItem = new TabItem("Students");
tabItem.setClosable(false);
tabItem.add(grid);

grid.addListener(Events.RowDoubleClick, new Listener<GridEvent<BeanModel>>() {
public void handleEvent(GridEvent<BeanModel> be) {
StudentTO student = be.getModel().getBean();
Window window = new Window();
window.setHeading("Selected row data");
window.addText(student.getFirstName());
window.addButton(new Button("OK"));
window.show();
}
});

I'm writing about the window only but it concerns all popup windows (dialogs, messageboxes).

PS: in ExtJS I can do it...

Thanks, Roman...

qwikso
10 Dec 2009, 4:30 AM
So I tried to add the window directly to the tab in this way:



TabItem tabItem = new TabItem("Students");
tabItem.setClosable(false);

Window window = new Window();
window.setHeading("Selected row");
window.addText("test");
window.addButton(new Button("OK"));
window.hide();

tabItem.add(window);


I'd like to hide the window, when the view is rendered, but it's always visible! I want to show it later, only if needed. How can hide a component after adding to the tab?

Thanks...

Arno.Nyhm
10 Dec 2009, 9:11 AM
its the same like this?

http://www.extjs.com/forum/showthread.php?t=85127&highlight=constrain

qwikso
11 Dec 2009, 4:44 AM
Thank you for your quick reply.

Unfortunately, this workaround solves this problem only partially. The Window is really constrained by a parent component (the Tab in my case), but after I switched tabs, the Window was always visible ~ it seems to be not a child component of the tab (or is a bug).

Finally, I decided to use the ExtJS library. This is just a small problem, and I expect, we'll need to solve many such issues. In ExtJS this worked already in my first test implementation. And besides it's more flexible for rich web application. I can add a new jQuery component, etc...

Eoin
5 Mar 2010, 5:15 AM
Hi,

Is there any solution for this in GXT? I'm having the same problem.

I have a different tabitem for each workspace. Each workspace/tabitem has its own menu for showing various windows. When I switch tabs the windows are still visible. I'd like the windows to remain visible only in the tabs to which they are attached.

I see that the Window show() method adds the window to the root panel which is the cause of this behaviour. Is there a solution/workaround?

Thanks,
Eoin

qwikso
5 Mar 2010, 9:43 AM
I'm afraid it doesn't work. I tried many different solutions to do it, but without any relevant result. That was why I decided to use ExtJS instead of GXT. With ExtJS, I was able to develope a prototype application without bigger issues. I can't say the same about GXT. For simpler apps GXT can be enough, but if I want to manage independent workspaces in the frame of the one web site, it seems to be problematic.

Try to develop an application like web browser (menus, panels, tabs with a enclosed rich content - popups, modal windows, ...) in GXT. I didn't manage it. In ExtJS I did! The worst was an unexpected behaviour, even the code in ExtJS and GXT was logically identical!

Maybe it was my fault, but nobody could help me.

Eoin
8 Mar 2010, 12:38 AM
Ok thanks qwikso. I think I've gone too far with GXT to turn back at this stage so will have to come up with an alternative design.

Eoin
8 Mar 2010, 3:22 AM
For anyone interested, I have come up with a workaround for this whereby I added a listener to the tab panel. In this listener I control which windows are displayed in which tab using the setVisible method. Not an ideal solution but it's the best option I've managed to think of.