Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ve-dev] Question about overriding EditPart.


Hello,
I have a question about override Edit Part in VE.

If we have a custom composite looks something like this, is it possible to render in VE?

Some explanations of CustomComposite :
1.  The CustomComposite has a private settings of type Properties.
2.   It has a render() method that constructs all its children.
3.   CustomControl is another custom Composite.
4.   The constructor of CustomControl does nothing but set the layout.
5.   The render() method of CustomControl creates a SWT widget based on the settings.
6.   The "settings" that's passed to each CustomControl is from CustomComposite.

We attempted to accomplish this by creating an Edit Part (eg: create a override file, and our own EditPart that extends CompositeGraphicalEditPart for our CustomControl), but ran into these problems:
1.  How do we initialize "settings" of CustomComposite when the *.java file is opened in VE editor, and before VE attempts to display this composite.    We need to send this "settings" to each of CustomControl in render() method.
2.  How can we tell VE to construct the figure when the render() method is called for each CustomControl.  

Hope this makes sense.  Thank you.

public class CustomComposite extends Composite
{
        private Properties settings;

        public CustomComposite(Composite parent,int style)
        {
                super(parent,style);
                initialize();
        }

        public void setSettings(Properties settings)
        {
                this.settings = settings;
        }

        protected void initialize()
        {
                this.setSize(new Point(548, 223));
                render();
        }

        public void render()
        {
                CustomControl control1= new CustomControl(this,SWT.NONE);
                control1.setSomeSettings(settings);                        
                control1.render();                                
               
                CustomControl control2 = new CustomControl (this,SWT.NONE);
                control2.setSomeSettings(settings);                        
                control2.render();
               
                CustomControl control3 = new CustomControl(this,SWT.NONE);
                control3.setSomeSettings(settings);                        
                control3.render();
               
                CustomControl control4 = new CustomControl(this,SWT.NONE);
                control4.setSomeSettings(settings);                        
                control4.render();
               
        }

}  //  @jve:decl-index=0:visual-constraint="10,10"





Regards,


Back to the top