List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:annis.gui.ShareQueryReferenceWindow.java
License:Apache License
public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) { super("Query reference link"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);//from w w w . j a v a 2s . c o m wLayout.setSizeFull(); wLayout.setMargin(true); Label lblInfo = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong> " + "1. Copy the generated link 2. Share this link with your peers. " + "</p>", ContentMode.HTML); wLayout.addComponent(lblInfo); wLayout.setExpandRatio(lblInfo, 0.0f); String shortURL = "ERROR"; if (query != null) { URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(), query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(), query.getLimit(), query.getOrder(), query.getSelectedMatches()); if (shorten) { shortURL = Helper.shortenURL(url); } else { shortURL = url.toASCIIString(); } } TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtCitation.addStyleName("shared-text"); txtCitation.setValue(shortURL); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btClose = new Button("Close"); btClose.addClickListener((Button.ClickListener) this); btClose.setSizeUndefined(); wLayout.addComponent(btClose); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("300px"); }
From source file:annis.libgui.ImagePanel.java
License:Apache License
public ImagePanel(Embedded image) { setWidth("100%"); setHeight("-1px"); VerticalLayout layout = new VerticalLayout(); setContent(layout);/*www . ja va 2 s . c om*/ // enable scrolling layout.setSizeUndefined(); addStyleName(ChameleonTheme.PANEL_BORDERLESS); layout.addComponent(image); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.MockQuestion.java
License:LGPL
public MockQuestion(Question question) { this.question = question; TextArea textArea = new TextArea("Question text"); textArea.setSizeFull();/*from w w w.ja v a2 s. co m*/ // Download the result Button button = new Button("Display current user's solution"); button.setSizeFull(); button.addClickListener(e -> { Window window = new Window("Current user solution"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); window.setContent(layout); // Update questionText textArea.addTextChangeListener(ev -> questionText = ev.getText()); textArea.setTextChangeEventMode(TextChangeEventMode.EAGER); Label label; try { label = new Label(toXML()); } catch (Exception e1) { label = new Label( "<h1>Error parsing XML</h1><p>" + e1.getMessage() + Arrays.toString(e1.getStackTrace()), ContentMode.HTML); LogHelper.logThrowable(e1); } layout.addComponent(label); window.center(); getUI().addWindow(window); }); // Add components to the UI addComponent(textArea); addComponent(question); addComponent(button); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
@Override public void startQuiz(StudentData student) { // Remove everything from the layout, save it for displaying after // clicking OK final Component[] components = new Component[getComponentCount()]; for (int i = 0; i < components.length; i++) { components[i] = getComponent(i); }/*from w w w . ja v a 2 s . c o m*/ removeAllComponents(); // Create first page VerticalLayout layout = new VerticalLayout(); addComponent(layout); ComboBox gender = new ComboBox("Geschlecht"); String[] genderItems = { "mnnlich", "weiblich" }; gender.addItems(genderItems); //gender.setSizeFull(); gender.setEnabled(true); Label gradeLastYear = new Label("<p/>Welche Note hattest du im letzten Zeugnis in ...", ContentMode.HTML); TextField gradeLastYearRW = new TextField("Rechungswesen"); TextField gradeLastYearBWL = new TextField("BWL/BVW"); TextField gradeLastYearD = new TextField("Deutsch"); TextField gradeLastYearE = new TextField("Englisch"); TextField gradeLastYearM = new TextField("Mathematik"); Label gradeLastTest = new Label("<p/>Welche Note hattest du auf die letzte Schularbeit aus ...", ContentMode.HTML); TextField gradeLastTestRW = new TextField("Rechungswesen"); TextField gradeLastTestBWL = new TextField("BWL/BVW"); TextField gradeLastTestD = new TextField("Deutsch"); TextField gradeLastTestE = new TextField("Englisch"); TextField gradeLastTestM = new TextField("Mathematik"); Label classNameLabel = new Label("<p/>Welche Klasse besuchst du?", ContentMode.HTML); TextField className = new TextField("(z.B. 4A)"); Label studentCode = new Label( "<p/>Damit deine Antworten mit spteren Fragebogenergebnissen verknpft werden knnen, ist es notwendig, einen anonymen Benutzernamen anzulegen. Erstelle deinen persnlichen Code nach folgendem Muster:", ContentMode.HTML); TextField studentCodeC1 = new TextField( "Tag und Monat der Geburt (DDMM), z.B. \"1008\" fr Geburtstag am 10. August"); TextField studentCodeC2 = new TextField( "Zwei Anfangsbuchstaben des Vornamens, z.B. \"St\" fr \"Stefan\""); TextField studentCodeC3 = new TextField( "Zwei Anfangsbuchstaben des Vornamens der Mutter,, z.B. \"Jo\" fr \"Johanna\""); Label thankYou = new Label("<p/>Danke fr die Angaben.<p/>", ContentMode.HTML); Button cont = new Button("Weiter", e -> { removeAllComponents(); studentIDCode = new String( studentCodeC1.getValue() + studentCodeC2.getValue() + studentCodeC3.getValue()); studentGender = (gender.getValue() == null) ? new String("undefined") : gender.getValue().toString(); studentClass = className.getValue(); studentGradesLastYear = new HashMap(); studentGradesLastYear.put("RW", gradeLastYearRW.getValue()); studentGradesLastYear.put("BWL", gradeLastYearBWL.getValue()); studentGradesLastYear.put("D", gradeLastYearD.getValue()); studentGradesLastYear.put("E", gradeLastYearE.getValue()); studentGradesLastYear.put("M", gradeLastYearM.getValue()); studentGradesLastTest = new HashMap(); studentGradesLastTest.put("RW", gradeLastTestRW.getValue()); studentGradesLastTest.put("BWL", gradeLastTestBWL.getValue()); studentGradesLastTest.put("D", gradeLastTestD.getValue()); studentGradesLastTest.put("E", gradeLastTestE.getValue()); studentGradesLastTest.put("M", gradeLastTestM.getValue()); this.student = new StudentData(studentIDCode, studentGender, studentClass, studentGradesLastYear, studentGradesLastTest); LogHelper.logInfo("StudentData: " + this.student.toString()); displayCompanyInfo(components); }); layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Fragen zu deiner Person"));// Title of the quiz layout.addComponent(gender); layout.addComponent(gradeLastYear); layout.addComponent(gradeLastYearRW); layout.addComponent(gradeLastYearBWL); layout.addComponent(gradeLastYearD); layout.addComponent(gradeLastYearE); layout.addComponent(gradeLastYearM); layout.addComponent(gradeLastTest); layout.addComponent(gradeLastTestRW); layout.addComponent(gradeLastTestBWL); layout.addComponent(gradeLastTestD); layout.addComponent(gradeLastTestE); layout.addComponent(gradeLastTestM); layout.addComponent(classNameLabel); layout.addComponent(className); layout.addComponent(studentCode); layout.addComponent(studentCodeC1); layout.addComponent(studentCodeC2); layout.addComponent(studentCodeC3); layout.addComponent(thankYou); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
public void displayCompanyInfo(Component[] components) { // Create second page VerticalLayout layout = new VerticalLayout(); addComponent(layout);/* ww w .j av a 2s . c o m*/ Label label = new Label( "Stelle dir vor, du hast dich mit dem Handel von Tablet-PCs aller Art selbstndig gemacht und dazu das Einzelunternehmen World of Tabs e. U. vor zwei Jahren gegrndet. Da du dich in Rechnungswesen schon gut auskennst, beschliet du selbst die Buchhaltung zu fhren.<p/>", ContentMode.HTML); Label companyData = new Label( "<table><tr><td>Firmenname:</td><td>World of Tabs</td></tr><tr><td>Adresse:</td><td>Unterfeld 15</td></tr><tr><td></td><td>4541 Adlwang</td></tr><tr><td>E-mail:</td><td>office@worldtabs.at</td></tr><tr><td>Internet:</td><td>www.worldtabs.at</td></tr><tr><td>UID-Nummer:</td><td>ATU32589716</td></tr></table><p/>", ContentMode.HTML); Label descr = new Label( "<i>World of Tabs dient im Folgenden als Modellunternehmen, <b>aus dessen Sicht</b> du die Aufgabenstellungen bearbeiten sollst. Wir bitten dich die Aufgaben <b>alleine, ohne Hilfe</b> von Mitschler/inne/n oder Lehrer/inne/n zu lsen. Du kannst den Kontenplan und einen Taschenrechner verwenden.</i><p/>", ContentMode.HTML); Label disclaimer = new Label( "<b>Wichtig ist, dass du im Folgenden bei der Angabe der Kontennummer und des Kontennamens die genaue Nummer bzw. Bezeichnung verwendest. Bspw. wird eine Aufgabe falsch gewertet, wenn du die Nummer 30 anstatt 33 fr das Lieferverbindlichkeiten whlst oder du den Kontennamen \"Lieferverbindlichkeiten\" anstatt \"AATech\" (bei personifiziertem Lieferantenkonto) fr den Lieferanten whlst.<b>", ContentMode.HTML); Button cont = new Button("Weiter", e -> { removeAllComponents(); for (Component c : components) { addComponent(c); } super.startQuiz(student); }); // layout.addComponent(components[0]);// Title of the quiz layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Unternehmensbeschreibung"));// Title of the quiz layout.addComponent(companyData); layout.addComponent(label); layout.addComponent(descr); layout.addComponent(disclaimer); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:at.meikel.nentis.Nentis.java
License:Apache License
private void initInfo(TabSheet tabSheet) { VerticalLayout infoTab = new VerticalLayout(); tabSheet.addTab(infoTab);/*from ww w . 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);/* ww w . j a v a 2 s .com*/ 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:at.peppol.webgui.app.components.InvoiceForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Invoice Header"); outerPanel.addComponent(grid);/* w ww.j a v a 2 s . c o m*/ outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); setLayout(outerLayout); final Panel invoiceDetailsPanel = new Panel("Invoice Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTopForm()); grid.addComponent(invoiceDetailsPanel, 0, 0, 3, 0); grid.setSizeUndefined(); outerPanel.requestRepaintAll(); }
From source file:at.peppol.webgui.app.components.InvoiceLineAllowanceChargeForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);//from w ww .ja v a 2 s . c o m hiddenContent.setMargin(true); table = new InvoiceLineAllowanceChargeTable(lineAllowanceChargeList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); Button addButton = new Button("Add new"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceLineAllowanceChargeTableEditor editor = new InvoiceLineAllowanceChargeTableEditor(editMode, inv); Label label = new Label("<h3>Adding allowance/charge line</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineAllowanceChargeList, label)); label = new Label("<h3>Edit allowance/charge line</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineAllowanceChargeList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(prefix + " Allowances/Charges"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }
From source file:at.peppol.webgui.app.components.InvoiceLineCommodityClassificationForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true);/* w w w . ja v a2s . co m*/ hiddenContent.setMargin(true); table = new InvoiceLineCommodityClassificationTable(lineCommodityList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(false); table.addStyleName("striped strong"); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); Button addButton = new Button("Add new"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceLineCommodityClassificationTableEditor editor = new InvoiceLineCommodityClassificationTableEditor( editMode); Label label = new Label("<h3>Adding commodity classification line</h3>", Label.CONTENT_XHTML); addButton.addListener( editor.addButtonListener(editButton, deleteButton, hiddenContent, table, lineCommodityList, label)); label = new Label("<h3>Edit commodity classification line</h3>", Label.CONTENT_XHTML); editButton.addListener( editor.editButtonListener(addButton, deleteButton, hiddenContent, table, lineCommodityList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); Panel outerPanel = new Panel(prefix + " Commodity Classifications"); //outerPanel.setStyleName("light"); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); // ---- HIDDEN FORM ENDS ----- grid.setSizeUndefined(); grid.addComponent(tableContainer, 0, 0); grid.addComponent(buttonsContainer, 1, 0); outerPanel.addComponent(grid); outerPanel.addComponent(formLayout); outerLayout.addComponent(outerPanel); outerPanel.requestRepaintAll(); VerticalLayout mainLayout = new VerticalLayout(); final VerticalLayout showHideContentLayout = new VerticalLayout(); showHideContentLayout.addComponent(outerPanel); HorizontalLayout showHideButtonLayout = new HorizontalLayout(); Button btn = new Button("Show/Hide Allowances/Charges", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub showHideContentLayout.setVisible(!showHideContentLayout.isVisible()); } }); showHideButtonLayout.setWidth("100%"); showHideButtonLayout.addComponent(btn); showHideButtonLayout.setComponentAlignment(btn, Alignment.MIDDLE_RIGHT); //mainLayout.addComponent(showHideButtonLayout); mainLayout.addComponent(showHideContentLayout); //showHideContentLayout.setVisible(false); addComponent(mainLayout); }