Vaadin: How to identify individual tabs in a TabSheet? - java

In Vaadin, say I have a Tabsheet, with several Tabs.
If I want to add subtabs to any of the Tabs in the Tabsheet, based on which Tab the subtabs have as their "parent" tab , how do I do this?

Tabs are identified by the Component they hold. So, basically addanother TabSheet as a Tab to have subtabs:
TabSheet tabs = new TabSheet();
TabSheet subTabs = new TabSheet();
tabs.addTab(subTabs, "Parent tab",null);
subTabs.addTab(new Label("Subtab content"), "Subtab",null);

Related

Switch tab on button clicked

I create one activity(Home activity)inside home activity I add frame layout & some buttons. in frame layout I load fragment(Home fragment)inside home fragment I create Tab Layout now my question is when we select button(from home activity)so change regarding tab is their any possible way??
Note: I can not use viewpager because of some reason
my flow is
(1) Activity->frame layout && buttons
(2) frame layout-> load fragment(Home fragment)-> tab layout-> new frame layout which contains diff. fragment regarding tabs.
when click on activity's button so change tab
Thanks in advance
Try this :
yourTabLayout.getTabAt(tabPosition).select();
tabPosition is an int that determinants which tab will be selected
For example : 0 will select the first tab, 1 will select the second tab, 2 will select the third tab and so on

Addition of items to the "NEW" button in eclipse toolbar

I'm developing a custom project plugin wizard.
Currently the custom project wizard option shows up when I press "CTRL+N"
Or when I navigate from toolbar "New -> (drop down list) -> other.
Instead I want my selection to my newprojectwizard in the dropdown list that is generated for the "New" button on toolbar.
We see that the new button on toolbar has the following format.
A list of perspective controlled options.
Dotted lines and "Example"
Dotted line and "other"
I want to put my custom project wizard either in the section along with "example" or "other"
Any help or code snippet highly appreciated.
Use the org.eclipse.ui.perspectiveExtensions extension point to add to the top level new menu. The newWizardShortcut adds the shortcut.
For example:
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.pde.ui.PDEPerspective">
<newWizardShortcut id="org.eclipse.pde.ds.ui.wizard"/>
</perspectiveExtension>
</extension>

Disappear SmartTabLayout pageViewer content

I'm trying to use SmartTabLayout from here https://github.com/ogaclejapan/SmartTabLayout, and i have a drawer. When i'm clicking at item on drawer, i replace my fragment, to fragment with smarttablayout. For first time it's ok, smarttablayout have tabs with content, but when i click in drawer on the same item, content of tabs just disappear, and to show them back i have to scroll to the end, and scroll back, to show them. I don't have idea why.
Notes: If using fragment inside a ViewPager, Must be use Fragment#getChildFragmentManager().
https://github.com/ogaclejapan/SmartTabLayout#pageradapter-for-fragment-based-page
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getChildFragmentManager(), FragmentPagerItems.with(this.getA())
.add(R.string.item_pager_title_products, ProductListFragment.class)
.add(R.string.item_pager_title_shops, ShopListFragment.class)
.create());
FYI: Had same problem because I didn't read the manual... Original answer found here https://stackoverflow.com/a/25525714/1257369

Java plugin pop-up menu

I have a plugin which adds a view. This view contains a table which contains on each row some informations. I would like to have a popup menu when I press the right mouse click.
How can I add the extension org.eclipse.ui.menus and after creating the menuContribution to see it in the view ?
In your ViewPart use this code:
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
getSite().registerContextMenu(contextMenu, viewer);
Control control = viewer.getControl();
Menu menu = contextMenu.createContextMenu(control);
control.setMenu(menu);
where viewer is your TableViewer.
The context menu this creates has the same id as your view so you contribute to it with:
<menuContribution
locationURI="popup:your.view.id">
....
</menuContribution>

GWT vertical menu

I need some help with Google web toolkit to make a vertical menu with expanding submenu items.
I want to create a vertical menu that woks like the left menu on the showcase of GWT
I tried this:
VerticalPanel vertpanel = new VerticalPanel();
MenuBar menubar = new MenuBar(true);//set to true so its set to vertical alignment
MenuBar subbar = new MenuBar(true);
MenuBar subbar2 = new MenuBar(true);
subbar.addItem("Fist item of submenu1", new AddEmployeeCommand());
subbar.addItem("Second item of submenu1", new AddEmployeeCommand());
subbar2.addItem("First item of submenu2", new AddEmployeeCommand());
subbar2.addItem("Second item of submenu2", new AddEmployeeCommand());
menubar.addItem("sub 1", subbar);
menubar.addItem("sub 2", subbar2);
vertpanel.add(menubar);
RootPanel.get().add(menubar);
But that doesn't work because the menu items won't expand to show their subitems. Although it works when I make it a horizontal menubar but that's not what I want.
You'll need to use DisclosurePanels in order to achieve that.
Check it out in the GWT showcase.
That's probably using a DosclosurePanel, not a Menu Bar.
http://gwt.google.com/samples/Showcase/Showcase.html#!CwDisclosurePanel
maybe you can have a look to a StackPanel
Gwt Stackpanel showcase

Categories

Resources