I've read several things about Scenes vs Panes / StackPanes in JavaFX. I'm just having a hard time determining if there is an "industry standard". Primarily, I'm wanting to go from Login -> Dashboard -> Other "screens". Is there a preferred / standard for this with regards to scenes vs stackpane? I understand if this question gets closed because of "opinion based" but I'm technically not looking for an opinion; I'm looking for the standard by which JavaFX Applications should be architected.
AFAIK there's no standard coming from JavaFX core nor any set of guidelines for that matter.
Back in the Swing days we used to rely on CardPane to attain the desired behavior. Sadly JavaFX core does not provide such container/component out of the box. One could write up a similar container based on StackPane (the trick is to make sure children nodes in the back layers are hidden from view).
Switching scenes as you mention appears to be a popular option too, although I prefer changing the root of the scene instead o switching the whole thing completely.
finally, building a medium to large sized JavaFX application most likely requires an application framework of some sort. Again JavaFX core delivers no support in this regard besides the very basic application lifecycle provided by the Application class. My suggestion is to have a look at https://github.com/mhrimaz/AwesomeJavaFX#frameworks and evaluate those options depending on your specific requirements. I'm biased but I'd suggest you to have a look at http://griffon-framework.org/. In all fairness Griffon doesn't enforce a particular strategy that can answer your question, but the recent additions to its JavaFX support should make it simpler to implement a CardPane. Perhaps that's what we'll do for the next release :-)
I think it really depends on the nature of your application. Ie., is it a single visible window that changes content depending on your activity (e.g., something like Windows calculator that can change mode), or an editor-like main window with tabbed panes, or a "tool" application like an image editor with a main view and separate child panes.
For your use case I would just switch out the root node property of your main Scene object. So you would have a "Dashboard" root node, and when you click/select something on the dashboard you just update the root node property with the new node to display.
Related
I'm currently designing a GUI using JavaFX and SceneBulder.
I would like it be composed of several windows, each of which can be hidden, resized, deleted, etc.... in much the same way that is posible in Final Cut Pro 7.
For example: http://www.squarebox.com/legacy/xfer_fcp7.png
I have read various posts and articles (e.g. Angela Caicedo's article for Oracle) about creating apps with multiple windows but none of them seem to address displaying several windows simultaneously and enabling the contents of these separate windows to communicate with each other.
I have read a post which suggests just creating several stages (and therefore windows) in the start method of the main Class. I am tempted to go down this route but am suspicious as it seems crude and I get the sense that this might lead to problems later down the line with regards to getting each window to interact.
Any help or recommendations with regards to design would be appreciated.
Thanks for reading.
I'm new to the world of C# automation so apologies if this is obvious. My colleagues and I work frequently within an app written in Java, and I'm looking to automate some of the tasks. However, I can't seem to identify any of the elements (various menus, textboxes, etc.) within the Java windows using the tools I'm aware of (Inspect and Spy++). Nothing within the main "window" of the app shows up in Inspect (just the title bar and its' children).
I've gotten the automation working by using P/Invoke SendInput commands to click on the various parts of the window I need to click on (based on x/y coordinates) and enter text as if it's coming from the keyboard. However, this seems a bit ... fiddly. I'd feel better using this if I could formalize element names instead of just sending mouseclick instructions via code, is there a way to do this? For example with something like the Windows.Automation library when I don't have the element IDs?
TestStack.White framework written in C# should help you. It's based on UI Automation API and should see any lightweight controls like WPF ones.
Has there been any advancement in discovering and/or setting which desktop/workspace my application is on (under Linux/Solaris of course)?
Discovering/setting the desktop on modern window managers is done through reading/setting the _NET_WM_DESKTOP property from the EWMH specification ( http://packages.debian.org/search?keywords=proftpd-basic&searchon=names&suite=all§ion=all )
I'm not aware of any neatly encapsulated API's that expose this functionality, but google turned up http://code.google.com/p/ewm/source/browse/trinity/fusion-X11/trunk/src/main/java/org/fusion/x11/ewmh/NetFrameExtents.java which might be a start.
I'm the author of the project proviously linked by the "NetFrmeExtents.java"
Here's my answer:
It's hard to do in pure java if not impossible unless swing/awt has implemented it by now. The most straightforward (and only?) way is to use JNI and do it through xlib/xcb. But it is possible to do what you ask.
There is a desktop convention called EWMH that can help you with what you want.
The basic order of steps you need to is:
Get the window id of your application. To do this Google how to retrieve the window handle/window id in awt.
Next you need to read several "properties" defined by atoms. If you don't know what this is google how to read a property from a window in xlib/xcb.
In the EWMH there is a property that lists all virtual desktops defined by the window manager.
See http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2449367
Set the property a property on your application's window, see http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507080 to the number of the virtual desktop you want your application to be on.
If you have done everything correct and the window manager supports ewmh (most do) it should work.
Is there an equivalent for Spy++ for java swing applications?
I work with a third party application that contains a huge number of screens that get invoked via a reflection based mechanism.
Whenever an issue occurs the only way to locate the problem code is to search through the source (we have access to the source but cannot fix and deploy due to contractual obligations) for a specific string sequence that occurs on the window in question. eg if I see the string "XYZ" on the buggy window I have to search against the source for that string to locate the java file in which the bug exists.
Is there a tool that will let me, at runtime, point to a Swing screen and return the class from which the screen is generated?
Have you tried using Swing Explorer? It is more or less meant for similar tasks. I'm unaware of whether it will display the actual class that contains the component, but it certainly is capable of displaying the component hierarchy. You might want to check the ability to obtain the addition trace which contains the stack trace of the events leading to the component's addition to the tree.
I love BooguNote very much (it's a Sharp tool for collecting and organizing information scraps) But what a pity it just run under windows currently.
I tried to build a Java version for BooguNote so I can run it under linux (first step: I want to just make a simple BooguViewer ) since I'm not very familiar with so huge Java libraries, so I ask for help who know the suitable Java tree component in this case.
My requirement is this:
it's not an usual tree component, as you can check from the BooguNote's screenshot as below:
http://boogu.me/en.jpg
Usual tree is used as an outline, but in BooguNote, tree node was used as a content container at the same time - you can even save a huge text in it! (I heard the author said in the forum before he used "Windowless Richedit Control" technology).
Any advices are welcome, Thanks in advance.
This Oracle tutorial tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Java Swing components.
Start with the Using Swing Components tutorial. Go through the following top-level lessons:
Using Top-Level Containers
The JComponent Class
Using Text Components
Go through the following component lessons:
How to Make Frames (Main Windows)
How to Use Panels
How to Use Trees
The Swing components that you want to use to make a viewer are JFrame, JPanel, and JTree.