How are collections Shared between two view models in TAB? - caliburn.micro

I have three view models, using TAB, the shell view model contains a TAB control, contains two view models, and the.tab1 view model contains a collection that changes within the tab1 view.Now I'm trying to get the set in the tab2 view model in real time and I'm trying to get the set in the tab1 view model, and I'm also changing the set value.How do I do that?

Related

How to generate Kanban with lists based on relationship between Item A, Item B and yet another sub-relationship with Item A?

I am trying to create a Kanban view based on several relationships between datasources.
The case
I have:
- Tasks datasource
- Task_Stages datasource (e.g. To Do / Doing / Done)
- Tasks many-to-many relationship with Tasks as in Master Task / Sub-Tasks
The Issue
I am trying to use grid-layout and its grid-cells as the typical "List" in a Kanban. Where lists are representing the Stages
Within a grid-cell I am trying to set a List-layout widget to represent a typical Kanban item.
If I set the grid's datasource to Task_Stages, each grid-cell would represent a state, e.g. To do / doing / done. In this case, the list-layout widget would show absolutely all Task records.
I am struggling to set it to show only Tasks, which are related as Sub-Tasks to a selected Task.
What I tried
I've tried a large number of relationship combinations using several layers of panels, but all fail.
e.g. I set up a Main-Panel as Task:Sub-Tasks, then the grid as Sub-Task:Stages - in this case it shows only 1 grid cell that represents the stage of the first sub-task record.
This is how it looks with the above example:
*Only one Stage is shown, instead of showing all stages as different "lists"(grid-cells)
*The tasks visualized in the cell do not bear the relationship with the master task and are just tasks that have that stage type selected
Is there another way I can achieve this?
In order to get this working correctly you will probably need to do the following:
Set your main panel datasource to Stages.
In your Stages datasource make sure you don't apply any filters, so
that all stages will show as in 'To Do/Doing/Done'.
Still in your Stages datasource set a prefetch for Tasks, then use
the 'Advanced' option under prefetch settings to prefetch
Tasks.relations.Subtasks.
Back to your main panel, drag in a new Grid or make sure your
existing grid datasource is set to 'Inherited: Stages'.
For reference purposes drag in a label and set the binding to
#datasource.item.YourStagesName, so it will reflect your correct
stage in each panel. Drag in a list widget into the grid cell and
set the datasource to 'Stages: Tasks (relation)'.
Drag in a list widget into the list row and set the datasource to
'Tasks: SubTasks (relation)'.
Relatively speaking this should correct your issue but may require some additional testing. I did not test this setup myself but have successfully implemented something similar. The secret here is to prefetch all relations even if they are multiple levels deep by using the advanced prefetch option. Also keep in mind that the more tasks you have the more this process of prefetching multiple relations deep can slow down the performance of your app.

Display a QFileSystemModel in two Views: Tree View and a TableView/ListView of selected items

I have a model derived from QFileSystemModel. I extended it by a Role which holds a bool value which indicates whether a file has been selected for later use. This model is displayed in a qml TreeView. In this view I can select files via checkboxes. I have a list of QPersistentModelIndex of the selected indices stored in my model.
In a different view (probably a ListView or TableView), I would like to display only items, which have have been selected in the TreeView. In this other view I also want to be able to remove the selection. So the question is whether this can be done with only one model (or maybe a QSortFilterProxyModel inbetween) or whether I need to have two models communicating with each other.

Select objects on a JavaFX Pane

I've created an application to draw objects on a JavaFX pane (rectangle, paths, custom controls etc..).
Now I want to be able to select those objects to move, copy or group them. The javafx Pane don't have a selectionModel by default and I somehow didn't find out how to implement such function.
If someone got an Idea on how to do this, I'll be grateful
You need to create your own selection model.
First you create a class SelectionModel. In that you put a Set. In order to put nodes into that set, you have to create a mouse handler that adds nodes to the model and removes them from the model depending on shift/ctrl pressed while you click on the nodes.
When you move the selection via mouse, you get the position of the currently clicked on node and instead of moving the single node in the event handler you move all nodes of the list in the SelectionModel.
In order to group them, you need to create a class/collection in which you can store the various nodes you selected. Usually the group is just a parent node. But that varies depending on your requirements.
Copy/Paste is a different matter. You need to create some kind of factory that creates and positions new nodes depending on the nodes in your selection model.
Here's an example with code for a start. It shows you how to select nodes.

Checkboxes and View Based Table View

I am having some difficulty trying to use checkboxes as the selectedIndex in a view based table.
There is good documentation on view based table here:
[View Based Tables ]
However, I after searching and looking on Stackoverflow I can't seem to get my implementation for doing the following.
My view is a table that makes a callout to Yahoo Finance. The table is view based constructed with bindings.
When the table is populated I want to have a check box against each row so that when the user clicks the check box, that row will be updated from Yahoo. Currently this works using multi or single selection using the table view and an observer.. I want to do this with the checkboxes and a button that gets all the checked rows.
The IB setup is as follows:
What is the best way to get the rows where the checkbox is selected? Should I use the array controller or do I need to do something with the table?
Assuming that you use a NSArray of NSDictionaries as your data model, why not add a key/value pair to each "stock" dictionary as a flag? Then in your button action method, just iterate through the data model and trigger an update when the flag is set. Bindings do the rest!

Grid form layout using jsf (Jdeveloper & ADF)

I am trying to build a 6x6 grid layout. In each cell, there will be an input check box. I want to bind the checkboxes to my backing bean in a "consecutive fashion"...meaning, I would like to be able to iterate over the checkboxes to see whether they are checked or not. Basically, there must be an underlying data model. For example, you can drag over and drop off as a table, any item in the data control palette. Then in my application module, I can modify the view object as I wish before I save to the database. Now if I have a table with 36 rows and two columns (one is Id, one is Numeric (1 or 0)). I would like to drag over that table and drop off as a Grid that will enable a user to update each of the rows by selecting or 'un-selecting' a checkbox.
Try to use for each or Iterator component. They iterate over some array/collection and repeat elements enclosed within those components. You can check how Oracle does Dynamic Table (when you drag view object instance from application module to a page, choose dynamic table option) to get and idea.
try :
http://jobinesh.blogspot.com/2010/06/model-driven-approach-for-building.html
http://blogs.oracle.com/shay/2010/10/adf_faces_dynamic_tags_-_for_a.html
also try google with "dynamic form adf"

Resources