EzDevInfo.com

vaadin

Vaadin is a Java framework for building modern web applications that look great, perform well and make you and your users happy. Vaadin – User Interface Components for business apps - vaadin.com

Vaadin authentication best practice

I am interested in the best practice in authentication in Vaadin I think there is mainly two option here:

  • ThreadLocal (can cause Out of memory, can have the same thread for different users)
  • Spring Security + Vaadin integration (seems a little too much)

Which one do you prefer and why? (Security issues, easy development, other factors)


Source: (StackOverflow)

Java to clojure rewrite

I have just been asked by my company to rewrite a largish (50,000 single lines of code) Java application (a web app using JSP and servlets) in Clojure. Has anyone else got tips as to what I should watch out for?

Please bear in mind that I know both Java AND Clojure quite well.

Update

I did the rewrite and it went into production. Its quite strange as the rewrite ended up going so fast that it was done in about 6 weeks. Because alot of functionality wasn't needed still it ended up more like 3000 lines of Clojure. I hear they are happy with the system and its doing exactly what they wanted. The only downside is that the guy maintaining the system had to learn Clojure from scratch, and he was dragged into it kicking and screaming. I did get a call from him the other day saying he loved Lisp now though.. funny :)

Also, I should give a good mention to Vaadin. Using Vaadin probably accounted for as much of the time saved and shortness of the code as Clojure did.. Vaadin is still the top web framework I have ever used, although now I'm learning ClojureScript in anger! (Note that both Vaadin and ClojureScript use Google's GUI frameworks underneath the hood)


Source: (StackOverflow)

Advertisements

wicket vs Vaadin

Am torn between wicket and vaadin. i am starting a micro-isv and need to make a choice of web framework. I have narrowed down my choices to wicket and vaadin. I have used both frameworks and i love them both. however i need to make a choice.

If i choose vaadin:

  1. I wont have to worry much about the look and feel.It comes with nice themes
  2. I will do all my programming in java which am very good at and wont have to spend time hacking css which am not very good at
  3. And most of the components that i will need for a business applications are there OUT OF THE BOX including, desktop like layout, tooltips, Keyboard shortcuts, tables with draggable and collapsible columns to name a few. How ever , if i go the vaadin way:
  4. i will loose the ability to create UI declaratively.
  5. I wont have the fallback feature if the browser doesnt support javascript - e.g most non webkit mobile browsers.
    1. Vaadin company is selling some components - e.g the JPAContainer so am not sure the company will be committed to offering full opensource framework. Business interests will always come first.
    2. vaadin applications will be mostly for the intranet. not very suitable for the internet with a web look and feel.

If i go the wicket way: I will have to style my applications and i can hardly give them a desktop look and feel.

Any advice. anyone with experience on either framework kindly tell me the cons and pros and how you made your decision.


Source: (StackOverflow)

Add javascript/Jquery & client side code in Vaadin 7

I have 3 questions:

  1. Each and every action in Vaadin makes a call to the server. is there a way to avoid calls to server for every actions? like having a code at client side for particular actions that is used many times? Like in CSValidation add-on.

  2. I want to know how to add Javascript/JQuery in Vaadin 7. It seems easy in Vaadin 6. But, I couldn't get it working in Vaadin 7. I hope they would have made it more easy now. Can anyone show me some examples regarding this. If it is JQuery, It will help me a lot.

  3. And also will

    Javascript.getCurrent().execute("");

'execute the javascript' or 'add specified script' in to the code. Will this help me to solve my 2nd question?


Source: (StackOverflow)

Vaadin session setMaxInactiveInterval UI response inconsistant

I have set the max inactive interval for Vaadin session as following.

VaadinSession.getCurrent().getSession().setMaxInactiveInterval(60); 

Added a session destroy listener as following for testing.

    servletService.addSessionDestroyListener(new SessionDestroyListener() {
    public void sessionDestroy(SessionDestroyEvent event) {
        System.out.println("SESSION TIMEOUT");
    }
});

This listener get called at the desired time on the server side. However I cannot see "Session Expired" message on the browser side at the same time. Normally it gets displayed between 4th and 5th minutes. Is there a way to get both of these at the same time in a consistent manner.

Also note that we are not using push and it is not an option for us at the moment.

