How to Set a Child to Parent Relationship in Visio? - parent-child

enter image description hereSo I'm being asked to make a Crows Foot diagram for the following rule.
"A painter can paint many paintings. Each painting is painted by only one painter."
So I created 2 entities painters and paintings, and created a relationship between the two, with painters being the parent and paintings being the child. I set the cardinality to zero or more to represent A painter can paint many paintings, but I do not know how to set another relationship from child to parent to represent that Each painting is painted by only one painter. Can someone please explain how to do this?

I came across the same problem and unfortunately MS Visio 2010 does not offer this functionality of setting child to parent cardinality.
I found a solution (Maybe its the official provided way) by searching on the internet and on my own.
Steps
First set the usual relationship connector to both entities. So that
the child entity gets a foreign key FK# label with the foreign key
select the relationship line and delete it.
It will ask if you want to delete underlying data object (something
like that) as well. Click NO.
There is a dynamic connector as well with other diagrams in toolbox. Drag it on page.
Right click the connector and Click Format -> Line.
In that dialog, there are options of starting and ending line styles at the right top panel.
Set the desired styles (and size if you want).
Click OK
Join each end with desired entities.
The foriegn key attribute might not be bold.
Click Entity and Go to Columns and make that Foriegn key column "Required"
Maybe this is a hacky solution but it does the work

On the child table (Paintings) make the foreign key "Required" and this should change the child-to-parent cardinality

Related

set default value for detail in master/detail relationship form widget dialog button

I have a master/detail relation similar to the relations sample provided.
In my example department has a one to many relationship with employee
I have a form widget(department) which has a button to insert an employee.
when I click on that button the correct dialog form is displayed but I am allowed to enter any department which I do not want.
I am looking to have the relation defaulted to the "parent" widget where it was clicked and ideally not be editable.
It's hard to give an exact answer without seeing your app, but you should probably replace the dropdown in the form with a label, that will make it not editable. You can bind the value of the label to the relation just like the value of the dropdown was bound.
A slightly easier option would be disabling the dropdown (look for the Enabled probably in the property inspector). But that could be confusing for your users since they might think it should be editable.
(Alternatively, you could just remove the field altogether if it's not important to show the relation.)
I think this only answers the "not editable" part of your question, if you want it to be pre-filled you either need to do some scripting, or use relation data sources.
I suggest using relation data sources, so right now you probably have something like:
app.datasources.Emp.create(), which creates a new employee.
Instead, you can use widget.datasource.relations.Emp.create(), which will create a new employee which has a relation to the current item in widget.datasource. If this button is placed in your department form widget, then that means it will create an employee related to whatever department is shown in the form.
Note that none of this stops users from changing the department of an employee, it just changes the UI. In lots of cases that is enough, but you may also want to add some server-side security controls if it's important to limit which users can create employees, change departments, etc: See https://developers.google.com/appmaker/security/secure-app-data

JavaFX / TreeTableView: Relationship between Selection and Focus

I need some clarification on the relationship between Focus and Selection in javafx.scene.control.TreeTableView.
In my code I have defined:
ttvMainTree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
Assumption 1: I was assuming, that the focused item is always the last item with left-click. Also I was assuming that the a left-click always moves the selection. So that in SelectionMode.SINGLE the focused item and the selected item are always identical.
This seemed to be correct in 90% of all situations. Anyhow after some random left-clickes my code produced such a picture:
Kindly confirm:
The item with the blue background is the selected item
The item with the blue border ist the focused item
Here the focused item can be changed with left-click, the selected item seems to be not influenced by left-click.
My apologies for not providing an SSCCE. At the moment I don't know how to shorten my code and reproduce this behavior.
Therefore a general question:
What is wrong with assumption 1?
In my humble opinion, i don't think there is a difference on the behavior of the two, it is rather a relationship as you said, when you select a Node, this one request the focus.
The focus can be controlled with the "focusTraversable" :
focusTraversable : Specifies whether this Node should be a part of focus traversal cycle. When this property is true focus can be moved to this Node and from this Node using regular focus traversal keys.
For your case I think maybe it's because you have chosen a TreeTableView that is both child and parent Child 2 !
Found the reason for the odd behaviour of my application:
A selection listener caused update of the datamodel. Basically the list with child-elements was deleted an populated again with the same data. This caused confusion in the selection model.

how to handle WAI ARIA role="listbox"

I have a list of options from which one can be selected. For all intents and purposes HTML's <select> element covers this. Since we need a different visual presentation, I'm looking at using WAI ARIA role="listbox". I'm unclear on how to use aria-activedescendant, aria-selected and aria-checked.
Questions regarding focus/active state:
If I use aria-activedescendant on the listbox to point to the [role="option"] that is currently active (has "virtual focus"), I would use [aria-selected]. How would best I tell the option element itself that it is active (has "virtual focus") to represent that visually? (:focus is on the listbox, after all)
an [role="option"] can have [aria-checked] and [aria-selected]. I guess I need [aria-selected] but don't see what I'd use [aria-checked] for.
Is there a trick to avoid having to put IDs on every option simply so it can be referenced by aria-activedescendant?
Questions regarding keyboard interaction:
"Checkbox - Space toggles checkboxes, if the list items are checkable" - how do I figure out if they are checkable or selectable?
Questions regarding validation:
If the listbox has [aria-required="true"] some sort of validation has to be performed. specifically if an option has been selected (or checked).
when do I trigger the validation? is on blur sufficient?
when invalid, what do I have to do besides setting [aria-invalid="true"] on the listbox?
aria-checked is indeed more something for a list of very closely related options with actual visible checkboxes that can be toggled on or off. This is most common in the Windows world. Explorer can be set to such a pseudo multi-select mode, or some apps use that to activate or deactivate a set of accounts. On the Mac, you can think of the list of accounts in Adium, which can be either checked (active) or not. A selection will always be there, and one or more of their checkboxes can be checked or not.
aria-selected is always the right one to indicate the selected state of an option. E. g. when traversing the list with the arrow keys, aria-selected="true" moves from item to item, while the others must then get aria-selected="false". As Patrick said, you can use this to also generate some nice looking CSS.
As for keyboard interaction: arrows up and down will select an item, and if the items are checkable, too, space will toggle the checked or unchecked state of the currently selected item.
In a true multi-select, like html:select #size>1, and multiselectable being true, the interaction would be:
Arrow keys select a single item.
Ctrl+Arrow keys would move focus from item to item, but not select the item yet.
Ctrl+Space would select the item.
Shift+up and down arrows would select contiguous items.
This is, again, standard Windows paradigm, can be observed in Explorer in Details view, for example.
As for validation: onBlur is sufficient, or you could dynamically do it via changes in selection/focused item, make sure at least one item is selected, or whatever validation you need.
aria-invalid="true" is sufficient for screen readers to know, but an error message and possibly a visual indication would be nice for everyone to know what's wrong.
How would best I tell the option element itself that it is active (has "virtual focus") to represent that visually?
Generally, you'd add aria-selected="true" and then craft some CSS that takes care of it using attribute selectors, e.g. div[role=option][aria-selected=true] { ... }, or add a css class dynamically?
[aria-checked] and [aria-selected]
This is more of a philosophical question I guess. aria-selected more closely matches what you'd have with a select...but then again (particularly for multi-select widgets) you can imagine the listbox actually being a series of checkboxes, and in that case you'd use aria-checked. there's no definitive right or wrong about either one (something you'll find a lot once you dive into more complex ARIA widgets).
Is there a trick to avoid having to put IDs on every option simply so it can be referenced by aria-activedescendant
Hmm...perhaps you could dynamically generate IDs for all options on page load via script? Or - but not tested - you could have something like a "roving" ID that moves around the options depending on which one is active (adding/removing the ID to the relevant option).

