[jira] Created: (TAP5-1048) Support for IE conditional stylesheets will need changes to DocumentLinkerImpl

2010-03-10 Thread Andy Blower (JIRA)
Support for IE conditional stylesheets will need changes to DocumentLinkerImpl
--

 Key: TAP5-1048
 URL: https://issues.apache.org/jira/browse/TAP5-1048
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.1.0.5
Reporter: Andy Blower
Priority: Minor


I'm having the issue described in TAP5-56, and although it's fairly easily 
solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) or 
some other way, this is still not sufficient. The problem is in the ordering of 
the stylesheets in the final rendered HTML output. The addStylesheetsToHead() 
method of DocumentLinkerImpl adds the included stylesheets and then moves them 
before any stylesheet links already in the dom. This fails if one of the 
existing stylesheet links is a conditional one, as findExistingElement() 
doesn't find the comment.

I've tried modifying the service, but because comments are Raw node, it seems 
impossible to put a bunch of Element nodes before one in the DOM.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (TAP5-1048) Support for IE conditional stylesheets will need changes to DocumentLinkerImpl

2010-03-10 Thread Andy Blower (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Blower updated TAP5-1048:
--

Attachment: TAP5-1048-patch.txt

This does fix the problem, but it's not the most satisfactory solution. Without 
changing the Node/Raw/Element classes I couldn't see another way to fix it.

> Support for IE conditional stylesheets will need changes to DocumentLinkerImpl
> --
>
> Key: TAP5-1048
> URL: https://issues.apache.org/jira/browse/TAP5-1048
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-core
>Affects Versions: 5.1.0.5
>Reporter: Andy Blower
>Priority: Minor
> Attachments: TAP5-1048-patch.txt
>
>
> I'm having the issue described in TAP5-56, and although it's fairly easily 
> solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) 
> or some other way, this is still not sufficient. The problem is in the 
> ordering of the stylesheets in the final rendered HTML output. The 
> addStylesheetsToHead() method of DocumentLinkerImpl adds the included 
> stylesheets and then moves them before any stylesheet links already in the 
> dom. This fails if one of the existing stylesheet links is a conditional one, 
> as findExistingElement() doesn't find the comment.
> I've tried modifying the service, but because comments are Raw node, it's 
> difficult to put a bunch of Element nodes before one in the DOM. The only way 
> I could think of is included as a patch - findExistingElement() can return 
> the previous Element which can then have the link element nodes placed after 
> rather than before. This works, but is not very satisfactory.
> I can't use this anyway because overriding that T5 DocumentLinkerImpl is 
> fragile and breaks in some of our environments. I spent several hours 
> aliasing and overriding this 'service' before I realised that DocumentLinker 
> is not actually a service! It's in the internal.services package, but isn't 
> actually a service - it's instantiated directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (TAP5-1048) Support for IE conditional stylesheets will need changes to DocumentLinkerImpl

2010-03-10 Thread Andy Blower (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Blower updated TAP5-1048:
--

Description: 
I'm having the issue described in TAP5-56, and although it's fairly easily 
solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) or 
some other way, this is still not sufficient. The problem is in the ordering of 
the stylesheets in the final rendered HTML output. The addStylesheetsToHead() 
method of DocumentLinkerImpl adds the included stylesheets and then moves them 
before any stylesheet links already in the dom. This fails if one of the 
existing stylesheet links is a conditional one, as findExistingElement() 
doesn't find the comment.

I've tried modifying the service, but because comments are Raw node, it's 
difficult to put a bunch of Element nodes before one in the DOM. The only way I 
could think of is included as a patch - findExistingElement() can return the 
previous Element which can then have the link element nodes placed after rather 
than before. This works, but is not very satisfactory.

I can't use this anyway because overriding that T5 DocumentLinkerImpl is 
fragile and breaks in some of our environments. I spent several hours aliasing 
and overriding this 'service' before I realised that DocumentLinker is not 
actually a service! It's in the internal.services package, but isn't actually a 
service - it's instantiated directly.

  was:
I'm having the issue described in TAP5-56, and although it's fairly easily 
solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) or 
some other way, this is still not sufficient. The problem is in the ordering of 
the stylesheets in the final rendered HTML output. The addStylesheetsToHead() 
method of DocumentLinkerImpl adds the included stylesheets and then moves them 
before any stylesheet links already in the dom. This fails if one of the 
existing stylesheet links is a conditional one, as findExistingElement() 
doesn't find the comment.

I've tried modifying the service, but because comments are Raw node, it seems 
impossible to put a bunch of Element nodes before one in the DOM.


