Showing posts with label Flyout. Show all posts
Showing posts with label Flyout. Show all posts

Wednesday, October 7, 2009

Using GraphicalEditorWithFlyoutPalette

I personally prefer the FlyoutPalette over the one we implemented in TutoGEF. In order to use it we have to do some minor changes to our code:
In tutogef.MyGraphicalEditor change:
public class MyGraphicalEditor extends GraphicalEditorWithPalette
to:
public class MyGraphicalEditor extends GraphicalEditorWithFlyoutPalette

Also remove the methode initializePaletteViewer() 
To get our DragSourceListener we just removed back we need to Override another methode:

@Override
protected PaletteViewerProvider createPaletteViewerProvider() {
    return new PaletteViewerProvider(getEditDomain()) {
        protected void configurePaletteViewer(PaletteViewer viewer) {
            super.configurePaletteViewer(viewer);
            viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer))
        }
    };
}

And we are set to enjoy the new Palette!

Here is the update to TutoGEF.