archi icon indicating copy to clipboard operation
archi copied to clipboard

Feature request: Adding/changing properties for all selected elements

Open mrygaard opened this issue 7 years ago • 15 comments

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.

mrygaard avatar Jan 19 '18 10:01 mrygaard

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?

Phillipus avatar Mar 23 '18 09:03 Phillipus

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

mrygaard avatar Mar 23 '18 10:03 mrygaard

FWIW I also have similar needs. Don't have time/knowledge to do it but worth looking at.

jbsarrodie avatar Mar 23 '18 14:03 jbsarrodie

@mrygaard Yes, thanks, that makes it clearer. I'm not sure how hard or easy this will be, but I'll assess it soon.

Phillipus avatar Mar 23 '18 18:03 Phillipus

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?

Phillipus avatar Mar 26 '18 11:03 Phillipus

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.

jbsarrodie avatar Mar 26 '18 19:03 jbsarrodie

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?

mrygaard avatar Mar 29 '18 06:03 mrygaard

I want to +1 this request. For certain in the Canvasses it would productivity a lot.

Ha found out how to +1 this!

robkamp avatar Mar 30 '18 13:03 robkamp

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?

mrygaard avatar Sep 05 '18 21:09 mrygaard

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...

jbsarrodie avatar Sep 06 '18 07:09 jbsarrodie

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)

JOSAML avatar Jan 12 '23 10:01 JOSAML

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.

enhendrickson avatar Aug 21 '23 10:08 enhendrickson

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.

Phillipus avatar Aug 23 '23 13:08 Phillipus

I've written the code now and it works like this:

  1. 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.
  2. Edit a name or value for a property - all values are changed for the selected objects
  3. Add one or more properties - added to all selected objects
  4. Delete one or more properties - all are deleted for the selected objects

Phillipus avatar Aug 25 '23 09:08 Phillipus

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.

romualdrichard avatar Oct 19 '23 15:10 romualdrichard