List of usage examples for com.vaadin.ui TabSheet getTab
public Tab getTab(int index)
From source file:at.meikel.nentis.Nentis.java
License:Apache License
private void initInfo(TabSheet tabSheet) { VerticalLayout infoTab = new VerticalLayout(); tabSheet.addTab(infoTab);/* w ww . jav a2 s. c o m*/ tabSheet.getTab(infoTab).setCaption("Info"); infoTab.addComponent(new Label("temp.dir:" + System.getProperty("temp.dir"))); }
From source file:at.meikel.nentis.Nentis.java
License:Apache License
private void initMain(TabSheet tabSheet) { final VerticalLayout mainTab = new VerticalLayout(); tabSheet.addTab(mainTab);/*from w w w. j a v a 2 s .c o m*/ tabSheet.getTab(mainTab).setCaption("Main"); final HorizontalLayout buttons = new HorizontalLayout(); mainTab.addComponent(buttons); final VerticalLayout state = new VerticalLayout(); mainTab.addComponent(state); final VerticalLayout info = new VerticalLayout(); mainTab.addComponent(info); Button createTicket = new Button("Create a new ticket"); createTicket.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { state.removeAllComponents(); Ticket ticket = nentisApi.createTicket("Ticket (" + new Date() + ")"); state.addComponent( new Label("Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created.")); } }); buttons.addComponent(createTicket); Button listAllTickets = new Button("List all existing tickets"); listAllTickets.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { state.removeAllComponents(); List<Ticket> allTickets = nentisApi.getAllTickets(); info.removeAllComponents(); if (allTickets != null) { for (Ticket ticket : allTickets) { info.addComponent(new Label( "Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created.")); } } } }); buttons.addComponent(listAllTickets); final Button openSubWindow = new Button("Open a sub window"); openSubWindow.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { buttons.removeComponent(openSubWindow); Window subWindow = new Window("Sub window"); mainWindow.addWindow(subWindow); } }); buttons.addComponent(openSubWindow); }
From source file:br.com.anteros.mobileserver.app.form.TableForm.java
License:Apache License
public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Tab tab = tabsheet.getTab(tabsheet.getSelectedTab()); if (tab != null) { buttons.removeComponent(buttonsFields); buttons.removeComponent(buttonsParameters); buttons.removeComponent(btnOk);/* w w w . j a v a2s. c o m*/ buttons.removeComponent(btnCancel); if (tab.getCaption().equals("Campos")) { buttons.addComponent(buttonsFields); buttons.setExpandRatio(buttonsFields, 1); } else { buttons.addComponent(buttonsParameters); buttons.setExpandRatio(buttonsParameters, 1); } buttons.addComponent(btnOk); buttons.addComponent(btnCancel); buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT); buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT); } }
From source file:ch.bfh.due1.srs.views.ReservationView.java
License:Open Source License
public ReservationView(Navigator navigator, RoomController roomController, ReservationController reservationController) { this.roomController = roomController; this.reservationController = reservationController; // setSizeFull(); addComponent(this.tabsheet); // Button button = new Button("Go to Room List View", new // Button.ClickListener() { // @Override// w ww .ja v a2 s . c om // public void buttonClick(ClickEvent event) { // navigator.navigateTo(RoomListView.VIEWNAME); // } // }); // addComponent(button); // setComponentAlignment(button, Alignment.MIDDLE_CENTER); this.tabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { // Find the tab sheet TabSheet tabsheet = event.getTabSheet(); // Find the tab (it's a layout) Layout tab = (Layout) tabsheet.getSelectedTab(); // Get the tab caption from the tab object String roomName = tabsheet.getTab(tab).getCaption(); // Fill the tab content tab.removeAllComponents(); // Create table for selected room table = createTimeSlotTable(roomName); tab.addComponent(table); } }); }
From source file:com.expressui.core.view.form.TypedForm.java
License:Open Source License
private void initializeOptionalTabs(VerticalLayout layout) { final Set<String> tabNames = getFormFieldSet().getTabNames(); menu = new LayoutContextMenu(layout); for (String tabName : tabNames) { TabSheet.Tab tab = getTabByName(tabName); if (getFormFieldSet().isTabOptional(tabName)) { tab.setClosable(true);/*from w w w . j a v a 2 s . co m*/ menu.addAction(uiMessageSource.getMessage("typedForm.add") + " " + tabName, this, "executeContextAction").setVisible(true); menu.addAction(uiMessageSource.getMessage("typedForm.remove") + " " + tabName, this, "executeContextAction").setVisible(false); setIsRequiredEnable(tabName, false); tab.setVisible(false); } tab.setDescription(uiMessageSource.getToolTip("typedForm.tab.toolTip")); } formTabSheet.setCloseHandler(new TabSheet.CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { String tabName = tabsheet.getTab(tabContent).getCaption(); String actionName = uiMessageSource.getMessage("typedForm.remove") + " " + tabName; executeContextAction(actionName); } }); }
From source file:com.foc.vaadin.gui.windows.AddTabWindow.java
License:Apache License
public AddTabWindow(final TabSheet tabSheet, final VerticalLayout addTabLayout) { super("Add New Tab"); setModal(true);/*from w w w . j a va 2 s. c o m*/ setWidth("264px"); setHeight("272px"); layout = new VerticalLayout(); buttonsLayout = new HorizontalLayout(); optionsLayout = new VerticalLayout(); seperateLayout = new VerticalLayout(); tabName = new TextField(); tabNameWrapper = new FVWrapperLayout(tabName, "Tab Name:", width); layoutHeight = new TextField(); heightWrapper = new FVWrapperLayout(layoutHeight, "Height:", width); layoutWidth = new TextField(); widthWrapper = new FVWrapperLayout(layoutWidth, "Width:", width); innerLayout = new ComboBox(); innerLayoutWrapper = new FVWrapperLayout(innerLayout, "Layout Type:", width); for (int i = 0; i < layoutTypes.length; i++) { innerLayout.addItem(layoutTypes[i]); } innerLayout.setImmediate(true); innerLayout.setNullSelectionAllowed(false); innerLayout.setValue(layoutTypes[0]); innerLayout.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String layoutType = event.getProperty().toString(); if (layoutType.equals(FXML.TAG_GRID_LAYOUT)) { layoutCols = new TextField(); colsWrapper = new FVWrapperLayout(layoutCols, "Columns:", width); layoutRows = new TextField(); rowsWrapper = new FVWrapperLayout(layoutRows, "Rows:", width); optionsLayout.addComponent(colsWrapper); optionsLayout.addComponent(rowsWrapper); setHeight("350px"); } else { if (layoutCols != null) { optionsLayout.removeComponent(colsWrapper); layoutCols = null; colsWrapper = null; } if (layoutRows != null) { optionsLayout.removeComponent(rowsWrapper); layoutRows = null; rowsWrapper = null; } setHeight("272px"); } } }); create = new Button("Create"); cancel = new Button("Cancel"); cancel.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); create.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { String layoutType = innerLayout.getValue().toString(); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "name", "name", "CDATA", "null"); attributes.addAttribute("", "height", "height", "CDATA", layoutHeight.getValue().toString().isEmpty() ? "-1px" : layoutHeight.getValue().toString() + "px"); attributes.addAttribute("", "width", "width", "CDATA", layoutWidth.getValue().toString().isEmpty() ? "-1px" : layoutWidth.getValue().toString() + "px"); if (layoutType.equals(FXML.TAG_ABSOLUTE_LAYOUT)) { selectedLayout = new FVAbsoluteLayout(attributes); } else if (layoutType.equals(FXML.TAG_VERTICAL_LAYOUT)) { selectedLayout = new FVVerticalLayout(attributes); } else if (layoutType.equals(FXML.TAG_HORIZONTAL_LAYOUT)) { selectedLayout = new FVHorizontalLayout(attributes); } else { attributes.addAttribute("", "rows", "rows", "CDATA", layoutRows.getValue().toString()); attributes.addAttribute("", "cols", "cols", "CDATA", layoutCols.getValue().toString()); selectedLayout = new FVGridLayout(attributes); } tabSheet.removeTab(tabSheet.getTab(addTabLayout)); tabSheet.addTab((Component) selectedLayout, tabName.getValue().toString()); tabSheet.addTab(addTabLayout, "+"); close(); } }); optionsLayout.setSpacing(true); optionsLayout.addComponent(widthWrapper); optionsLayout.addComponent(heightWrapper); seperateLayout.setHeight("25px"); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(create); buttonsLayout.addComponent(cancel); layout.setSpacing(true); layout.addComponent(tabNameWrapper); layout.addComponent(innerLayoutWrapper); layout.addComponent(optionsLayout); layout.addComponent(seperateLayout); layout.addComponent(buttonsLayout); layout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); setContent(layout); }
From source file:com.haulmont.cuba.web.gui.components.WebComponentsHelper.java
License:Apache License
/** * Tests if component visible and its container visible. * * @param child component//from w w w. j a v a2 s .co m * @return component visibility */ public static boolean isComponentVisible(Component child) { if (child.getParent() instanceof TabSheet) { TabSheet tabSheet = (TabSheet) child.getParent(); TabSheet.Tab tab = tabSheet.getTab(child); if (!tab.isVisible()) { return false; } } if (child.getParent() instanceof CubaGroupBox) { // ignore groupbox content container visibility return isComponentVisible(child.getParent()); } return child.isVisible() && (child.getParent() == null || isComponentVisible(child.getParent())); }
From source file:com.haulmont.cuba.web.gui.components.WebComponentsHelper.java
License:Apache License
/** * Tests if component enabled and visible and its container enabled. * * @param child component//w ww. j ava 2 s . c o m * @return component enabled state */ public static boolean isComponentEnabled(Component child) { if (child.getParent() instanceof TabSheet) { TabSheet tabSheet = (TabSheet) child.getParent(); TabSheet.Tab tab = tabSheet.getTab(child); if (!tab.isEnabled()) { return false; } } return child.isEnabled() && (child.getParent() == null || isComponentEnabled(child.getParent())) && isComponentVisible(child); }
From source file:com.hybridbpm.ui.component.bpm.CaseLayout.java
License:Apache License
private void close() { if (getParent() instanceof TabSheet) { TabSheet parent = (TabSheet) getParent(); parent.removeTab(parent.getTab(this)); parent.setSelectedTab(2);/*from w w w . ja v a2s. c o m*/ } }
From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java
License:Apache License
private void close() { if (getParent() instanceof TabSheet) { TabSheet parent = (TabSheet) getParent(); parent.removeTab(parent.getTab(this)); parent.setSelectedTab(0);// w w w.ja va 2s.c om } else if (getParent() != null && getParent() instanceof VerticalLayout && getParent().getParent() instanceof AdaptiveTaskPanel) { AdaptiveTaskPanel adaptiveTaskPanel = (AdaptiveTaskPanel) getParent().getParent(); adaptiveTaskPanel.close(); } else if (getParent() != null && getParent() instanceof VerticalLayout && getParent().getParent() instanceof AdaptiveTaskEditor) { AdaptiveTaskEditor adaptiveTaskEditor = (AdaptiveTaskEditor) getParent().getParent(); adaptiveTaskEditor.close(); } }