vaadin7

Vaadin - center custom component

情到浓时终转凉″ 提交于 2020-01-04 17:39:12
问题 Using Grails 2.3.9 and Vaadin plugin 7.3.9 class MyUI extends UI { @Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout() layout.setMargin(true) SignInForm signInForm = new SignInForm() layout.addComponent(signInForm) layout.setComponentAlignment(signInForm, Alignment.MIDDLE_CENTER) layout.setSizeFull() setContent(layout) } } Custom component class SignInForm extends CustomComponent { Panel p = new Panel() public SignInForm() { p

How can I force Vaadin client engine to retry sending requests to the server?

六月ゝ 毕业季﹏ 提交于 2020-01-02 05:24:10
问题 I'm experimenting with the Vaadin Java framework at the moment and I've noticed that the client engine does not retry sending requests to the server. When mobile internet network is weak or inconsistent it would be good to keep retrying sending of requests rather than giving up. Does any one know how to achieve this in Vaadin? 回答1: Extending ApplicationConnection and overriding doAjaxRequest should be enough to achieve what you're trying to do. Something like this: public class

How to close a Vaadin subwindow on mouseclick outside of the window?

安稳与你 提交于 2020-01-01 10:56:39
问题 I'm using vaadin 7 and in my application I use subwindows sometimes. In one case I have a modal window with several components in it. It opens another window when clicked on some of the components inside the modal window. I'd like this window to close automatically when the user clicks outside of it (e.g. on the modal window again). In the Vaadin Sampler this behaviour seems implemented when showing the source (click on the source button in the right upper corner). Also the behaviour should

@PreserveOnRefresh - Purpose and need?

 ̄綄美尐妖づ 提交于 2020-01-01 03:23:49
问题 I have a doubt regarding the purpose of @PreserveOnRefresh annotation. What is the purpose of this particular annotation and what are the scenarios in which it has to be used? What are the effects of using/not using this annotation? Thanks, Daniccan VP 回答1: The other answer is not quite correct as noted in the comments (summarized here). Vaadin 7 This Answer applies to Vaadin 7. Vaadin 6 is different in some ways. Session Is On-going As soon as a user’s browser reaches your Vaadin app, a

Both ENTER shortcut and TextArea in Vaadin

五迷三道 提交于 2019-12-31 01:58:09
问题 TextField f = new TextField(); Button b = new Button("Save"); b.setClickShortcut(KeyCode.ENTER); // For quick saving from text field itself TextArea longText = new TextArea(); // "Enter" is garbled here Hot to make the shortcut to work only in the from text field? 回答1: Use focus and blur listeners to remove and add the shortcut key: f.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { b.setClickShortcut(KeyCode.ENTER); } }); f.addBlurListener(new

Doubleclick listener on Vaadin Grid

心已入冬 提交于 2019-12-25 18:09:20
问题 How do I add a 2x click listener on a vaadin grid? When I 2x click on it, it takes me to another page. Example would be most appreciated. 回答1: With the MouseEvent you can simply ask for a double click. See here #MouseEvents.ClickEvent.html#isDoubleClick() 回答2: Here is an example: grid.addItemClickListener(listener -> { if (listener.getMouseEventDetails().isDoubleClick()) // pass the row/item that the user double clicked // to method doStuff. doStuff(l.getItem()); } ); 来源: https:/

How to open a vaadin combobox programmatically

允我心安 提交于 2019-12-25 12:47:51
问题 I have implemented a poor-mans-searchbox using a combobox. The search expression is typed into the textfield and the user press enter. Then the search expression is added to the combo model, this is caught in the eventhandler which then runs the search, empties the combo list and populates it with the searchresults instead. However, the user then need to open the combo list manually (by pressing the little down-arrow) to see the result. It'd be nice to open the list automatically, but I haven

Internationalization in Vaadin with property file

荒凉一梦 提交于 2019-12-25 08:47:58
问题 I found a useful example for internationalization in Vaadin. Here is online-demo for this. I tried with combobox for locale change as .. private Locale localeMyanmar, localeEnglish; private static final String LOCALE_COOKIE = "locale"; ....... localeMyanmar = new Locale("my", "Burmese"); localeEnglish = Locale.ENGLISH; ......... final ComboBox cbLanguage = new ComboBox(); cbLanguage.addStyleName("comboIconCaption"); cbLanguage.setNullSelectionAllowed(false); cbLanguage.setImmediate(true);

What is the difference between elemental.json and com.google.json library?

佐手、 提交于 2019-12-25 04:29:53
问题 Why do we have elemental.json library over com.google.json? I'm struggling with the creation of JsonArray in Vaadin 7. In Json.createArray() there is no add method. How can I create a json array? I want to create an array like: var shapeArray = [ {type: 'rectangle', x:50, y:50, width : 50, height: 50}, {type: 'circle', x:75, y:150, r : 20}, {type: 'rectangle', x:50, y:200, width : 100, height: 20}, {type: 'circle', x:75, y:300, r : 30}, ]; Am I missing something? 回答1: As per this official

What are the jars necessary to bean validation?

烈酒焚心 提交于 2019-12-25 02:05:52
问题 I'm trying validating my beans using bean validator. The problem is I don't know which libraries(jar) are necessary to validation. I'm using. Vaadin 7, BeanFieldGroup and EclipseLink /** class of MyBean */ public class MyBean{ @Id @GeneratedValue private Long id; @NotNull @NotEmpty @Size(min=5, max=50, message="Min = 5 and Max = 50, this field is not empty") private String name; @Email @NotEmpty private String email; } Any idea ? 回答1: Follow these step-by-step instructions on how to download