Dear all,
I am trying to get pre-set pickericon name through onBrowserEvent listener but with no luck. I have created pickericon and add it to the textitem which is then added to the form item and window.
If i look at the browser HTML source i can see that name is set as $9a="pickericon" and not as name as expected. Also name is set to underlying span item not on img item, so i have to operate with getParent.....
Code is as follows:
I am trying to get pre-set pickericon name through onBrowserEvent listener but with no luck. I have created pickericon and add it to the textitem which is then added to the form item and window.
If i look at the browser HTML source i can see that name is set as $9a="pickericon" and not as name as expected. Also name is set to underlying span item not on img item, so i have to operate with getParent.....
Code is as follows:
Code:
DynamicForm form = new DynamicForm();
PickerIcon pi = new PickerIcon(PickerIcon.SEARCH);
pi.setName("pickericon");
pi.addFormItemClickHandler(new FormItemClickHandler() {
@Override
public void onFormItemClick(FormItemIconClickEvent event) {
System.out.println("icon click");
}
});
TextItem ti = new TextItem();
ti.setIcons(pi);
form.setItems(ti);
Window window = new Window();
window.setWidth(600);
window.setHeight(200);
window.setAutoCenter(true);
window.setIsModal(true);
window.addItem(form);
window.show();
Event.sinkEvents(window.getElement(), Event.ONMOUSEDOWN);
Event.setEventListener(window.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONMOUSEDOWN == event.getTypeInt()) {
// how to get icon name and not auto-generated id on click ???
}
}
});
Comment