You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Kogel, Jonck-van-der" <jo...@bmw.nl> on 2010/01/06 17:12:05 UTC

Autosize modal window

Hi,
Is it possible to have a modal window auto-size depending on its
contents? I've been fiddling with header contributions and such but
can't get it to work.
 
Thanks!
 
Jonck

Re: Autosize modal window

Posted by Ilja Pavkovic <il...@binaere-bauten.de>.
Hi,

> Ok, great, the height is indeed autosizing nicely now. Is there any way to
>  have the width autosize as well?
no, as you need either a height or a width to calculate on out of the other  
automatically with respect to the window content (content dimension and aspect 
ratio would be sufficient, but we don't have that :))

You could get the width from ClientProperties after enabling 
gatherExtendedBrowserInfo in the Application settings

ApplicationClass.init() {
		getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
}

But you will have one flickering extra page that is used to gather this 
information.

Perhaps when you could use something like 

int width = ((WebClientInfo) 
getRequestCycle().getClientInfo()).getProperties().getBrowserWidth();

width = width/3;


Easier would be to use a reasonable width.

Best Regards,
	Ilja


> Thanks, Jonck
> 
> 
> -----Original Message-----
> From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de]
> Sent: donderdag 7 januari 2010 13:51
> To: users@wicket.apache.org
> Cc: Kogel, Jonck-van-der
> Subject: Re: Autosize modal window
> 
> Hi,
> 
> I forgot the following line: modalWindow.setUseInitialHeight(false);
> 
> Best Regards,
> 	Ilja Pavkovic
> 
> Am Donnerstag, 7. Januar 2010 12:40:25 schrieb Kogel, Jonck-van-der:
> > Hi Ilja,
> > Ok, that's good, I'm not using PageCreator. But how do I then make the
> > ModalWindow autosize? Perhaps I'm missing something in the JavaDocs
> > but I  can't find it anywhere.
> >
> > Thanks, Jonck
> >
> > -----Original Message-----
> > From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de]
> > Sent: woensdag 6 januari 2010 17:23
> > To: users@wicket.apache.org
> > Subject: Re: Autosize modal window
> >
> > Hi,
> >
> > according to the inline documentation of ModalWindow you can only
> > autosize  if you add components and don't use  ModalWindow.PageCreator
> >
> > something like
> >
> > ModalWindow modalWindow = new ModalWindow(); modalWindow.add(new
> > MyPanel(modalWindow.getComponentId());
> >
> > ....
> >
> > Best Regards,
> > 	Ilja Pavkovic
> >
> > Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
> > > Hi,
> > > Is it possible to have a modal window auto-size depending on its
> > > contents? I've been fiddling with header contributions and such but
> > > can't get it to work.
> > >
> > > Thanks!
> > >
> > > Jonck
> >
> > --
> > binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> >
> >    +49 · 171 · 9342 465
> >
> > Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> > Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost
> > Becker
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> 
> --
> binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> 
>    +49 · 171 · 9342 465
> 
> Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Autosize modal window

Posted by "Kogel, Jonck-van-der" <jo...@bmw.nl>.
Ok, great, the height is indeed autosizing nicely now. Is there any way to have the width autosize as well?

Thanks, Jonck


-----Original Message-----
From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de] 
Sent: donderdag 7 januari 2010 13:51
To: users@wicket.apache.org
Cc: Kogel, Jonck-van-der
Subject: Re: Autosize modal window

Hi,

I forgot the following line: modalWindow.setUseInitialHeight(false);

Best Regards,
	Ilja Pavkovic

