vaadin

Open pdf file from menubar using Vaadin

蹲街弑〆低调 提交于 2019-12-23 16:01:45
问题 I have a menubar in my vaadin application and want to add an item to open a pdf-file is a new tab of the browser. I found some solutions to open files with a button, but I have to use an MenuItem... MenuBar.Command commandHandler = new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.equals(menu_help)) { openHelp(); } } }; ... menu_help = menuBar .addItem("", WebImageList.getImage(ImageList.gc_helpIcon), commandHandler); ... private void

adding text to a combobox with a datasource

做~自己de王妃 提交于 2019-12-23 10:09:56
问题 I have a vaadin combobox that is filled with a containerdatasource setContainerDataSource(container); I now want to insert a static text somewhere in the list of results. For example: A Combobox that is filled with a container of and the first entry that pops up in the result list is some kind of header: Persons: Thomas S. Lucas B. Alex X. Can i achieve that by either manipulating the container or the combobox? I just tried to set the container source and add a String/Label via addItem() to

Pagination for table in vaadin [closed]

守給你的承諾、 提交于 2019-12-23 07:06:00
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Could you please help me in implementing pagination for a table in vaadin? If there is any sample ,it will help me. 回答1: You can simply use the PagedTable Add-on: http://vaadin.com/addon/pagedtable 来源: https:/

Vaadin: How to make a validator accept numbers and one decimal only

怎甘沉沦 提交于 2019-12-23 05:35:10
问题 I'm trying to validate a textfield to it's only numbers and one decimal, but the decimal keeps causing the validator to go off: TextField tf = new TextField(); tf.addValidator(new RegexpValidator("^\\d+$", facilityId.getCaption() + "Only numbers and one decimal allowed.")); So I got the numbers to work, but how do I tell the validator that the "." is okay? Note: Add-Ons are not an option. 回答1: This regex should work /^\d+\.\d$|^\d+$/ Breakdown ^ - start of line \d+ - One or more digit \. -

Vaadin 7 url navigation hashbang

情到浓时终转凉″ 提交于 2019-12-23 04:58:08
问题 I'm trying to fully understand Navigation in Vaadin 7. I read the Navigator Chapter in the Vaadin book but still have some practical questions. Basically it is about using the bang (!). When do I need to set it and why? There is a view (myview) There is a parameter (param=X) The parameter is identifying a displayed label Example for browser history: I need to set the bang (!) or clicking back in the browser does not work, because the parameters is not passed the the views enter function:

How to save file in memory and read file output stream?

亡梦爱人 提交于 2019-12-23 04:47:13
问题 When I save file I use: File file = new File(filename); But, since I no longer have privileges to write to folders, I would like rather to save it to memory and then read file to FileOutputStream. I have read I can save file to memory with this approach: new ByteArrayOutputStream(); How would whole code look like? I can't figure it out how to write it properly after upload is done. Edit: I'm using Vaadins upload plugin: public File file; public OutputStream receiveUpload(String filename,

Vaadin Grid Table: how to draw border for certain columns?

让人想犯罪 __ 提交于 2019-12-23 02:44:20
问题 I'm using Vaadins Grid table for data representation. Therefore I want to draw a thick line for the right border of the Employee -ID-column and for both border sides of the name or name and surname column. The result should look like this: How I can manage that? 回答1: Continuing from where we left off in your other question regarding cell background, update your CellStyleGenerator to handle your other columns. For the sake of brevity I'll just demo a column with both borders, but you'll get

Description tooltips for Vaadin Grid header cells

回眸只為那壹抹淺笑 提交于 2019-12-23 02:41:16
问题 I'd like to define descriptions for Grid header cells, similarly to how AbstractComponent.setDescription(String description) works (i.e. tooltip shown on mouse hover). As the Grid doesn't support this in itself, I tried adding a Label component into the header cell, and then use setDescription() on the label. I can get the info tooltip working like this, but the downside is that clicking on the label component doesn't trigger sorting. If I want to sort the column, I need to click the header

Vaadin - How to open BrowserWindowOpener from a SINGLE BUTTON

谁都会走 提交于 2019-12-23 02:22:11
问题 In the Vaadin example of how to print a dynamically generated PDF they have a two step approach, first you click on the OkButton and then the PrintButton . The problem is that their code to open the PDF relies on creating a new BrowserWindowOpener which then extends the Print button in the ClickListener for the OKButton . In other words they have: okButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // Dynamically generate PDF - this is greatly

Vaadin - How to open BrowserWindowOpener from a SINGLE BUTTON

不问归期 提交于 2019-12-23 02:22:05
问题 In the Vaadin example of how to print a dynamically generated PDF they have a two step approach, first you click on the OkButton and then the PrintButton . The problem is that their code to open the PDF relies on creating a new BrowserWindowOpener which then extends the Print button in the ClickListener for the OKButton . In other words they have: okButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // Dynamically generate PDF - this is greatly