> Support for IE conditional stylesheets will need changes to DocumentLinkerImpl
> --
>
> Key: TAP5-1048
> URL: https://issues.apache.org/jira/browse/TAP5-1048
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-core
>Affects Versions: 5.1.0.5
>Reporter: Andy Blower
>Priority: Minor
> Attachments: TAP5-1048-patch.txt
>
>
> I'm having the issue described in TAP5-56, and although it's fairly easily 
> solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) 
> or some other way, this is still not sufficient. The problem is in the 
> ordering of the stylesheets in the final rendered HTML output. The 
> addStylesheetsToHead() method of DocumentLinkerImpl adds the included 
> stylesheets and then moves them before any stylesheet links already in the 
> dom. This fails if one of the existing stylesheet links is a conditional one, 
> as findExistingElement() doesn't find the comment.
> I've tried modifying the service, but because comments are Raw node, it's 
> difficult to put a bunch of Element nodes before one in the DOM. The only way 
> I could think of is included as a patch - findExistingElement() can return 
> the previous Element which can then have the link element nodes placed after 
> rather than before. This works, but is not very satisfactory.
> I can't use this anyway because overriding that T5 DocumentLinkerImpl is 
> fragile and breaks in some of our environments. I spent several hours 
> aliasing and overriding this 'service' before I realised that DocumentLinker 
> is not actually a service! It's in the internal.services package, but isn't 
> actually a service - it's instantiated directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (TAP5-1048) Support for IE conditional stylesheets will need changes to DocumentLinkerImpl

2010-03-10 Thread Howard M. Lewis Ship (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843670#action_12843670
 ] 

Howard M. Lewis Ship commented on TAP5-1048:


My intention is to extend the new JavascriptSupport interface (adding in 5.2) 
with new options to support these kinds of issues, along with new annotations 
(@ImportJavascriptLibrary to replace @IncludeJavascriptLibrary) to make it 
easier to control ordering.

> Support for IE conditional stylesheets will need changes to DocumentLinkerImpl
> --
>
> Key: TAP5-1048
> URL: https://issues.apache.org/jira/browse/TAP5-1048
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-core
>Affects Versions: 5.1.0.5
>Reporter: Andy Blower
>Priority: Minor
> Attachments: TAP5-1048-patch.txt
>
>
> I'm having the issue described in TAP5-56, and although it's fairly easily 
> solved using a component (see: http://markmail.org/message/aidg4w223t5yaass) 
> or some other way, this is still not sufficient. The problem is in the 
> ordering of the stylesheets in the final rendered HTML output. The 
> addStylesheetsToHead() method of DocumentLinkerImpl adds the included 
> stylesheets and then moves them before any stylesheet links already in the 
> dom. This fails if one of the existing stylesheet links is a conditional one, 
> as findExistingElement() doesn't find the comment.
> I've tried modifying the service, but because comments are Raw node, it's 
> difficult to put a bunch of Element nodes before one in the DOM. The only way 
> I could think of is included as a patch - findExistingElement() can return 
> the previous Element which can then have the link element nodes placed after 
> rather than before. This works, but is not very satisfactory.
> I can't use this anyway because overriding that T5 DocumentLinkerImpl is 
> fragile and breaks in some of our environments. I spent several hours 
> aliasing and overriding this 'service' before I realised that DocumentLinker 
> is not actually a service! It's in the internal.services package, but isn't 
> actually a service - it's instantiated directly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Closed: (TAP5-993) Reorganize ComponentClassTransformWorkers to start moving away from Javassist

2010-03-10 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship closed TAP5-993.
-

   Resolution: Fixed
Fix Version/s: 5.2.0

I think this is done, though there's room for improvement in terms of 
optimizing the behavior and improving performance.

> Reorganize ComponentClassTransformWorkers to start moving away from Javassist
> -
>
> Key: TAP5-993
> URL: https://issues.apache.org/jira/browse/TAP5-993
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-core
>Affects Versions: 5.2.0
>Reporter: Howard M. Lewis Ship
>Assignee: Howard M. Lewis Ship
> Fix For: 5.2.0
>
>
> Begin moving code into forms that can be implemented without Javassist, by 
> creating new methods on ClassTransformation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (TAP5-1049) TimeInterval should have the ability to convert backwards to a useful string

2010-03-10 Thread Howard M. Lewis Ship (JIRA)
TimeInterval should have the ability to convert backwards to a useful string


 Key: TAP5-1049
 URL: https://issues.apache.org/jira/browse/TAP5-1049
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-ioc
Affects Versions: 5.2.0
Reporter: Howard M. Lewis Ship


It's very useful, sometimes, to express a time interval, in milliseconds, in 
terms of days, hours, etc.  It would be nice if TimeInterval could reverse a 
long back into a input string to its constructor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



svn commit: r921673 - in /tapestry/tapestry5/trunk/tapestry-ioc/src: main/java/org/apache/tapestry5/ioc/util/TimeInterval.java test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java

2010-03-10 Thread hlship
Author: hlship
Date: Thu Mar 11 02:47:12 2010
New Revision: 921673

URL: http://svn.apache.org/viewvc?rev=921673&view=rev
Log:
TAP5-1049: TimeInterval should have the ability to convert backwards to a 
useful string

Modified:

tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/TimeInterval.java

tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/TimeInterval.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/TimeInterval.java?rev=921673&r1=921672&r2=921673&view=diff
==
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/TimeInterval.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/util/TimeInterval.java
 Thu Mar 11 02:47:12 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -47,18 +47,30 @@ public class TimeInterval
 UNITS.put("y", 365 * UNITS.get("d"));
 }
 
