List of usage examples for com.vaadin.ui TabSheet TabSheet
public TabSheet()
From source file:com.toptal.ui.view.MainView.java
License:Open Source License
/** * Ctor.// w w w .j a v a 2 s . co m * @param vui Vaadin UI entry point. */ public MainView(final VaadinUI vui) { super(vui); final TabSheet tabsheet = new TabSheet(); this.entries = new EntryTab(this, "Entries").build(); tabsheet.addTab(this.entries); this.weeks = new WeekTab(this, "Statistics").build(); tabsheet.addTab(this.weeks); if (SecurityUtils.actualUser().isManager()) { this.users = Optional.of(new UserTab(this, "Users").build()); tabsheet.addTab(this.users.get()); } else { this.users = Optional.empty(); } this.addComponent(this.header()); this.addComponent(tabsheet); }
From source file:com.trivago.mail.pigeon.web.components.mail.ActionButtonColumnGenerator.java
License:Apache License
@Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { HorizontalLayout hl = new HorizontalLayout(); Button showNlConentButton = new Button(); showNlConentButton.setDescription("View"); showNlConentButton.setImmediate(true); showNlConentButton.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); showNlConentButton.addListener(new Button.ClickListener() { @Override// w ww . jav a 2 s. c o m public void buttonClick(Button.ClickEvent event) { Mail m = new Mail((Long) itemId); Window nlConentView = new Window("Newsletter Contents of ID " + itemId); // Create an empty tab sheet. TabSheet tabsheet = new TabSheet(); Panel pText = new Panel("Text Content"); Panel pHtml = new Panel("Text Content"); RichTextArea textArea = new RichTextArea(); textArea.setValue(m.getText()); textArea.setReadOnly(true); RichTextArea richTextArea = new RichTextArea(); richTextArea.setValue(m.getHtml()); richTextArea.setReadOnly(true); pText.addComponent(textArea); pHtml.addComponent(richTextArea); richTextArea.setHeight("50%"); richTextArea.setWidth("100%"); textArea.setHeight("50%"); textArea.setWidth("100%"); nlConentView.setResizable(true); nlConentView.setWidth("800px"); nlConentView.setHeight("600px"); tabsheet.addTab(pText); tabsheet.getTab(pText).setCaption("Text Version"); tabsheet.addTab(pHtml); tabsheet.getTab(pHtml).setCaption("Html Version"); nlConentView.addComponent(tabsheet); source.getWindow().addWindow(nlConentView); nlConentView.setVisible(true); } }); final Button showOpenendMails = new Button(); showOpenendMails.setDescription("Show recipients of this mailling"); showOpenendMails.setIcon(new ThemeResource("../runo/icons/16/users.png")); showOpenendMails.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Mail m = new Mail((Long) itemId); ModalRecipientListByMail modalRecipientListByMail = new ModalRecipientListByMail(m); source.getWindow().addWindow(modalRecipientListByMail); modalRecipientListByMail.setVisible(true); } }); hl.addComponent(showNlConentButton); hl.addComponent(showOpenendMails); return hl; }
From source file:com.trivago.mail.pigeon.web.components.recipients.ModalRecipientListByMail.java
License:Apache License
public ModalRecipientListByMail(Mail mail) { super("Recipient List for mailing " + mail.getSubject()); setModal(true);/* ww w.j av a2 s . c o m*/ setWidth("900px"); TabSheet tabsheet = new TabSheet(); RecipientByMailList rl = new RecipientByMailList(mail); tabsheet.addTab(rl).setCaption("Recipient List"); MailOpenChart chart = new MailOpenChart(mail); tabsheet.addTab(chart).setCaption("Statistics"); addComponent(tabsheet); }
From source file:com.trivago.mail.pigeon.web.components.templates.ModalAddTemplate.java
License:Apache License
public ModalAddTemplate(final TemplateList tl, final Long templateId) { setResizable(true);/*from w w w .j a v a 2s .co m*/ setWidth("972px"); setHeight("700px"); Panel rootPanel = new Panel("Add new Template"); TabSheet tSheet = new TabSheet(); HorizontalLayout hLayout = new HorizontalLayout(); final TextField title = new TextField("Template description"); final TextField subject = new TextField("Newsletter Subject"); final TextArea textContent = new TextArea("Text Version"); textContent.setRows(40); textContent.setColumns(100); final CKEditorTextField htmlContent = new CKEditorTextField(); htmlContent.setWidth("100%"); htmlContent.setHeight("650px"); // Load the content, if we receive a template id if (templateId != null) { MailTemplate mt = new MailTemplate(templateId); title.setValue(mt.getTitle()); subject.setValue(mt.getSubject()); textContent.setValue(mt.getText()); htmlContent.setValue(mt.getHtml()); } Button saveButton = new Button("Save"); Button cancel = new Button("Cancel"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean hasError = false; if (title.getValue().equals("")) { title.setComponentError(new UserError("Name must not be empty")); hasError = true; } else { title.setComponentError(null); } if (subject.getValue().equals("")) { subject.setComponentError(new UserError("Subject must not be empty")); hasError = true; } else { subject.setComponentError(null); } if (htmlContent.getValue().equals("")) { htmlContent.setComponentError(new UserError("Please provide some HTML content")); hasError = true; } else { htmlContent.setComponentError(null); } if (textContent.getValue().equals("")) { textContent.setComponentError(new UserError("Please provide some text content")); hasError = true; } else { textContent.setComponentError(null); } if (!hasError) { if (templateId == null) { long templateId = Util.generateId(); try { MailTemplate mt = new MailTemplate(templateId, title.getValue().toString(), textContent.getValue().toString(), htmlContent.getValue().toString(), subject.getValue().toString()); event.getButton().getWindow().setVisible(false); event.getButton().getWindow().getParent() .removeComponent(event.getButton().getWindow()); event.getButton().getWindow().getParent().showNotification("Saved successfully", Notification.TYPE_HUMANIZED_MESSAGE); tl.getBeanContainer().addItem(mt.getId(), mt); } catch (RuntimeException e) { // Should never happen ... hopefully :D } } else { MailTemplate mt = new MailTemplate(templateId); mt.setHtml(htmlContent.getValue().toString()); mt.setSubject(subject.getValue().toString()); mt.setText(textContent.getValue().toString()); mt.setTitle(title.getValue().toString()); event.getButton().getWindow().setVisible(false); event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow()); event.getButton().getWindow().getParent().showNotification("Saved successfully", Notification.TYPE_HUMANIZED_MESSAGE); final int beanIndex = tl.getBeanContainer().indexOfId(mt.getId()); tl.getBeanContainer().removeItem(mt.getId()); tl.getBeanContainer().addItemAt(beanIndex, mt.getId(), mt); } TemplateSelectBox.reloadSelect(); } } }); hLayout.addComponent(saveButton); hLayout.addComponent(cancel); hLayout.setSpacing(true); VerticalLayout metaDataLayout = new VerticalLayout(); Panel textFieldPanel = new Panel("Meta Data"); VerticalLayout metaLayout = new VerticalLayout(); metaLayout.addComponent(title); metaLayout.addComponent(subject); textFieldPanel.addComponent(metaLayout); Panel helpPanel = new Panel("Template Documentation"); assembleHelpComponents(helpPanel); metaDataLayout.addComponent(textFieldPanel); metaDataLayout.addComponent(helpPanel); tSheet.addTab(metaDataLayout).setCaption("Meta Data"); VerticalLayout textLayout = new VerticalLayout(); textLayout.addComponent(textContent); tSheet.addTab(textLayout).setCaption("Text Content"); VerticalLayout htmlLayout = new VerticalLayout(); htmlLayout.addComponent(htmlContent); tSheet.addTab(htmlLayout).setCaption("HTML Content"); rootPanel.addComponent(tSheet); rootPanel.addComponent(hLayout); addComponent(rootPanel); }
From source file:com.vphakala.VaadinUI.java
@Override protected void init(VaadinRequest request) { customerTab = new CustomerUI(customerService); subscriberTab = new SubscriberUI(subscriberService); mainLayout = new TabSheet(); mainLayout.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Layout tab = (Layout) tabsheet.getSelectedTab(); if (tab == subscriberTab) { subscriberTab.setUIFields(customerTab.getEmail().getValue()); } else if (tab == customerTab) { // no action needed } else { Notification.show("*** shit happens ***"); }//from w w w.j ava 2 s .co m } }); mainLayout.addTab(customerTab); mainLayout.addTab(subscriberTab); setContent(mainLayout); }
From source file:com.zklogtool.web.components.MainLayout.java
License:Apache License
@AutoGenerated private HorizontalLayout buildHorizontalLayout_3() { // common part: create layout horizontalLayout_3 = new HorizontalLayout(); horizontalLayout_3.setImmediate(false); horizontalLayout_3.setWidth("100.0%"); horizontalLayout_3.setHeight("100.0%"); horizontalLayout_3.setMargin(false); // tabSheet_1 tabSheet_1 = new TabSheet(); tabSheet_1.setImmediate(false);/*from w w w . j a v a 2 s . c o m*/ tabSheet_1.setWidth("100.0%"); tabSheet_1.setHeight("100.0%"); horizontalLayout_3.addComponent(tabSheet_1); return horizontalLayout_3; }
From source file:cz.zcu.pia.social.network.frontend.views.ViewProfile.java
/** * PostConstruct/*from w w w .j ava2s.c o m*/ */ @PostConstruct @Override public void postConstruct() { super.postConstruct(); if (!securityHelper.isAuthenticated()) { ((MyUI) UI.getCurrent().getUI()).getNavigator().navigateTo(ViewHome.NAME); } TabSheet tabsheet = new TabSheet(); tabsheet.setWidth(COMPONENT_WIDTH, Unit.PIXELS); tabsheet.addTab(friends, msgs.getMessage("view.profile.tab.friends")); tabsheet.addTab(profile, msgs.getMessage("view.profile.tab.profile")); this.getContentWrapper().addComponent(tabsheet); //this.getContentWrapper().addComponent(); }
From source file:de.catma.ui.analyzer.AnalyzerView.java
License:Open Source License
private Component createResultPanel() { resultTabSheet = new TabSheet(); resultTabSheet.setSizeFull();/*from w w w. ja v a 2 s. c o m*/ Component resultByPhraseView = createResultByPhraseView(); resultTabSheet.addTab(resultByPhraseView, "Result by phrase"); Component resultByMarkupView = createResultByMarkupView(); resultTabSheet.addTab(resultByMarkupView, "Result by markup"); return resultTabSheet; }
From source file:de.catma.ui.tabbedview.TabbedView.java
License:Open Source License
private void initComponents(String noOpenTabsText) { tabSheet = new TabSheet(); tabSheet.setSizeFull();/* w w w . ja v a2 s . c o m*/ noOpenTabsLabel = new Label(noOpenTabsText); noOpenTabsLabel.setSizeFull(); setMargin(true); addComponent(noOpenTabsLabel); setComponentAlignment(noOpenTabsLabel, Alignment.MIDDLE_CENTER); addComponent(tabSheet); tabSheet.hideTabs(true); tabSheet.setHeight("0px"); tabSheet.setCloseHandler(this); setSizeFull(); }
From source file:de.catma.ui.tagger.MarkupPanel.java
License:Open Source License
private void initComponents(PropertyChangeListener tagDefinitionSelectionListener, PropertyChangeListener tagDefinitionsRemovedListener) { tabSheet = new TabSheet(); tabSheet.setSizeFull();//from w ww .ja v a 2s .co m VerticalLayout tabContent = new VerticalLayout(); tabContent.setSpacing(true); tabContent.setSizeFull(); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application)); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Creating Tags</h4>" + "<ol><li>First you have to tell CATMA which Tagset you want to use. " + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section." + " If you already have an active Tagset you want to use, you can skip this step.</li>" + "<li>Now you can select the Tagset and click the \"Create Tag\"-Button.</li></ol>" + "<h4>Tag this Source Document</h4>" + "<ol><li>First you have to tell CATMA which Tagset you want to use. " + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section." + " If you already have an active Tagset you want to use, you can skip this step.</li>" + "<li>Now you can mark the text sequence you want to tag.</li><li>Click the colored button of the desired Tag to apply it to the marked sequence.</li></ol> " + "When you click on a tagged text, i. e. a text that is underlined with colored bars you should see " + "the available Tag Instances in the section on the lower right of this view."); tabContent.addComponent(helpLabel); tabContent.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT); tagsetTree = new TagsetTree(repository.getTagManager(), null, false, colorButtonListener); tabContent.addComponent(tagsetTree); tabContent.setExpandRatio(tagsetTree, 1.0f); tabSheet.addTab(tabContent, "Active Tagsets"); markupCollectionsPanel = new MarkupCollectionsPanel(repository); markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionSelected, tagDefinitionSelectionListener); markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.tagDefinitionsRemoved, tagDefinitionsRemovedListener); markupCollectionsPanel.addPropertyChangeListener(MarkupCollectionPanelEvent.userMarkupCollectionSelected, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() != null) { writableUserMarkupCollectionLabel.setValue(evt.getNewValue()); } else { writableUserMarkupCollectionLabel.setValue(""); } colorButtonListener.setEnabled(evt.getNewValue() != null); } }); tabSheet.addTab(markupCollectionsPanel, "Active Markup Collections"); addComponent(tabSheet); Component markupInfoPanel = createInfoPanel(); addComponent(markupInfoPanel); }