[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Layout issue with Polygon in Composite Figure

Hi all,



my goal (one of many actually) with GMF is to create the following
figure:


| | Root connection going into the decision figure. | | V +------------------------------------+ | /\ | The outer Rectangle is | / \ | fill=false, outline=false | _______/ \_______ | | | \ / | | The Rhomb shall be placed | | \ / | | centered, top inside the outer | | \/ | | rectangle. So it looks like | | | | the root connection above | | | | connects to it although it | | | | connects to the outer rectangle +------|--------------------|--------+ instead. | | | | | | | | This is a non-collapsible | V V | compartment, the rectangles | +---------+ +---------+ | are seperate nodes which in | | Label | | | | turn contain a label and | |---------| | | | collapsible compartments | | | | | | hosting other nodes as well | | Compart-| | | | (sort of activity modelling) | | ment | | | | | +---------+ +---------+ | | | | | +------|--------------------|--------+ | | V V ============================ This is kind of sync line from | activity diagramming. | V END



But I am already stuck at the very beginning:
I tried to adapt the procedure in: http://wiki.eclipse.org/GMF_Tutorial_Part_3#Composite_Figures
and also followed the hint working around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=142010
(setting myUseLocalCoordinates=true in generated
...edit.parts.ResourceEditPart$ResourceFigure class)


But the generated diagram editor doesn't center a polygon inside the outer rectangle while it does center an ellipse or rectangle.

If i create a .gmfgraph containing the following figure descriptor:

    <descriptors
        name="ResourceFigure">
      <actualFigure
          xsi:type="gmfgraph:Rectangle"
          name="ResourceFigure"
          outline="false"
          fill="false">
        <layout
            xsi:type="gmfgraph:StackLayout"/>
        <children
            xsi:type="gmfgraph:Rectangle"
            name="Inner"
            outline="false"
            fill="false">
          <layout
              xsi:type="gmfgraph:GridLayout"
              equalWidth="false"/>
          <children
              xsi:type="gmfgraph:Ellipse"
              name="DecisionRhomb">
            <layoutData
                xsi:type="gmfgraph:GridLayoutData"
                verticalAlignment="BEGINNING"/>
            <backgroundColor
                xsi:type="gmfgraph:ConstantColor"
                value="gray"/>
            <size
                x="25"
                y="25"/>
          </children>
          <children
              xsi:type="gmfgraph:Rectangle"
              name="Body">
            <layoutData
                xsi:type="gmfgraph:GridLayoutData"
                grabExcessHorizontalSpace="true"
                grabExcessVerticalSpace="true"
                verticalAlignment="FILL"
                horizontalAlignment="FILL"/>
            <backgroundColor
                xsi:type="gmfgraph:ConstantColor"
                value="gray"/>
            <size
                x="120"
                y="200"/>
          </children>
        </children>
      </actualFigure>
    </descriptors>

It looks exactly like it should, the ellipse "DecisionRhomb" placed centered above the "Body" rectangle which expands to its parent's horizontal and vertical dimensions.

But if i chance the ellipse to a polygon in .gmfgraph:

    <descriptors
        name="ResourceFigure">
      <actualFigure
          xsi:type="gmfgraph:Rectangle"
          name="ResourceFigure"
          outline="false"
          fill="false">
        <layout
            xsi:type="gmfgraph:StackLayout"/>
        <children
            xsi:type="gmfgraph:Rectangle"
            name="Inner"
            outline="false"
            fill="false">
          <layout
              xsi:type="gmfgraph:GridLayout"
              equalWidth="false"/>
          <foregroundColor
              xsi:type="gmfgraph:ConstantColor"
              value="gray"/>
          <children
              xsi:type="gmfgraph:Polygon"
              name="DecisionRhomb">
            <layoutData
                xsi:type="gmfgraph:GridLayoutData"
                verticalAlignment="BEGINNING"/>
	        <template
	            x="20"/>
	        <template
	            x="40"
	            y="20"/>
	        <template
	            x="20"
	            y="40"/>
	        <template
	            y="20"/>
          </children>
          <children
              xsi:type="gmfgraph:Rectangle"
              name="Body">
            <layoutData
                xsi:type="gmfgraph:GridLayoutData"
                grabExcessHorizontalSpace="true"
                grabExcessVerticalSpace="true"
                verticalAlignment="FILL"
                horizontalAlignment="FILL"/>
            <backgroundColor
                xsi:type="gmfgraph:ConstantColor"
                value="gray"/>
            <size
                x="120"
                y="200"/>
          </children>
        </children>
      </actualFigure>
    </descriptors>


I either don't see the rhomb at all (myUseLocalCoordinates=false) or top left with myUseLocalCoordinates=true.

How can the rhomb be aligned like the ellipse? Do i have to make a custom rhomb shape?



Thanks a lot in advance,

Christian