This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

JavaFXPorts with Eclipse

Some weeks ago, Gluon released the first version of their Eclipse plugin for creating/building mobile applications with Java(FX).

We had some experience with their NetBeans plugin but our preferred IDE was Eclipse. So, an Eclipse plugin was good for us :)
The NetBeans version worked without bigger problems and we expected the same quality for the Eclipse plugin.

We followed the official installation instructions and didn't have any problem. But the problems started after we tried to create Android or iOS specific code. It wasn't possible to access javafxports, android or robovm classes, because the jar files weren't found. The classpath with NetBeans had references to all libraries, but the Eclipse project didn't have such references.

We tried to find some information in the documentation and found the NFC example application. The build file had additional dependencies for android and javafxports. We changed the build file of our Eclipse project:

dependencies {
    compile files("C:/tools/android/android-sdk_r04-windows/platforms/android-21/android.jar")
    compile "org.javafxports:jfxdvk:8u60-b3"
       
    compile fileTree(dir: 'libs', include: '*.jar')
    runtime fileTree(dir: 'libs', include: '*.jar')
}

and after some Gradle/Refresh Dependencies, Refresh All clicks, all Errors were fixed!
It was horrible, because after clicking Refresh Dependencies, nothing happened and after some more clicks, all errors were gone. Not sure if this was a Gradle project problem, or Gluon plugin problem.

Our full build script (without robovm):

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.1'

    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
}

dependencies {
    compile files("C:/tools/android/android-sdk_r04-windows/platforms/android-21/android.jar")
    compile "org.javafxports:jfxdvk:8u60-b3"
       
    compile fileTree(dir: 'libs', include: '*.jar')
    runtime fileTree(dir: 'libs', include: '*.jar')
}

mainClassName = 'com.sibvisions.mobilefx.android.DemoERPApplication'
   
jfxmobile {
    ios {
        forceLinkClasses = [ 'com.sibvisions.mobilefx.ios.**.*' ]
    }
   
    android {
      androidSdk = 'C:/tools/android/android-sdk_r04-windows'
      compileSdkVersion = 21  
    }
}

Hints
  • Enable developer options for your Android device
  • Show log messages from your Android device: \platform-tools\adb logcat

JVxEE 1.2

JVxEE version 1.2 is out!

The good news

JVxEE is now available from Maven central, that means that you can add it as dependency to your Maven projects:

<dependency>
    <groupId>com.sibvisions.jvx</groupId>
    <artifactId>jvxee</artifactId>
    <version>1.2</version>
</dependency>

The first of the two major changes are that we fixed possible exceptions that might be thrown by JPAStorage.getEstimatedRowCount(ICondition), it should now work under all situations.

The second change is the handling of foreign key columns. Previously, foreign key columns where named with the pattern "REFERENCEDTABLE_REFERENCEDCOLUMN", which can lead to collisions if there is more than one column referencing the same table and primary key. So it was possible that you would end up with two columns with the same name, which of course can't be handled by the storage and databook correctly. We devised a new naming scheme and from now on the foreign key columns are named with a combination of the referencing column and the referenced column.

An example:

@Entity public class A
{
    @Id private int id;
    private B source;
    private B target;
   
    // Getters/Setters
}

@Entity public class B
{
    @Id private int id;
    private String name;

    // Getters/Setters
}

With 1.1 the generated columns would look like this, for entity "A":

ID          BigDecimal
B_ID        BigDecimal
B_NAME      String
B_ID        BigDecimal
B_NAME      String

And with 1.2:

ID          BigDecimal
SOURCE_ID   BigDecimal
SOURCE_NAME String
TARGET_ID   BigDecimal
TARGET_NAME BigDecimal

This is definitely an improvement!

The bad news

