Im working on coding a WYSIWYG document designer. The basic intent of this designer is to be capable of both reading(loading) and creating multiple documents written in a variety of templating languages (ZPL, XSL-FO etc).
Now for the sake of building a WYSIWYG designer, i plan to have an elegant UI which the user can play around with to create/edit the document.
The compulsory needs of the UI is that --
The UI should be such that the user must be able to pick or
choose elements and be able to drop them off on the UI. Once
dropped, the position of the elements should be capable of allowing
repositioning.
The UI must associate the spatial postioning of elements to the
element's metadata (say, x coordinate,y coordinate, height ,width
etc).
The UI must be capable of seamlessly passing on the elements and
their spatial positions to a backend module,written in Java, that
would wither edit or create the document in the specified templating
language.
Im having trouble in deciding what to implement the UI in. I tried Swing and found it to be not great(was pretty rigid for my needs). Any suggestions with regard to what can be used to build the UI described above would be of immense help.
Your underpinnings options are pretty much Swing or SWT.
Not sure what you mean by "rigid"; Swing is a pretty good GUI framework architecturally, although some prefer SWT. Not sure how JavaFX will end up, but it has some nice features.
XUI layers on top. Or take the Griffon approach, although I'm not sure it's a great fit for the type of application you're working on. Or use Groovy/JRuby/etc. to make many aspects of working with Swing/etc. less painful.
IIRC there are Java bindings for QT as well, if the QT licensing works for you.
Perhaps you'll be better served by some rich client platform (RCP) like Eclipse or NetBeans. Both are probably best known as IDEs, but the IDEs are actually built on top of the respective platforms. Using an RCP will take a lot of responsibility out of your hands. Existing plugins/modules can be made to interoperate with your code and facilities such as perspectives (Eclipse) or rearranging panels are accounted for.
Like Dave Newton hinted at, JavaFX could also be a candidate. JavaFX 2.0 is now out and no longer requires the scripting language used in 1.0, instead opting for a Java API that'll feel more natural to experienced Java developers. And it can be used within Swing.
Related
Technically it has been "possible" to create a javafx/groovyfx based griffon application for quite a while.
How does swing compare to javafx nowadays ?
Can the latter be generally recommended for a fresh application without legacy baggage ?
Any gotchas to watch out for ?
How is the relationship griffon + javafx/groovyfx doing in general ?
JavaFX is the successor to Swing, and has many advantages over Swing, including:
A scene graph in which all nodes (e.g. UI components, shapes, images, containers) reside. This provides the ability to manipulate the properties of any node in UI with the result of affecting its contained nodes. For example, a Group containing some images may be rotated as a unit by applying a rotate transformation on the Group. Compare this to Swing, in which the UI is comprised of two separate worlds: UI Components and Java2D.
The WebView node is a WebKit port that that lets you embed a web browser in the scene graph.
CSS may be used for skinning the UI
FXML may be used to define the UI separately from the application logic. SceneBuilder, whose output is FXML, is a tool for drawing a UI.
There are currently some features that Swing developers mention that they miss, but you can take a look at the OpenJFX project http://openjdk.java.net/projects/openjfx/ and participate in this very active community to influence and contribute to future versions of JavaFX.
You may be interested in a technology position paper written by Björn Müller of CaptainCasa.com entitled "Why we use JavaFX" that discusses their architecture, including their decision to move from Swing to JavaFX
http://captaincasa.blogspot.com/2013/01/why-we-use-javafx-paper.html
I hope this helps, and welcome you to check out the JavaFX Community site at javafxcommunity dot com to see the latest blog posts from JavaFX developers.
Regards,
James Weaver
Oracle Java Technology Ambassador
I can recommend use javafx instead of swing. It's easy to learn and the apps look much better. I've made several applications using javafx with griffon at my work and I haven't been problems.
Why, Where, and How JavaFX Makes Sense
http://www.oracle.com/technetwork/articles/java/casa-1919152.html
Pretty soon now, we're gonna need to develop a GUI for creating configurations (more like scripts, to be honest) for our EAI solution at work. Think of a typical workflow editor. The visualization of the actual flows will most likely be a completely custom job, either in Swing, SWT or JavaFX 2. What I have trouble with choosing is whether to do everything else by ourselves or using a rich client platform.
In particular, I've noticed that JavaFX 2 is getting a lot of attention and seems to be really pushed by Oracle as the next big thing in the Java GUI landscape. The demonstrations look interesting and perhaps this newer API is more closely focused on productivity as opposed to the tons of boilerplate code that Swing tends to impose. Using a newer technology that gets a lot of support seems like a safe bet for future maintenance.
Using an RCP would have definite benefits for this project. Whether we go for Eclipse or NetBeans as the platform, having existing plugins/modules for viewing the underlying (XML) config, version control etc. would offer powerful functionality with minimal work. I also like the idea of having project types of our software next to Java projects in the same GUI. Even simple stuff like window management and customly arranging panels is much better handled by RCPs that what we could whip up.
So the question now is, what technology or combination thereof is viable? My options, as far as I can see, are thus:
Eclipse. I'm not too eager for using SWT, though, since I'm more familiar with Swing. NetBeans is also my primary IDE and I'm most familiar with it. It always felt more intuitive too.
NetBeans. This'd allow development of custom components in Swing. A lower learning curve for me.
NetBeans + JavaFX 2. This idea appeals to me... Use NetBeans for the RCP goodness and using JavaFX 2 for custom components. JavaFX 2 apparently integrates with Swing, but how well can this be done within NetBeans?
Swing or JavaFX 2. Do all the GUI work ourselves or use some existing framework(s) to get most of what an RCP offers. This seems like a lot of work but also offers superb control. I'm a bit loathe to try this in Swing. How well would JavaFX 2 suit itself to this?
Basically my only GUI experience is in Swing on small apps. This is the first time I'll be going for something that would warrant a RCP. But JavaFX 2 seems the way forward and I don't want to miss the boat on that one. If Swing might be on the way out, I'd prefer hopping onboard the newer technology.
If there are people who can share their experiences, have tried something like NetBeans + JavaFX 2 or are closer to the forefront of JavaFX and can recommend/discourage its use for this sort of thing I'd be most interested.
I realize it's a somewhat open question, but I can't really think of a more appropriate place. I'm not looking for a "what's the best RCP / is JavaFX better than Swing" debate. I'm looking for valid points for/against their use in this context.
My opinion in few lines,
JavaFX2 can be integrated into Swing and SWT applications into a panel/container.
Swing doesn't provide a structured architecture to deal with multi components applications, Eclipse RCP does but it's heavier and sometimes too complex (WindowWorkbench etc..) and hard to customize.
If you have a good UI Designer in your team (Developer or Graphic Designer) you should begin to work on an application Full JavaFX2 with a simple but powerful framework (like JRebirth or a custom one you can build on your own way).
JavaFX will be the Java UI Standard for years to come, It could'nt be a bad choice, thus its architecure is pretty good and powerful
Moreover javaFX2 could be used into a browser and/or deployed online with help of JNLP.
Don't bother you to learn complex undocumented framework (like EclipseRCP), create Yours !! and be free to make the application your client need :D
I worked 3 years on Swing Appz, 2 years on Eclipse RCP, and 2 years on Flex/Silverlight/JavafX apps
Here some points and (personal) opinions for helping you determining a proper solution for your current situation:
Eclipse vs. Netbeans
Personally, I dont't like big discussions about pros/cons of IDEs. Just use the one you feel most comfortable with. If you work in a team, make a voting. Considering Swing both IDEs are fine (IMHO Netbeans has the better GUI builder). Considering JavaFX 2.0 both IDEs are also fine but both share the absence of a GUI builder. I wouldn't recommend a mixture of IDEs.
JavaFX 2.0 vs. Swing vs. SWT vs. Eclipse RCP
Well, I don't - I even can't - want to tell you which of the above listed UI technologies is best since I don't know enough about your project's environment - experience, human resources, budget, timeline etc. Having a lean timeline and a team(?) of experienced Swing developers should lead the decision to Swing. Same for SWT and Eclipse RCP. Cutting edge developers might tend to try JavaFX. I agree, JavaFX gets a lot attention and you get great looking demonstrations, but keep in mind, that using JavaFX requires - additionally to the JRE - the JavaFX runtime on each client.
Hope this helps.
We switched to javaFx due to FXML usage,you can use MVC pattern ,you can add javascript and css init,but it seems slow when changing page
I want to develop web sites rapidly with good looking easy to use components when needed.
I like python and java both (each with its own strengths).
from my small research it looks to me like i would like to use django for the general web sites framework (models, views, some generic apps like login, registration, comments).
and if i need like cool gadgets/components on my web site like some cool select boxes combo boxes etc i will use SmartGWT (assuming its possible to integrate it seamlessly inside my Django frameworked web apps), also i would like to outsource the templates to good html/javascript/photoshop/gimp ui designers...
does this sounds like a good way to go? :)
PS I want to stress out what i'm looking for: rapid development, large community, ready made open sources created with these frameworks (so i can look for examples), framework on top of these - so i have ready made components, easy development, availability to graphic designers so i can tell them design these htmls they bring it back to me and i have VERY easy integration, not falling behind the massive amount of SmartGWT amount of ready made components if django would be enough for me without feeling i miss all SmartGWT components i might choose only it, but i cant ignore the massive amount of components in SmartGWT.
thanks
I have been developing a Django + GWT site for the last 6 months. The last 6 weeks have been with a designer.
Django and GWT are both excellent ways of working. I'm really impressed with both... but if your key objective is "VERY easy integration", they might not be a good match.
Django's default templating is a bit rubbish compared to Flexy, PHPTal or Smarty. Mainly because the templates themselves end up being too cluttered to use in designer friendly tools like Dreamweaver.
GWT can be made to operate like JQuery where it takes stuff out of the DOM, messes with elements and then puts them back in elsewhere. This way of working would be fine with a designer but really you want a designer to style GWT widgets (as they are one of the most powerful features in GWT). Styling widgets then becomes an iterative process of adding hooks (CSS styles etc.) to various types of GWT panel and then trusting the resulting combination of CSS+JS+HTML fits what the designer was expecting!
The main problem is the overlap of CSS, HTML, Django, AJAX and GWT. There are quite a few things that could be legitimately done in more then one place. A designer will need guiding in a iterative/interactive way. It's not like a few years ago when designers could just come back with a load of templates that a coder just sticks a few for loops and variable into.
I've been working in this iterative way for a while now and am slowly improving the separation of roles (designer, css-monkey, userface coder, sys. backend etc.) but I'm finding this separation much harder then it usually is with web-frameworks.
But ... the results are really good and we've produced an app. that is far ahead of PHP+JQuery type sites and will be much easier to scale, white-label....
Swing is good in many ways, then why do we need JavaFX?
There is both a technology part of JavaFX that will help design UIs, and a language part that will make writing UIs easier.
The JavaFX technology brings a 2d scenegraph and video capabilities. Afaik these will also be made available generally to java. They are good advancements for creating client side application with fancy and interactive graphical UIs. The 2d scenegraph should make it possible to create more graphic heavy applications that are still responsive.
The JavaFX language is a much better way off creating UIs programatically. Java Swing code can get very verbose, while the same JavaFX code will be smaller and easier to maintain. Closure support makes creating event handlers easier. Declerative assignment of settings makes configuration of elements easier. Native list syntax makes adding components easier.
Please note that I haven't really written any JavaFX, but I have read code and paid attention to what's going on. I recommend trying it yourself to find out what's cooking.
I think Staale's answer is a good start but I would add...
Use JavaFX if
1) If you're interested in developing the application for mobile or TV (note this has yet to be released)
2) If you're working with a graphic designer who is creating the appearance of the application in photoshop and you want to be able to import their look directly.
3) If making the GUI filthy rich is important to you. (so if you want a panel to fade in or out, or slide upon demand)
Use Swing if
1) You're creating an application mainly for the desktop.
2) Performance matters and you know what you are doing (so if you're writing an IDE, Swing would be a better choice)
3) You're looking for a RPC (rich client platform) to build upon.
It is the same reason why we have Java, C++, C#, Python, Perl, Ruby... although we already have C.
Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?
You are really asking two different questions: SWT vs Swing, and Eclipse GUI Editor vs Netbeans GUI Editor (Matisse).
First, the difference between SWT and Swing is that they are two fundamentally different GUI libraries. This akin to asking the difference between Tk and Win32, or Java Swing vs .NET Forms (not to say that SWT is .NET). There are a lot of discussions out there discussing SWT vs Swing--I don't know enough about SWT to summarize the differences.
First, let me say my bias is in favor of Netbeans and I have spent 10 years learning the IDE from its days as Forte.
As far as the GUI editor, Eclipse and Netbeans have functionally similar products, but implement the code in very different ways.
My observation is that Matisse behaves, functions, and produces code that's reminiscent of Visual Studio .NET code. There are clear initialziation sections and custom behaviors for certain objects (such as the JTable). You can "Customize" an object and add your own arbitrary code via the GUI editor very easily for everything from initialization to setting individual properties. For event handling, it defaults to replicating "delegates" in .NET by using anonymous inner classes and invoking a stand-alone method. The GUI editor itself provides detailed access to the form object model and has a rich set of customizations. You also have the freedom to drop non-GUI beans into the form for use by GUI components, such as models (tablemodel, listmodel, etc), JPA-related objects, Workers, etc. What used to take a week to produce with hand-coded SWING takes a day with Matisse (though you have to really learn Matisse to do this). If you've been hand-coding swing for many years, then relearning to use a GUI editor effectively is going to be a long, hard lession.
The code is highly maintainable from within Matisse; it is NOT intended to be edited outside of Matisse, but the code is suitable for editing if you needed to (many folks I know use Netbeans GUI and then copy the source into Eclipse).
The Eclipse GUI editor is a very different creature. The GUI editor(s) are roughly the same in terms of overall capability, but I have found them to be less polished. The layout capabilities are about equal, though errors are a bit less forgiving at times. Some customizations required me to go to the source file and edit the file directly, rather than getting access to code customizations through the GUI. The code produced is very different than Matisse. GUI Components are added and initialized through "getters" and is scattered throughout the file; this good because each component is isolated/grouped into a single function, but troublesome when you need to diagnose bad interactions between component initialization. The same goes with the event handlers--very different than matisse.
Eclipse also did not provide any protections from me editing/breaking/tampering with the produced GUI file where as Netbeans was almost obnoxious with its protections. As far as maintainability, the Eclipse code is probably a little closer to the way a human would produce Java code... personally, I find the code it produces harder to maintain, but I've been looking at Matisse generated code since the first beta so my opinion is hardly objective on this issue.
Netbeans also has the capability of using the same editor for building Swing framework applications, Netbeans RCP, etc... I am unsure if Eclipse does the same.
This is definitely subjective -- we use both, Eclipse and Netbeans. I think it comes down to a matter of preference.
No one can tell you which is better. This is completely subject to change per developer. Here's a google search for "Eclipse vs Netbeans" and you can look at some pros and cons which others have poured their thoughts into already. Eclipse vs. NetBeans
I think you should put more research into whether you want the resulting application to be SWT or Swing-based. Which IDE to use should be the least important factor.
I'm personally an Eclipse user, but I heard very good things about Matisse, so I would probably consider it if I had to build a Swing UI. BTW, if you buy MyEclipse, it integrates Matisse.
Some may contend that the end product you want to use actually depends on how easy it is to use - which is hinted at in the question.
This article suggests that the Netbeans/Matisse editor is easier to use - and so you should use it on your projects.
http://cld.blog-city.com/netbeans_matisse_versus_eclipses_visual_editor__no_contest.htm