I'm currently doing a small personal project that needs to display an extremely large amount of data, and I suddenly thought about implementing a form of zoomable user interface to allow the user to navigate around the large amounts of data.
I'm aware of existing projects such as ZVTM and Piccolo2d which I'll probably end up using for the job, however I'm also quite tempted to embark upon writing my own. However, I'm a little unsure as how to start.
From what I've been reading, it seems that projects like Piccolo2d were developed due to a lack of 'scene graph' management within Java, and Piccolo2d was developed based on the work of older projects such as 'Pad', 'Pad++' and 'Jazz'.
After a quick bit of Googling around, I can see that scene graph management is available in JavaFX, but I'm wondering if Swing in Java 7 has this functionality.
I've had a bit of a think, and I'm wondering if it could be possible to implement a basic zooming interface using the JLayer
API, essentially decorating an object with different layers dependant upon the current zoom level.
So as an example, let's say I can see a directory at the furthest zoom level, zooming in would then show the contents of the directory, and zooming in further would show the text within the file present in said directory. I've been playing around with Eagle Mode for a while now, so that's a perfect example of what I'm thinking of.
I know this is a bit of a long question (if it's really a question at all). So essentially, let's pretend that Piccolo et al, don't exist, and all I have is the core Java 7 JDK, can anyone suggest a good starting point?
It seems that the Piccolo2d is based heavily upon the Java2d API, so I'm wondering if the API has advanced in anyway, or perhaps Java 7 has introduced new mechanisms for achieving a similar effect.
I'd be interested in any input or advice that can be offered. I know this isn't going to be an easy task, but there aren't any time limits involved, it's just a personal project.
Thanks
all I have is the core Java 7 JDK, can anyone suggest a good starting point?
I'd recommend using JavaFX.
- JavaFX is included in the core Oracle Java 7 (and Java 8) JDKs and runtimes.
- The JavaFX Architecture includes a comprehensive scene graph.
- JavaFX has inbuilt facilities for scene graph transforms such as scaling, translating, layering, animating, transitioning, etc.
- JavaFX performs hardware accelerated rendering.
- You get scalable video playback using modern codecs like H.264.
- JavaFX includes a comprehensive vector based control set that looks good as it zooms in and out.
- HiDPI support for retina displays, etc. is included (in Java 8).
- Hardware accelerated 3D object model rendering within the JavaFX scene graph (in Java 8).
- You can define UI declaratively using FXML and interactively using SceneBuilder - side issue, but might make development easier for you.
- The JavaFX project is open source and under active development.
- JPedal provide a 3rd party pdf viewer for JavaFX which you could use for viewing scalable pdf documents.
- JavaFX includes an HTML viewer (with zoom capabilities in Java 8).
Implementation Considerations
My guess (and this is purely my opinion) is that it is going to be a whole lot easier for you to implement this particular project in JavaFX than it would be in vanilla Swing because the underlying JavaFX technology and capabilities more closely match your requirements.
Obviously, no matter what technology you choose, to implement something as comprehensive as Eagle Mode would still be a lot of work and would require native extensions outside of the Java system (in order to display virtual desktops, etc.).
The JavaFX recommendation is from a "all I have is the core Java 7 JDK" standpoint. Systems such as ZVTM have supporting functionality and APIs for ZUI building which no JavaFX application (to my knowledge) yet includes (e.g. lens views, portal views, mapping UIs to large multi-screen arrays, etc). Uf you have the flexibility of using a pre-built library such as ZVTM, it should be seriously evaluated against your project requirements.
Scope Recommendation
To make the project more easily manageable, restrict the initial implementation requirements to a ZUI based filesystem viewer rather than a fully functional ZUI desktop UI.
JavaFX ZUI Samples
- The grezi project is a ZUI presentation system based on the GroovyFX wrapper for JavaFX.
- vworkflows from mihosoft provides a ZUI aware windowing system on top of the JavaFX scene graph.
- Zooming JavaFX nodes in a ScrollPane.
Best of luck with your project . . .
来源:https://stackoverflow.com/questions/18257887/java-zui-zoomable-user-interface