There is always a downside :(

The changes in the foreign key column naming scheme, to avoid collisions, also mean that most foreign key columns do now have a different name. You'll have to check your code for usages of the now differently named columns.

But there is also an upside! With EPlug you will find those easily.

Usage example

JVxEE provides the possibility to utilize the Java Persistence API (JPA) as backend for storages and databooks. JPA is powered by POJOs, like these:

@Entity public class Aircraft
{
    private String country;
    private String description;
    @Id @OneToMany private String registrationNumber;
}

@Entity public class Airport
{
    @Id @OneToMany private String code;
    private String country;
    private String location;
    private String name;
}

@Entity public class Flight
{
    @OneToOne private Aircraft aircraft;
    private String airline;
    @OneToOne private Airport airportDestination;
    @OneToOne private Airport airportOrigin;
    @Id private String flightNumber;
}

This is an extremely simplified model for airline flights.

There is an aircraft that can be used, airports that can be flown to and from and the flight itself. Flight is referencing both, the aircraft and the airport. Now we only need to tell JPA about these classes by placing a persistence.xml in the META-INF directory, like this one that we use for our unit tests:

<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence              
                                 http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

             version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">

  <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
    <class>com.sibvisions.rad.persist.jpa.entity.flight.Aircraft</class>
    <class>com.sibvisions.rad.persist.jpa.entity.flight.Airport</class>
    <class>com.sibvisions.rad.persist.jpa.entity.flight.Flight</class>

    <properties>
      <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:hsql://localhost/db" />
      <property name="javax.persistence.jdbc.user" value="sa" />
      <property name="javax.persistence.jdbc.password" value="" />

      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.ddl-generation.output-mode" value="database" />
      <property name="eclipselink.logging.level" value="FINE"/>
    </properties>
  </persistence-unit>
</persistence>

(Sure, it's also possible without manual XML mapping)

Now all that is left is creating a new storage that uses the JPA:

EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("test");
EntityManager entityManager = entityManagerFactory.createEntityManager();

JPAStorage storage = new JPAStorage(Flight.class);
storage.setEntityManager(entityManager);
storage.open();

And that's it! From here on there is only JVx code.

Ein GUI für alle Fälle

Es gibt seit heute einen neuen Artikel über JVx in der deutschen Presse. Hier das Intro:

Die Erstellung von modernen und optisch ansprechenden Anwendungen ist gerade ein heißes Thema. Egal welche Fachzeitschrift oder welches Onlinemagazin gelesen wird, ein Artikel über JavaFX ist immer dabei. Wer Webanwendungen bevorzugt, findet auch ganz bestimmt einen Artikel über Vaadin. Und natürlich...

Der vollständige Artikel wurde heute auf Informatik Aktuell veröffentlicht. Natürlich lesenswert :)

Jegliches Feedback ist willkommen.

DOAG 2015 - I'm a speaker

2015-K_A-Banner-Speaker-180x150-ENGL   I'm a speaker at DOAG 2015 in Nuremberg.
My talk will be about "Mobile applications with JavaFX"

Read more.


I'll show you some really cool things with JVx and JavaFX on mobile devices. Let yourself be surprised.

Create WildFly Swarm applications from existing war files [part 2]

My first steps with WildFly swarm were very successful but I didn't solve my problem completely:

I tried to create a self-contained jar (fat jar) file from an existing war file, with minimal effort. The idea was that our product VisionX could create such jar files with some mouse clicks.

This wasn't possible because the project is in a very early phase, ANT wasn't supported and it wasn't planned.

I solved the problem for my use-case and published the result at github.

The project contains an Eclipse project with an ant task and a fully functional ANT build. It has a dependency to ivy, because ivy was used for dependency resolution. Ivy is not needed if you want to work with a copy of all dependencies, e.g. our VisionX will do this.

The code isn't production ready but it works like a charm. The test war file has 56MB and the created jar is around 78MB.

Just play around with the code :)

Create WildFly Swarm applications from existing war files

Have you heard about WildFly Swarm?

It's a new sidecar project to WildFly which helps you create self-contained Java microservices based upon the normal WildFly application-server.

Sounds interesting?

We had different use-cases for such a product. Our VisionX creates war files and desktop applications. It would be nice to have a microservice option. Our idea was to create a WildFly Swarm application based on our pre-created war files. Could be useful.

We made some experience with bundeling an embedded Tomcat with our applications because we use this variant for our desktop applications to add browser based help systems. We thought that a replacement of embedded Tomcat could reduce complexity...

The documentation was simple and maven based. The info:

We do aim to add support for other build-systems in the near future.

