You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "digiovinazzo (via GitHub)" <gi...@apache.org> on 2023/06/27 20:49:32 UTC
[GitHub] [netbeans] digiovinazzo commented on issue #5774: Not honoring containerDelegate in BeanInfo
digiovinazzo commented on issue #5774:
URL: https://github.com/apache/netbeans/issues/5774#issuecomment-1610192551
We ended up fixing the problem creating the `PropertyDescriptor` of the `UI` property using the constructor that takes `Method`s, not method names. This way we can get the `PanelUI getUI()` method and not the `ComponentUI getUI()` method:
```java
try {
Method readMethod = JPanel.class.getDeclaredMethod("getUI"); // NOI18N
Class<?> returnType = readMethod.getReturnType();
if (!returnType.equals(PanelUI.class)) {
throw new RuntimeException("getUI() returns " + returnType + " instead of PanelUI"); // NOI18N
}
Method writeMethod = JPanel.class.getDeclaredMethod("setUI", PanelUI.class); // NOI18N
properties[PROPERTY_UI] = new PropertyDescriptor("UI", readMethod, writeMethod); // NOI18N
} catch (IntrospectionException | NoSuchMethodException | SecurityException e) {
// XXX: this will not work as it will find the method getUI() returning ComponentUI, not PanelUI
// see https://github.com/apache/netbeans/issues/5774
properties[PROPERTY_UI] = new PropertyDescriptor("UI", com.streamsim.commonsgui.SectionPanel.class, "getUI", "setUI"); // NOI18N
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists