archi
archi copied to clipboard
Feature request: Adding/changing properties for all selected elements
When several element are selected it's possible to change colors, fonts, alignment, etc. for all the selected elements. The request I have is to have the same behaviour if several elements are selected and you are changing (add, change delete) properties. E.g. when you select 3 elements and add a new property should the new property key and value be added to all elements. Current behaviour is that only the first selected element are changed. This is a feature in for instance Visio and it's very useful for analysis etc.
I took a look at this. Difficult to know what to do when selecting many elements and they all have different properties. What to display in the table? A union of all properties?
I can refer to this function in Visio (as I remember it). When you select several objects to change the properties, Visio shows properties where keys and values are identical.
Use Case Select several objects and select properties (Archi should identify names/keys and values which are identical for the selected objects and show them in the properties list
Behaviour
- If you change a value for a property - All values are changed for the selected objects
- If you add a key/name and a property - New keys/names and values are added for the selected objects
- If you delete a key/name - All keys/names and values are deleted for the selected objects
Hope this gives a better explanation
FWIW I also have similar needs. Don't have time/knowledge to do it but worth looking at.
@mrygaard Yes, thanks, that makes it clearer. I'm not sure how hard or easy this will be, but I'll assess it soon.
There is a problem because an object can have the same key with different values.
Object 1 MyKey1 = Value1 MyKey1 = Value2
Object 2 MyKey2 = Value3
Collecting the union of these gives:
MyKey1 = Value1 MyKey1 = Value2 MyKey2 = Value3
And the user doesn't know which object is MyKey1
Ideally, you want to display something like:
MyKey1 = (multiple values) MyKey2 = Value3
But if you edit the value of MyKey1 which one do you update in Object 1?
My feeling is that the purpose is independant from the UI. Using Property tab for that is one way of doing it, but the same could be done through a simple dialog box in which we could select a property key, and decide to either add/update it on, or delete it from all selected concept. The whole point is to ease properties management.
I would assume that for those use cases, if a concept has several properties with the same key, then at the end only one is kept with its value updated.
I'm not sure using the Property tab is the way to go as this could leave to lots of edge cases. But I agree that having a way to easily and quickly understand how properties are set on a collection could help, so maybe the UI should be a dialog showing a list of properties with some kind of convention.
As described in the use case, i.e keys and values are only managed if they are identical, that might also apply if there are same key with different name in one object. Maybe a separate form could be used for this instead of the property tabs?
I want to +1 this request. For certain in the Canvasses it would productivity a lot.
Ha found out how to +1 this!
Just became Patron and testing Jarchi, so I assume a script selecting all elements in a view (or just the selected elements) and add/remove/change properties for the selected element could be a solution, but how would that script look like?
Yes, that's quite simple with jArchi. Basically this involves a few things:
You can access the selection using $(selection)
. You can then manipulate properties using .prop()
and .removePropr()
(see API's doc here).
This leads us to:
-
$(selection).prop("someKey", "someValue")
will add a property with choosen value on all selected object. If this property already exists then it will be updated. -
$(selection).removeProp("someKey")
will remove a property on all selected objects.
Of course you will have to prompt the user for him to select a property and a value. You can do this using window.prompt(message, defaultText)
(see API's doc here).
With some safeguard added, this leads us to:
AddOrUpdateProperty.ajs
var propName = window.prompt("Which property do you want to add or update (leave empty to cancel)?", "");
if (propName) {
var propValue = window.prompt("Which value do you want to set for '"+propName+"' (leave empty to cancel)?", "");
if (propValue) {
$(selection).prop(propName, propValue);
}
}
RemoveProperty.ajs
var propName = window.prompt("Which property do you want to remove (leave empty to cancel)?", "");
if (propName) {
$(selection).removeProp(propName);
}
I'll add these to scripts shared through Gist later today...
Version 4.9.3 allows multiple selection of objects Changes to the name or documentation are carried over for all selected objects Unfortunately in the case of assigning a value to a custom property the modification is only taken into account for the first selected element. idem for the assignment of properties to a set of objects only the first will be concerned by this addition Is it me who misunderstands the way it works or is it a bug?
(multiple selection seems to have been implemented as of version 4.7.1)
Yep. Me too. jArchi isn't a horrible option, but that the multi-select and add/update property doesn't work "right" does seem like an obvious UI expectation-to-reality divergence.
I can refer to this function in Visio (as I remember it). When you select several objects to change the properties, Visio shows properties where keys and values are identical.
Use Case Select several objects and select properties (Archi should identify names/keys and values which are identical for the selected objects and show them in the properties list
Behaviour
1. If you change a value for a property - All values are changed for the selected objects 2. If you add a key/name and a property - New keys/names and values are added for the selected objects 3. If you delete a key/name - All keys/names and values are deleted for the selected objects
Hope this gives a better explanation
~That's the only way I could implement it that works.~ Edit: see next comment.
I've written the code now and it works like this:
- Select more than one object. Properties that share the same name (key) are displayed. If an object has multiple properties with the same name (key), only the first one is used. If the values are different, "(multiple values)" is displayed.
- Edit a name or value for a property - all values are changed for the selected objects
- Add one or more properties - added to all selected objects
- Delete one or more properties - all are deleted for the selected objects
With this, I am wondering if it's possible to set default properties for new concept. That should be great when adding a concept instead of adding properties after on the concept.