Skip to main content



      Home
Home » Modeling » Graphiti » Change the Color of the Grid
Change the Color of the Grid [message #754203] Tue, 01 November 2011 07:07 Go to next message
Eclipse UserFriend
Hi,

I found a way to hide/show the grid in the diagram editor but I am wondering if there is a way to change it's color. Does anybody know how to achieve this?

Best regards
Lars
Re: Change the Color of the Grid [message #754222 is a reply to message #754203] Tue, 01 November 2011 09:53 Go to previous messageGo to next message
Eclipse UserFriend
It seems that is deeply hardcoded in class
org.eclipse.graphiti.internal.util.DefaultLook Confused

Actually, there is a LookManager that is oriented (I guess)
to support some pluggable "Looks" but
1) The LookManager is "internal" (not intended to be accessed by client code)
2) The LookManager methods are accesed statically and it does not support pluggin other looks
3) The DefaultLook look itself does not take its values (eg colors) from some configuration or properties file, but from hardcoded strings.
4) The ILook properties (few) are not very clear to me, for example, for example, i'm not sure about how these Major/MinorGridLineDistance relate with the Diagram gridUnit, etc


Re: Change the Color of the Grid [message #754230 is a reply to message #754222] Tue, 01 November 2011 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Yeah, looking at the code it seems this is not intended to be modified by anybody. Would be really nice to give that stuff a public API.
Re: Change the Color of the Grid [message #754231 is a reply to message #754230] Tue, 01 November 2011 10:28 Go to previous messageGo to next message
Eclipse UserFriend
So I at least managed to change the minor grid color with the below lines...

IColorConstant cc = ...
GraphicsAlgorithm ga = myDiagram.getGraphicsAlgorithm();
ga.setForeground(GraphitiUi.getGaService().manageColor(myDiagram, cc));


But going this way you loose the major line color it seams and that looks not as good as the initial style.
Re: Change the Color of the Grid [message #754336 is a reply to message #754230] Wed, 02 November 2011 04:48 Go to previous messageGo to next message
Eclipse UserFriend
Yes, this stuff is internal now, but it would make sense to open it up. Would you file an extension bugzilla for that?

Thanks,
Michael
Re: Change the Color of the Grid [message #754390 is a reply to message #754336] Wed, 02 November 2011 08:23 Go to previous messageGo to next message
Eclipse UserFriend
Opened a bugzilla issue 362658

Thank you.
Re: Change the Color of the Grid [message #1048353 is a reply to message #754231] Wed, 24 April 2013 06:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi Lars,

Can you please provide the pointers as how did you hide/show the grid of the diagram?
Re: Change the Color of the Grid [message #1051836 is a reply to message #1048353] Mon, 29 April 2013 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Saniya,

you can set the grid unit property on your diagram instance using
setGridUnit to -1 to hide the grid.

Michael
Re: Change the Color of the Grid [message #1052982 is a reply to message #1051836] Wed, 01 May 2013 13:08 Go to previous message
Eclipse UserFriend
Hi Saniya,
To hide grid I took the solution from Activiti project. In MyDiagramEditor:

@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    // hides grid on diagram, but you can reenable it
    if (getGraphicalViewer() != null && getGraphicalViewer().getEditPartRegistry() != null) {
        ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER);
        gridFigure.setVisible(false);
    }
}


Marek
Previous Topic:How to draw feedback shapes?
Next Topic:Auto save Editor
Goto Forum:
  


Current Time: Fri Jul 25 01:46:06 EDT 2025

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

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

Back to the top