Possible ways to refresh tableview in Javafx - javafx

The one in the picture is what i need , whenever I press sell button the quatity in the backgroud tableview column should change What makes tableview refreshed automatically detecting the change in database value without running the program from scratch.

you attached an observableList to the Tableview, so it inmediatly detects any change and update the view. So, the thing here is you have to maintain updated your observableList, you should find a way to detects change in you database. If you database is only modified for you application this should not be a hard task to complete, on the other hand, if it's modified for another system I suppossed you have to maintain the list consulting the database every often.

Related

how to select multiple column in tableview

In need of building a desktop application to deal table data imported from csv files, I have been working with JavaFX few months.
Now, I have hit a problem: I can't select multi-column in a tableview. What I want to do is that in my application users can select two columns, then trigger a button to combinate them into a new column and append the new one into the tableview. But it seem that JavaFX's TableView do not support to select multi-column or even a single column. In Swing I can finish this work easily with the link Java Swing Tutorials to Use Table.
However, I have done by adding listeners to column headers and setting corresponding trigger action like lighlight the selected columns and adding the selected to a recording List so that as user press the button my application could know what user selected.
But I think there must be some way nicely to meet the demand. And so what is it? Please give some useful imformation or tourials.

Storing a state of a dialog box

if I have a dialog box with some checkboxes, some ratiobuttons etc, and I select some of them after I close this dialog and open it again all checkboxes are unchecked. What is the best way to store the state of this dialog box?
If you want to keep the state while the app is running - simply keep the dialog around and show/hide it as necessary.
If you need to keep state for next time the app is run then you need to store the individual settings separately (see QSettings) - this makes sense if say an update of your app add new settings.

Flex Spark tabbar : initialize hidden tabs

problem is I have a spark Tabbar, with many forms in each tab.
But I have a single global save button. Problem is, if I don't open a Tab,
it doesn't get initialized and therefore the forms it contains do not exist..
How Can I make it as if the user had clicked on every tab?
The best way to handle this is to have a data model that each tab is displaying and editing, rather than trying to go in and read the values out of the controls in each tab, and save those. This is at the heart of MVC.
However, if you're too invested in your current architecture to be able to change it and you are using a ViewStack with your TabBar, you may find that setting creationPolicy to "all" does what you want. If you're using States, I don't think you can force all of them to be instantiated without putting your application into each State at least once.

Should WP7 edit forms have Save/Cancel buttons or should you use 2 way binding?

This is a question on edit form UI for a WP7 app:
I currently have my edit form fields set to 2-way binding which means that as the user changes them they save on edit and update the UI in the ViewModel (Method 1). So I don't need a Save button and there is no Cancel button (unless you code in logic to store the original state and rollback on cancel).
Method 2 would be to use 1 way binding and UpdateSource on the save button and then you could have a Cancel button which functions like the Back button (goes back without saving).
Method 1 is nice as it handles preservation of state if the app is tombstoned - WP7 will restore the page and your changes will have been saved. The downside is that there is no way for the user to restore it to it's starting state once they make changes. My form is trivial so I do not think this is a problem. The Back button acts as Go Back.
I also do calculations in the setter property in my VM that need to be reflected to the UI (ie you will in Field 1 and Field 2 is double the value (but they can also override it) - I use 2 way binding on Field 1 and update field 1 and 2 on edit. I can't think of a way to do this using explicit updating.
The problem is that I have a Delete button for the record, so when I use Method 1 with no Save and Cancel button the user is likely to click the Delete button as it is the only available option (they need to click on the Back button to go back).
My question is; should a simple form have a Save and Cancel button and commit the data only on Save, or is it ok to use 2 way binding and have no buttons?
Parts of this are mentioned in the UI Design and Interaction Guide page 68.
Changes to Application Settings should be immediately implemented. This
means that a “Done”, “OK”, or other confirming dialog is not needed.
...
If a task cannot be undone, always provide the user with an option to cancel. Text entry is an example.
Actions that overwrite or delete data, or are irreversable must have a “Cancel” button.
As for your situation you will need a confirmation for the delete action (see the ie settings for an example). For your other fields check the guide as other issues are mentioned and you could also see how the built-in settings work.
If it is possible that the user may ever not want to have their entered text changed it'll be easier to have a one-way binding and update the saved value only when the user specifically says to.
Yes, this can make the preservation of entered data slightly harder during tombstoning but means that it's easier fro the user to be able to change their mind.
In your situation, I'd recommend having on screen buttons for Save and Delete (and relying on the hardward back button for cancel).

Issues with using # for deep linking into dynamic apps?

I have a Flex app I built. It uses the BrowserManager class to listen for changes in the # part of the URL. When a change is made to the hash my application updates accordingly so you can link directly to a state of the application. Also inside my programming when a user clicks something, all I do is use the BrowserManager to update the # and then my listener will apply the correct changes once its finished. I believe this is the best practice way to doing this in Flex.
I have some issues though. When using the Back button in FF or IE, it gets "stuck". for example if the hash is like #state4 clicking the back button will take you to #state3 then #state2 but sometimes get stuck where you can be on #state3 click the back button, see it flicker to #state2 real quick then change back to #state3 preventing you from going back any further in your history.
Now in Chrome its even worse. As you make your way through the application the hash # is updated and so the application updates (proving that the app can see changes in the hash since thats the only way it updates). but when you click the back button, the hash # goes back to its previous state, but my application does not as if it is unaware the hash is changing.
I find this very bizarre and don't know what to make of it. I was wondering if anyone else had experienced this or knows what might be the issue.
To see it in action go here and navigate the builder (it will ask you to click jewelry type, metal, etc.) a few times until you see the big red add to cart button, then try to use your back button to get back to this page.
Have you tried the History Manager. Have a look on the http://www.nbilyk.com/blog/1/68/flex-history-manager

Resources