Archi Forum

Discussion Boards => jArchi => Topic started by: cr0que on September 11, 2018, 07:26:10 AM

Title: jArchi: Attribute "Viewpoint" on diagram?
Post by: cr0que on September 11, 2018, 07:26:10 AM
Hi!
I've just found out the strength of jArchi and started to automate some of the work I do with my models.

However, I just can figure it out how to read the attribute or property on a diagram that shows the viewpoint. I've tried with both attributes and properties or "natural syntax" (.someAttribute) but can in no way understand how to access information about the viewpoint.

Can someone here help me?

/ cr0que
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: Phil Beauvoir on September 11, 2018, 09:09:25 AM
Hi,

we haven't implemented setting and getting viewpoint names or info yet. Not sure how this would be achieved, if a viewpoint name is a standard thing as per the exchange format.

Phil
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: cr0que on September 11, 2018, 09:43:44 AM
Then I have to re-think my design. =)

Thank you for your quick response.
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: Phil Beauvoir on September 11, 2018, 11:14:45 AM
It depends what is required for a "viewpoint".

Is it the internal Archi id name, such as "implementation_deployment"?
Is it the external English name, such as "Implementation and Deployment"?
Is it required to know the concept types that are permitted in the viewpoint?
Is it a JS object type that returns all of the above? For example:

id : "implementation_deployment"
name : "Implementation and Deployment"
concepts : <list of permitted concept names>
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: Phil Beauvoir on September 11, 2018, 11:17:46 AM
More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: cr0que on September 11, 2018, 11:36:17 AM
 
Quote from: Phil Beauvoir on September 11, 2018, 11:17:46 AM
More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);

For my use case either id or name will do the work. Complete information will probably cover more use cases and the methods is imho an elegant solution.
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: cr0que on September 11, 2018, 12:13:09 PM
Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

My use case is based on a selection of an archimate-diagram-model and then I want to find two or more concepts in that view.

/ cr0que
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: Phil Beauvoir on September 11, 2018, 12:48:50 PM
Have you tried using the filter(predicate) function?

collection.filter(function(object) {return someBoolean})

For example:


var selected = $("element").filter(function(object) {
    return object.name === "foo" || object.name === "bar";
});
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: Jean-Baptiste Sarrodie on September 11, 2018, 18:30:26 PM
Hi,

Quote from: cr0que on September 11, 2018, 12:13:09 PM
Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

You have to do it in two steps:

$('selector').find('fo').add($('selector').find('bar'))

Regards,

JB
Title: Re: jArchi: Attribute "Viewpoint" on diagram?
Post by: cr0que on September 12, 2018, 06:26:19 AM
Thank you!

I found that the filter function is best suited for my needs. But since filter works on the currently matched elements I first had to find everything (get e new set of matched elements) with

$(selector).find.().filter(function...

It's because my first selection is a diagram and not a collection of concepts or visuals. Since the expression

$(selector).find().add(...

will need a constant number of find selectors the filter seems a lot more flexible.

/ cr0que