Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Re: Using JEM to draw cartoon images of widgets (Rich Kulp)


Hi Namrata,

Luckily most of that you don't need to worry about. :-)

addComponentWithConstraint is basically jpanel.add(childJComponent, constraint). It is how we do the add. We need such a complicated add because we have to handle all variations of the add (with or without a constraint, at a certain index, using childJComponent.getName() as the constraint, etc). You already know exactly how to add your components. You don't have to worry about all of the variations. instantiateSetting is our general way of instantiating any property of a bean before we can apply it. Since you won't be a subclass of BeanProxyAdapter (and I recommend that you aren't) then you don't need to think about all of that junk.

The basic way to use an IExpression with the component manger (because it doesn't handle straight IBeanProxy type calls yet) is:

        IExpression _expression_ = proxyFactoryRegistry.getBeanProxyFactory().createExpression();
        try {
                do the call with the IExpression
        } catch (IllegalStateException e) {
                ... (called an _expression_ in invalid order, shouldn't occur for you after you get it working right) ;
        } finally {
                try {
                        if (_expression_.isValid())
                                _expression_.invokeExpression();
                        else
                                _expression_.close();
                } catch (IllegalStateException e) {
                        ... (called an _expression_ in invalid order, shouldn't occur for you after you get it working right) ;
                } catch (ThrowableProxy e) {
                        ... (exception for remote vm);
                } catch (NoExpressionValueException e) {
                        ... (tried to access a void value, normally never occurs) ...;
                }
        }
       
The basic process for working with the component manager: (Note: There is one component manager per component that is of interest to you).
  1. After creating the component you need to tell the component manager about it:

    componentManager.setComponentBeanProxy(newbean, _expression_, getModelChangeController());

    The "newBean" is your IBeanProxy for your awt.Component you are managing, _expression_ is an _expression_, and ModelChangeController is the model change controller.
  2. Whenever you change something on your component that would require a new layout of the component (such as "text" or bounds), then you need to tell the component manager about it:

    componentManager.invalidate(getModelChangeController());

    This tells the component manager that something has changed and at the end of the transaction the component will need a layout done and a new image needs to be produced.
  3. If you want to listen for component changes such as size and position use:

    componentManager.addComponentListener(IVisualComponentListener);
  4. If you want to listen for images (this should only be used on the highest component such as a top-level JPanel so that you don't have to have images for every single child. It isn't normally necessary. That is what we do. We just listen for images of the top-level JPanel because that image will include all of the children component images too. No need to get an image of each child):

    componentManager.addImageListener(IImageListener)
  5. When you are done with your component you need to dispose of the component manager too:

    componentManager.dispose(_expression_)


Thanks,
Rich



"Namrata" <namrata@xxxxxxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

07/07/2005 08:19 PM

Please respond to
Discussions people developing code for the Visual Editor project

To
<ve-dev@xxxxxxxxxxx>
cc
Subject
[ve-dev] Re: Using JEM to draw cartoon images of widgets (Rich Kulp)





Hi Rich,

I have a few more follow up questions. I'm trying to understand what
ComponentManager does with the _expression_, and what the Adapter is expected
to do to the _expression_ before it passes it to ComponentManager.

ComponentManager has two bean proxies - fComponentManagersProxy and
fComponentBeanProxy.

Do they correspond to the container and component (ex: panel and button)?

What does the method ContainerProxyAdapter::addComponentWithConstraint do? I
was looking at it while debugging the VE flow on adding a control. It calls
instantiateSettingBean(). Could not figure out what it instantiates. My


_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top