Generic HighCharts (Javascript\Java) - java

I have searched for ages but couldn't find what I am looking for.
I'm using highCharts.
Is there a method or project or something that creates generic highcharts charts for me? Currently I must make a javascript chart function for every chart I want. I want to make this generic.
So that I only have to ask the method getChart('line','etc'); something like this.
This way i dont have to code everything over and over again for each chart that I want.
(its for a Dashboard )
If this doesn't exists at all I will make it myself.

There are several libraries out there for producing highcharts. Many are listed on the highcharts download page here: http://www.highcharts.com/download under 'API Wrappers:'.
If you are most confortable working in Java, maybe you should check out GWT and the GWT Highcharts wrapper. GWT lets you write Java code, which compiles down into javascript.

Those ones are the bests http://www.highcharts.com/ i tried them and they work absolutely fine with great design just download them and make us know if you get problemes using them.

Related

GWT FileUpload OnClick

I'm trying to use a GWT button to call a FileUpload using the .click method. I was struggling with getting code to trigger after a file is selected using this method. I've tried using an addChangeHandler but it doesn't seem to be calling once a file is selected.
Any help would be appreciated,
Thanks!
If you use the lastest GWT 2.8.2, you will use Elemental2 and JsInterop (the correct approach right now; please find an explanation here: https://stackoverflow.com/a/52083441/5394086).
Then please find some examples below.
An implementation for native browser's API: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop .
It's a modern one with "drag'n'drop" instead of "click", hopefully you will like it.
The first example uses GXT for the UI, but the upload stuff will be the same for generic GWT, so it's easy to modify the example for your purposes. The animated gif shows how it works. What more, it works without additional effort with drag'n'drop.
https://gist.github.com/branflake2267/d424e4a0c0b371e3dd9d15bfd3514429
Another example with JSNI is currently kind of deprecated approach:
https://gist.github.com/branflake2267/97266601f0f225ae2a750fc8115dc2c4
Finally a very nice Java8 lambdas and also very compact example using only free libraries, since Elemental2 is a part of the "new GWT" and Elemento is open source (https://github.com/hal/elemento):
https://gist.github.com/ibaca/a8a84b6e7b63259109fd782d7dbadd8d
I hope you will find it useful.

How to use CSS graph in java

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.

making a browser without using JTextPane or any other class that reads HTML

Good evening, I'm working on a project with a team, we have to make a browser without using JEditorPane or any other class that reads HTML.
How can we do that? Do we need to make a new class that does what JEditorPane does? Can I find somewhere JEditorPane's code? Thanks!
Well, this is an answer:
If you need to display web content without using any pre-existing engine (such JEditorPanel or a ChromeBind), you need to read the HTML as a XML file and construct your native View based on it (without CSS and JS this is a fairly easy task) by constructing the screen based on a one-to-one equivalent of a HTML tag to a Java JComponent.
Modern Web Browsers are pretty complicated, so there are a lot of different pieces that come together to display a web page. In order to build a browser, you need to first understand what a browser is. For that, I recommend reading this tutorial.
Once you have an understanding of how a browser actually works you need to determine which pieces you can reuse and which pieces you have to write from scratch. Do you have to write the entire rendering engine? Good luck! Can you use an existing engine like Gecko or Webkit? Or maybe you can get a little closer to done and use the java port of Webkit?
Once you have a better understanding of the question come back and ask more direct questions when you get stuck at a specific piece. As it is, your first step is to gain an understanding of the problem you are trying to solve.

Web UI for existing Java application

I am trying to build a search engine using java and the lucene API as part of a project. For the last step, we plan to build a web UI (a local host would do) for the same. Are there UI softwares/plugins for eclipse which will allow me to call the functions present in the java classes?
Essentially I would want to have a search box and a search key, pressing which will throw up the search results(which is computed from the java program). javascript cannot call java code I understand. So using that is eliminated?
Any suggestions on what to use will be greatly appreciated. I have pretty poor knowledge in front end design!
Cheers!
AB
If all you have is a simple screen with a entry field and a button and you simply want to return an html table. I would go with a servlet and two jsps. Your servlet can call your search engine and then have the jsp format the data into the table. If you do not know web apis this is probably the easiest entry.
I think, If your using JAVA, that you should look into JSF.
It's a rather easy to maintain and work with library for just the uses you describe.
I recommend these tutorials to get you started: http://www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro
There are lots of options to achieve this.
you can create web-ui using jsp.
I have also created same type of project using Lucene, here i have used spring mvc.i have provided all the back-end process as REST api which any web-ui can use.
Please do not look into JSF; it is an overengineered pile for your task.
Sure you can call your java code from javascript, you can make it really simple with something like DWR.
However, for your project I would suggest GWT as then you only deal with Java and it will generate javascript, html and css for you.
For your project you dont really need an "enterprise" level framework like spring or a fullstack JavaEE, you could keep it real oldschool with only JSPs and html/javascript. However thats a bit too flaky for my taste, so go with GWT.
With GWT you basically set it up, define your module, entrance point (look at the hello world), and then you add a layout to your page like something to place the searchbox into and the resultbox to. Then you call your other Java code and classes from there like you normally would.
I would suggest you to use GWT in your application because GWT enables you to call java methods and it will also convert Javascript and css for your Java modules after GWT compile.
GWT reference :- http://code.google.com/webtoolkit/gettingstarted.html
If you're going to use GWT, you could aslo check Vaadin.
Creating a search UI is really simple, and the tutorial show a criteria /result table application taht could be adapted.

Execute javascript function from java

I want to know if it's possible to execute a javascript function from java. Basically I have a javascript function to which I want to pass a string and then get the output from that function.
If it's possible, how do I accomplish it?
EDIT -
I couldn't find a solution to this, what I did was re-write all the javascript code in Java. But I am guessing, Rhino ported on Android should do the trick. If someone has tried it out, please post a solution.
You probably want to take a look at the ScriptEngine. There are plenty of samples out there on how to use it. Works on anything but Mac where they for some reason selected to include AppleScript instead of JavaScript by default.
Edit: Take a look at this page, there seems to be a Rhino port for Android out there.
Javascript is not natively supported in java. If you need it, you may implement the Rhino javascript engine to do this.
"Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users."

Categories

Resources