List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:annis.gui.admin.CorpusAdminPanel.java
License:Apache License
public CorpusAdminPanel() { corpusContainer.setBeanIdProperty("name"); final Grid corporaGrid = new Grid(corpusContainer); corporaGrid.setSizeFull();//from w w w . ja va2s. c o m corporaGrid.setSelectionMode(Grid.SelectionMode.MULTI); corporaGrid.setColumns("name", "textCount", "tokenCount", "sourcePath"); corporaGrid.getColumn("textCount").setHeaderCaption("Texts"); corporaGrid.getColumn("tokenCount").setHeaderCaption("Tokens"); corporaGrid.getColumn("sourcePath").setHeaderCaption("Source Path"); Button btDelete = new Button("Delete selected"); btDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Set<String> selection = new TreeSet<>(); for (Object o : corporaGrid.getSelectedRows()) { selection.add((String) o); } corporaGrid.getSelectionModel().reset(); if (!selection.isEmpty()) { for (CorpusListView.Listener l : listeners) { l.deleteCorpora(selection); } } } }); VerticalLayout layout = new VerticalLayout(btDelete, corporaGrid); layout.setSizeFull(); layout.setExpandRatio(corporaGrid, 1.0f); layout.setSpacing(true); layout.setMargin(new MarginInfo(true, false, false, false)); layout.setComponentAlignment(btDelete, Alignment.MIDDLE_CENTER); setContent(layout); setSizeFull(); }
From source file:annis.gui.admin.GroupManagementPanel.java
License:Apache License
public GroupManagementPanel() { groupsContainer.setBeanIdProperty("name"); progress = new ProgressBar(); progress.setCaption("Loading group list"); progress.setIndeterminate(true);/*from w w w.j a v a2 s . c o m*/ progress.setVisible(false); GeneratedPropertyContainer generated = new GeneratedPropertyContainer(groupsContainer); generated.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); groupsGrid.setContainerDataSource(generated); groupsGrid.setSelectionMode(Grid.SelectionMode.MULTI); groupsGrid.setSizeFull(); groupsGrid.setColumns("name", "edit", "corpora"); Grid.HeaderRow filterRow = groupsGrid.appendHeaderRow(); TextField groupFilterField = new TextField(); groupFilterField.setInputPrompt("Filter"); groupFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { groupsContainer.removeContainerFilters("name"); if (!event.getText().isEmpty()) { groupsContainer .addContainerFilter(new SimpleStringFilter("name", event.getText(), true, false)); } } }); filterRow.getCell("name").setComponent(groupFilterField); TextField corpusFilterField = new TextField(); corpusFilterField.setInputPrompt("Filter by corpus"); corpusFilterField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { groupsContainer.removeContainerFilters("corpora"); if (!event.getText().isEmpty()) { groupsContainer.addContainerFilter(new StringPatternInSetFilter("corpora", event.getText())); } } }); filterRow.getCell("corpora").setComponent(corpusFilterField); Grid.Column editColumn = groupsGrid.getColumn("edit"); editColumn.setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() { @Override public void click(ClickableRenderer.RendererClickEvent event) { Group g = groupsContainer.getItem(event.getItemId()).getBean(); FieldGroup fields = new FieldGroup(groupsContainer.getItem(event.getItemId())); fields.addCommitHandler(new GroupCommitHandler(g.getName())); EditSingleGroup edit = new EditSingleGroup(fields, corpusContainer); Window w = new Window("Edit group \"" + g.getName() + "\""); w.setContent(edit); w.setModal(true); w.setWidth("500px"); w.setHeight("250px"); UI.getCurrent().addWindow(w); } })); Grid.Column corporaColumn = groupsGrid.getColumn("corpora"); ; corporaColumn.setConverter(new CommaSeperatedStringConverterSet()); txtGroupName = new TextField(); txtGroupName.setInputPrompt("New group name"); Button btAddNewGroup = new Button("Add new group"); btAddNewGroup.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { handleAdd(); } }); btAddNewGroup.addStyleName(ChameleonTheme.BUTTON_DEFAULT); Button btDeleteGroup = new Button("Delete selected group(s)"); btDeleteGroup.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // get selected groups Set<String> selectedGroups = new TreeSet<>(); for (Object id : groupsGrid.getSelectedRows()) { selectedGroups.add((String) id); } groupsGrid.getSelectionModel().reset(); for (GroupListView.Listener l : listeners) { l.deleteGroups(selectedGroups); } } }); actionLayout = new HorizontalLayout(txtGroupName, btAddNewGroup, btDeleteGroup); VerticalLayout layout = new VerticalLayout(actionLayout, progress, groupsGrid); layout.setSizeFull(); layout.setExpandRatio(groupsGrid, 1.0f); layout.setExpandRatio(progress, 1.0f); layout.setSpacing(true); layout.setMargin(new MarginInfo(true, false, false, false)); layout.setComponentAlignment(actionLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progress, Alignment.TOP_CENTER); setContent(layout); setSizeFull(); addActionHandler(new AddGroupHandler(txtGroupName)); }
From source file:annis.gui.CitationWindow.java
License:Apache License
public CitationWindow(String query, Set<String> corpora, int contextLeft, int contextRight) { super("Citation"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);//w w w .j av a 2 s . com wLayout.setSizeFull(); String url = Helper.generateCitation(query, corpora, contextLeft, contextRight, null, 0, 10); TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ChameleonTheme.TEXTFIELD_BIG); txtCitation.addStyleName("citation"); txtCitation.setValue(url); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btOk = new Button("OK"); btOk.addListener((Button.ClickListener) this); btOk.setSizeUndefined(); wLayout.addComponent(btOk); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btOk, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("200px"); }
From source file:annis.gui.CorpusBrowserPanel.java
License:Apache License
/** * Places a label with the text "(No <caption>)" in the centered middle of the accordion * tab./*from w w w .j a v a 2 s . com*/ * * @param accordion the target accordion * @param caption is set as caption of the accordion tab */ private void placeEmptyLabel(Accordion accordion, String caption) { VerticalLayout v = new VerticalLayout(); v.setSizeFull(); Label l = new Label("(No " + caption + ")"); v.addComponent(l); l.setSizeUndefined(); v.setComponentAlignment(l, Alignment.MIDDLE_CENTER); accordion.addTab(v, caption, null); l.setSizeUndefined(); }
From source file:annis.gui.docbrowser.DocBrowserController.java
License:Apache License
public void openDocVis(String corpus, String doc, Visualizer visConfig, Button btn) { final String canonicalTitle = corpus + " > " + doc + " - " + "Visualizer: " + visConfig.getDisplayName(); final String tabCaption = StringUtils.substring(canonicalTitle, 0, 15) + "..."; if (visibleVisHolder.containsKey(canonicalTitle)) { Panel visHolder = visibleVisHolder.get(canonicalTitle); ui.getSearchView().getTabSheet().setSelectedTab(visHolder); return;/* w w w . j a v a2s . c om*/ } Panel visHolder = new Panel(); visHolder.setSizeFull(); visHolder.addDetachListener(new ClientConnector.DetachListener() { @Override public void detach(ClientConnector.DetachEvent event) { visibleVisHolder.remove(canonicalTitle); } }); // first set loading indicator ProgressBar progressBar = new ProgressBar(1.0f); progressBar.setIndeterminate(true); progressBar.setSizeFull(); VerticalLayout layoutProgress = new VerticalLayout(progressBar); layoutProgress.setSizeFull(); layoutProgress.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); visHolder.setContent(layoutProgress); Tab visTab = ui.getSearchView().getTabSheet().addTab(visHolder, tabCaption); visTab.setDescription(canonicalTitle); visTab.setIcon(EYE_ICON); visTab.setClosable(true); ui.getSearchView().getTabSheet().setSelectedTab(visTab); // register visible visHolder this.visibleVisHolder.put(canonicalTitle, visHolder); Background.run(new DocVisualizerFetcher(corpus, doc, canonicalTitle, visConfig.getType(), visHolder, visConfig, btn, UI.getCurrent())); }
From source file:annis.gui.EmbeddedVisUI.java
License:Apache License
private void generateVisFromRemoteURL(final String visName, final String rawUri, Map<String, String[]> args) { try {// w w w . j a v a 2s . c o m // find the matching visualizer final VisualizerPlugin visPlugin = this.getVisualizer(visName); if (visPlugin == null) { displayMessage("Unknown visualizer \"" + visName + "\"", "This ANNIS instance does not know the given visualizer."); return; } URI uri = new URI(rawUri); // fetch content of the URI Client client = null; AnnisUser user = Helper.getUser(); if (user != null) { client = user.getClient(); } if (client == null) { client = Helper.createRESTClient(); } final WebResource saltRes = client.resource(uri); displayLoadingIndicator(); // copy the arguments for using them later in the callback final Map<String, String[]> argsCopy = new LinkedHashMap<>(args); Background.runWithCallback(new Callable<SaltProject>() { @Override public SaltProject call() throws Exception { return saltRes.get(SaltProject.class); } }, new FutureCallback<SaltProject>() { @Override public void onFailure(Throwable t) { displayMessage("Could not query the result.", t.getMessage()); } @Override public void onSuccess(SaltProject p) { // TODO: allow to display several visualizers when there is more than one document SCorpusGraph firstCorpusGraph = null; SDocument doc = null; if (p.getCorpusGraphs() != null && !p.getCorpusGraphs().isEmpty()) { firstCorpusGraph = p.getCorpusGraphs().get(0); if (firstCorpusGraph.getDocuments() != null && !firstCorpusGraph.getDocuments().isEmpty()) { doc = firstCorpusGraph.getDocuments().get(0); } } if (doc == null) { displayMessage("No documents found in provided URL.", ""); return; } if (argsCopy.containsKey(KEY_INSTANCE)) { Map<String, InstanceConfig> allConfigs = loadInstanceConfig(); InstanceConfig newConfig = allConfigs.get(argsCopy.get(KEY_INSTANCE)[0]); if (newConfig != null) { setInstanceConfig(newConfig); } } // now it is time to load the actual defined instance fonts loadInstanceFonts(); // generate the visualizer VisualizerInput visInput = new VisualizerInput(); visInput.setDocument(doc); if (getInstanceConfig() != null && getInstanceConfig().getFont() != null) { visInput.setFont(getInstanceFont()); } Properties mappings = new Properties(); for (Map.Entry<String, String[]> e : argsCopy.entrySet()) { if (!KEY_SALT.equals(e.getKey()) && e.getValue().length > 0) { mappings.put(e.getKey(), e.getValue()[0]); } } visInput.setMappings(mappings); String[] namespace = argsCopy.get(KEY_NAMESPACE); if (namespace != null && namespace.length > 0) { visInput.setNamespace(namespace[0]); } else { visInput.setNamespace(null); } String baseText = null; if (argsCopy.containsKey(KEY_BASE_TEXT)) { String[] value = argsCopy.get(KEY_BASE_TEXT); if (value.length > 0) { baseText = value[0]; } } List<SNode> segNodes = CommonHelper.getSortedSegmentationNodes(baseText, doc.getDocumentGraph()); if (argsCopy.containsKey(KEY_MATCH)) { String[] rawMatch = argsCopy.get(KEY_MATCH); if (rawMatch.length > 0) { // enhance the graph with match information from the arguments Match match = Match.parseFromString(rawMatch[0]); addMatchToDocumentGraph(match, doc); } } Map<String, String> markedColorMap = new HashMap<>(); Map<String, String> exactMarkedMap = Helper.calculateColorsForMarkedExact(doc); Map<String, Long> markedAndCovered = Helper.calculateMarkedAndCoveredIDs(doc, segNodes, baseText); Helper.calulcateColorsForMarkedAndCovered(doc, markedAndCovered, markedColorMap); visInput.setMarkedAndCovered(markedAndCovered); visInput.setMarkableMap(markedColorMap); visInput.setMarkableExactMap(exactMarkedMap); visInput.setContextPath(Helper.getContext()); String template = Helper.getContext() + "/Resource/" + visName + "/%s"; visInput.setResourcePathTemplate(template); visInput.setSegmentationName(baseText); // TODO: which other thing do we have to provide? Component c = visPlugin.createComponent(visInput, null); // add the styles c.addStyleName("corpus-font"); c.addStyleName("vis-content"); Link link = new Link(); link.setCaption("Show in ANNIS search interface"); link.setIcon(ANNISFontIcon.LOGO); link.setVisible(false); link.addStyleName("dontprint"); link.setTargetName("_blank"); if (argsCopy.containsKey(KEY_SEARCH_INTERFACE)) { String[] interfaceLink = argsCopy.get(KEY_SEARCH_INTERFACE); if (interfaceLink.length > 0) { link.setResource(new ExternalResource(interfaceLink[0])); link.setVisible(true); } } VerticalLayout layout = new VerticalLayout(link, c); layout.setComponentAlignment(link, Alignment.TOP_LEFT); layout.setSpacing(true); layout.setMargin(true); setContent(layout); IDGenerator.assignID(link); } }); } catch (URISyntaxException ex) { displayMessage("Invalid URL", "The provided URL is malformed:<br />" + ex.getMessage()); } catch (LoginDataLostException ex) { displayMessage("LoginData Lost", "No login data available any longer in the session:<br /> " + ex.getMessage()); } catch (UniformInterfaceException ex) { if (ex.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode()) { displayMessage("Corpus access forbidden", "You are not allowed to access this corpus. " + "Please login at the <a target=\"_blank\" href=\"" + Helper.getContext() + "\">main application</a> first and then reload this page."); } else { displayMessage("Service error", ex.getMessage()); } } catch (ClientHandlerException ex) { displayMessage("Could not generate the visualization because the ANNIS service reported an error.", ex.getMessage()); } catch (Throwable ex) { displayMessage("Could not generate the visualization.", ex.getMessage() == null ? ("An unknown error of type " + ex.getClass().getSimpleName()) + " occured." : ex.getMessage()); } }
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 www. j ava 2 s .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: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 om 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);/*from ww w . j av a2s . c om*/ 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.peppol.webgui.app.components.InvoiceLineWindow.java
License:Mozilla Public License
public InvoiceLineWindow(final TabInvoiceLine parent) { this.parent = parent; invln = new InvoiceLineAdapter(); // line = new Line(); // BeanItem<InvoiceLineAdapter> invoiceLine = new BeanItem<InvoiceLineAdapter>(invln); // parent.setItemDataSource(invoiceLine); // BeanItem<Line> invoiceLine = new BeanItem<Line>(line); // parent.setItemDataSource(invoiceLine); subwindow = new Window("Invoice Line"); subwindow.setModal(true);//from w w w. ja v a2 s .co m VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); Button btnClose = new Button("Close", new Button.ClickListener() { public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); Button btnSave = new Button("Save", new Button.ClickListener() { public void buttonClick(ClickEvent event) { //update GUI table !! ///parent.getTable().addInvoiceLine (invln); //update actual invoice line item ///parent.items.add (invln); //close popup (subwindow.getParent()).removeWindow(subwindow); } }); try { layout.addComponent(createInvoiceLineForm()); } catch (Exception e) { e.printStackTrace(); } layout.addComponent(btnSave); layout.addComponent(btnClose); layout.setComponentAlignment(btnClose, Alignment.BOTTOM_RIGHT); }