was nice but the relevant information wasn't available for ANT. We found some gradle tasks, but nothing for ANT - because ANT isn't supported.
What's the problem with maven? We don't like downloading the Internet for simple dependency management. This happened during our first tests with WildFly Swarm. Before we built our first "fat" jar, the "whole JBoss repository" was downloaded.

Test: Phase 1

We tried to follow the documentation and started with a new Maven "war" project. Our application was a simple JVx application with vaadin UI. The application code:

@Push
@Widgetset(value = "com.sibvisions.rad.ui.vaadin.ext.ui.Widgetset")
@Configuration({@Parameter(name = "main", value = "com.sibvisions.demos.swarm.EmbeddedApplication$MyApplication")})
@SuppressWarnings("serial")
public class EmbeddedApplication extends VaadinUI
{
    @WebServlet(value = {"/minimal/*", "/VAADIN/*"}, asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = EmbeddedApplication.class)
    public static class Servlet extends VaadinServlet
    {
    }   // Servlet

    public static class MyApplication extends Application
    {
        public MyApplication(UILauncher pLauncher)
        {
            super(pLauncher);
           
            setName("Simple application");

            setLayout(new UIBorderLayout());
           
            UILabel lblHello = new UILabel("Hello JVx' vaadinUI");
            lblHello.setFont(UIFont.getDefaultFont().deriveFont(UIFont.BOLD, 16));
            lblHello.setHorizontalAlignment(IAlignmentConstants.ALIGN_CENTER);
            //example CSS without custom css file
            ((VaadinLabel)lblHello.getUIResource()).getCssExtension().addAttribute("margin-top", "100px");
           
            add(lblHello, UIBorderLayout.CENTER);
        }        
    }    
}

We found an intro from vaadin about their tests with WildFly Swarm. The last link contains redirects to a github project with many examples and a ready-to-use maven configuration.

But, we had bad luck because no example was working with our setup. The build wasn't a problem, but we got some Exceptions at runtime. We tried to find documentation in the Internet, but we didn't find a solution because the project is in Alpha status and documentation is not yet ready... So we tried to build WildFly Swarm on our own to be able to add debug messages.

After a long maven fight (once again) everything was working. We had some problems with JDK 8 and Eclipse Kepler because Kepler didn't support JDK8 without a Patch and bundled maven was too old. Latest maven didn't work with Eclipse but 3.2.1 was working...
WildFly Swarm test artifacts didn't work without problems and we had to fix some autoboxing errors (because of our custom compiler settings). Horrible but we won the fight!

The problem with our "fat" jar was that two dependencies were missing or weren't resolved correctly. After we manually set two more dependencies:

<dependency>
  <groupId>org.jboss.msc</groupId>
  <artifactId>jboss-msc</artifactId>
  <version>1.2.6.Final</version>
</dependency>
<dependency>
  <groupId>org.jboss.spec.javax.sql</groupId>
  <artifactId>jboss-javax-sql-api_7.0_spec</artifactId>
  <version>1.1.0.Final</version>
</dependency>

our "fat" jar was working without problems.

BUT... the jar had about 100 MB! Our war file had about 40MB. The overhead was about 60MB - WTF?
Our applications with embedded Tomcat had an overhead of 4MB.

The problem was/is that all maven dependencies were added to the war and the jar file. It was handled by the swarm-plugin and the issue #107 explains the problem.

After one day! we had a working Hello world example as Maven project. Sure, we built our own WildFly Swarm version too.

Test: Phase 2

The Maven project was working and maven built a war for our sources and bundled all dependencies for us, but what about existing war files? Our initial plan was the creation of WildFly Swarm applications for existing war files. This wasn't possible without hacking because it wasn't implemented... for us.

I told you that we built our own WildFly Swarm version and also the swarm-plugin. The plugin had a PackageMojo class. This mojo had enough documentation (= source code) for us, to create a simple test case for our use-case.

The test class is about 100 LoC with minimal logic but it's tricky. The relevant calls:

BuildTool tool = new BuildTool();

for (File jar : findMinimalDependencies())
{
  //read groupid, artifactid, version from jar

  tool.dependency("compile", sGroupId, sArtifactId, sVersion, "jar", null, jar);
}

