Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram Canvas BackgroundColor
Diagram Canvas BackgroundColor [message #215234] Wed, 14 January 2009 18:10 Go to next message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
Dear community,


I am trying to set the background of the editor canvas to some user
spedific function.
I can do this via the DiagramEditPart's methods setOpaque and set
BackgroundColor.

However the grid is only visible when set to "infront" and then really
in front of every other diagram element.

Whats the steps to get the grid shown but as the lowest layer, just like
when the DiagramEditPart is not set to opaque.

TIA & regards
Thomas
Re: Diagram Canvas BackgroundColor [solved] [message #222921 is a reply to message #215234] Fri, 27 March 2009 08:12 Go to previous message
Thomas Beyer is currently offline Thomas BeyerFriend
Messages: 47
Registered: July 2009
Member
I managed to set the background color without any drawbacks of the
GMF/GEF-layers by settings the GrahpicalViewer's Control background to
the color i desire.

I added the following method
/**
* dynamic template content
* @author Thomas Beyer
* @generated
*/
protected void createGraphicalViewer(Composite parent) {
super.createGraphicalViewer(parent);
org.eclipse.swt.graphics.RGB rgb = PreferenceConverter.getColor(
HmiDiagramEditorPlugin.getInstance().getPreferenceStore(),
HMIUIMessages.Id_Pref_CanvasBackground);
if (!rgb.equals(ColorConstants.white.getRGB())) {
getGraphicalViewer().getControl().setBackground(
new Color(null, rgb));
}
}

to the generated XXXDiagramEditor and it does the trick.

Regards Thomas

Am 14.01.2009 19:10, schrieb Thomas Beyer:
> Dear community,
>
>
> I am trying to set the background of the editor canvas to some user
> spedific function.
> I can do this via the DiagramEditPart's methods setOpaque and set
> BackgroundColor.
>
> However the grid is only visible when set to "infront" and then really
> in front of every other diagram element.
>
> Whats the steps to get the grid shown but as the lowest layer, just like
> when the DiagramEditPart is not set to opaque.
>
> TIA & regards
> Thomas
Previous Topic:WrapTextCellEditor problem
Next Topic:Making a border invisible
Goto Forum:
  


Current Time: Fri Apr 26 15:01:03 GMT 2024

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

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

Back to the top