Login | Register
My pages Projects Community openCollabNet

argouml
Wiki: Issue1048

Edit this page | Links to this page | Page information | Attachments | Refresh page

 

Issue 1048

This page is to summarise the strategy and status for completing ArgoUML issue 1048, (Allow manual adjustment of text label positions on edges).

Each section is broken down into two sections: 'User' which describes the intended behaviour from the point of view of the user, and 'Design' which describes the internal behaviour including details of the implementation.

Editing Method

User

  • The user will move fig labels by clicking and dragging them on the diagram.
  • Labels will move in real time during the drag.
  • When the user releases the mouse, the label will remain in the last position of the mouse.
  • There will be no snap-to grid for draggable labels.

Design

The Label drag function will be controlled by a new '?ModeLabelDrag' mode which will be placed first in the GEF mode layer stack. This will process all 'label drag' mouse events first, and pass control to the other Modes if no label is being dragged.

The actual moving of labels will be via a new method setPoint() added to the ?PathConv abstract class. setPoint() will act as a generic method for setting a new position of a label in the diagram's coordinate space. The class will internally handle the setPoint() parameters and calculate whatever fields the ?PathConv implementation uses. These will then be translated back into real diagram coordinates whenever the fig is painted.

This is currently implemented and working for FigAssociation in branches/work_issue1048_dthompson.

Appearance

Appearance is covered by issue 5517 (Paint pathitem placement for selected edge).

User

  • Draggable labels will be highlighted, indicating the bounds of the draggable label.
  • A visualisation of the path placement will be highlighted, showing the imaginary connecting line which links a label to where it is anchored on an edge.

Design

Display of draggable Path Items will be implemented by a paint(Graphics g) method in the ?PathConv abstract class. By default, nothing will be painted. In an implementation that supports painting, a line and a box will be drawn.

This is currently implemented and working for FigAssociation in branches/work_issue1048_dthompson.

Persistence (saving/loading label positions)

User

  • Manually adjusted label positions will retain their positions through a save/load.
  • If path item placement algorithms are adjusted in a new version of argouml, the positions of labels when a diagram is loaded may change.
  • There will probably be a pop-up menu option to assign the label positions back to defaults for the selected edge.

Design

To review the the discussion, see here, here, here,

  • The path item placement parameters will be stored as additional elements in the PGML file.
  • The path item placement parameters will be handled through save/load in the same way regardless of whether they are the default values or a user custom setting.
  • The path item figs will have owners assigned (issue 5518) as follows:

Fig

Owner (model object)

middleGroup

association

srcGroup

src association-end

destGroup

dest association-end

srcMult

src association-end

destMult

dest association-end

i.e. Some path items share an owner.

  • The Fig on the end type of each path item will also be stored, and the intent is that by using both the Fig type and the owner, it will be possible to match up each path item to a Fig when reconstructing the diagram.

Saving the data in the above format is now implemented, and the resulting file at the time of writing is as follows (snippet of FigAssociation only) [note this is now slightly out of date, and the format has been tweaked a bit]:

  <group name="Fig2"
       description="org.argouml.uml.diagram.ui.FigAssociation"
       href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B39"
       stroke="1"
       strokecolor="black"
  >
    <private>
      sourcePortFig="Fig0.0"
      destPortFig="Fig1.0"
      sourceFigNode="Fig0"
      destFigNode="Fig1"
      
      <argouml:pathitem figname="Fig2.1"
                        description="org.argouml.uml.diagram.ui.PathItemPlacement"
                        figdescription="org.argouml.uml.diagram.ui.FigTextGroup"
                        href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B39"
                        percent="50"
                        angle="4.71238898038469"
                        offset="0" />
      <argouml:pathitem figname="Fig2.2"
                        description="org.argouml.uml.diagram.ui.PathItemPlacement"
                        figdescription="org.argouml.uml.diagram.ui.FigMultiplicity"
                        href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B3A"
                        percent="0"
                        angle="5.497787143782138"
                        offset="5" />
      <argouml:pathitem figname="Fig2.3"
                        description="org.argouml.uml.diagram.ui.PathItemPlacement"
                        figdescription="org.argouml.uml.diagram.ui.FigAssociationEndAnnotation"
                        href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B3A"
                        percent="0"
                        angle="0.7853981633974483"
                        offset="5" />
      <argouml:pathitem figname="Fig2.4"
                        description="org.argouml.uml.diagram.ui.PathItemPlacement"
                        figdescription="org.argouml.uml.diagram.ui.FigMultiplicity"
                        href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B3D"
                        percent="100"
                        angle="3.9269908169872414"
                        offset="-5" />
      <argouml:pathitem figname="Fig2.5"
                        description="org.argouml.uml.diagram.ui.PathItemPlacement"
                        figdescription="org.argouml.uml.diagram.ui.FigAssociationEndAnnotation"
                        href="-64--88-2-100-5bbf81ec:11e2d424081:-8000:0000000000000B3D"
                        percent="100"
                        angle="2.356194490192345"
                        offset="-5" />
    </private>
    <path name="Fig2.0"
      description="org.argouml.gefext.ArgoFigPoly"
      fill="0"
      fillcolor="white"
      stroke="1"
      strokecolor="black"
    >
      <moveto x="228"
              y="249" />
      <lineto x="490"
              y="138" />
    </path>
  </group>

Current Status

The feature has now been implemented and merged into the trunk, it should be available in ArgoUML 0.28-alpha3 and above (stable release 0.28). There are a few remaining problems (2009-01-14):

  • A NullPointerException sometimes occurs when clicking and dragging in open space on the diagram.

Useful Links

Issue1048 (last edited 2009-01-14 20:40:19 -0800 by ?dthompson)