tool.artifactResolvingHelper(new Resolver(tool));
tool.projectArtifact("com.sibvisions.demos", "swarm", "0.2-SNAPSHOT", "war", war);
tool.build("swarm-0.2-SNAPSHOT", target);

The Resolver was a simply code copy of BuildTool findArtifact method:

public class Resolver implements ArtifactResolvingHelper
{
    private BuildTool tool;
   
    public Resolver(BuildTool pTool)
    {
        tool = pTool;
    }

    @Override
    public ArtifactSpec resolve(ArtifactSpec pSpec) throws Exception
    {
        for (ArtifactSpec each : tool.dependencies())
        {
            if (each.file == null) {
                continue;
            }
           
            if (pSpec.artifactId != null && !pSpec.artifactId.equals(each.artifactId)) {
                continue;
            }

            if (pSpec.version != null && !pSpec.version.equals(each.version)) {
                continue;
            }

            if (pSpec.packaging != null && !pSpec.packaging.equals(each.packaging)) {
                continue;
            }

            if (pSpec.classifier != null && !pSpec.classifier.equals(each.classifier)) {
                continue;
            }

            return each;
        }

        return null;
    }  
}

(Sure, not the best solution - but it was good enough for our tests)

With our test class, it was possible to create a WildFly Swarm application for an existing war file, without problems and without maven. And the best: The "fat" jar file had about 83MB and the original war file was about 60MB. The overhead was 23MB, but awesome for a basic WildFly installation.

The example project of Phase 1 is available on github.

Conclusion

WildFly Swarm is a nice product but it's not ready-to-use. If you have time to play around with it, just do it because it creates a back to the roots feeling - back to hacking. The "fat" jars are a nice idea, but microservice is just a buzzword.

WildFly is not comparable to embedded Tomcat, but if you need a simple application server for your servlets, an embedded Tomcat or Jetty are good enough. We won't replace our embedded Tomcat with WildFly Swarm because we misunderstood the concept and both products are for different use-cases.... but a new export Option for VisionX should be possible!

JVx' Vaadin UI 1.3 is available

The next release of our JVx' vaadin UI is available. It's not a big update but an important one because vaadin was updated to 7.5.0 and we support CORS out-of-the-box. We also have some annotations for easier application deployment.

The best thing for most of you is that starting with 1.3 our vaadin UI can be found on maven central.

Simply add the dependency:

<dependency>
    <groupId>com.sibvisions.vaadin</groupId>
    <artifactId>jvxvaadin-server</artifactId>
    <version>1.3</version>
</dependency>

We also upload snaphsots of vaadin UI, starting with current 1.4 branch
Simply configure the repository:

<repository>  
    <id>sonatype-nexus-snapshots</id>    
    <name>Sonatype Snapshots</name>  
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>

and use following dependency:

<dependency>
    <groupId>com.sibvisions.vaadin</groupId>
    <artifactId>jvxvaadin-server</artifactId>
    <version>1.4-SNAPSHOT</version>
</dependency>

The release files are also available on SourceForge.

The complete Changelog.

VaadinUI without web.xml

We've added some annotations to our vaadin UI to support UI configuration without web.xml (deployment descriptor).

Check this:

@Push
@Widgetset(value = "com.sibvisions.rad.ui.vaadin.ext.ui.Widgetset")
@Configuration({@Parameter(name = "main", value = "MinimalApplication$MyApplication")})
@SuppressWarnings("serial")
public class MinimalApplication extends VaadinUI
{
    @WebServlet(value = {"/minimal/*", "/VAADIN/*"}, asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = MinimalApplication.class)
    public static class Servlet extends VaadinServlet
    {}

    public static class MyApplication extends Application
    {
        public MyApplication(UILauncher pLauncher)
        {
            super(pLauncher);
           
            setName("JVx application");
            setLayout(new UIBorderLayout());
           
            add(new UILabel("Hello JVx' vaadinUI"), UIBorderLayout.CENTER);
        }        
    }
}

The example demonstrates a minimalistic JVx application with vaadin UI. It's like a standard vaadin application with one additional annotation:

