public void onAddRequested(final FavouriteEvent event) {
		final SearchFavourite fav = event.getNewFavourite();
		final Window addWindow = new DockableWindow();
		addWindow.setTitle(messages.favouritesControllerAddTitle());
		addWindow.setWidth(310);
		addWindow.setHeight(145);
		addWindow.setAutoCenter(true);
		addWindow.setShowMinimizeButton(false);
		addWindow.setIsModal(true);
		addWindow.setKeepInParentRect(true);
		//addWindow.setShowModalMask(true);

		VLayout mainLayout = new VLayout(10);
		mainLayout.setMargin(10);

		// ----------------------------------------------------------

		final DynamicForm form = new DynamicForm();
		form.setGroupTitle(messages.favouritesControllerAddGroupTitle());
		form.setIsGroup(true);
		final TextItem nameItem = new TextItem();
		nameItem.setWidth(190);
		nameItem.setTitle(messages.favouritesControllerAddName());
		nameItem.setTooltip(messages.favouritesControllerAddNameTooltip());
		nameItem.setRequired(true);
		final CheckboxItem sharedItem = new CheckboxItem();
		sharedItem.setTitle(messages.favouritesControllerAddShared());
		sharedItem.setTooltip(messages.favouritesControllerAddSharedTooltip());
		form.setFields(nameItem, sharedItem);

		// ----------------------------------------------------------

		HLayout buttonLayout = new HLayout(10);
		buttonLayout.setHeight(20);
		buttonLayout.setWidth100();
		IButton addBtn = new IButton(messages.favouritesControllerAddAdd());
		addBtn.setIcon(BTN_ADD_IMG);
		addBtn.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				if (form.validate()) {
					addWindow.hide();
					fav.setName(nameItem.getValueAsString());
					fav.setShared(sharedItem.getValueAsBoolean());
					FavouritesCommService.saveSearchFavourite(fav, new DataCallback<SearchFavourite>() {
						public void execute(SearchFavourite result) {
							fireAddEvent(new FavouriteEvent(null, result, FavouritesController.this));
							addWindow.destroy();
						}
					});
				}
			}
		});
		IButton cancelBtn = new IButton(messages.favouritesControllerAddCancel());
		cancelBtn.setIcon(WidgetLayout.iconCancel);
		cancelBtn.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				addWindow.destroy();
			}
		});
		LayoutSpacer lsr = new LayoutSpacer();
		lsr.setWidth("*");

		// ----------------------------------------------------------

		buttonLayout.addMember(lsr);
		buttonLayout.addMember(addBtn);
		buttonLayout.addMember(cancelBtn);
		mainLayout.addMember(form);
		mainLayout.addMember(buttonLayout);
		addWindow.addItem(mainLayout);
		addWindow.show();
	}
public void onAddRequested ( final FavouriteEvent event ) { final SearchFavourite fav = event . getNewFavourite ( ) ; final Window addWindow = new DockableWindow ( ) ; addWindow . setTitle ( messages . favouritesControllerAddTitle ( ) ) ; addWindow . setWidth ( 310 ) ; addWindow . setHeight ( 145 ) ; addWindow . setAutoCenter ( true ) ; addWindow . setShowMinimizeButton ( false ) ; addWindow . setIsModal ( true ) ; addWindow . setKeepInParentRect ( true ) ; VLayout mainLayout = new VLayout ( 10 ) ; mainLayout . setMargin ( 10 ) ; final DynamicForm form = new DynamicForm ( ) ; form . setGroupTitle ( messages . favouritesControllerAddGroupTitle ( ) ) ; form . setIsGroup ( true ) ; final TextItem nameItem = new TextItem ( ) ; nameItem . setWidth ( 190 ) ; nameItem . setTitle ( messages . favouritesControllerAddName ( ) ) ; nameItem . setTooltip ( messages . favouritesControllerAddNameTooltip ( ) ) ; nameItem . setRequired ( true ) ; final CheckboxItem sharedItem = new CheckboxItem ( ) ; sharedItem . setTitle ( messages . favouritesControllerAddShared ( ) ) ; sharedItem . setTooltip ( messages . favouritesControllerAddSharedTooltip ( ) ) ; form . setFields ( nameItem , sharedItem ) ; HLayout buttonLayout = new HLayout ( 10 ) ; buttonLayout . setHeight ( 20 ) ; buttonLayout . setWidth100 ( ) ; IButton addBtn = new IButton ( messages . favouritesControllerAddAdd ( ) ) ; addBtn . setIcon ( BTN_ADD_IMG ) ; addBtn . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { if ( form . validate ( ) ) { addWindow . hide ( ) ; fav . setName ( nameItem . getValueAsString ( ) ) ; fav . setShared ( sharedItem . getValueAsBoolean ( ) ) ; FavouritesCommService . saveSearchFavourite ( fav , new DataCallback < SearchFavourite > ( ) { public void execute ( SearchFavourite result ) { fireAddEvent ( new FavouriteEvent ( null , result , FavouritesController . this ) ) ; addWindow . destroy ( ) ; } } ) ; } } } ) ; IButton cancelBtn = new IButton ( messages . favouritesControllerAddCancel ( ) ) ; cancelBtn . setIcon ( WidgetLayout . iconCancel ) ; cancelBtn . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent event ) { addWindow . destroy ( ) ; } } ) ; LayoutSpacer lsr = new LayoutSpacer ( ) ; lsr . setWidth ( "*" ) ; buttonLayout . addMember ( lsr ) ; buttonLayout . addMember ( addBtn ) ; buttonLayout . addMember ( cancelBtn ) ; mainLayout . addMember ( form ) ; mainLayout . addMember ( buttonLayout ) ; addWindow . addItem ( mainLayout ) ; addWindow . show ( ) ; }
----------------------------------------------------------