Doing client side polling will reset last active time of the sessions and can keep the session active forever if poll interval is lesser than maxInactiveInterval.


Source: (StackOverflow)

Vaadin JpaContainer

I'm working this JPAContainer + Hibernate and it takes a long time to load. For example page with SQLContainer loading 60ms and same page with JPA Container loading 1.30s.

With JPAContainer in console I see many SQL queries - for each entity - query; Entity Person does not have links to other tables;

Code with jpacontainer:

JPAContainer<Person> container = JPAContainerFactory.make(Person.class,
            "persistence-unit");
table.setContainerDataSource(container);

Code with SQLContainer:

JDBCConnectionPool pool = null;
    try {
        pool = new SimpleJDBCConnectionPool("org.postgresql.Driver",
                "jdbc:postgresql://127.0.0.1:5432/postgres", "postgres",
                "pwd");
    } catch (SQLException e) {
        e.printStackTrace();
    }
    TableQuery tq = new TableQuery("Person", pool);
    SQLContainer sqlContainer = null;
    try {
        sqlContainer = new SQLContainer(tq);
    } catch (SQLException e) {
        e.printStackTrace();
    }
table.setContainerDataSource(sqlContainer);

My persistence.xml file:

<persistence-unit name="persistence-unit" transaction-type="RESOURCE_LOCAL">

  <jta-data-source>java:jboss/datasources/mfc-frontendDS</jta-data-source>

  <properties>
     <!-- Properties for Hibernate -->
    <property name="hibernate.archive.autodetection" value="class"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.format_sql" value="true"/>
    <property name="hibernate.use_sql_comments" value="true"/>
    <property name="hibernate.hbm2ddl.auto" value="update"/>
    <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
    <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" /> 
  </properties>

What am I doing wrong?


Source: (StackOverflow)

Java Web Application for 5000~ Users

For the first time (hopefully not the last) in my life I will be developing an application that will have to handle a high number of users (around 5000) and manage lots of data. I have developed an application that manages lots of data (around 100~ GB of data, not so much by many of your standards), but the user count was pretty low (around 50).

Here is the list of tools / frameworks I think I will be using:

  • Vaadin UI framework
  • Hibernate
  • PostgreSQL
  • Apache Tomcat
  • Memcached (for session handling)

The application will mainly be run inside a company network. It might be run on a cluster of servers or not, depends on how much money the company wants to spend to make its life easier.

So what do you think of my choices and what should I take caution of?

Cheers


Source: (StackOverflow)

Minimal example of Push in Vaadin 7 app ("@Push")

I want to see the most minimal example of using the new Push technology in Vaadin 7, such as the new @Push annotation.

I am having problems getting server-push to work in my app. I would like to try a simple example app before trying to fix my own app.


Source: (StackOverflow)

Vaadin - Iterate over components in a layout

I'm working on a project in Vaadin 7. In that I need to parse over all the components in a Layout and find a component I need.

enter image description here

The above is the pictorial representation of my layout.

I'm dynamically creating the green coloured Vertical layout inside blue coloured Vertical layout. Since I'm creating them dynamically, I can't have any instance for those dynamically created things. But, I have unique ID's for all the components.

Now I need to find a Combobox using the Id. I donno how to parse in to the combobox from the Blue coloured vertical layout.

All I have is an instance of the blue coloured vertical layout and Id's for combobox. And, I can have ID's for green and red layouts too if needed.

I need something like this, But stuck..

Iterator<Component> iterate = blueMainLayout.iterator();
Combobox cb;
while (iterate.hasNext()) {
Component c = (Component) iterate.next();
cb = (Combobox) blueMainLayout.....;
        if (cb.getId().equals(something.getId())) {
            // do my job
        }
    }

Source: (StackOverflow)

How to specify a button to open an URL?

I want to write a web application that triggers the default email client of the user to send an email.

