What is the difference between JavaFX scripting and Using Regular java Syntax while programming JavaFX Applications - javafx

I am looking for a detail explanation to the following question.
Can I use regular java syntax to develop JavaFX application? And if so why is the JavaFX scripting so important?

JavaFX Script was a language developed for JavaFX 1.x. It was dropped for JavaFX 2.x and is no longer supported or developed.
Can I use regular java syntax to develop JavaFX application?
Yes. All of the JavaFX 2.x system is accessible through regular Java language code running on a Java Virtual Machine. Here is a sample JavaFX program. You will notice it is just a Java application that provides a simple GUI.
And if so why is the JavaFX scripting so important?
Students studying the history of computer languages might be interested in the design of JavaFX Script's innovative binding features and declarative programming support. From a practical development point of view, JavaFX Script is completely obsolete and never used.
In addition to the standard Java API, many alternate languages, such as Ruby, Closure, Scala, JavaScript and Groovy are also able to access and use JavaFX. For scripting JavaFX applications, languages like JavaScript and Groovy take the place of the JavaFX Script language. An XML based markup called FXML replaces JavaFX Script for declarative definition of GUI scenes.
It's probably a good idea to review the JavaFX documentation in detail before asking further questions.

Related

What are the pros and cons in C++ Qt vs Eclipse RCP for cross-platform GUI development?

I am going to develop a new GUI for an existing C++ application. The application works on Windows and Linux, and the communication with GUI is through client/server.
What are the pros and cons between Eclipse RCP and Qt?
Some pros of Qt:
C++ stuff will generally perform better; however, this is arguable.
Qt is the base of Meego, the mobile platform sponsored by Intel, AMD and others; however, its current momentum seems not too high to me. This means you can also create applications for various mobile and generally embedded devices
There are a lot of Qt-based applications out there.
It has a WYSIWYG designer.
Good for small to large projects especially because of QtQuick, which allows the creation of small applications in no time and with almost zero knowledge about C++
Qt has an amazing wrapper in Python called PyQt (there is also the PySide of course), which allows rapid development and slick prototyping. People often use PyQt (or PySide) for the UI-side of a Qt application because of that. You can of course combine with ease Python and Qt in the same application taking advantage of all their strengths (but also weaknesses). This allows relatively fast and smooth development cycles even for large projects
Some cons of Qt:
The code of Qt-based applications make use of some elements that are not part of C++, which have to be converted into C++ by a special preprocessor called moc (Meta-Object Compiler) prior to the actual compilation. You and your build system have to take that into account.
Nokia (former owner of Qt, since it acquired Trollech) has sold it to Digia. However, this does not imply their involvement in the development of the open source Qt has changed.
Some pros of Eclipse RCP:
Eclipse RCP is far more than a graphical toolkit:
It sports a plugin-based architecture that can help distributing functionality among different components (plugins) and keeping control over dependencies among such components (plugins). Eclipse plugin system relies on their own implementation of the Java component system specification called OSGi.
It provides a mechanism to enable decoupled application extensibility called extension points.
There are many Eclipse plugins that you can use in your application and many of them have distribution licenses that are friendly to commercial products.
It has a WYSIWYG designer.
Some cons of Eclipse RCP:
Eclipse uses a custom windowing toolkit called SWT; on each platform it relies on the native graphical layer. On Linux, it relies on Gtk+ (although it's also possible to use Motif), which in my experience (and other's) has performance problems, mostly with widgets that are updated at high rates. Actually many of us embed Swing elements in Eclipse RCP applications to overcome performance problems while keeping Eclipse's extensible architecture; this, however, can bring integration problems. There's a version of SWT that uses Qt as backend, but its incorporation into Eclipse's codebase seems stagnated since October 2010.
Startup time (understood as the time elapsed since the application is launched until it shows up a window) of Eclipse RCP applications can be very long.
If you intend to integrate C++ stuff with Java by means of JNI, be aware that some people find it difficult.
Eclipse has lots and lots of bugs. Eclipse's bugzilla is a very useful resource for the RCP developer.
The more you want you Eclipse RCP application's look&feel and behaviour to differ from Eclipse IDE, the more troubles you will get into.
Eclipse RCP development has a big learning curve, in my opinion.
Using Eclipse RCP for small projects is basically a suicide (unless you are restricting yourself to only creating a plugin or similar). It is meant for medium to large and very large projects due to the complexity of its infrastructure, resource requirements and the above mentioned steep learning curve.
Eclipse RCP is not for mobile development because...it's RCP (Rich Client Platform). If you want to go mobile, this is not for you.
Both their distribution licenses (LGPL/GPL/commercial for Qt, EPL for Eclipse) are flexible enough for most uses, in my opinion. Nevertheless, I am not a lawyer, so I may be mistaken about that.
And of course, other factors like the experience of the developers, their technical skills, the size of the team, concrete requirements, etc, should be taken into account.
BTW, I have much experience in Eclipse RCP but only theoretical knowledge on Qt, so I may be biased/mistaken in my statements.
Now that Qt has an LGPL license I would choose Qt any day of the week over Eclipse RCP.
I have used both to create fairly complex applications.
Since you can use eclipse to develop c++, I am assuming that we are comparing mostly swt/jface vs Qt, and not the eclipse development environment itself.
Some things I have noticed having used both:
1) Qt has better documentation and samples
Other than some half-baked examples on the web, I could find little useful eclipse documentation.
2) Qt has a lot more 'professional' users
There are many professional companies out there using Qt as their UI framework. Given it's three platform support (Windows, Linux, Mac), it is very flexible, and has a lot of backing.
3) Qt tends to be more complete and mature -
Using Eclipse I noticed that quite often the controls, and packages that were available were only partially done, and not quite complete. They were typically developed for someone's use, and only coded as far as that. Qt's controls were almost always a complete design.
4) Styling.
Both Qt and Eclipse render using local platform libraries, so your UI will 'look' like other UIs on the platform you are running on (i.e. Linux vs Windows). However, Qt also provides fairly sophisticated styling functionality that allows you to easily alter the look of any control, and gives you much more control over the look of your application.
With the new declarative language (Qt 4.7.*) you are approaching WPF level of control which is really amazing.
5) UI Designer:
Qt has a much richer Designer that allows you to layout your form, and do basic testing without having to compile any code. The designer also gives you the capability to add interactions between the controls on your form. Ex. Click this button - disable this option
Eclipse also has a form designer, although my experience with it is limited. I did try to use it a couple of times with very limited success. Finally I coded every form by hand through code. That is painful.
6) Interfacing with existing source code
If you don't have this problem, then you are very lucky. Because Qt is c++ based it integrates seamlessly with legacy C and C++ code. Integrating Java and C is not easy.
7) Drawing Libraries
I tried coding some hand-drawn shapes using the swt libraries and was forced to bypass large parts of the swt drawing library, because of the cludge that was in there. Using Qt to do something similar was no trouble at all.
8) Tree and List Models
Eclipse does provide some nice out of the box functionality for propagated data into trees, and lists and things. It is almost as good in Qt, although a little trickier to set up.
9) Application Layout
Eclipse provides some nice functionality to manage 'view's (dock panels), and 'perspectives' (workflows) that if you decide to use them makes life nice and easy. Qt requires you to do this yourself. Qt does have dock panel functionality, but when building a rich application you have to set this up yourself.
Extra Note:
Qt has also provided some extra libraries to support things like xml, etc... So this helps bridge the gap a little between c++ and java for things like this.