@Configuration({@Parameter(name = "main", value = "MinimalApplication$MyApplication")})

The main parameter defines the JVx application class. It's the inner class MyApplication, in our example.

It's that easy!

VisionX 2.2 is out

What a day!
Our final release of VisionX 2.2 is out and it's the best piece Software we've ever released.

We worked very hard during the last 5 months to reach our goals and to make it happen. The new version brings many new productivity features and contains many bugfixes. The focus was and is still on end-users. But in VisionX 2.2, we have many new features for Software developers and Oracle Forms users as well. It depends on your license if you see more or less options.

So what's new? First, VisionX is compatible to Java 8 and can handle Lambda expressions without problems. This isn't relevant for end-users but for all developers. VisionX 2.2 still runs with Java 7 but it's no problem to switch the Java version to 8.

VisionX 2.2 has our brand new JavaFX UI integrated. If you have Java8, it'll be possible to start your applications as JavaFX applications or to export JavaFX standalone applications.

The new release is based on JVx 2.3.

So let's talk about Features

  • Java 8 support

    VisionX reads Java 8 syntax and if your project was set to target version 1.8, VisionX will create action listeners with lambda syntax. VisionX got new global configuration options:

    <options>
        <java>
          <source>1.8</source>
          <target>1.8</target>
          <compliance>1.8</compliance>
        </java>
      </options>

    It's also possible to configure single applications via Eclipse settings, for Java 8. The configuration will be read from VisionX automatically.

  • Vaadin 7.5.0

    VisionX 2.2.403 includes our current vaadin UI and it's based on vaadin 7.5.0.

  • OpenShift

    VisionX supports application creation for OpenShift. You'll need a special license for this feature. The integration contains a new wizard and is available as new option in new application wizard.

    OpenShift

    OpenShift

    OpenShift - New application

    OpenShift - New application

  • Multi-IDE support

    VisionX 2.2.403 creates project files for Eclipse, NetBeans and IntelliJ. Simply open existing projects and start coding.

  • Config file encryption

    It's now possible to encrypt configuration files.

    Config encryption

    Config encryption

  • Corporation style

    VisionX applications have a new UI style for web mode. It's the corporation style for applications with many screens and big menus. Simply switch the style via VisionX.

    Corporation style

    Corporation style

  • Edit JDBC Url

    VisionX supports custom JDBC Urls (Developer feature). This feature could be relevant if you have an Oracle RAC or complex JDBC parameter.

    Edit JDBC Url

    Edit JDBC Url

  • JavaFX UI

    VisionX got support for JavaFX applications. Simply start the live preview or create a desktop JavaFX application in three clicks.

    JavaFX Live Preview

    JavaFX Live Preview

    JavaFX desktop application

    JavaFX desktop application

  • New deployment modes

    VisionX supports WildFly 9, IoT applications and latest Tomcat versions.

    Deployment modes

    Deployment modes

  • Edit panel (aka Morph panel)

    The Edit panel is a brand new component. It's also called Morph panel because it changes the style.

    Inline mode

    Inline mode

    Popup mode

    Popup mode

    Split mode

    Split mode

    Tabset mode

    Tabset mode

    You can use this panel to show e.g. a table of records and open detailed information as popup, as replacement of the table or show the details as split or tabset. Don't change the screen to show different modes.

  • More features

    Use custom css files for your web application,
    Use mobile preview applications available for Android and iOS,
    Spreadsheet reports will be created as XLSX instead of XLS,
    Full CORS support for your web application,
    Full CORS support for application logic called via REST, ...

Simply try out our new VisionX.

If you're already customer, please check your download area!

Have fun with our new VisionX release - it's really powerful.

EPlug 1.2.1 is out

A new version of EPlug is available. It's a smaller bugfix release.

Changes:

  • Fixed that all dialogs (including trial) would not be displayed
  • Resource detection for Maven projects should now work correctly
  • Fixed NullPointerException, if "check databooks while typing" was active and a file was edited that was not a Java file
  • Fixed possible NullPointerException in the DataBooksView
  • "Auto Reload" and Auto Select" are now properly disabled if EPlug is not active on the project

Simply "Check for updates" in your Eclipse IDE.