Am Donnerstag, 7. Januar 2010 12:40:25 schrieb Kogel, Jonck-van-der:
> Hi Ilja,
> Ok, that's good, I'm not using PageCreator. But how do I then make the  
> ModalWindow autosize? Perhaps I'm missing something in the JavaDocs 
> but I  can't find it anywhere.
> 
> Thanks, Jonck
> 
> -----Original Message-----
> From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de]
> Sent: woensdag 6 januari 2010 17:23
> To: users@wicket.apache.org
> Subject: Re: Autosize modal window
> 
> Hi,
> 
> according to the inline documentation of ModalWindow you can only 
> autosize  if you add components and don't use  ModalWindow.PageCreator
> 
> something like
> 
> ModalWindow modalWindow = new ModalWindow(); modalWindow.add(new  
> MyPanel(modalWindow.getComponentId());
> 
> ....
> 
> Best Regards,
> 	Ilja Pavkovic
> 
> Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
> > Hi,
> > Is it possible to have a modal window auto-size depending on its 
> > contents? I've been fiddling with header contributions and such but 
> > can't get it to work.
> >
> > Thanks!
> >
> > Jonck
> 
> --
> binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> 
>    +49 · 171 · 9342 465
> 
> Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost 
> Becker
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

--
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autosize modal window

Posted by Ilja Pavkovic <il...@binaere-bauten.de>.
Hi,

I forgot the following line: modalWindow.setUseInitialHeight(false);

Best Regards,
	Ilja Pavkovic

Am Donnerstag, 7. Januar 2010 12:40:25 schrieb Kogel, Jonck-van-der:
> Hi Ilja,
> Ok, that's good, I'm not using PageCreator. But how do I then make the
>  ModalWindow autosize? Perhaps I'm missing something in the JavaDocs but I
>  can't find it anywhere.
> 
> Thanks, Jonck
> 
> -----Original Message-----
> From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de]
> Sent: woensdag 6 januari 2010 17:23
> To: users@wicket.apache.org
> Subject: Re: Autosize modal window
> 
> Hi,
> 
> according to the inline documentation of ModalWindow you can only autosize
>  if you add components and don't use  ModalWindow.PageCreator
> 
> something like
> 
> ModalWindow modalWindow = new ModalWindow(); modalWindow.add(new
>  MyPanel(modalWindow.getComponentId());
> 
> ....
> 
> Best Regards,
> 	Ilja Pavkovic
> 
> Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
> > Hi,
> > Is it possible to have a modal window auto-size depending on its
> > contents? I've been fiddling with header contributions and such but
> > can't get it to work.
> >
> > Thanks!
> >
> > Jonck
> 
> --
> binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> 
>    +49 · 171 · 9342 465
> 
> Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Autosize modal window

Posted by "Kogel, Jonck-van-der" <jo...@bmw.nl>.
Hi Ilja,
Ok, that's good, I'm not using PageCreator. But how do I then make the ModalWindow autosize? Perhaps I'm missing something in the JavaDocs but I can't find it anywhere.

Thanks, Jonck 

-----Original Message-----
From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de] 
Sent: woensdag 6 januari 2010 17:23
To: users@wicket.apache.org
Subject: Re: Autosize modal window

Hi,

according to the inline documentation of ModalWindow you can only autosize if you add components and don't use  ModalWindow.PageCreator

something like

ModalWindow modalWindow = new ModalWindow(); modalWindow.add(new MyPanel(modalWindow.getComponentId());

....

Best Regards,
	Ilja Pavkovic

Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
> Hi,
> Is it possible to have a modal window auto-size depending on its 
> contents? I've been fiddling with header contributions and such but 
> can't get it to work.
> 
> Thanks!
> 
> Jonck
> 

--
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autosize modal window

Posted by Ilja Pavkovic <il...@binaere-bauten.de>.
Hi,

according to the inline documentation of ModalWindow you can only autosize if 
you add components and don't use  ModalWindow.PageCreator

something like

ModalWindow modalWindow = new ModalWindow();
modalWindow.add(new MyPanel(modalWindow.getComponentId());

....

Best Regards,
	Ilja Pavkovic

Am Mittwoch, 6. Januar 2010 17:12:05 schrieb Kogel, Jonck-van-der:
> Hi,
> Is it possible to have a modal window auto-size depending on its
> contents? I've been fiddling with header contributions and such but
> can't get it to work.
> 
> Thanks!
> 
> Jonck
> 

-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autosize modal window

Posted by Stefan Jozsa <st...@yahoo.com>.
Forgot:

public MyModalWindow  extends ModalWindow {

   public MyModalWindow(String id) {
       super(id);
       setResizable(false);
       setWidthUnit("em");
       setHeightUnit("em");
       setContent(new MyWindowPanel(this.getContentId()));
       // ...
   }
}

Stefan



      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Autosize modal window

Posted by Stefan Jozsa <st...@yahoo.com>.
Yes, it can be resized.
Do something like this:

	public void show(AjaxRequestTarget target, ...) {
                // ...
		super.show(target);
		// ...
		int height = YOUR_COMPUTED_HEIGHT;
		int width = YOUR_COMPUTED_WIDTH;
		target.appendJavascript(""//
				+ "var thisWindow = Wicket.Window.get();\n"//
				+ "if (thisWindow) {\n"//
				+ "thisWindow.window.style.width = \"" + width + "em\";\n"//
				+ "thisWindow.content.style.height = \"" + height + "em\";\n"//
				+ "thisWindow.center();\n"//
				+ "}"//
		);
	}

Stefan



      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org