How to foster Qt Style sheets use at work?

I'm working with a PyQt application.
My workmates work with Java and they developed a whole framework (java code + xml files) to set different and new UIs to their desktop application.
I told them that Qt has styles sheets. I showed them by example how cool style sheets are.
I did not convince them. They want me to port their java framework to python.
I want to persuade them to use qt style sheets, but I need "serious" and technical arguments.
Examples are not enough.
By using Qt, you are using a commercially backed library that has a full support staff dedicated to maintaining it, not to mention the open source community that also supports it. You do not need to spend time and effort maintaining the UI framework so you can spend more time developing UI components specific to your applications.
Trying to develop a whole UI internally is a lot of work not only in implementation but also testing and maintenance. For such complicated systems, I would always recommend using an established library over doing an internal implementation.

Flex Application Framework -- PureMVC Portability vs. Swiz?

My company is building a Flex application that we may need to port to other platforms:
Silverlight (likely)
Mobile (maybe -- iPhone: Objective-C , Android: Java, etc.)
Desktop (maybe -- AIR, .NET, etc.)
TV sets (maybe eventually)
Currently, I’m looking into application frameworks to build upon and I’m torn between pureMVC and Swiz.
I LOVE swiz for its simplicity and how it just gives you a way to hook things up and then apply your own patterns. From a flex-only perspective, this is my 1st choice.
But, PureMVC is platform-independent and has already been ported over to most of the platforms that are mentioned above. How valuable is this portability? Will it really make our lives significantly easier when it comes to porting and developing/maintaining multiple applications? If so, then it seems like PureMVC is the way to go.
Alternatively, since Silverlight has the most definite business case for porting of our application, maybe we could port Swiz to Silverlight? I'm not too familiar with which AS3 language and Flex framework features Swiz depends on and whether they are available in C#/Silvelright. Would this actually be possible?
Thanks so much!
Karthik
The way I see it, if you used pureMVC you could port to a new language, without too much trouble (other than what the new language will give you) your commands, mediators and proxies, provided you program your mediators to an interface, instead of a concrete component implementation, and the proxies use a services layer to get the data from server. That way you'll only have to implement the components and the service layer in the new language.
A quick look at the Swiz framework:
uses the flash event model (see CentralDispatcher)
uses some flash.net, and mx.rpc classes (see net and rpc swiz packages)
PureMVC framework doesn't use the flash event model, and eventual flash.net/mx.rpc references would normally appear in the service layer. On the other hand Swiz seems to be aimed at taking full advantage of flex, and the mxml format, so it might get the job done faster there. So you might also want to consider using Swiz for flex and PureMVC for the other languages.
Any framework, including Swiz, can very easily be ported to just about any language. Actionscript is touring complete, so theoretically any code writen in actionscript can be transformed into another touring complete language. For example, we use the Swiz framework in our mobile apps, which get cross compiled to run in iOS. There are many other open source cross compilers for a variety of languages, as well as Adobe's Alchemy project.
The only thing that is not easily portable in Swiz the usage of runtime metadata tags. This can be solved by using an advanced search and replace utility, or a custom transformation framework to convert custom metadata tags to their native code implementation. Hopefully we will see some cool new open source tools for this soon, now that Flex 4.5 was released with custom compiler hooks.
In short, I wouldn't even take portability into consideration when deciding on a framework. Choose the one which is most comfortable for you or your developers to use. I personally prefer Swiz myself.
Cheers!