How to pin all spaces efficiently?

When I need a view to fill its superview space, I add four constraints using Editor/Pin (some space) to superview.
After the constraint is added, the view is deselected, and you have to reselect it to add the next constraint.
Is there a faster way to achieve this, not neccessarily using the UI ? A solution using some auto layout snippet would work too.
This answer should help you. You can also experiment with selecting the view and then clicking on "Reset to Suggested Constraints":
It's faster, but won't always create constraints you're looking for. Generated constraints are dependent on your view hierarchy.

flex expand and collapse icon in Tree control

I am having some trouble with the flex Tree control.
I have a control in my system and of course it is data driven.
I have a group which shows a folder icon and that's fine but it also shows an expand icon when the item has no children.
I don't what it to show the expand icon when the group has no children but I do want to show the folder icon, because it is different entities in my system.
here's an example of what I'm talking about. I still want to show the folder icon, the expand Icon should be hidden in this case only for the child icon.
It's easy to get this problem if you're trying to use a non-XML data provider (e.g. setting the dataProvider property of the Tree to a structure of nested ArrayCollections). In that case, the trick is to give each node a children() function that returns null (as opposed to an empty set) if there are no children.
However, assuming you're using a plain old XMLListCollection, what are you doing to make it display a folder icon at all? If you're giving the node an empty set of children, then once again, the expand icon will be displayed. The list of child nodes must be null. Alternatively, if you set the isBranch property of the node to true, it will display 'incorrectly' as you have it above.
The easiest way to display a folder icon without the expand icons is to just replace all the (really rather ugly) default icons with your own, which gives you complete control of how they appear. What you would do is set three properties: defaultLeafIcon, folderClosedIcon, and folderOpenIcon (good example at Flex Examples):
[Embed(source="folder.png")]
public var iconFolder:Class;
[Embed(source="folder.png")]
public var iconFolderOpen:Class;
<mx:Tree dataProvider="{yourData}"
defaultLeafIcon="{iconFolder}"
folderClosedIcon="{iconFolder}"
folderOpenIcon="{iconFolderOpen}" />
I see you're already using the Silk icon set, which has a rather nice closed folder icon. For some reason it doesn't contain an open folder icon though, but you can just use a closed one or anything else.
You could also just use an iconFunction (Flex Examples again), though I think the approach above is easier for what you're trying to achieve.
If it's none of those problems, give us a bit more detail on the content of your data provider and existing tree properties and see if we can't figure it out then. Hope that helps a bit anyway.

Resources