Author Topic: constlayoutstyles enum in java?[solved]  (Read 4409 times)

misterk

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
constlayoutstyles enum in java?[solved]
« on: April 22, 2013, 11:31:35 pm »
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
« Last Edit: April 24, 2013, 06:19:33 pm by misterk »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: "constlayoutstyles enum" in java?
« Reply #1 on: April 23, 2013, 01:58:44 am »
Look into the EAConstants-Jscript in the scripting window.

q.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: "constlayoutstyles enum" in java?
« Reply #2 on: April 23, 2013, 04:24:33 pm »
Unfortunately this enumeration is not currently in the Java API.  There are a number of things currently missing from the Java API which we hope to fix in a future update.

As per qwerty's response - you can find the specific values for this enum in the Scripting window, Local Scripts > EAConstants-JScript.

Based on the values from the 'EAConstants-JScript' script file, i think the following code should give you the appropriate constants in Java.

Code: [Select]
final int lsDiagramDefault            = 0x00000000;
final int lsProgramDefault            = 0xFFFFFFFF;
final int lsCycleRemoveGreedy            = 0x80000000;
final int lsCycleRemoveDFS            = 0x40000000;
final int lsLayeringLongestPathSink      = 0x30000000;
final int lsLayeringLongestPathSource      = 0x20000000;
final int lsLayeringOptimalLinkLength      = 0x10000000;
final int lsInitializeNaive            = 0x08000000;
final int lsInitializeDFSOut            = 0x04000000;
final int lsInitializeDFSIn            = 0x0C000000;
final int lsCrossReduceAggressive      = 0x02000000;
final int lsLayoutDirectionUp            = 0x00010000;
final int lsLayoutDirectionDown            = 0x00020000;
final int lsLayoutDirectionLeft            = 0x00040000;
final int lsLayoutDirectionRight      = 0x00080000;

misterk

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: "constlayoutstyles enum" in java?
« Reply #3 on: April 24, 2013, 06:18:35 pm »
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.