You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Elad Katz <el...@xtify.com> on 2009/07/31 20:00:45 UTC
launching a modal page from a Panel
Hi all,
I need to launch a modal from a panel.
I saw the examples
http://www.wicket-library.com/wicket-examples/ajax/modal-window but they
were very complicated for what I need and didn't show how I can launch it
from within a panel.
Let me try to explain:
I have a datatable where one of the columns is defines like this:
columns.add(new AbstractColumn<LocationsEntity>(new
> Model<String>("Edit")) {
>
> public void populateItem(Item<ICellPopulator<LocationsEntity>>
> cellItem, String componentId,
> IModel<LocationsEntity> model) {
> cellItem.add(new EditActionPanel(componentId, model));
> }
> });
Now the EditActionPanel is a panel that basically shows a link, and is
defined like this:
> class EditActionPanel extends Panel {
>
> /**
> * @param id
> * component id
> * @param model
> * model for contact
> */
> public EditActionPanel(String id, IModel<LocationsEntity> model) {
> super(id, model);
> add(new Link("edit") {
>
> @Override
> public void onClick() {
> selected = (LocationsEntity)
> getParent().getDefaultModelObject();
> *HERE IS WHERE I NEED TO CALL A VERY SIMPLE
> YEN/NO/CANCEL MODAL *(are you sure you want to edit? y\n\c)
> }
> });
> }
> }
Can you guys please tell me what is the line I'm missing?
I know it sounds trivial, but I've been battling this all day and i could
really use some help on this
Thanks allot in advance,
E.
Re: launching a modal page from a Panel
Posted by Mathias Nilsson <wi...@gmail.com>.
Of course. If it is a panel then you'll do the same thing.
class MyPanel extends Panel{
class variable....
}
--
View this message in context: http://www.nabble.com/launching-a-modal-page-from-a-Panel-tp24760576p24776281.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: launching a modal page from a Panel
Posted by Mathias Nilsson <wi...@gmail.com>.
Define your modal window as a class variable.
class MyWebPage extends WebPage{
private ModalWindow myWindow;
}
in the constructor
myWindow = new ModalWindow( "myWindow" );
myWindow.setPageMapName("myWindow-1");
myWindow.setCookieName("myWindow-1");
myWindow.setPageCreator(new ModalWindow.PageCreator() {
public org.apache.wicket.Page createPage() {
return new MyWindow();
}
});
myWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
public void onClose(AjaxRequestTarget target) {
}
});
myWindow.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
return true;
}
});
add( myWindow );
Now, all you have to do is to call myWindow.show() in your ajaxlink.
--
View this message in context: http://www.nabble.com/launching-a-modal-page-from-a-Panel-tp24760576p24776275.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org