Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] 2.2 suggestion: Draw2D LayoutManagers as decorators


Could you try explaining the overall problem you are trying to solve first and then propose a solution? What did you mean by "layouts ... that have associated layouts"?  Are you talking about constraints?

I don't think you have run into a limitation of the layout mechanism, maybe just the provided layout managers. The layout mechanism is very capable, just look at IBM's PageDesigner which renders HTML, or the TreeExample in the draw2d.examples project.  Is there any reason why you can't write your own chained or compound layoutmanager within the current API?

-randy



Richard Clark <rdclark@xxxxxxxxxxxxxxxx>
Sent by: gef-dev-admin@xxxxxxxxxxx

05/01/2003 12:57 PM
Please respond to gef-dev

       
        To:        <gef-dev@xxxxxxxxxxx>
        cc:        
        Subject:        [gef-dev] 2.2 suggestion: Draw2D LayoutManagers as decorators



As I've worked on several editors, I've run into limitations in the Draw2D layout and LayoutManager classes. In particular, there are times I'd like to restrict a layout to a specific area of the screen (a la XYLayout), but let the individual components arrange themselves (a la DelegatingLayout.)

Some layouts stand alone, while others have associated layout managers (and only work with those managers). This can make it difficult to choose an appropriate layout or to use the layout manager of one's choice. So I'd like to suggest a refactoring of the Layout code to use "decorators":
1. Allow a Layout to have a chain of Layout Managers, ending in a default "null" manager contained within AbstractLayout (replace setLayoutManager with addLayoutManager / removeLayoutManager)
2. replace (or extend) setConstraint with boolean addConstraint(IFigure, Object) & removeConstraint(IFigure, Object). These calls would be chained, and could "consume" the constraint (by returning true) in which case the chain ends. Unconsumed constraints could be caught by the null layout manager and either be swallowed silently (returning false at the top level) or raise an exception.

This would move us a long way toward having "toolkits" of layout managers that could be composed together to get the desired effect (as in the "arrange yourselves within this rectangle" example).

..Richard

_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/gef-dev


Back to the top