Notes:
The answer is NOT clojurescript. I want to code in Clojure, not ClojureScript.
Context:
I like the CSS/DOM model for user interfaces more than I like Java's Graphics2D.
Question:
Is there some way / some project that embeds a WebKit of sorts into a Java Application? I would like to be able to code in Java, but also be able to have a GUI which I can control/manipulate via CSS/DOM.
Thanks!
The JavaFX 2.0 scene graph is somewhat similar in concept to a DOM, and you can skin it using CSS.
There is a Java API, so you should be able to use this fairly easily from Clojure.
It's not exactly CSS/DOM, but seesaw allows to query Swing widget hierarchies with CSS-like selectors.
You can find a list of more-or-less mature GUI libraries here.
An above-mentioned Seesaw can fit. GUIFTW uses a CSS-like stylesheets for describing the UI and may also meet your needs but it wasn't updated for a year now.
Related
I need to create flow diagrams based on specific inputs, using java code, what are best ways\plugins to achieve this.
something like the above diagram (For sample only it is taken from google images)
Also the diagrams should be editable after generation.
I would recommend Graphviz - the industry standard for graphs. It also has Java API (as well as perl, python, ruby etc.), so it possible to use it in Eclipse.
It uses DOT - a plain text graph description language. Small example:
digraph graphname {
a -> b -> c;
b -> d;
}
And the resulting graph:
Graphviz provides everything you need to create any kind of graphs. And yes, diagrams are editable.
Graphviz Eclipse plug-in: https://github.com/abstratt/eclipsegraphviz
Maybe something like https://github.com/jgraph/draw.io can solve your Problem. It is the sourcecode for https://www.draw.io/ which is a graphical Editor for creating diagrams.
So you can create an XML-File and upload it to your own version of draw.io and create the flowchart. Then you can edit it and save it to varoious file formats.
This is not the perfect answer, but maybe it is worth a try.
From the doc of JDiagram:
MindFusion.Diagramming for Java Swing (JDiagram for short) is a Java
class library that that lets you create and display various types of
diagrams and charts. The library includes model classes that describe
the structure and appearance of a flow diagram, and view classes that
can be integrated into any application that targets the Java Swing
framework
here are the examples, of what you can achieve with the library:
http://www.mindfusion.eu/onlinehelp/jdiagram/
There you could browse the tutorials and the doc.
I think this library might fit the bill...
https://eclipse.org/modeling/mdt/?project=xsd#xsd
Is there a way to implement good design graphs in java?
I come from web front end, and I'd like to create graphs with amazing style effect in java - Just like how I would do in javascript and CSS?
Something like this:
You can take a look to those libs:
JfreeChart
JavaFX
I can miss some others.
I built a month ago an J2EE app (with servlet and JSP page) and I had to deal with charts and honestly I dropped the idea of doing it in Java. The reason? The difficulty of finding a good API/lib and the poor documentation of these.
I personally chose to use AngularJS and my data are produced with a Java program (NOT telling you that's the best method).
My charts are made with Zingchart. I found it very powerful due to the fact that the charts can be made from JSON (easy to make in Java).
Hope I helped you.
I have Java code of the algorithm that has numeric values as its input and output. The GUI is implemented as Swing in Eclipse. Now I would like to tranfer to the web environment and create the web-tool using JavaScript or sth like this. Is there any way to use the Java code of my algorithm without rewriting it?
if your logic and goi all together at the same class you need to remove all the GUI part and stay with all the logic. after you have logic class you can use what ever goi you want(swing, html, jsf....)
Another alternative is to skip the HTML part by hand and just create your HTML app in Java. No need for separate servlets serving Java validation to your HTML inputs. The open source framework Vaadin that we've been working on since 2001 and it has an almost 100% similar API to Swing could be an alternative for this for you. And it would hopefully save you a lot of time.
As a swing developer the most relevant starting point for you would be: https://vaadin.com/swing
You can look up in to servlets and if you do it in netbeans then will be much easier for you.
At work we're discussing upgrading our view layer for our web application. We're currently running an old and "modified" version of FreeMarker Classic, which is a pain to work with. One of our developers suggested using a Component UI style architecture similar to desktop style environments.
Essentially, this would mean that you would build custom HTML components as Java Classes that the controller would render into the Document view. This would completely take away the need to write HTML into a view layer. The Components would generate the view layer for you.
For instance, the following rendered HTML:
<h1>I am a title</h1>
<p>I am a paragraph.</p>
Would be generated by doing something like:
String titleString = "I am a title";
html.elements.Heading heading = new html.elements.Heading(Heading.H1, titleString);
String paraString = "I am a paragraph.";
html.elements.Paragraph paragraph = new html.elements.Paragraph(paraString);
PrintWriter somePrintWriter = new PrintWriter();
Document document = new Document();
document.addElement(heading);
document.addElement(paragraph);
document.compose(somePrintWriter);
The above code is just an example, don't critique the names or style, I just wrote it for a quick demonstration of what we may be trying to accomplish. I'm trying to determine if this has been done before in Java, and if so if there are any links I can be pointed to. I've been researching it as much as I can, but haven't found any implementations that completely remove the template layer (such as JSP or JSF).
Thanks!
There is a pure Java way where EVERYTHING is built using Java. Check it out here
http://www.zkoss.org/
UPDATE: I found even better one. Also pure Java. http://vaadin.com/home
How about GWT?
Echo2/Echo3 might be useful.
Echo is a platform for building
web-based applications that approach
the capabilities of rich clients. The
applications are developed using a
component-oriented and event-driven
API, eliminating the need to deal with
the "page-based" nature of browsers.
To the developer, Echo works just like
a user interface toolkit.
I used GWT-Ext to create a desktop-feel for a Java-based web app. It was very well received and feels very much like you are not within a web browser at all.
Click is pretty close, to what you are describing. It does use Velocity, but if you take a look at the Advanced Forms example, the template was very basic.
wingS is another one that looks to be close to what you want. It is supposed to be Swing like.
Is there a free decent java GUI descriptor language (probably XML based), which has a Glade-like (WYSIWYG) GUI builder?
Netbeans IDE. Whenever you use its GUI editor, it stores the GUI in XML, in a *.form file.
For example if your create a class com.some.package.MyForm which extends some Swing component or window, look for this file $SRCDIR/com/some/package/MyForm.java and $SRCDIR/com/some/package/MyForm.form.
The former is the actual Java class that gets compiled. The latter is a file that Netbeans uses to store the GUI in XML format. This is what netbeans uses to generate the auto-gen'd code that goes in the code fold to initiliase the GUI.
HTH
Edit:
I do acknowledge that the Netbeans IDE probably isn't the best one out there, and I personally use it only because it's already built into the IDE that I use anyway. For me it gets the job done, and I may sometimes have to manually apply tweaks in the code to get what I want. It's a no-frills, XML-based, Java GUI, WYSIWYG editor.
Sorry this is prob not the answer you were looking for but have you looked into using flex? The markup in Flex is all XML based and the builder is very good.
Blaze DS can then be used to communicate between flex and Java.
Dont know any pure xml layout frameworks off the top of my head. Whats your reason for wanting an XML based UI?
Simple googling yields me many like http://swingml.sourceforge.net/, http://jfcml.sourceforge.net/,http://cookxml.yuanheng.org/cookswing/etc.
You can try JavaFX, it is too a cool DSL way of representing the Swing components and it provides more of its own for API for animation and graphics usage.
Netbeans and eclipse have plugins/extensions to do DnD development for it.