+/**
+ * The unit keys, sorted in descending order.
+ */
+private static final String[] UNIT_KEYS =
+{ "y", "d", "h", "m", "s", "ms" };
+
 private static final Pattern PATTERN = 
Pattern.compile("\\s*(\\d+)\\s*([a-z]*)", Pattern.CASE_INSENSITIVE);
 
 private final long milliseconds;
 
 /**
  * Creates a TimeInterval for a string.
- *
- * @param input the string specifying the amount of time in the period
+ * 
+ * @param input
+ *the string specifying the amount of time in the period
  */
 public TimeInterval(String input)
 {
-milliseconds = parseMilliseconds(input);
+this(parseMilliseconds(input));
+}
+
+public TimeInterval(long milliseconds)
+{
+this.milliseconds = milliseconds;
 }
 
 public long milliseconds()
@@ -71,6 +83,43 @@ public class TimeInterval
 return milliseconds / MILLISECOND;
 }
 
+/**
+ * Converts the milliseconds back into a string (compatible with {...@link 
#TimeInterval(String)}).
+ * 
+ * @since 5.2.0
+ */
+public String toDescription()
+{
+StringBuilder builder = new StringBuilder();
+
+String sep = "";
+
+long remainder = milliseconds;
+
+for (String key : UNIT_KEYS)
+{
+if (remainder == 0)
+break;
+
+long value = UNITS.get(key);
+
+long units = remainder / value;
+
+if (units > 0)
+{
+builder.append(sep);
+builder.append(units);
+builder.append(key);
+
+sep = " ";
+
+remainder = remainder % value;
+}
+}
+
+return builder.toString();
+}
+
 static long parseMilliseconds(String input)
 {
 long milliseconds = 0l;
@@ -130,7 +179,8 @@ public class TimeInterval
 @Override
 public boolean equals(Object obj)
 {
-if (obj == null) return false;
+if (obj == null)
+return false;
 
 if (obj instanceof TimeInterval)
 {

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java?rev=921673&r1=921672&r2=921673&view=diff
==
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/util/TimeIntervalTest.java
 Thu Mar 11 02:47:12 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ public class TimeIntervalTest extends Te
 @Test(dataProvider = "mix_of_units_data")
 public void mix_of_units(String input, long expected)
 {
-assertEquals(TimeInterval.parseMilliseconds(input), 

[jira] Closed: (TAP5-1049) TimeInterval should have the ability to convert backwards to a useful string

2010-03-10 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship closed TAP5-1049.
--

Resolution: Fixed
  Assignee: Howard M. Lewis Ship

> TimeInterval should have the ability to convert backwards to a useful string
> 
>
> Key: TAP5-1049
> URL: https://issues.apache.org/jira/browse/TAP5-1049
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-ioc
>Affects Versions: 5.2.0
>Reporter: Howard M. Lewis Ship
>Assignee: Howard M. Lewis Ship
>Priority: Minor
>
> It's very useful, sometimes, to express a time interval, in milliseconds, in 
> terms of days, hours, etc.  It would be nice if TimeInterval could reverse a 
> long back into a input string to its constructor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (TAP5-1049) TimeInterval should have the ability to convert backwards to a useful string

2010-03-10 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship updated TAP5-1049:
---

Priority: Minor  (was: Major)

> TimeInterval should have the ability to convert backwards to a useful string
> 
>
> Key: TAP5-1049
> URL: https://issues.apache.org/jira/browse/TAP5-1049
> Project: Tapestry 5
>  Issue Type: Improvement
>  Components: tapestry-ioc
>Affects Versions: 5.2.0
>Reporter: Howard M. Lewis Ship
>Priority: Minor
>
> It's very useful, sometimes, to express a time interval, in milliseconds, in 
> terms of days, hours, etc.  It would be nice if TimeInterval could reverse a 
> long back into a input string to its constructor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.