Artur W. wrote:
Is is possible to create different markup files (for the same page) depends
on user screen resolution?
This is quite easy, actually.
Create an abstract ResolutionDependentPage extends WebPage which your
pages will extend.
Add this method:
@Override
public String getVariation() {
WebClientInfo info =
(WebClientInfo)getRequestCycle().getClientInfo();
ClientProperties p = info.getClientProperties();
// Defaults to -1 if not available (JS disabled).
int width = p.getScreenWidth();
String size;
if (width < 1024) {
size = "small";
}
else if (width < 1280) {
size = "medium";
}
else {
size = "large";
}
return super.getVariation() + "_" + size;
}
That should let you localize things properly, too, e.g:
HomePage_de_big.html
Note that in order to gather the extended browser info stuff like screen
resolution, you need to go:
getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
...in your application's init() method.
Should work, maybe. ;-)
BTW, note that in the example above, I'm not using exact resolutions.
This is because I really don't think you want to do that - there are an
awful lot of possible resolutions, what with people using widescreen
laptop displays. If you include the randomly-sized VMware/Parallels
desktops you can have, the possibilities are effectively infinite. ;-)
Regards,
Al
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]