You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Bruno Borges (JIRA)" <ji...@apache.org> on 2011/06/17 21:05:48 UTC
[jira] [Created] (WICKET-3813) Support for device and fallback
device specific layout
Support for device and fallback device specific layout
------------------------------------------------------
Key: WICKET-3813
URL: https://issues.apache.org/jira/browse/WICKET-3813
Project: Wicket
Issue Type: New Feature
Components: wicket-core
Reporter: Bruno Borges
Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
Page[_variation][_style][_locale].extension
where:
* variation is per Component
* style and locale are per Session
* extension is usually ".html"
The feature proposed here is to add another section, separated by a single dot:
Page[_variation][_style][_locale][.device].extension
The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
Consider the HomePage:
- HomePage.html
- HomePage.m.html
- HomePage.android.html
For the Android user, HomePage will render HomePage.android.html file.
A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051305#comment-13051305 ]
Bruno Borges commented on WICKET-3813:
--------------------------------------
This feature could also include .css and .js files.
To add a fallbackStyle property into Session would add complexity and would be hard to implement this as there are places where style is used in a different way, like loading i18n inside property files.
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "David Phillips (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Phillips updated WICKET-3813:
-----------------------------------
Attachment: devicelayout.patch
We encountered a need for this change earlier this year and have implemented a solution locally. This patch is a bit of a mix of Bruno's design with ours.
There are a few major changes from Bruno's original thoughts.
FIrst, we implemented the fallback inside of a Device object. This way the structure of fallbacks is far more flexible to certain devices. This is especially important if projects treat the devices differently (e.g. whether an iPad falls back to a tablet or an iOS device).
Second, we allowed individual components to specify their device. This is important for us as we have many reusable components which use device specific markup in differing ways.
Third, we added a hook point in which this component specific device logic can be externalized to a central location (Session). This is important if there's an external rules engine which is determining which devices should be used for which components).
Finally, we moved the logic for determining the correct extension to the DefaultMarkupResourceStreamProvider. This aligns it with the logic for finding Style, Variation, and Locale, as well as giving it access to the component (for our above requirements) without requiring an API change.
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket
> Reporter: Bruno Borges
> Attachments: devicelayout.patch, DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruno Borges updated WICKET-3813:
---------------------------------
Attachment: DeviceStreamLocator.java
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> * extension is usually ".html"
> The feature proposed here is to add another section, separated by a single dot:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051266#comment-13051266 ]
Bruno Borges commented on WICKET-3813:
--------------------------------------
This could be implemented if there was a fallbackStyle, but after digging around about this, I found out that style is cached in a few places because of things like properties files and String resources. I don't know if that could be easily modified .
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruno Borges updated WICKET-3813:
---------------------------------
Description:
Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
Page[_variation][_style][_locale].extension
where:
* variation is per Component
* style and locale are per Session
The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
Page[_variation][_style][_locale][.device].extension
The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
Consider the HomePage:
- HomePage.html
- HomePage.m.html
- HomePage.android.html
For the Android user, HomePage will render HomePage.android.html file.
A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
I've attached an example of DeviceStreamLocator
was:
Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
Page[_variation][_style][_locale].extension
where:
* variation is per Component
* style and locale are per Session
* extension is usually ".html"
The feature proposed here is to add another section, separated by a single dot:
Page[_variation][_style][_locale][.device].extension
The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
Consider the HomePage:
- HomePage.html
- HomePage.m.html
- HomePage.android.html
For the Android user, HomePage will render HomePage.android.html file.
A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
I've attached an example of DeviceStreamLocator
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pedro Santos updated WICKET-3813:
---------------------------------
Comment: was deleted
(was: Hi Bruno, ResourceNameIterator has the fallback logic in the framework. You can customize it to honor the described resource resolution fallback logic. )
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13486880#comment-13486880 ]
Bruno Borges commented on WICKET-3813:
--------------------------------------
[~david.phillips] I liked the way you improved this. If Wicket wants to compete on the mobile world of web frameworks, this is a top feature that really should be take in consideration for future releases.
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket
> Reporter: Bruno Borges
> Attachments: devicelayout.patch, DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-3813) Support for device and fallback
device specific layout
Posted by "Pedro Santos (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-3813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051273#comment-13051273 ]
Pedro Santos commented on WICKET-3813:
--------------------------------------
Hi Bruno, ResourceNameIterator has the fallback logic in the framework. You can customize it to honor the described resource resolution fallback logic.
> Support for device and fallback device specific layout
> ------------------------------------------------------
>
> Key: WICKET-3813
> URL: https://issues.apache.org/jira/browse/WICKET-3813
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-core
> Reporter: Bruno Borges
> Attachments: DeviceStreamLocator.java
>
>
> Wicket does a great job at locating resources based on variation, style and location. The current way of locating HTML resources is done by the following schema:
> Page[_variation][_style][_locale].extension
> where:
> * variation is per Component
> * style and locale are per Session
> The feature proposed here is to add another section, separated by a single dot, to be used specifically for HTML files:
> Page[_variation][_style][_locale][.device].extension
> The use case that requires this is one where an user's device is identified as an Android phone and so one could set Session.get().setDevice("android");
> Inside ResourceStreamLocator, the current algorithm can just add that as an array of extensions to iterate.
> Consider the HomePage:
> - HomePage.html
> - HomePage.m.html
> - HomePage.android.html
> For the Android user, HomePage will render HomePage.android.html file.
> A desktop user will render HomePage.html because Session.get().isStandardDevice(); will return true
> To support an iPhone user, one could set Session.get().setFallbackDevice("m"); and so, will render HomePage.m.html which could be a simplier version for other phones but Android.
> I've attached an example of DeviceStreamLocator
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira