Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - misterk

Pages: [1]
1
Thanks a lot for these values, it's working great :-).

I didn't know, there was a scripting window... I will look at it later.

Thanks for the answers.

2
Hello,

I'm using this code to layout a diagram:

Code: [Select]
rep.GetProjectInterface().LayoutDiagramEx(diagram.GetDiagramGUID(), 0, 4, 20, 20, true);
rep.RefreshModelView(1);
diagram.Update();

This is working great, except I don't how to use the ConstLayoutStyles Enum in java
http://www.sparxsystems.com/enterprise_architect_user_guide/9.0/automation/constlayoutstylesenum.html

The LayoutDiagramEx methods takes these parameters:
LayoutDiagramEx (string
DiagramGUID, long
LayoutStyle, long Iterations,
long LayerSpacing, long
ColumnSpacing, boolean
SaveToDiagram)

The LayoutStyle which is a long, can take the values of the ConstLayoutStyles Enum, yet I don't know what are those values.

In the sdk documentation, it is said:

LayoutStyleaccepts the following options (also see
ConstLayoutStyles Enum ):
· Default Options:
lsDiagramDefault
lsProgramDefault.
· Cycle Removal Options:
lsCycleRemoveGreedy
lsCycleRemoveDFS.
· Layering Options:
lsLayeringLongestPathSink
lsLayeringLongestPathSource
lsLayeringOptimalLinkLength.
· Initialize Options:
IsInitializeNaive
IsInitializeDFSOut
IsInitializeDFSIn.
· Crossing Reduction Option:
lsCrossReduceAggressive.
· Layout Options - Direction
lsLayoutDirectionUp
lsLayoutDirectionDown
lsLayoutDirectionLeft
lsLayoutDirectionRight.


For example, if I want to have the option "lsLayoutDirectionLeft", what will be the value of the long LayoutStyle in LayoutDiagramEx, and how do you find this value.

Thanks in advance,
Kevin

3
By looking at the VB examples of the SDK (I was not aware of them), I removed some code:

Code: [Select]
connector.SetClientID(destinationElement.GetElementID());        
       connector.SetDiagramID(diagram.GetDiagramID());

and also the code with the diagramLink, and now it's working.

Thanks for your help (it helped me find some documentation, so this was very helpful)! :-)


4
Thanks for your answer.
It helped me with another bug actually, yet my main issue is not solved.

I've tried to create (in java) two elements connected with a connector in two different diagrams.

Yet I'm not able to see the new diagramLink in the second Diagram.
I'm well able to see the new diagramObject of each element in the second Diagram.

Any idea?

5
Hello,

I'm using Java to create Elements and Connector in a package and in a diagram.

This is working fine.

When I open the model with EA, I can see my components and the link between them.

But when I'm in EA (version 9.3), something is not working:
In fact, when I create a new diagram, and drag and drop my two components in the new diagram. The components are well shown, but the link is not there.

When I'm under the diagram created with java, I can see in the properties "Related/Links" of the elements that I'm able to see a menu option called "Hide Relation".
This option is not there when I'm in the diagram created with EA.

-----------

The structure of the tree of Project Browser looks like this:
Model (created with java)
- Package 1 (created with java)
  - Package 11 (created with java)
    - Diagram 1 (created with java)
    - Diagram 2 (created with EA)
    - component A (created with java)
    - component B (created with java)

component A and B are visible in Diagram 1 and 2.
A link (an assembly relationship) is created and visible in diagram 1, but not in diagram 2.

----

Code: [Select]
       Element sourceElement = FindElement(source.getName(), p);
        Element destinationElement = FindElement(destination.getName(), p);
          
        Connector connector = sourceElement.GetConnectors().AddNew("", "Assembly");
          
        connector.SetName(linkName);
        connector.SetSupplierID(sourceElement.GetElementID());
        connector.SetClientID(destinationElement.GetElementID());        
        connector.SetDiagramID(diagram.GetDiagramID());
        connector.Update();
        sourceElement.Refresh();
        destinationElement.Refresh();        
        p.GetConnectors().Refresh();
        
        DiagramLink diagramLink = diagram.GetDiagramLinks().AddNew("", "");
        diagramLink.SetConnectorID(connector.GetConnectorID());
        diagramLink.SetDiagramID(diagram.GetDiagramID());
        diagramLink.SetIsHidden(false);
        diagramLink.Update();        
                
        diagram.GetDiagramLinks().Refresh();
        diagram.Update();

---
When I export the diagrams in XML :

I have something different with the link created through java, that if I do it directly with EA.

it's:
Code: [Select]
<extendedProperties virtualInheritance="0" diagram="EAID_47AD417E_1566_4a1a_AD9F_044E03D0A165" privatedata5="EDGE=4;SX=35;SY=13;EX=35;EY=13;"/>

from:
Code: [Select]
<connector xmi:idref="EAID_DF7A2A95_49FE_40a1_833F_F3730877F11C">
      <source xmi:idref="EAID_58E24A71_430A_440f_838E_70A82B15F12A">
            <model ea_localid="4" type="Component" name="composant B"/>
            <role visibility="Public" targetScope="instance"/>
            <type aggregation="none" containment="Unspecified"/>
            <constraints/>
            <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
            <style value="Navigable=Unspecified;Union=0;Derived=0;AllowDuplicates=0;Owned=0;"/>
            <documentation/>
            <xrefs/>
            <tags/>
      </source>
      <target xmi:idref="EAID_C9DAE6DC_167D_4e21_BFC9_915116491B30">
            <model ea_localid="3" type="Component" name="composant A"/>
            <role visibility="Public" targetScope="instance"/>
            <type aggregation="none" containment="Unspecified"/>
            <constraints/>
            <modifiers isOrdered="false" changeable="none" isNavigable="true"/>
            <style value="Navigable=Navigable;Union=0;Derived=0;AllowDuplicates=0;Owned=0;"/>
            <documentation/>
            <xrefs/>
            <tags/>
      </target>
      <model ea_localid="1"/>
      <properties ea_type="Assembly" direction="Source -&gt; Destination"/>
      <documentation/>
      <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
      <labels mt="lien"/>
      <extendedProperties virtualInheritance="0" diagram="EAID_47AD417E_1566_4a1a_AD9F_044E03D0A165" privatedata5="EDGE=4;SX=35;SY=13;EX=35;EY=13;"/>
      <style/>
      <xrefs/>
      <tags/>
</connector>

when I replace that line with :
Code: [Select]
<extendedProperties virtualInheritance="0" />
and import it back in EA, my link is working again.

So I would like to know what I've done wrong (or not done) in Java so that I have this extendedProperties that makes my link not visible in other diagrams, and not even able to change that through EA.

Thanks in advance for any help on this.
Regards,
Kevin



Pages: [1]