Set background images for GMF applications

Source: Internet
Author: User
Tags set background

Override the configuregraphicalviewer () method of xxxdiagrameditor. Add the followingCodeYou can. However, after a background image is added, the gridlines cannot be displayed, which may be due to the order of layers.

 /**  * @ Generated not  */  Protected   Void  Configuregraphicalviewer (){  Super  . Configuregraphicalviewer ();  //////  Background layer  ////////////////// Layer backgroundlayer = New Layer () {@ override  Protected   Void  Paintfigure (Graphics graphics ){  Super  . Paintfigure (graphics); graphics. drawimage (networkdiagrameditorplugin. getinstance (). getbundledimage ( "Images/worldmap_no_text.gif"), 0 , 0 ) ;}}; Backgroundlayer. setsize ( 4990,248 4 );  ////////////////////////////////////////  Diagramrooteditpart Root = (Diagramrooteditpart) getdiagramgraphicalviewer (). getrooteditpart (); layeredpane printablelayers = (Layeredpane) root. getlayer (layerconstants. printable_layers); freeformlayer extlabelslayer = New  Freeformlayer (); extlabelslayer. setlayoutmanager (  New  Delegatinglayout (); printablelayers. addlayerafter (extlabelslayer, networkeditpartfactory. external_node_labels_layer, layerconstants. primary_layer );  //////  Insert background layer  ////////// /  Printablelayers. addlayerbefore (backgroundlayer, networkeditpartfactory. external_node_labels_layer, layerconstants. primary_layer );  ////////////////////////////////////////  Layeredpane scalablelayers = (Layeredpane) root. getlayer (layerconstants. scalable_layers); freeformlayer scaledfeedbacklayer = New  Freeformlayer (); scaledfeedbacklayer. setenabled (  False ); Scalablelayers. addlayerafter (scaledfeedbacklayer, layerconstants. scaled_feedback_layer, diagramrooteditpart. decoration_unprintable_layer );} 

Reference: Set a background image for the graphic editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.