I am new on java and javafx. I made a simple application on javafx using mvc pattern. This application handles a person table and is structured in this way.
Model containing the persons data
View containing a menu
View containing the tableview of the persons, the detail of the selected person and three buttons (New --> add new person, Edit --> change a person, Delete --> cancel a person
View that allows to change contents of the selected person
All works fine, but I have a problem with the menu. I would like to handle the menuitem 'Save' changing the 'Disable' flag in the way that it set to 'false' or 'true' programmatically, depending on if the user changed the data or not, but I do not know how can pass it from a scene to another.
I have been searching a lot on this web site and on other sites without any result.
I have found a question on stackoverflow called 'Toggle enable/disable on Menuitem javafx from another scene?' that probably could solve my question, but unfortunately I did not understand the solution.
Is there somebody who can help me?
Thank you in advance.
Alberto
Related
Is there someone who can tell me how you loop over the contacts in the template "Vendor ratings" please ?
I give you a screenshot of the page. To reproduce, go to the "Contacts" page, add a new contact and see two contacts...
I want to do the same behavior for my application and I don't know how to loop...
When I create a single card with a label binding #datasource.item.name for example, I only have 1 card displayed although in my datasource I have two results...
Thanks a lot for your help.
You are looking for widgets that can render repetitive data: List, Accordion, Grid. You can build prototype row/cell inside such widget, bind it to array of items (datasource) and App Maker's runtime will take care about the rest for you:
I have a CompositeField consisting of a LinkField and TextField in my dialog.
On select of data for LinkField, I want to populate the TextField also with a value related to the LinkField value.
Any idea how to do this?
This is for Magnolia CMS. I'm using the latest Magnolia version.
Thanks! :)
There is no ootb binding between different fields.
To create it, you would either need to write your own field that will internally encapsulate the link field and text field and register listener for link field value change and upon change set value for the text field.
Or you would need to rewrite dialog presenter to be able to register such listener on the link field when it's being created.
Sorry, don't have any code samples at the moment to demonstrate it. Hope the explanation is clear enough.
HTH,
Jan
Do you need to update the text field in view of the editor?
If not, this can be easily achieved by modifying the save action. Your form should have a commit button defined with class=info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
Open SaveDialogActionDefinition and you'll see it points to info.magnolia.ui.admincentral.dialog.action.SaveDialogAction which, when executed, can manipulate the node before saving the session.
If you extended SaveDialogAction, added another method similar to setNodeName(Node node, JcrNodeAdapter item) and called it between setNodeName(...) and node.getSession().save(), you could set any additional property you wanted based on those entered by the user.
You would also need another definition class that referenced your new action so your dialog definition knew to use the new action on commit.
I followed the instructions in this link
but I face a strange problem which is when the lookup is populated with the new filtered view the add button is getting disabled when I select a record from the new view !!
I debugged the code in the lookupinfo.aspx page and I found this line of code that controls whether the add button is enabled or disabled
btnAdd.disabled = (crmGrid.InnerGrid.SelectedRecords.length == 0);
and this line of code always return true despite there is a selected record !!
Can anyone help me ?
Thank you.
I followed the instructions in this link
Which link? I can't see one referenced in your question. I'll make some assumptions about what you are trying to do. I will assume that you are trying to hide an "Add Existing" button linked to a form's sub-grid. I'll also assuem you're trying to edit XML files by hand (which is the hard way!).
The easiest way to apply rules to buttons in CRM 2011 is to use Erik Pool's brilliant tool "Visual Ribbon Editor" (available here)).
To hide an "Add Existing" button based on selected records, you would:
Connect the tool to your CRM environment
Open the "parent" entity (i.e. the record type that shows the "Add Existing xxxx" button
Select the Ribbon Type to be "Sub-Grid"
Select the button you wish to manipulate
Add or edit the Enable Rules for that button
If I'm not describing a solution to your problem, maybe enhance your question - it's hard to understand what you are trying to acheive.
I'm making a small application that represents a to-do list.
The list is stored in a cusom model (derived from QAbstractItemModel) and is displayed in a QTableView.
I have also a custom widget (TaskDialog) that is used to browse and edit tasks from the list. The children of the TaskDialog are mapped to the model with a QDataWidgetMMapper.
On the task dialog I have also buttons that allow browsing through all the tasks in my to-do list (QDataWidgetMapper::toPrevious() ...).
The problem is that if I'm editing a task in the TaskDialog (e.g. the tasks name) and then browse to another task, the new edited enty isn't set in the model.
But if I edit something in the TaskDialog, then first change the focus to an other child widget of the TaskDialog and then press one of the browsing button, than the changes are written to the model.
How can I achive that widgets that are in a editing mode are accepted and written to the model.
I also tried the example of QDataWidgetMapper from Nokia. There it works perfectly. But they use a QStandardItemModel.
Best regards
Luke
I found a solution:
The submit policy of the QDataWidgetMapper has to be set to QDataWidgetMapper::ManualSubmit.
Then allways when I browse to a new item (i.e. one of the browse buttons is pressed) i submit the changes with QDataWidgetMapper::submit().
I have a database, which tables should viewed in a widget. Seems simple, but I can't decide what to du or use.
Each row of the table should be viewed as one list view item, for instance, imagine table with this fields: id, title, content, date, number.
I need to view it as a list view (not hard-coded, it may also be another thing, if it is possible or better), and the label of the list view item should be the title field. But when the user clicks or double clicks on that item it should open all the contents of the current row in a separate widget. The all of these can be implemented easily by me, but I can't understand what to use: QListView with its model, or QListWidget? Or maybe QSqlTableModel? The last one is unfamiliar to me, I can read about from documentation, but if you have heard or met some kind things/applications, please provide a better solution for described problem.
Hope I could explain my problem correctly,
Thanks in advance.
Have you read about model/view programming in Qt? Basically you should use some model (QSqlTableModel, QSqlQueryModel, QSqlRelationalTableModel or create your own) an then attach it to QListView or QListWidget.