Skip to main content

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


Hi Hung,

Sorry for the delay in replying.  For your custom composite everything you want to do can be done.  However before I launch into a huge reply it's probably better than we hook up, myabe via a conference call and net meeting so I can see your control in action and then understand more, as well as show you the code we have in place for customization and the kind of things you're trying to do.

I'm in the UK so there's a five hour difference from the east cost (I think you're in Raleigh).  I'm on a course this week, however if we did a call say 4pm your time that'd be 9pm my time which should be OK as the kids will be in bed and I'll be at home.  Let me know if one day this week works for you, or failing that next week I am out of my course and have more time during the day.

Best regards,

Joe

Please respond to Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>

Sent by:        ve-dev-bounces@xxxxxxxxxxx

To:        ve-dev@xxxxxxxxxxx
cc:        
Subject:        [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,
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top