Something to allow "Writing flex without ActionScript", or "Java to AVM2 compiler", or "Write Flex using Java" exists?

There are many dynamic languages that target Sun's JVM (Groovy, Scala, Jython, Jruby etc) and I was sure there are many that target Adobe's AVM as well. But I was surprised to find only Haxe do something similiar. related question on this site
I think the eclipse e4 SWT project doesn't compile to ABC (ActionScript Byte Code) directly, but first converts Java to AS3 and then the Flex compilter does the rest.
Could it be that no one yet wrote a simple Java / Python / Scala AVM2 compiler that can be used as an alternative to the proprietary Adobe Flash Builder (formerly Flex Builder)?
I don't mind paying Adobe for a fine producy, but writing Java in Eclipse is so much faster and convinent than the half baked Adobe plugin suite. are there really no efforts other than Haxe?
Here you go: Compiling Java and C# to SWF
I don't mind paying Adobe for a fine
producy, but writing Java in eclipse
is so much faster and convinent than
the half baked adobe plugin suite.
mxmlc (the Flex compiler) is free and open source and available as part of the Flex SDK. It compiles actionscript 3 to swf. If you want an IDE with the same level of support as writing Java in Eclipse then you will want FDT which unfortunately isn't free but is far superior to Adobe's Flex/Flash Builder. You could also use Flash Develop which is a very capable and free IDE for flash development.
AS3 is a nice language in it's own right and can compare favorably to Java (although some newer Java features like generics are sadly missing). So learning it wouldn't be "re-inventing the wheel" so much as adding another bow to your development skills quiver.
But if you are insistent on wanting to write Java code and produce swf files then I think that Joa's work that James linked to above is your best bet. I'm not sure if he has released all the parts publicly yet though...
I found out that adobe started to do something similar (but for C++): http://labs.adobe.com/technologies/alchemy/
Also this one (C# compiler) but it seems to be obsolete:
http://blog.bluetubeinteractive.com/2005/05/c_to_swf_compil.html
And there is an apparently abandoned Java Implementation: http://osflash.org/j2as
But I'm still looking for a working Java to AVM2 implementation...
Anyone? :)

Jdesktop or Qt for better Desktop application

I will make a desktop application. I searched on web which one is better. Can someone say positive and negative sides of these components.
I can add some information about QT:
QT is a well designed, portable library that covers nearly everything you'll need for a desktop application. QT covers GUI, networking, SQL, Graphics and more.
Pros:
very extensive library
high performance
portable
Cons:
It's C++
special preprocessor / make tool needed.
Setting up a QT compile environment is a little bit more difficult than setting up a C++ compile environment. C++ is - especially if you are not used to it - very difficult and the learning curve is steep. QT helps alot with appropriate helper classes (QPointer, ...) and library magic (QObjects freeing children, ...) in the background. There are bindings to other languages as well. Just to mention a few - Jambi is a binding for Java and there's a binding for python as well.
For your decision consider the following things
which programming language do you know best
which libray reduces your amout of work for this application the most
how much performance do you REALLY need. C++ code can be very fast, but there's no reason to work with manual memory management and pointers if you don't need the performance.
which library offers you the look and feel you want to have for your desktop application
If you need portability: Do you want to "compile once run everywhere" (Java) or do you want to "run your app everywhere once you compiled it for this plattform" (QT)
Here's the link to QT-Jambi Wiki: http://qt.gitorious.org/qt-jambi/pages/Home. According to Nokia: "Qt Jambi is the Qt GUI toolkit for Java developers"
Qt is the best cross platform GUI framework at the moment. It renders the widgets with a native look on each platform and it has a very easy to use API.
Using Qt doesn't mean that you have to use C++. You can program Qt in Java (Qt Jambi) or Python (PyQt) for instance.

Resources