|
Re: automatocally Grid in Background [message #804516 is a reply to message #804419] |
Wed, 22 February 2012 18:16 |
Michael Golubev Messages: 383 Registered: July 2009 |
Senior Member |
|
|
Hello,
I have added the followng code into the TaiPan sample, TaiPanDiagramEditor#configureGraphicalViewer():
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
getDiagramGraphicalViewer().setContextMenu(provider);
getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
//ADDED START
DiagramRootEditPart root = (DiagramRootEditPart) getDiagramGraphicalViewer().getRootEditPart();
Layer printableLayers = (Layer)root.getLayer(LayerConstants.PRINTABLE_LAYERS);
Layer gridLayer = (Layer)root.getLayer(LayerConstants.GRID_LAYER);
if (printableLayers != null && gridLayer != null){
LayeredPane paneForPrintable = (LayeredPane)printableLayers.getParent();
LayeredPane paneForGrid = (LayeredPane)gridLayer.getParent();
if (paneForGrid == paneForPrintable) {
paneForGrid.removeLayer(LayerConstants.GRID_LAYER);
paneForGrid.addLayerBefore(gridLayer, LayerConstants.GRID_LAYER, LayerConstants.PRINTABLE_LAYERS);
}
}
//ADDED END
}
Looks hackish, so any better solution would be appreciated, but at least to first look it works -- see attached screenshot
|
|
|
|
Powered by
FUDForum. Page generated in 0.03402 seconds