This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 93709

Summary: API for components to provide their backing component
Product: obsolete Reporter: Peter Zavadsky <pzavadsky>
Component: visualwebAssignee: Winston Prakash <wjprakash>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on: 102521    
Bug Blocks: 93710    

Description Peter Zavadsky 2007-01-31 20:48:30 UTC
There is a need that the component (represented by designtime API, e.g.
DesignBean) provides a way to retrieve its backing component.

Example:
For ui table component to provide component representing the database table.

This is needed in order to implement so called decorations in the designer.
Comment 1 Winston Prakash 2007-03-24 01:05:14 UTC
The decorator could be viewed as set of auxiliary set of actions, an icon (to be
displayed at the corner of the component) on which user will click to pop up the
icon and some tool tip to go with the icon from the DesignInfo. Unlike
ContextItems in the DesignInfo, which are static by nature, these auxiliary set
of actions are dynamic by nature. It could be obtained from the dataprovider
design info bound to the component.

One solution would be to add another method to DesignInfo
     public DisplayActionSet getAuxiliaryContextItems(); (or getDynamicContextItems)

The interface DisplayActionSet extends DisplayItem, so it can provide its own
icon (getSmallIcon()) and getDescription() (for tooltip)

However, extending the DesignInfo would break backward compatibility. So,
another solution discussed is to provide a mixin (DesignInfoExt or 
DesignBeanDecorator)

public interface DesignInfoExt/DesignBeanDecorator{
   public DisplayActionSet getAuxiliaryContextItems/getDynamicContextItems();
}
Comment 2 Winston Prakash 2007-04-24 00:41:04 UTC
In order to support Component Decoration, I need to do the following
modification to CachedRowset designtime

When a component is bound to a database, then a small icon will be displayed at
the right top corner of the component. When user clicks on the icon, user will
get a  popup menu which may have menu items like "Edit SQL..." which brings
up the Query Editor.

In order to support this some how I need to invoke the "Edit SQL..." action from
the decoration.

Unfortunately, external components such as "woodstock" has no idea about SQL
Query Editor. So how to achieve this?

When designer asks the DesignInfoExt of a component to give the Context items to
display in the decorator, the following thing happens

- If a component is bound to a CachedRowsetDataProvider, the DesignInfoExt of
the component will some how finds the DesignBean corresponding to the
CachedRowsetDataProvider,
- Then from it some how it will find the DesignBean corresponding to the
CachedRowset.
- Then from the DesignBean of CachedRowset, it will get the DesignInfo and
return the DesignInfo.ContextItems which will be displayed in the decorator
context menu.

One of the ContextItems obtained  from CachedRowset DesignInfo  is to invoke the
SQL Query Editor.

Currently the "Edit SQL...", in the CachedRowset is done in an ugly 
pre-historic way. It is directly registered to insync as
    LiveUnit.registerCustomizer(JdbcRowSetXImpl.class.getName(),
                new SqlCommandCustomizer(JdbcRowSetXImpl.class.getName()));

To support decoration, the context item must be done through new era techniques
i.e via DesignInfo.ContextItems

Here is my proposal

- Create a package org.netbeans.modules.visualweb.dataconnectivity.designtime
- Move the CachedRowSetXImplBeanInfo from
org.netbeans.modules.visualweb.faces.dt.data to here
   (It took a while for me to find this secret hiding place of
CachedRowSetXImplBeanInfo)
- Create 
org.netbeans.modules.visualweb.dataconnectivity.designtime.CachedRowSetXImplDesignInfo
- Register org.netbeans.modules.visualweb.dataconnectivity.designtime as
BeanInfoPath in the dataconnectivity module installer

One of the context item of  CachedRowSetXImplDesignInfo is to invoke SQL Query
Editor
  public class CachedRowSetXImplDesignInfo{
      DisplayAction[] getContextItems(DesignBean designBean){
                  return new DisplayAction[]  {                               
new InvokeQueryEditor(designBean);
                  }
     }
}
 
Comment 3 Winston Prakash 2007-07-16 23:05:10 UTC
Completed. But the components need to provide the actions for the decorator to show