[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: How to add Legend to GEF Layer

Uma Mahesh <umarao@xxxxxxxxxxxx> wrote:
> Hi,
>
>  I would like to add a legend to my figure. The requirement is like
> the legend should not move even when we scroll.  I am searching for a
> layer which stays static and does not move on scroll.
>
Create a legend layer and add your legend figure to it.
Then let the legend figure listen for viewport changes and move itself 
accordingly.

            Viewport viewPort = 
((FigureCanvas)graphicalViewer.getControl()).getViewport();
            viewPort.addPropertyChangeListener(new PropertyChangeListener() 
{
        public void propertyChange(PropertyChangeEvent evt)
        {
            if(evt.getPropertyName().equals(Viewport.PROPERTY_VIEW_LOCATION)) 
{
                //Do your thing here
            }
        }
    });


-- 
Sunil