GWT and dynamic tabs - java

Is it possible to create panel with dynamic added tabs in GWT using TabPanel or TabLayoutPanel.
My requirements:
First tab is not closeable and has a celltable.
When I select row in the celltable, new tab is created.
Newly created tab can be closed.
My question:
How to create this architecture in GWT using MVP style and UiBinder?

Why not? Even if you get some problem in GWT, you always can dive into level below to javascript and make exactly what you need.
Any panel can be dinamically changed. If it is layout panel then you can forceLayout() it at any moment. You can add() or insert() new items to panel and use different selfmade widgets for tabs (you have a lot of possibilities how to add or insert: add(Widget child, Widget tab) or add(Widget child, SafeHtml html)).
Here is an example how it made with ExtGWT, logic is identical but you will have to made widgets for your tabs (that can be closed and not).

Related

How to create Vaadin tabsheet without components?

I need the functionality of a Vaadin Tabsheet. But don't need a component for each tab.
Instead, I have only one component (separate table) and it will be manipulated with the tab sheet actions. For now, I have assigned hidden labels to tabs.
Is there a better way to do this?
If anyone one ran into the same scenario, here is how I solved it.
Instead of adding hidden labels, I added labels without captions.so no need to hide them, because they have nothing to show. :).
Don't set their visibility to hidden. It will cause problems since Vaadin doesn't send hidden components to the client.

How Can I Clone a tab in a JTabbedPane?

I'm looking for a way to clone (duplicate) a whole tab (the selected one) in a JTabbedPane. Every time I take the tabwith getSelectedComponent() and add it to the pane, the title of the tab disapnö rs and I get no second tab. But there is no exception.
I tried to copy the currently selected tab. Each tab is a JPanel with a simple JTable on it and I want to get the selected tab two times.
As far as I know, the same swing component can't appear in multiple places in your GUI, so you would actually have to create new instances of all your UI elements for the "copied" tab and set their values to the same values of the first tab / connect them to the same domain objects.
In Swings, a component can be added to only one container. Adding it again to another container will have no effect.

how is it possible to design a java based user interface using custom tabbed panes and provide an broswer like design?

I had started working on a java based tool that my friend has developed. Now we are working on it together. He has used custom made jpanels and used them in jtabed pane like fashion. Its something like this,(check the link for the screen shot,since i am new user,i cannot post images here)
https://www.dropbox.com/s/5wnrmxiraywlg7p/tab2.png
The problem is that,we want to implement a browser like display of tabs,when the number of tabs opened is more that the panels widths,it gets hided.so the idea is to develop a left and right brows tab buttons tats similar to web broswer .how this could b achieved?
More info about the current layout and design:
The canvas panels are created and tab panels are created and finally called in the main display panel. The stagetab panel holds the tab panels(which mimics appearances of the tabbed pane). Also there already functions to display various canvas panel(different tabs) based on user pressing the tab panels.so all those are working well. have been looking on various solutions for this problem.one sch is developing an custom view port like method similar to jscroll pane which could be used here.
What would be the better way to do this?
A good possibility would be to use SCROLL_TAB_LAYOUT as tabLayoutPolicy. This will show two arrows at the corner of the JTabbedPane. Of course you could redesign the component to show it as you want.
You can find an image of a table using it here.

Needing a component similar to JTabbedPane

I'm looking for a component like "JTabbedPane" in which I can design each tab separately and easily but I don't want the little square buttons with tab names in runtime! Instead, I want to activate each tab panel in my code. In fact, I want to have multiple "JPanel"s with same size and location (they have complete overlap) and I set visibility of each them manually in my code but the most importing thing is that I want to design each panel as easy as possible (like clicking on the tab names in design-time).
You could use CardLayout here to create your own overlapping panels as you have described. The visibility of each panel can be programmatically changed.

how to add panel/jpanel or any panel of any package to composite in java?? (using RAP, SWT)

I am creating an RAP application in JAVA.
i want to have a GUI like master detail. in which left side has panel that has a tree (like in windows 7) and on the right side there will be text fields which will be changing when different TreeItem is selected.
So i have to add two panels, but i don't know how to add panels into composite.
Please help
use frame.getContentPane() to the the master contentpane. Set its layout as new GridLayout(1,2).
Now create two panels and add them to the frame. http://docs.oracle.com/javase/tutorial/uiswing/components/panel.html
There are also more complex solutions depending on what you want to do. For example if you want to make the division of the space between left and right side cosumizable use jsplitpanes (http://docs.oracle.com/javase/tutorial/uiswing/components/splitpane.html).
SWT is one thing, Swing is another. If you already have something written in SWT and want to add Swing components, then you have to use the SWT/AWT Bridge. You can find a tutorial on how to do this here.

Categories