addListener type click listener to a component extending Embedded

Hello,
I am having a problem having a component that extends the Embedded class to react to click listeners.

If I use the regular Embedded object I can attach a listener and it work fine using the following snippet of code:


Embedded 
					historySwitchEmd = new Embedded("", new ThemeResource("images/search/details/personDetailsDresserIcons_history.png"));
					historySwitchEmd.setSizeUndefined();
					
					historySwitchEmd.addListener(new ClickListener()
					{
						
						@Override
						public void click(com.vaadin.event.MouseEvents.ClickEvent event)
						{
							switchSnapDisplay(event, in_identitySection);
							
						}
					});

instead if I try to do the same to a component that is extending the Embedded object the click listener is totally ignored.

For example I am creating an Icon cased Switch button that is suppose to work as a checkbox except that I do not want the check box but just two bitmaps showing the different click states.


public class IconSwitch extends Embedded 
{
...etc

then


public IconSwitch()
	{
		this.bitmapUnClickState = new ThemeResource("images/utilities/customComponents/IconSwitch/defaultBitmaps/states/defaultIconSwitchBitmaps_unclicked.png");
		this.bitmapClickState = new ThemeResource("images/utilities/customComponents/IconSwitch/defaultBitmaps/states/defaultIconSwitchBitmaps_clicked.png");
		this.setSizeUndefined();
		
		setIcon(bitmapUnClickState);
	
		this.addListener(new ClickListener()
		{
			
			@Override
			public void click(ClickEvent event)
			{
				
				//log something...
			}
		});
		
		
	}

as a result I cannot see any logging after I click on the image generated in the constructor.

Am I doing something wrong ?

Old thread, but: the icon is a part of the caption of the Embedded, not of the Embedded itself. You should use setSource(Resource) instead of setIcon().