I am working on a Java Swing client for JIRA REST API.
Most of the work is done, and I'm now giving the UI a final touch, and I'm having trouble to view the icons/avatars of users, projects and issue types.
The REST service does provide an API for acquiring the avatars, but I can only download them as svg format, which is not usable with swing, AFAIK.
I am familiar with libraries / executables such as batik and jmagick, but using these 3rd party, platform dependent, heavy weighted tools for such low priority UI issue seems to me like an overkill.
Since the client might not have access to the internet (for users of local JIRA servers), online conversion services are also ruled out.
Is there some other simple way to convert SVG to a Swing compatible format? I was thinking maybe there's a Swing component that handles rendering SVG's, or a very simple and light library/open source code/command line tool that only handles rendering. I am also open to ideas using a specific browser installed on the client machine (if there's any way to silently load a download page in chrome to get a png file, that would be great).
Related
I want some way of creating a dedicated browser window for a browser (chrom-e/ium or firefox). Its content needs to be controlled by a java application (a http call to localhost or better a more direct way of communicating). These two should be bundled together in some way.
A little Background
I want to write a java desktop app but don't want to use Swing or javaFX for the UI. The UI should be written like a one page app and may be ported (at least partially) to the web. I have taken a look at the javafx WebView but would rather have a full fledged browser on my hands. It would also be nice to have a little more control over said browser to send files and read files in a more desktopish way. The only real requirement is that there has to be some java backend behind it and that is has to work offline.
Is something like this possible at all or is it just a pipe dream?
I am very almost a year late for the party, but:
There are a few (that I know) technologies that can help you:
Electron. It is basically what you want, you can use web
technologies to "forge" a desktop app, it's quite well known, I never used it but for what I have read that you can stick almost anything to it's "backend".
JavaFxWebView. There are some really nice ways to use it, you can
even use bootstrap and AngularJs, here is a example (not by me)
Yes it's possible and not all that unusual. Your app can open a default browser as described here -
https://stackoverflow.com/a/10967469/5087125
And then proceed to respond to http requests to your app.
My supervisor has tasked me with programmatically reducing a website's content by looking at the HTML tags to reveal only the core content. Importantly, this particular piece of the project must be written in Java.
Now having learnt about the differences betweenPlugins, Extensions, Applets, and Widgets, I think I want to use an Extension that calls a client-side Applet. My approach was going to be this:
Using the Google-Chrome API, I was going to display a button that
the user can click.
If clicked, the action is to launch a new browser tab that has the
Applet embedded within it.
The applet automatically sources the called tab's HTML code and
filters it.
Once filtered, the reduced copy of the original site appears.
So I have a few questions. To start, is it even possible to use an Extension with an Applet? Moreover, is it possible for an applet to look # another tabs HTML code? If not, is it possible to just reload the original tab with the Applet now embedded within it and complete the function. Thanks.
Javascript is already on most mobile web platforms. Java is not, and there is no reasonable way mobile customers will be able to install Java. Android, which runs many, but not all, mobile devices has a Java run time environment, and is basically a loader for Java apps. But an Apple iPhone is not an Android device... nor is a Windows Phone.
If you want to summarize content on the client, and in Javascript, as I see it you have two choices:
Succeed with some inner burst of genius where dozens of the best expert PhDs in Natural Language Computing have just begun exploring how to extract "true meaning" from text; OR
look at document.title and be done with it.
The 2nd approach assumes that the authors of web pages set titles and set a title appropriate for summarizing their website. This isn't a perfect assumption, but it is OK
most of the time. It is also a lot less expensive than #1
With the 1st approach you can get a head start with a "natural language toolkit" that can do things like scan text for unusual words and phrases. To get a rough idea of the kinds of software that have been built in this area, review wikipedia: Outline of natural language processing:: toolkits. A popular tookit for python is called NLTK. Whether you use a toolkit from java, or python, it means working on the server because the client will not have the storage, network speed, or CPU. For python there are server side app frameworks like django or web2py that can make building out a server app faster, and on Java there are servlets frameworks. Ultimately you'll need a lot of help, training, or luck and as I have hinted above it can easily be beyond the capabilities of a small team of fresh hires, and certainly way beyond what a single new developer eager to prove his/her capabilities can do in a few weeks on their own with limited help.
Most web pages have titles set like this near the beginning of the downloaded HTML:
<head><title>My Furry Kittens!</title></head>
You don't need to write a parser. If you are running in the browser, the title has been parsed into the DOM or Document Object Model already. The string "My Furry Kittens!" in this example would be available in the global variable document.title.
If you like, you could put a button into a plugin and let people push it to summarize the website. Or, they could just look up at the title. It is already on the page. Of course, if the goal is to scrape titles one can avoid writing a parser and use a "fake" headless scriptable browser like phantomJS or similar.
You can read more about document.title on the Mozilla Developer Network. MDN is a great reference for learning how web browsers work. They are the maintainers of the Mozilla Firefox browser. Most of what you can learn there will also work on Chrome, Internet Explorer, and various mobile platforms.
Good Luck!
How about implementing a local proxy server on the mobile device. The browser would just need to be configured to use the proxy, while the custom proxy implementation can transform the requested html however it likes.
I want to display a HTML file in my java GUI.
Big problem: this java program has to run on Raspbian (Raspberry Pi).
I used the browser from eclipse swt which worked perfectly on my PC, but there is no swt build for the ARM processor on my RPI...
A JEditorPane is too weak, because I need to display some pages with CSS
Is there any other possibility?
The easiest solution is of course to see of JavaFX is supported on Raspbian. If it is, then you can use the WebView component (http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm) and most of your problems will be solved. As pointed out in the comments below by jewelsea, this is not a feasible solution yet. This might change with future builds of JavaFX for Raspbian though, so keep an eye on it.
If, for some reason, JavaFX won't work (due to display drivers etc.) then you might want to reconsider your application approach. If you just need to display the HTML file, then you can write it out to disk and display it in the default system browser. If you need to interact with it, it becomes a bit more complicated - you'd basically write a small web server and then respond to user interaction that way. The user will be using their browser of choice, and you'll send responses back to it.
I have an idea for a GUI application, however it needs a set of technologies that i do not use frequently (as such i am a bit of a novice here, apologies if this is stupid!).
I want a 3D Earth Model, (like google earth, the actual look to be like the terrain overlay in google maps (I don't care about roads, just height & position)). Like google maps & google earth i will wish to add my custom tracks & locations & boundaries; and move / pan / tilt etc...
I cannot however be continually connected to the internet. So i will need a 1 time download of terrain/geodata before i startup the program. (Can this be done as a single kml dataset ? (Is that even correct?) i guess i would need a 'local map server' instead of an internet connection?)
I will need to use a precompiled language (preferably java) to actually write the program in. (Scripting / Javascript is not acceptable) Can i interface Java & KML using an existing library ?
Is it possible to reproduce the google maps 'map window' with the terrain imaging in 3rd party software ? (Can i pull this from open source somewhere?)
Everything you want to do is possible -- however -- let me preface this by saying that it will be a long, difficult journey.
Let's start with the easy thing: you can load your data as KML, it will show up as a layer in Google Earth, and you'll be able to turn it on and off. You'll also be able to turn off default layers (roads, etc) either programmatically or via the GUI.
I would use Google Earth (the web plugin thing) tied to a C# application. You do not want to use the old Google Earth COM API. It was deprecated by Google as of GE 6, and was truly a terrible thing to work with. Java could also work, but I prefer C# development. In either case, you can use the language's ability to call into the Google Earth API directly.
Here's a good example (C#). It's GNU/GPL, so it may work as a base for your app:
http://code.google.com/p/winforms-geplugin-control-library/
Essentially, you load a Google Earth web page in a WebBrowser control, which allows you to manage it directly. Actually interfacing with the web page is the hard part (but still easier than the COM API!) -- hopefully you can use the control library linked above to get a feel for how it works.
As for your internet connectivity issue: yes -- Google Earth (even the web plugin) supports caching. The exact amount of cache that is allowed is ~100 MB. Exactly what goes in the cache is a complete mystery. The 100MB limit won't get you very far -- but you can create larger caches (up to 2GB) using the full Google Earth app. These caches work with the web browser plugin, you just have to copy the database file into the Google Earth application data directory (and rename the file I think -- the plugin appends a 0 or something to the file name.) The process for creating a cache is simple -- fly around the area in question at the altitude you'd like. There are tools to help automate this, such as:
http://bx11.110mb.com/gecacher.htm
Note that caching Google's data isn't exactly what they'd like you to do. So please keep in mind that you'll need to fully review the EULA to make sure you're not violating it...
Good luck! I've been working with GE in a large app for ~3 years; It's definitely a fun thing to work with and can make your application really stand out.
I have been developing with Java for several years and last six months I have been building GWT based application. But I have almost no Flash or Action Script experience and I would like to try out some hobby programming with Flex. Especially 2D graphics and image manipulation would be interesting topics.
Adobe's tutorials for Java developers are naturally the starting point but I would need some pointers for graphics. Something like drawing 2D graphics based on data from the server or modifying image uploaded by user. How much can be done on the Flex and what must be done on the server side?
For drawing you don't need the 'full' flex library, flex will mostly provide you with a nice set of GUI components and some ways to integrate with your back-end server easily.
If you just want to draw something check out the Graphics object http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html - it works similar to the java Graphics object.
If you want to modify an image uploaded by the user you are of course already at the server (because the image was uploaded) - however the new flash player (version 10) allows some manipulations of local data as well, so it might even be possible to show a modified image that was not even uploaded, see http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/ for example.
Flex/AS3 will feel a bit weird to a java programmer - parts of it are very easy and other parts will be frustrating, tooling support is worse, slow compiler, no support for running unittests without jumping through lots of hoops (don't get me started...). But as a deployment platform I must say I like it a lot.