Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Palette Background Color
Palette Background Color [message #227210] Thu, 30 November 2006 14:28 Go to next message
Barry Dresdner is currently offline Barry DresdnerFriend
Messages: 75
Registered: July 2009
Member
Hi - can anyone tell me how I can go about changing the background color of
my palette (interested in a white background) - thanks, Barry.
Re: Palette Background Color [message #227237 is a reply to message #227210] Thu, 30 November 2006 20:04 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi Barry,

To me this seems not an easy thing to do, it's straight-forward, but
requires a lot of work. The colors for palette entries are hard coded in
palette edit parts classes under
org.eclipse.gef.internal.ui.palette.editparts. This means they are not
supposed to be used by clients. Hence you'll have to extend
PaletteEditPartFactory to provide your own edit parts and create them
based on the edit parts in the GEF's internal package above. In your edit
parts you'll be able to provide custom colors for the edit parts' figures.
The customized edit part factory can be plugged to the PaletteViewer. This
could be done in PaletteViewerProvider#configurePaletteViewer().
You can try this, unless someone has a better idea of how to implement
custom colours for palette.

Cheers,
Alex
Re: Palette Background Color [message #227256 is a reply to message #227237] Thu, 30 November 2006 21:31 Go to previous messageGo to next message
Barry Dresdner is currently offline Barry DresdnerFriend
Messages: 75
Registered: July 2009
Member
Hi Alex,

That does seem like alot of work. If all else fails, I will certainly give
it a try - Thanks alot for the explanation. Does anyone else know of a
simpler solution?
thanks - Barry

"Alex Boyko" <aboyko@ca.ibm.com> wrote in message
news:8400d55158447be2423093f3f7b40067$1@www.eclipse.org...
> Hi Barry,
>
> To me this seems not an easy thing to do, it's straight-forward, but
> requires a lot of work. The colors for palette entries are hard coded in
> palette edit parts classes under
> org.eclipse.gef.internal.ui.palette.editparts. This means they are not
> supposed to be used by clients. Hence you'll have to extend
> PaletteEditPartFactory to provide your own edit parts and create them
> based on the edit parts in the GEF's internal package above. In your edit
> parts you'll be able to provide custom colors for the edit parts' figures.
> The customized edit part factory can be plugged to the PaletteViewer. This
> could be done in PaletteViewerProvider#configurePaletteViewer().
> You can try this, unless someone has a better idea of how to implement
> custom colours for palette.
>
> Cheers,
> Alex
>
Re: Palette Background Color [message #228413 is a reply to message #227210] Wed, 20 December 2006 17:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peter.schoell.hwb-ag.com

Hi,

thats easy....

In DiagramEditPart:

protected IFigure createFigure() {

ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
connLayer.setConnectionRouter(new ManhattanConnectionRouter());

return new DiagramFigure();
}

// use your own Figure for the Diagram

public class DiagramFigure extends FreeformLayer {

public DiagramFigure() {

setBorder(new MarginBorder(3));
setLayoutManager(new FreeformLayout());
setBackgroundColor(ColorConstants.lightGray);
// Create the static router for the connection layer
}

/** Paint this figure. */
public void paintFigure(Graphics graphics) {
graphics.setAntialias(SWT.ON);

graphics.setForegroundColor(ColorConstants.lightGray);

graphics.setBackgroundColor(ColorConstants.white);
graphics.fillGradient(getBounds(), true);

}
}

Hope this helps,
peter
Re: Palette Background Color [message #228422 is a reply to message #227210] Wed, 20 December 2006 17:46 Go to previous message
Eclipse UserFriend
Originally posted by: peter.schoell.hwb-ag.com

Hi,

ups, ok, this was for the Diagram Background....

sorry...

peter
Previous Topic:GEF Shapes-RCP show outline and property views
Next Topic:GEF Shapes-RCP example and Property View
Goto Forum:
  


Current Time: Thu Apr 25 11:43:18 GMT 2024

Powered by FUDForum. Page generated in 0.03409 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top