TornadoFX: Label text not updating - javafx

One of the issues I'm currently experiencing is that I can't seem to change the text of a Label which is implemented in a dynamically loaded AnchorPane. I assume this might be related to the controller and how JavaFX/TornadoFX works, but I can't seem to find what I'm doing wrong.
The issue itself occurs in this class, and happens in the showSystemDetails() method. What I would expect to happen is that upon pressing the "System Details" button in the sidebar, the labels would update to the required value, but this isn't happening for some reason.
Please feel free to point me to what I'm doing wrong, or provide any constructive criticism. The project is still in full development so a lot of things are still messy/broken.

The reason this isn't working is that you're manually loading a new version of the FMXL file every time you select something in your menu. The FXML file originally loaded by SystemDetailsViewProxy is updated correctly, but that's not the one you're showing on screen anymore.
To see the updated View, make sure you put the root node of the SystemDetailsViewProxy instance back.
You could for example change your DrawerMenuButton enum to contain references to SystemDetailsViewProxy::class instead of those two strings, and use add(viewClass) to add the correct root node to your view when clicking the menu buttons.
Furthermore, you should be using ViewModels and binding instead of manually updating the text property of the labels. You're doing an awful lot of manual/error prone work that the framework can help you with for free.
Your application is not using best practices in several important areas, and you're rolling your own solutions for stuff that the framework already does very well :)
Views are singletons when managed by the framework, but you instantiate them yourself instead of using inject/find. The result is that important life cycle methods are not being called.
I would also suggest looking into type safe builders instead of FXML.
Hope this helps :)

Related

How to make MultiValueField with Composite Fields and i18n enabled work properly?

Have anyone tried to have a form with MultiValueField in Magnolia having Composite fields with i18n enabled and is working properly?
Currently, I'm encountering some weird behaviour when adding items to English then switching to other language and adding items again then switch back to English with items all gone. In one JIRA post it said it was already fixed but I still encounter this issue. Also encountered issues in sorting which apparently not supported by the DelegatingMultiValueTransformer.
If so, can you please show me the configuration you use to make this work properly? If needed customisation, can you give me ideas on how to do it?
Would really appreciate any help on this.
Btw, I'm using the latest release 5.4.6 now.
Maybe you don't want to put two questions in one request in the future ;)
Re language issue:
did you check that you have i18n enabled also on the subfields, since you are using deletage transformer? AFAIK with delegate you need to have them enabled on all fields in the hierarchy.
Re transformer & ordering:
IMO the only way out is to write custom transformer. Look at source code of MultiValueTransformer and in the part of the code where it goes just two levels down when checking child values, you need to go deeper.
You would also need to define different structure storage for your values there since one used by the MultiValueTransformer would not suffice for multiple levels.
Perhaps you can extend one of the more specialized MultiValue*Transformer or perhaps you try MultiValueJSONTransformer if storing all values in json array is enough for you (you would still need to extend it and to repopulate values back into dialog when opening dialog for editing).
HTH,
Jan

Models are missing in strongly typed view drop-down

First of all, I apologize if this question is unclear, I am going to try and be as clear as possible.
My solution has 2 projects: Models and View/Controller. The View/Controller project knows what is in the Models project but not vice-versa.
I have created some Text Templates to automatically create CRUD Pages that work when I use the Add View dialog box to add new Views. This obviously happens in the View/Controller project. I've been using this without issues for a long time.
I am able to run the project without syntax errors or runtime errors, but when I use the Add View Dialog Box to try and create a new page, I choose the strongly typed option and I do not see anything from the Models project.
Things I have tried:
Reattaching the DLL for the Models as a reference to the View/Controller project again.
Build and Rebuild as well as Cleans
Manually typing everything in the dialog box (fails).
I do not want to create this page manually, as it will make errors/bugs very likely whereas the Template will reduce the amount of bugs I am likely to encounter.
Don't know how it did it, but I cleaned the project again (after failed attempts) and it finally works.
Before Adding View just Build the solution and then add view it will work. if it will not work then you can again concern with me i will give you another solution

drupal exposed filter with jquery datepicker popup

I have a view that I created based upon a content type in my drupal instance. I have then went and added some exposed filters. Two of these filters are date fields that use the jquery ui datepicker popup. Functionally, everything is working fine. Aesthetically, everything is not fine....
With the date picker, The label is showing up in the correct place, but the actual text box where the date will ultimately display is dropped down to the next line. Has anyone worked with this module that might be able to give me an idea of where the issue might be? If I just put a regular exposed filter on (that works with regular text fields instead of dates), it works fine.
This leads me to believe it is something to do with the module css, but I don't know where else to look.
Thanks for any thoughts.
I suspect your problem might actually be in your theme. There might be a class definition that's overruling the module's definitions and throwing the layout off.
If you switch your page to Garland and the problem goes away, then you'll know you need to look in your theme to find the offending element. Firebug and similar tools will help you find that quickly.
The default CSS in that whole suite of Date-related modules is pretty robust, in my experience. I've thrown them into some pretty hairy page layouts and they've always performed admirably, so the module's CSS is probably the last place I'd look for a problem.

AdvanceDataGrid nodes collapse on refresh

I have an AdvancedDataGrid which Im attemping to update with data from a web service that I poll once very 10 seconds. Im using a HierarchicalData object to provide data to the grid. The update seems to work fine, except that on each update, any nodes that were expanded are collapsed when the grid is refreshed. Stranger still, when I dig down into the bowels of the thing and look at the contents of the HierarchicalCollectionView that backs the grid, I can see that the openNodes property correctly contains the nodes that I opened, but those nodes are not shown as open on the grid...the state seems inconsistent. Any help would be much appreciated!
I try and steer clear of that component. I think your best bet is to extend it and implement the functionality you need (you will probably end up overriding a good amount of logic to get what you need).
You already know that you can utilize the openNodes property...
I know this answer doesn't help you immediately, but you will thank yourself later if you take the time to roll out your own component.

How do I display content assist in flex builder for all classes?

I have a components and classes project library. Within the library, flex builder only seems to display content/code assist options for top level classes (e.g. arguments, Array) but not other classes such as VBox. Also, within the non top level classes, class properties are not provided by content assist.
In my other flex projects in the workspace, content assist works fine.
Any help would be greatly appreciated!
Flex / Flash Builder is often inconsistent in stuff like this; but I have never seen the exact situation you describe.
Have you tried closing down and relaunching Flex Builder?
Have you tried launching Flex Builder with the '-clean' attribute?
Have you tried cleaning your workspace?
Are you sure you do not have a syntax error somewhere causing issues? Are all the classes in the library included in your library class? Sometimes error don't show up if the class is not used, and therefore not compiled into the file SWC.
Did you save your source files? I don't think Eclipse updates its index until you save - so, if you just wrote class X with function Y, but didn't save X.as, then Eclipse won't know what to do with X.Y(...
Sometimes when I've run into the problem you're describing, it's been because FB wasn't able to determine what type of object I was using (for example, obj["toto"] = ?).
Another idea may be to update your version of eclipse ("Software Updates" or something like that under the Help menu).
Finally, there's an annoying issue that happens to me sometimes where the content assist will appear for about half a second, then disappear like the window tried to scroll and lost the pop-up. Do you get anything when you press Ctrl-Space?

Resources