Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Mobile Applications with TouchKit

22.5.7. VerticalComponentGroup

The VerticalComponentGroup is a layout component for grouping components in the vertical stack. The most typical use of the VerticalComponentGroup is to make vertical navigation menus containing NavigationButtons for the mobile application.The VerticalComponentGroup and HorizontalComponentGroup both extend AbstractComponentGroup which is inherited from the AbstractComponentContainer. In the client side both component group widgets are extending the lightweigth FlowPanel.

Styling with CSS

.v-touchkit-verticalcomponentgroup { }

The component has an overall v-touchkit-verticalcomponentgroup style. If the component has a caption, the v-touchkit-has-caption style is added.

22.5.8. HorizontalComponentGroup

The HorizontalComponentGroup is mainly intended to group buttons inside the VerticalComponentGroup slots.

HorizontalComponentGroup horizontalCGroup = new HorizontalComponentGroup(); horizontalCGroup.addComponent(new Button("First")); horizontalCGroup.addComponent(new Button("Another"));

NavigationButton navButton = new NavigationButton(); button.setIcon(new ThemeResource("../runo/icons/32/ok.png"));

VerticalComponentGroup verticalCGroup = new VerticalComponentGroup(); verticalCGroup.setMargin(true);

verticalCGroup.addComponent(horizontalCGroup); verticalCGroup.addComponent(new Button("Button")); verticalCGroup.addComponent(new TextField("TF's caption")); verticalCGroup.addComponent(navButton);

22.5.9. TabBarView

The TabBarView is a layout component that consist of a tab bar and content area. Each tab will have it's own content area which will be displayed when a correspoding tab is selected. TabBarView is inherited from the ComponentContainer but uses it's own specialized API for monipulating tabs. removeComponent() and addComponent() will throw an UnsupportedOperationException if used.

TabBarView bar = new TabBarView();

//Create some Vaadin Component to use as content Label content = new Label("Really simple content");

//Create a tab for it

Tab tab = bar.addTab(label);

//Set tab name and/or icon tab.setCaption("tab name"); tab.setIcon(new ThemeResource(...));

//Programmatically modify tab bar

Tab selectedTab = bar.getSelectedTab(); bar.setSelectedTab(selectedTab); //same as user clicking the tab bar.removeTab(selectedTab);

VerticalComponentGroup

491

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]