Default icons for VE components bar. [message #16009] |
Wed, 21 January 2004 10:54  |
Eclipse User |
|
|
|
Hi!
To add JavaBeans to the VE components bar I used an .xmi file that contains
lines similar to:
<cmpEntries xsi:type="palette:AnnotatedCreationEntry" xmi:id="entry4"
icon16Name="platform:/plugin/ClasesVisuales/iconos/butt16.gif "
icon32Name="platform:/plugin/ClasesVisuales/iconos/butt32.gif ">
In this line I write the name of the icons that I use but...
¿Exists some variable or constant that show the same icon that show the
JavaBeans tree?.
Example: In the tool bar appears the icon that I write but if my JavaBean
extends from JComboBox in the JavaBeans tree show the JComboBox icon. I
would like show this icon in the component bar without having to write
each one of the icon. If I don't write any icon VE shows me a red icon but
not the default icon that it shows in JavaBeans tree.
Thank you very much.
|
|
|
|
|
|
Re: can I show my icons in JavaBeans tree? [message #16864 is a reply to message #16551] |
Mon, 26 January 2004 04:08  |
Eclipse User |
|
|
|
Hi Joe,
I haven't checked recently, but with the VE 0.5.0 (final release) it did not
worked exactly as you described.
I specified the Icon in the beaninfo (both 16 and 32) and the JavaBeans Tree
displays the default ones (for both visual and non visual beans).
I think I remember a post from Rich Kulp, telling me that the getIcon(int)
method from the BeanInfo returned a Swing Icon and the JavaBeans Tree needed
an SWT icon to display ...
I assume it's still true and that it's not possible to specify custom icon
for the JavaBeans Tree yet. Rich told me there was a feature request for the
next release but it's not available yet. Am I right ?
"Joe Winchester" <winchest@uk.ibm.com> wrote in message
news:40110262.69CE1A09@uk.ibm.com...
> Hi David,
>
> > Finally I wrote the code to show my icons instead trying to show default
> > icons of VE in the component bar.
> >
> > I used lines as:
> > <cmpEntries xsi:type="palette:AnnotatedCreationEntry" xmi:id="entry1"
> >
icon16Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visu
ales/icons/canvas16.gif"
> >
icon32Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visu
ales/icons/canvas32.gif">
> >
> > In this line appears two icons with different size. I suppose that one
is
> > for the component bar and another for the JavaBeans tree.
>
> The icon32Name is not used. The icon16Name is used by the palette and it
is not used by the JavaBeans
> viewer. The JavaBeans tree graphic from the BeanInfo.
>
> > How I can use my icons in the JavaBeans tree?
>
> The BeanInfo class for your JavaBean needs to have the BeanDescriptor key
of ICON_COLOR_16x16_URL
> associated with the URL of the graphic file. For example if the class is
called com.mapfre.TestBean
> create a BeanInfo class named com.mapfre.TestBeanBeanInfo that extends
java.beans.SimpleBeanInfo. Then
> override the getBeanDescriptor() method as follows
>
> public BeanDescriptor getBeanDescriptor(){
> BeanDescriptor result = new BeanDescriptor(TestBean.class);
>
result.setValue("ICON_COLOR_16x16_URL",getClass().getResource( "test.gif").to
ExternalForm());
> return result;
> }
>
> Best regards,
>
> Joe Winchester
>
|
|
|
Re: Default icons for VE components bar. [message #578892 is a reply to message #16009] |
Wed, 21 January 2004 13:49  |
Eclipse User |
|
|
|
Hi David,
By VE components bar do you mean the palette ?
The xmi you described modifies the icons used by the palette. However it
doesn't affect the one used at runtime if the Java bean is used - this is by
the Java Beans tree viewer or by the graphical view (assuming that the JavaBean
is non-visual and doesn't descend from java.awt.Component).
The icon used for this comes from the meta model that we internally hold for
the class. The reason the palette doesn't use this model is that to populate
it requires introspection, and this would slow down showing the palette to
introspect each entry. The way that the icon should be specified (according to
the BeanInfo specificiation) is overriding the getIcon(int iconType) in the
BeanDescriptor returned by the BeanInfo. However at the moment we don't use
this because the icon is on the wrong JVM and in the wrong format (SWT instead
of AWT). We have a bugzilla to do this
https://bugs.eclipse.org/bugs/show_bug.cgi?id=48593
In the meantime however there is a work around where we allow the URL of the
icon to be specified in the BeanInfo, we get this from introspection, and then
the VE can just create an SWT one to use internally. This is done by
specifying a key of ICON_COLOR_16x16_URL together with the URL for the icon.
For example, if your graphic was called "test.gif" and in the same folder as
the BeanInfo class the method might be
public BeanDescriptor getBeanDescriptor(){
BeanDescriptor result = new BeanDescriptor(TestBean.class);
result.setValue("ICON_COLOR_16x16_URL",getClass().getResource( "test.gif").toExternalForm());
return result;
}
One thing to be aware of is that this workaround for 48593 is just a temporary
one until the bugzilla bug is worked on, so it's possible that we end up
deprecating it to encourage users to use the getIcon(int iconType) method
later.
Best regards,
Joe Winchester
|
|
|
can I show my icons in JavaBeans tree? [message #579197 is a reply to message #16045] |
Fri, 23 January 2004 03:19  |
Eclipse User |
|
|
|
Hi!
Finally I wrote the code to show my icons instead trying to show default
icons of VE in the component bar.
I used lines as:
<cmpEntries xsi:type="palette:AnnotatedCreationEntry" xmi:id="entry1"
icon16Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visuales/icons/canvas16.gif "
icon32Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visuales/icons/canvas32.gif ">
In this line appears two icons with different size. I suppose that one is
for the component bar and another for the JavaBeans tree.
But the JavaBeans tree continues shows default icons for visual components.
How I can use my icons in the JavaBeans tree?
Many thanks.
|
|
|
Re: can I show my icons in JavaBeans tree? [message #579212 is a reply to message #16518] |
Fri, 23 January 2004 06:15  |
Eclipse User |
|
|
|
Hi David,
> Finally I wrote the code to show my icons instead trying to show default
> icons of VE in the component bar.
>
> I used lines as:
> <cmpEntries xsi:type="palette:AnnotatedCreationEntry" xmi:id="entry1"
> icon16Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visuales/icons/canvas16.gif "
> icon32Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visuales/icons/canvas32.gif ">
>
> In this line appears two icons with different size. I suppose that one is
> for the component bar and another for the JavaBeans tree.
The icon32Name is not used. The icon16Name is used by the palette and it is not used by the JavaBeans
viewer. The JavaBeans tree graphic from the BeanInfo.
> How I can use my icons in the JavaBeans tree?
The BeanInfo class for your JavaBean needs to have the BeanDescriptor key of ICON_COLOR_16x16_URL
associated with the URL of the graphic file. For example if the class is called com.mapfre.TestBean
create a BeanInfo class named com.mapfre.TestBeanBeanInfo that extends java.beans.SimpleBeanInfo. Then
override the getBeanDescriptor() method as follows
public BeanDescriptor getBeanDescriptor(){
BeanDescriptor result = new BeanDescriptor(TestBean.class);
result.setValue("ICON_COLOR_16x16_URL",getClass().getResource( "test.gif").toExternalForm());
return result;
}
Best regards,
Joe Winchester
|
|
|
Re: can I show my icons in JavaBeans tree? [message #579452 is a reply to message #16551] |
Mon, 26 January 2004 04:08  |
Eclipse User |
|
|
|
Hi Joe,
I haven't checked recently, but with the VE 0.5.0 (final release) it did not
worked exactly as you described.
I specified the Icon in the beaninfo (both 16 and 32) and the JavaBeans Tree
displays the default ones (for both visual and non visual beans).
I think I remember a post from Rich Kulp, telling me that the getIcon(int)
method from the BeanInfo returned a Swing Icon and the JavaBeans Tree needed
an SWT icon to display ...
I assume it's still true and that it's not possible to specify custom icon
for the JavaBeans Tree yet. Rich told me there was a feature request for the
next release but it's not available yet. Am I right ?
"Joe Winchester" <winchest@uk.ibm.com> wrote in message
news:40110262.69CE1A09@uk.ibm.com...
> Hi David,
>
> > Finally I wrote the code to show my icons instead trying to show default
> > icons of VE in the component bar.
> >
> > I used lines as:
> > <cmpEntries xsi:type="palette:AnnotatedCreationEntry" xmi:id="entry1"
> >
icon16Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visu
ales/icons/canvas16.gif"
> >
icon32Name=" platform:/plugin/com.mapfre.general.eclipse.ui.tron21.clases visu
ales/icons/canvas32.gif">
> >
> > In this line appears two icons with different size. I suppose that one
is
> > for the component bar and another for the JavaBeans tree.
>
> The icon32Name is not used. The icon16Name is used by the palette and it
is not used by the JavaBeans
> viewer. The JavaBeans tree graphic from the BeanInfo.
>
> > How I can use my icons in the JavaBeans tree?
>
> The BeanInfo class for your JavaBean needs to have the BeanDescriptor key
of ICON_COLOR_16x16_URL
> associated with the URL of the graphic file. For example if the class is
called com.mapfre.TestBean
> create a BeanInfo class named com.mapfre.TestBeanBeanInfo that extends
java.beans.SimpleBeanInfo. Then
> override the getBeanDescriptor() method as follows
>
> public BeanDescriptor getBeanDescriptor(){
> BeanDescriptor result = new BeanDescriptor(TestBean.class);
>
result.setValue("ICON_COLOR_16x16_URL",getClass().getResource( "test.gif").to
ExternalForm());
> return result;
> }
>
> Best regards,
>
> Joe Winchester
>
|
|
|
Powered by
FUDForum. Page generated in 0.05364 seconds