use of com.vaadin.ui.TabSheet.Tab in project opennms by OpenNMS.
the class DataCollectionGroupPanel method selectedTabChange.
/* (non-Javadoc)
* @see com.vaadin.ui.TabSheet.SelectedTabChangeListener#selectedTabChange(com.vaadin.ui.TabSheet.SelectedTabChangeEvent)
*/
@Override
public void selectedTabChange(SelectedTabChangeEvent event) {
TabSheet tabsheet = event.getTabSheet();
Tab tab = tabsheet.getTab(tabsheet.getSelectedTab());
if (tab != null) {
Notification.show("Selected tab: " + tab.getCaption());
}
}
use of com.vaadin.ui.TabSheet.Tab in project opennms by OpenNMS.
the class WallboardConfigView method addNewTabComponent.
/**
* This method is used to add a new {@link TabSheet.Tab} component. It creates a new window querying the user for the name of the new {@link Wallboard}.
*/
protected void addNewTabComponent() {
final Window window = new Window("New Ops Board");
window.setModal(true);
window.setClosable(false);
window.setResizable(false);
window.addCloseListener(new Window.CloseListener() {
@Override
public void windowClose(Window.CloseEvent e) {
m_dashboardOverview.refreshTable();
}
});
getUI().addWindow(window);
window.setContent(new VerticalLayout() {
TextField name = new TextField("Ops Board Name");
{
addComponent(new FormLayout() {
{
setSizeUndefined();
setMargin(true);
String newName = "Untitled";
int i = 1;
if (WallboardProvider.getInstance().containsWallboard(newName)) {
do {
i++;
newName = "Untitled #" + i;
} while (WallboardProvider.getInstance().containsWallboard(newName));
}
name.setValue(newName);
addComponent(name);
name.focus();
name.selectAll();
name.addValidator(new AbstractStringValidator("Title must be unique") {
@Override
protected boolean isValidValue(String s) {
return (!WallboardProvider.getInstance().containsWallboard(s) && !"".equals(s));
}
});
}
});
addComponent(new HorizontalLayout() {
{
setMargin(true);
setSpacing(true);
setWidth("100%");
Button cancel = new Button("Cancel");
cancel.setDescription("Cancel editing");
cancel.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
// NMS-7560: Toggle the tab in order to allow us to click it again
m_tabSheet.togglePlusTab();
window.close();
}
});
cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
addComponent(cancel);
setExpandRatio(cancel, 1);
setComponentAlignment(cancel, Alignment.TOP_RIGHT);
Button ok = new Button("Save");
ok.setDescription("Save configuration");
ok.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
if (name.isValid()) {
Wallboard wallboard = new Wallboard();
wallboard.setTitle(name.getValue());
WallboardProvider.getInstance().addWallboard(wallboard);
WallboardProvider.getInstance().save();
WallboardEditor wallboardEditor = new WallboardEditor(m_dashletSelector, wallboard);
TabSheet.Tab tab = m_tabSheet.addTab(wallboardEditor, wallboard.getTitle());
wallboardEditor.setTab(tab);
m_wallboardEditorMap.put(wallboard, tab);
tab.setClosable(true);
m_tabSheet.setSelectedTab(tab);
window.close();
}
}
});
ok.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
addComponent(ok);
}
});
}
});
}
use of com.vaadin.ui.TabSheet.Tab in project cia by Hack23.
the class AbstractPageModContentFactoryImpl method createPageVisitHistory.
/**
* Creates the page visit history.
*
* @param pageName
* the page name
* @param pageId
* the page id
* @param panelContent
* the panel content
*/
protected final void createPageVisitHistory(final String pageName, final String pageId, final VerticalLayout panelContent) {
final TabSheet tabsheet = new TabSheet();
tabsheet.setWidth(100, Unit.PERCENTAGE);
tabsheet.setHeight(100, Unit.PERCENTAGE);
panelContent.addComponent(tabsheet);
panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);
final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout();
tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE);
tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE);
final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory);
tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY);
adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(tabContentPageItemRankHistory, pageName, pageId);
final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout();
tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE);
tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE);
final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary);
tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT);
adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary, pageName);
}
use of com.vaadin.ui.TabSheet.Tab in project ANNIS by korpling.
the class DocBrowserController method openDocBrowser.
public void openDocBrowser(String corpus) {
// if not already init, do it now
if (!initedDocBrowsers.containsKey(corpus)) {
DocBrowserPanel docBrowser = DocBrowserPanel.initDocBrowserPanel(ui, corpus);
initedDocBrowsers.put(corpus, docBrowser);
}
// init tab and put to front
TabSheet.Tab tab = ui.getSearchView().getTabSheet().addTab(initedDocBrowsers.get(corpus), corpus);
tab.setIcon(DOC_ICON);
tab.setClosable(true);
ui.getSearchView().getTabSheet().setSelectedTab(tab);
}
use of com.vaadin.ui.TabSheet.Tab in project cuba by cuba-platform.
the class DefaultAccordionDropHandler method handleComponentReordering.
/**
* Called when tabs are being rearranged
*
* @param event
* A drag and drop event
*/
@Override
protected void handleComponentReordering(DragAndDropEvent event) {
AccordionTargetDetails details = (AccordionTargetDetails) event.getTargetDetails();
DDAccordion acc = (DDAccordion) details.getTarget();
VerticalDropLocation location = details.getDropLocation();
LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();
Component c = transferable.getComponent();
int idx = details.getOverIndex();
Tab tab = acc.getTab(c);
if (location == VerticalDropLocation.TOP) {
// Left of previous tab
int originalIndex = acc.getTabPosition(tab);
if (originalIndex > idx) {
acc.setTabPosition(tab, idx);
} else if (idx - 1 >= 0) {
acc.setTabPosition(tab, idx - 1);
}
} else if (location == VerticalDropLocation.BOTTOM) {
// Right of previous tab
int originalIndex = acc.getTabPosition(tab);
if (originalIndex > idx) {
acc.setTabPosition(tab, idx + 1);
} else {
acc.setTabPosition(tab, idx);
}
}
}
Aggregations