@agent in skinning should allow for a range of agent versions -------------------------------------------------------------
Key: TRINIDAD-1547 URL: https://issues.apache.org/jira/browse/TRINIDAD-1547 Project: MyFaces Trinidad Issue Type: New Feature Reporter: Jeanne Waldman related to https://issues.apache.org/jira/browse/TRINIDAD-799 Add agent version support in skinning We currently have @agent support, @agent ie and (version:5) We need to add version ranges - the min-version and max-version. See thread from April, 2008: http://www.mail-archive.com/dev@myfaces.apache.org/msg31841.html -- from thread -- max- means less-than-or-equal-to:max-version:8 means version <= 8.0 == true -- option 5) the version feature is a String that matches the native "major.minor.whatever" format of the browser's engine. If the browser's engine uses non "." for separating versions, "." is used instead. For matches, the "*" character is allowed in any version section. For comparisons, the "*" is always a valid match regardless of <, >, or = comparison For comparisons where the comparison side contains fewer version sections than the actual browser version, the comparison side is padded with * version sections and the comparison occurs as above. For comparisons where the comparison side contains more version sections than the actual browser version, the browser version is padded with 0 version sections and the comparison occurs as above. // user wants to match IE 5, actual browser version ie 5.5 @agent ie and (version:5) matches because version:5 expands to version 5.* and 5.* matches 5.5 @agent ie and (min-version:5) matches because version:5 expands to version 5.* and 5.* < 5.5 = true @agent ie and (max-version:5) matches because version:5 expands to version 5.* and 5.* > 5.5 = true // actual browser version gecko 1.9 @agent gecko and (min-version:1.9.2) does not match because the browser version 1.9 expands to 1.9.0 and 1.9.2 is > than 1.9.0 // actual browser version gecko 1.9 @agent gecko and (min-version:1.9.*) matches because the browser version 1.9 expands to 1.9.0 and 1.9.* == 1.9.0 -- I have implemented and attached a Version class with the desired behavior and tested that the following works as expected System.out.println("toString:" + new Version("5.0.3", "*")); System.out.println("hashCode:" + new Version("5.0.3", "*").hashCode()); System.out.println("not equals:" + new Version("5.0.3", "*").equals(new Version("5", "*"))); System.out.println("compareTo == 0:" + new Version("5.0.3", "*").compareTo(new Version("5", "*"))); System.out.println("compareTo == +:" + new Version("5.0.3", "*").compareTo(new Version("5", "0"))); System.out.println("compareTo == -:" + new Version("5.0.3", "*").compareTo(new Version("5.0.4", "*"))); Given the way that compareTo works, I changed the wildcard behavior from what is listed before to make the wildcard behavior only affect compareTo() results of 0. However, this still has the desired effect because min- and max- comparisons are <= and >= respectively. Anway, I believe looking at the code in compareTo() will give everyone a better idea of what I intend. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.