Thus, I created a Link, that leads to an URL conforming to the mailto URI scheme (http://en.wikipedia.org/wiki/Mailto):

Link emailLink = new Link("Send Email", 
    new ExternalResource("mailto:someone@example.com"));

However, instead of using a Link, I want to provide a Button that allows to trigger the respective functionality. But, for buttons I cannot set an ExternalResource to be opened.

Does anybody know to solve this problem for Buttons, or how to create a Link that looks and behaves exactly like a button? I also tried some CCS modification but did not manage the task by myself. I also found some solutions for former Vaadin versions (https://vaadin.com/forum/#!/thread/69989), but, unfortunately they do not work for Vaadin 7.


Source: (StackOverflow)

Should I use Vaadin Framework [closed]

I just tried to play with Vaadin Framework and it seems to me very easy to use. Plus what I like about his framework is that it is built on top of GWT. What do you think, should I continue using this framework or it's better to stick with GWT.


Source: (StackOverflow)

Is is possible to use jQuery inside of Vaadin framework?

As Vaadin is a Java web application framework, so is it possible to insert the jquery javascript snippet in the Vaadin java code?


Source: (StackOverflow)

How to integrate maven generated vaadin project into eclipse vaadin plugin?

Eclipse Vaadin plugin has cool autobuild feature. Just clicking "restart application" in debug console will bring up to date application version to live.

Unfortunately importing maven generated vaadin project(using m2e) and copy-pasting .project buildCommands and natures from vaadin eclipse plugin generated project does not works.

I'm unnable to "Run on server...", tomcat does not deploy app for unknown reason. I can see app in wtpapps folder but it still does not deploys.


Source: (StackOverflow)

Grails with Vaadin plugin, is it the right choice?

For my organization I am evaluating RICH technologies for our next projects. We are currently using grails 2.1.0 and very happy with that, especially with groovy and gorm and we would like to stay with that. The idea is to extend grails with some RICH framework/library. Currently I am evaluating: grails plugin for ZK, grails plugin for Vaadin, knockoutjs, angular.js, ember.js.

I already received a feedback from my colleagues who worked with ZK (no grails) and their conclusion was: cool, but forget performances, ZK goes to the server every time you do something at client side.

My question is: is this also true with Vaadin (plugin for Grails) ? How does it react with heavy single page applications? and what about Bambi? can this be an option?

On paper grails + Vaadin is what we need: we want to write groovy/java, not xml and surely not javascript. Is this the right choice?

I know my question is very generic, but I am just at the beginning of the evaluation... Thank you for your attention!


Source: (StackOverflow)

Maven build error: Failed to execute goal, missing a class

I'm trying to package the sample application from vaadin 7.0.0 with the maven plugin for eclipse, but every time a run the goal "package", building fails with the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project essai: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile: org/codehaus/plexus/compiler/util/scan/InclusionScanException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Benoit/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar
[ERROR] urls[1] = file:/C:/Users/Benoit/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

The result of mvn package -X is here: http://pastebin.com/jk5uW8Ut

My pom.xml is the following: http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.mycompany essai war 0.0.1-SNAPSHOT Vaadin Web Application

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <vaadin.version>7.0.0.rc2</vaadin.version>
    <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
</properties>
<repositories>
    <repository>
        <id>vaadin-addons</id>
        <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
    <repository>
        <id>vaadin-snapshots</id>
        <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>vaadin-snapshots</id>
        <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>
<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-server</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client</artifactId>
        <version>${vaadin.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-themes</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
        <!-- directory is cleaned properly -->
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>src/main/webapp/VAADIN/widgetsets</directory>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.plugin.version}</version>
            <configuration>
                <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                <!-- <runTarget>mobilemail</runTarget> -->
                <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This 
                    way compatible with Vaadin eclipse plugin. -->
                <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
                </webappDirectory>
                <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets
                </hostedWebapp>
                <noServer>true</noServer>
                <!-- Remove draftCompile when project is ready -->
                <draftCompile>false</draftCompile>
                <compileReport>true</compileReport>
                <style>OBF</style>
                <strict>true</strict>
                <runTarget>http://localhost:8080/</runTarget>
            </configuration>
            <executions>
                <execution>
                    <configuration>
                        <!-- if you don't specify any modules, the plugin will find them -->
                        <!-- <modules>     <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module> 
                            </modules> -->
                    </configuration>
                    <goals>
                        <goal>resources</goal>
                        <goal>update-widgetset</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>
                                        vaadin-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [7.0.0.rc2,)
                                    </versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>update-widgetset</goal>
                                        <goal>compile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</project>

I'm new to maven and even if I found many post about this error, I haven't been able to understand what could cause this error.


Source: (StackOverflow)