[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Again, how to change diagram layout?

Using ToolbarLayout I can implement swimlane on the canvas, the problem is 
swimlanes can not be reordered through drag and drop, do I need to manually 
implement these or GMF can generate such code?

Actually in GMF 2.0 now I can set "Layout Type" to "TOOLBAR_LAYOUT" Figure 
Viewmap in .gmfgen file, but how to allow nodes being dragged to change 
their sequence?

"Kristian O'Connor" <kristian.oconnor@xxxxxxxxx> 
??????:etdq3d$qo2$1@xxxxxxxxxxxxxxxxxxxx
> This may or may not help -
>
> Basically put the default ConstrainedToolbarLayout is vertical to change 
> it to horizontal find the EditPart where it is used and modify the layout 
> of the figures "content pane".
>
>    public IFigure createFigure()
>    {
>       ResizableCompartmentFigure result =
>       (ResizableCompartmentFigure) super.createFigure();
>
>       ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
>       layout.setStretchMajorAxis(true);
>       layout.setVertical(false);
>       result.getContentPane().setLayoutManager(layout);
>       return result;
>    }
>
> Regards -
> Kristian.
>
>
>
> Fabian wrote:
>>
>> Hi,
>>
>> I tried the following:
>>
>> ... MyEditPart extends DiagramEditPart {
>>
>>   protected IFigure createFigure() {
>>
>>     IFigure f = super.createFigure();
>>     f.setLayoutManager(new ToolbarLayout(false));
>>     return f;
>>   }
>>
>>
>> and the result were infinite loops when using the selection tool. I
>> think this is related to some kind of XYEditPolicy incompatibility.
>>
>> However, I disabled all the EditPolicies on the given EditPart and
>> still had the same result.
>>
>> I also tried FlowLayout and installed a corresponding
>> FlowLayoutEditPolicy but this also introduces infinite loops.
>>
>> Any help welcome.
>>
>> Kind Regards,
>> Fabian
>>
>>
>> On Tue, 12 Dec 2006 21:27:38 +0100, Michael Haeberlen
>> <haeber@xxxxxxxxxx> wrote:
>>
>>> Hao Zhang wrote:
>>>> Hi,
>>>> I've found someone had posted similar questions before without much 
>>>> result, I tried to modify MyDiagramEditPart to implement toolbarlayout 
>>>> behavior, for example I installed ConstraintToolbarLayoutEditPolicy on 
>>>> that editpart and set ConstraintToolbarLayout to the diagram figure, 
>>>> although no exception was reported, I didn't get top level nodes laied 
>>>> out horizontally in columns on the canvas..
>>>> Is there anyone who ever succeed on this?
>>>>
>>>> Best Regards,
>>>> Hao Zhang
>>>>
>>> What I did is overriding createFigure() method of class DiagramEditPart. 
>>> I copied most of the code therein and added ToolbarLayout to its 
>>> FreeformLayer.
>>>
>>> regards, Michael
>>