You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2006/08/01 19:44:01 UTC
svn commit: r427657 [23/42] - in /myfaces:
core/trunk/api/src/main/java/javax/faces/component/
core/trunk/api/src/test/java/javax/faces/
core/trunk/api/src/test/java/javax/faces/application/
core/trunk/api/src/test/java/javax/faces/component/ core/trun...
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java Tue Aug 1 10:43:28 2006
@@ -1,103 +1,103 @@
-/*
- * Copyright 2004 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.myfaces.taglib.html.ext;
-
-import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
-import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
-import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlSelectListboxTagBase;
-import org.apache.myfaces.component.UserRoleAware;
-import org.apache.myfaces.component.html.ext.HtmlSelectOneListbox;
-
-import javax.faces.component.UIComponent;
-
-/**
- * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
- * @version $Revision: 170212 $ $Date: 2005-05-15 12:58:15 +0200 (Sun, 15 May 2005) $
- */
-public class HtmlSelectOneListboxTag
- extends HtmlSelectListboxTagBase
-{
- public String getComponentType()
- {
- return HtmlSelectOneListbox.COMPONENT_TYPE;
- }
-
- public String getRendererType()
- {
- return "org.apache.myfaces.Listbox";
- }
-
- private String _escape;
- private String _enabledOnUserRole;
- private String _visibleOnUserRole;
-
- private String _displayValueOnly;
- private String _displayValueOnlyStyle;
- private String _displayValueOnlyStyleClass;
-
- public void release() {
- super.release();
- _escape=null;
- _enabledOnUserRole=null;
- _visibleOnUserRole=null;
-
- _displayValueOnly=null;
- _displayValueOnlyStyle=null;
- _displayValueOnlyStyleClass=null;
- }
-
- protected void setProperties(UIComponent component)
- {
- super.setProperties(component);
- setBooleanProperty(component, JSFAttr.ESCAPE_ATTR, _escape);
- setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
- setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
-
- setBooleanProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_ATTR, _displayValueOnly);
- setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_ATTR, _displayValueOnlyStyle);
- setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_CLASS_ATTR, _displayValueOnlyStyleClass);
- }
-
- public void setEscape(String escape)
- {
- _escape = escape;
- }
-
- public void setEnabledOnUserRole(String enabledOnUserRole)
- {
- _enabledOnUserRole = enabledOnUserRole;
- }
-
- public void setVisibleOnUserRole(String visibleOnUserRole)
- {
- _visibleOnUserRole = visibleOnUserRole;
- }
-
- public void setDisplayValueOnly(String displayValueOnly)
- {
- _displayValueOnly = displayValueOnly;
- }
-
- public void setDisplayValueOnlyStyle(String displayValueOnlyStyle)
- {
- _displayValueOnlyStyle = displayValueOnlyStyle;
- }
-
- public void setDisplayValueOnlyStyleClass(String displayValueOnlyStyleClass)
- {
- _displayValueOnlyStyleClass = displayValueOnlyStyleClass;
- }
-}
+/*
+ * Copyright 2004 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.taglib.html.ext;
+
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlSelectListboxTagBase;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.html.ext.HtmlSelectOneListbox;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
+ * @version $Revision: 170212 $ $Date: 2005-05-15 12:58:15 +0200 (Sun, 15 May 2005) $
+ */
+public class HtmlSelectOneListboxTag
+ extends HtmlSelectListboxTagBase
+{
+ public String getComponentType()
+ {
+ return HtmlSelectOneListbox.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return "org.apache.myfaces.Listbox";
+ }
+
+ private String _escape;
+ private String _enabledOnUserRole;
+ private String _visibleOnUserRole;
+
+ private String _displayValueOnly;
+ private String _displayValueOnlyStyle;
+ private String _displayValueOnlyStyleClass;
+
+ public void release() {
+ super.release();
+ _escape=null;
+ _enabledOnUserRole=null;
+ _visibleOnUserRole=null;
+
+ _displayValueOnly=null;
+ _displayValueOnlyStyle=null;
+ _displayValueOnlyStyleClass=null;
+ }
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setBooleanProperty(component, JSFAttr.ESCAPE_ATTR, _escape);
+ setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
+ setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
+
+ setBooleanProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_ATTR, _displayValueOnly);
+ setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_ATTR, _displayValueOnlyStyle);
+ setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_CLASS_ATTR, _displayValueOnlyStyleClass);
+ }
+
+ public void setEscape(String escape)
+ {
+ _escape = escape;
+ }
+
+ public void setEnabledOnUserRole(String enabledOnUserRole)
+ {
+ _enabledOnUserRole = enabledOnUserRole;
+ }
+
+ public void setVisibleOnUserRole(String visibleOnUserRole)
+ {
+ _visibleOnUserRole = visibleOnUserRole;
+ }
+
+ public void setDisplayValueOnly(String displayValueOnly)
+ {
+ _displayValueOnly = displayValueOnly;
+ }
+
+ public void setDisplayValueOnlyStyle(String displayValueOnlyStyle)
+ {
+ _displayValueOnlyStyle = displayValueOnlyStyle;
+ }
+
+ public void setDisplayValueOnlyStyleClass(String displayValueOnlyStyleClass)
+ {
+ _displayValueOnlyStyleClass = displayValueOnlyStyleClass;
+ }
+}
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/taglib/html/ext/HtmlSelectOneListboxTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/date.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/date.js?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/date.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/date.js Tue Aug 1 10:43:28 2006
@@ -1,485 +1,485 @@
-/*
-* Copyright 2004 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
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-org_apache_myfaces_DateFormatSymbols = function()
-{
- this.eras = new Array('BC', 'AD');
- this.months = new Array('January', 'February', 'March', 'April',
- 'May', 'June', 'July', 'August', 'September', 'October',
- 'November', 'December', 'Undecimber');
- this.shortMonths = new Array('Jan', 'Feb', 'Mar', 'Apr',
- 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
- 'Nov', 'Dec', 'Und');
- this.weekdays = new Array('Sunday', 'Monday', 'Tuesday',
- 'Wednesday', 'Thursday', 'Friday', 'Saturday');
- this.shortWeekdays = new Array('Sun', 'Mon', 'Tue',
- 'Wed', 'Thu', 'Fri', 'Sat');
- this.ampms = new Array('AM', 'PM');
- this.zoneStrings = new Array(new Array(0, 'long-name', 'short-name'));
- var threshold = new Date();
- threshold.setYear(threshold.getYear()-80);
- this.twoDigitYearStart = threshold;
-}
-
-org_apache_myfaces_SimpleDateFormatParserContext = function()
-{
- this.newIndex=0;
- this.retValue=0;
- this.year=0;
- this.ambigousYear=false;
- this.month=0;
- this.day=0;
- this.dayOfWeek=0;
- this.hour=0;
- this.min=0;
- this.sec=0;
- this.ampm=0;
- this.dateStr="";
-}
-
-org_apache_myfaces_SimpleDateFormat = function(pattern, dateFormatSymbols)
-{
- this.pattern = pattern;
- this.dateFormatSymbols = dateFormatSymbols ? dateFormatSymbols :
- new org_apache_myfaces_DateFormatSymbols();
-}
-org_apache_myfaces_SimpleDateFormat.prototype._handle = function(dateStr, date, parse)
- {
- var patternIndex = 0;
- var dateIndex = 0;
- var commentMode = false;
- var lastChar = 0;
- var currentChar=0;
- var nextChar=0;
- var patternSub = null;
-
- var context = new org_apache_myfaces_SimpleDateFormatParserContext();
-
- if(date != null)
- {
- context.year = this._fullYearFromDate(date.getYear());
- context.month = date.getMonth();
- context.day = date.getDate();
- context.dayOfWeek = date.getDay();
- context.hour = date.getHours();
- context.min = date.getMinutes();
- context.sec = date.getSeconds();
- }
-
- while (patternIndex < this.pattern.length)
- {
- currentChar = this.pattern.charAt(patternIndex);
-
- if(patternIndex<(this.pattern.length-1))
- {
- nextChar = this.pattern.charAt(patternIndex+1);
- }
- else
- {
- nextChar = 0;
- }
-
-
- if (currentChar == '\'' && lastChar!='\\')
- {
- commentMode = !commentMode;
- patternIndex++;
- }
- else
- {
- if(!commentMode)
- {
- if (currentChar == '\\' && lastChar!='\\')
- {
- patternIndex++;
- }
- else
- {
- if(patternSub == null)
- patternSub = "";
-
- patternSub+=currentChar;
-
- if(currentChar != nextChar)
- {
- this._handlePatternSub(context, patternSub,
- dateStr, dateIndex, parse);
-
- patternSub = null;
-
- if(context.newIndex<0)
- break;
-
- dateIndex = context.newIndex;
- }
-
- patternIndex++;
- }
- }
- else
- {
- if(parse)
- {
- if(this.pattern.charAt(patternIndex)!=dateStr.charAt(dateIndex))
- {
- //invalid character in dateString
- return null;
- }
- }
- else
- {
- context.dateStr+=this.pattern.charAt(patternIndex);
- }
-
- patternIndex++;
- dateIndex++;
- }
- }
-
- lastChar = currentChar;
- }
-
- this._handlePatternSub(context, patternSub,
- dateStr, dateIndex, parse);
-
- return context;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype.parse = function(dateStr)
- {
- if(!dateStr || dateStr.length==0)
- return null;
-
- var context = this._handle(dateStr, null, true);
-
- if(context.retValue==-1)
- return null;
-
- this._adjustTwoDigitYear(context);
-
- return this._createDateFromContext(context);
- };
-org_apache_myfaces_SimpleDateFormat.prototype._createDateFromContext=function(context)
- {
- return new Date(context.year, context.month,
- context.day,context.hour,context.min,context.sec);
- };
-org_apache_myfaces_SimpleDateFormat.prototype.format = function(date)
- {
- var context = this._handle(null, date, false);
-
- return context.dateStr;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._parseString = function(context, dateStr, dateIndex, strings)
- {
- var fragment = dateStr.substr(dateIndex);
- var index = this._prefixOf(strings, fragment);
- if (index != -1) {
- context.retValue = index;
- context.newIndex = dateIndex + strings[index].length;
- return context;
- }
-
- context.retValue=-1;
- context.newIndex=-1;
- return context;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._parseNum = function(context, dateStr, posCount, dateIndex)
- {
- for(var i=Math.min(posCount,dateStr.length-dateIndex);i>0;i--)
- {
- var numStr = dateStr.substring(dateIndex,dateIndex+i);
-
- context.retValue = this._parseInt(numStr);
-
- if(context.retValue == -1)
- continue;
-
- context.newIndex = dateIndex+i;
- return context;
- }
-
- context.retValue = -1;
- context.newIndex = -1;
- return context;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._handlePatternSub = function(context, patternSub, dateStr, dateIndex, parse)
- {
- if(patternSub==null || patternSub.length==0)
- return;
-
- if(patternSub.charAt(0)=='y')
- {
- if(parse)
- {
- /* XXX @Arvid: whatever we do, we need to try to parse
- the full year format - length means nothing for
- parsing, only for formatting, so says SimpleDateFormat javadoc.
- only if we run into problems as there are no separator chars, we
- should use exact length parsing - how are we going to handle this?
-
- Additionally, the threshold was not quite correct - it needs to
- be set to current date - 80years...
-
- this is done after parsing now!
-
- if (patternSub.length <= 3) {
- this._parseNum(context, dateStr,2,dateIndex);
- context.year = (context.retValue < 26)
- ? 2000 + context.retValue : 1900 + context.retValue;
- } else {
- this._parseNum(context, dateStr,4,dateIndex);
- context.year = context.retValue;
- }*/
- this._parseNum(context, dateStr,4,dateIndex);
-
- if((context.newIndex-dateIndex)<4)
- {
- context.year = context.retValue+1900;
- context.ambigousYear = true;
- }
- else
- {
- context.year = context.retValue;
-
- }
- }
- else
- {
- this._formatNum(context,context.year,patternSub.length <= 3 ? 2 : 4,true);
- }
- }
- else if(patternSub.charAt(0)=='M')
- {
- if(parse)
- {
- if (patternSub.length == 3) {
- var fragment = dateStr.substr(dateIndex, 3);
- var index = this._indexOf(this.dateFormatSymbols.shortMonths, fragment);
- if (index != -1) {
- context.month = index;
- context.newIndex = dateIndex + 3;
- }
- } else if (patternSub.length >= 4) {
- var fragment = dateStr.substr(dateIndex);
- var index = this._prefixOf(this.dateFormatSymbols.months, fragment);
- if (index != -1) {
- context.month = index;
- context.newIndex = dateIndex + this.dateFormatSymbols.months[index].length;
- }
- } else {
- this._parseNum(context, dateStr,2,dateIndex);
- context.month = context.retValue-1;
- }
- }
- else
- {
- if (patternSub.length == 3) {
- context.dateStr += this.dateFormatSymbols.shortMonths[context.month];
- } else if (patternSub.length >= 4) {
- context.dateStr += this.dateFormatSymbols.months[context.month];
- } else {
- this._formatNum(context,context.month+1,patternSub.length);
- }
- }
- }
- else if(patternSub.charAt(0)=='d')
- {
- if(parse)
- {
- this._parseNum(context, dateStr,2,dateIndex);
- context.day = context.retValue;
- }
- else
- {
- this._formatNum(context,context.day,patternSub.length);
- }
- }
- else if(patternSub.charAt(0)=='E')
- {
- if(parse)
- {
- // XXX dayOfWeek is not used to generate date at the moment
- if (patternSub.length <= 3) {
- var fragment = dateStr.substr(dateIndex, 3);
- var index = this._indexOf(this.dateFormatSymbols.shortWeekdays, fragment);
- if (index != -1) {
- context.dayOfWeek = index;
- context.newIndex = dateIndex + 3;
- }
- } else {
- var fragment = dateStr.substr(dateIndex);
- var index = this._prefixOf(this.dateFormatSymbols.weekdays, fragment);
- if (index != -1) {
- context.dayOfWeek = index;
- context.newIndex = dateIndex + this.dateFormatSymbols.weekdays[index].length;
- }
- }
- }
- else
- {
- if (patternSub.length <= 3) {
- context.dateStr += this.dateFormatSymbols.shortWeekdays[context.dayOfWeek];
- } else {
- context.dateStr += this.dateFormatSymbols.weekdays[context.dayOfWeek];
- }
- }
- }
- else if(patternSub.charAt(0)=='H' ||
- patternSub.charAt(0)=='h')
- {
- if(parse)
- {
- this._parseNum(context, dateStr,2,dateIndex);
- context.hour = context.retValue;
- }
- else
- {
- this._formatNum(context,context.hour,patternSub.length);
- }
- }
- else if(patternSub.charAt(0)=='m')
- {
- if(parse)
- {
- this._parseNum(context, dateStr,2,dateIndex);
- context.min = context.retValue;
- }
- else
- {
- this._formatNum(context,context.min,patternSub.length);
- }
- }
- else if(patternSub.charAt(0)=='s')
- {
- if(parse)
- {
- this._parseNum(context, dateStr,2,dateIndex);
- context.sec = context.retValue;
- }
- else
- {
- this._formatNum(context,context.sec,patternSub.length);
- }
- }
- else if(patternSub.charAt(0)=='a')
- {
- if(parse)
- {
- this._parseString(context, dateStr,dateIndex,this.dateFormatSymbols.ampms);
- context.ampm = context.retValue;
- }
- else
- {
- context.dateStr += this.dateFormatSymbols.ampms[context.ampm];
- }
- }
- else
- {
- if(parse)
- {
- context.newIndex=dateIndex+patternSub.length;
- }
- else
- {
- context.dateStr+=patternSub;
- }
-
- }
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._formatNum = function (context, num, length, ensureLength)
- {
- var str = num+"";
-
- while(str.length<length)
- str="0"+str;
-
- // XXX do we have to distinguish left and right 'cutting'
- //ensureLength - enable cutting only for parameters like the year, the other
- if (ensureLength && str.length > length) {
- str = str.substr(str.length - length);
- }
-
- context.dateStr+=str;
- };
-
- // perhaps add to Array.prototype
-org_apache_myfaces_SimpleDateFormat.prototype._indexOf = function (array, value)
- {
- for (var i = 0; i < array.length; ++i) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._prefixOf = function (array, value)
- {
- for (var i = 0; i < array.length; ++i) {
- if (value.indexOf(array[i]) == 0) {
- return i;
- }
- }
- return -1;
- };
-
-org_apache_myfaces_SimpleDateFormat.prototype._parseInt = function(value)
- {
- var sum = 0;
-
- for(var i=0;i<value.length;i++)
- {
- var c = value.charAt(i);
-
- if(c<'0'||c>'9')
- {
- return -1;
- }
- sum = sum*10+(c-'0');
- }
-
- return sum;
- };
-org_apache_myfaces_SimpleDateFormat.prototype._fullYearFromDate = function(year)
- {
-
- var yearStr = year+"";
-
- if (yearStr.length < 4)
- {
- return year+1900;
- }
-
- return year;
- };
-org_apache_myfaces_SimpleDateFormat.prototype._adjustTwoDigitYear = function(context)
- {
-
- if(context.ambigousYear)
- {
- var date = this._createDateFromContext(context);
- var threshold = this.dateFormatSymbols.twoDigitYearStart;
-
- if(date.getTime()<threshold.getTime())
- context.year += 100;
- }
- };
-
+/*
+* Copyright 2004 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
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+org_apache_myfaces_DateFormatSymbols = function()
+{
+ this.eras = new Array('BC', 'AD');
+ this.months = new Array('January', 'February', 'March', 'April',
+ 'May', 'June', 'July', 'August', 'September', 'October',
+ 'November', 'December', 'Undecimber');
+ this.shortMonths = new Array('Jan', 'Feb', 'Mar', 'Apr',
+ 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+ 'Nov', 'Dec', 'Und');
+ this.weekdays = new Array('Sunday', 'Monday', 'Tuesday',
+ 'Wednesday', 'Thursday', 'Friday', 'Saturday');
+ this.shortWeekdays = new Array('Sun', 'Mon', 'Tue',
+ 'Wed', 'Thu', 'Fri', 'Sat');
+ this.ampms = new Array('AM', 'PM');
+ this.zoneStrings = new Array(new Array(0, 'long-name', 'short-name'));
+ var threshold = new Date();
+ threshold.setYear(threshold.getYear()-80);
+ this.twoDigitYearStart = threshold;
+}
+
+org_apache_myfaces_SimpleDateFormatParserContext = function()
+{
+ this.newIndex=0;
+ this.retValue=0;
+ this.year=0;
+ this.ambigousYear=false;
+ this.month=0;
+ this.day=0;
+ this.dayOfWeek=0;
+ this.hour=0;
+ this.min=0;
+ this.sec=0;
+ this.ampm=0;
+ this.dateStr="";
+}
+
+org_apache_myfaces_SimpleDateFormat = function(pattern, dateFormatSymbols)
+{
+ this.pattern = pattern;
+ this.dateFormatSymbols = dateFormatSymbols ? dateFormatSymbols :
+ new org_apache_myfaces_DateFormatSymbols();
+}
+org_apache_myfaces_SimpleDateFormat.prototype._handle = function(dateStr, date, parse)
+ {
+ var patternIndex = 0;
+ var dateIndex = 0;
+ var commentMode = false;
+ var lastChar = 0;
+ var currentChar=0;
+ var nextChar=0;
+ var patternSub = null;
+
+ var context = new org_apache_myfaces_SimpleDateFormatParserContext();
+
+ if(date != null)
+ {
+ context.year = this._fullYearFromDate(date.getYear());
+ context.month = date.getMonth();
+ context.day = date.getDate();
+ context.dayOfWeek = date.getDay();
+ context.hour = date.getHours();
+ context.min = date.getMinutes();
+ context.sec = date.getSeconds();
+ }
+
+ while (patternIndex < this.pattern.length)
+ {
+ currentChar = this.pattern.charAt(patternIndex);
+
+ if(patternIndex<(this.pattern.length-1))
+ {
+ nextChar = this.pattern.charAt(patternIndex+1);
+ }
+ else
+ {
+ nextChar = 0;
+ }
+
+
+ if (currentChar == '\'' && lastChar!='\\')
+ {
+ commentMode = !commentMode;
+ patternIndex++;
+ }
+ else
+ {
+ if(!commentMode)
+ {
+ if (currentChar == '\\' && lastChar!='\\')
+ {
+ patternIndex++;
+ }
+ else
+ {
+ if(patternSub == null)
+ patternSub = "";
+
+ patternSub+=currentChar;
+
+ if(currentChar != nextChar)
+ {
+ this._handlePatternSub(context, patternSub,
+ dateStr, dateIndex, parse);
+
+ patternSub = null;
+
+ if(context.newIndex<0)
+ break;
+
+ dateIndex = context.newIndex;
+ }
+
+ patternIndex++;
+ }
+ }
+ else
+ {
+ if(parse)
+ {
+ if(this.pattern.charAt(patternIndex)!=dateStr.charAt(dateIndex))
+ {
+ //invalid character in dateString
+ return null;
+ }
+ }
+ else
+ {
+ context.dateStr+=this.pattern.charAt(patternIndex);
+ }
+
+ patternIndex++;
+ dateIndex++;
+ }
+ }
+
+ lastChar = currentChar;
+ }
+
+ this._handlePatternSub(context, patternSub,
+ dateStr, dateIndex, parse);
+
+ return context;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype.parse = function(dateStr)
+ {
+ if(!dateStr || dateStr.length==0)
+ return null;
+
+ var context = this._handle(dateStr, null, true);
+
+ if(context.retValue==-1)
+ return null;
+
+ this._adjustTwoDigitYear(context);
+
+ return this._createDateFromContext(context);
+ };
+org_apache_myfaces_SimpleDateFormat.prototype._createDateFromContext=function(context)
+ {
+ return new Date(context.year, context.month,
+ context.day,context.hour,context.min,context.sec);
+ };
+org_apache_myfaces_SimpleDateFormat.prototype.format = function(date)
+ {
+ var context = this._handle(null, date, false);
+
+ return context.dateStr;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._parseString = function(context, dateStr, dateIndex, strings)
+ {
+ var fragment = dateStr.substr(dateIndex);
+ var index = this._prefixOf(strings, fragment);
+ if (index != -1) {
+ context.retValue = index;
+ context.newIndex = dateIndex + strings[index].length;
+ return context;
+ }
+
+ context.retValue=-1;
+ context.newIndex=-1;
+ return context;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._parseNum = function(context, dateStr, posCount, dateIndex)
+ {
+ for(var i=Math.min(posCount,dateStr.length-dateIndex);i>0;i--)
+ {
+ var numStr = dateStr.substring(dateIndex,dateIndex+i);
+
+ context.retValue = this._parseInt(numStr);
+
+ if(context.retValue == -1)
+ continue;
+
+ context.newIndex = dateIndex+i;
+ return context;
+ }
+
+ context.retValue = -1;
+ context.newIndex = -1;
+ return context;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._handlePatternSub = function(context, patternSub, dateStr, dateIndex, parse)
+ {
+ if(patternSub==null || patternSub.length==0)
+ return;
+
+ if(patternSub.charAt(0)=='y')
+ {
+ if(parse)
+ {
+ /* XXX @Arvid: whatever we do, we need to try to parse
+ the full year format - length means nothing for
+ parsing, only for formatting, so says SimpleDateFormat javadoc.
+ only if we run into problems as there are no separator chars, we
+ should use exact length parsing - how are we going to handle this?
+
+ Additionally, the threshold was not quite correct - it needs to
+ be set to current date - 80years...
+
+ this is done after parsing now!
+
+ if (patternSub.length <= 3) {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.year = (context.retValue < 26)
+ ? 2000 + context.retValue : 1900 + context.retValue;
+ } else {
+ this._parseNum(context, dateStr,4,dateIndex);
+ context.year = context.retValue;
+ }*/
+ this._parseNum(context, dateStr,4,dateIndex);
+
+ if((context.newIndex-dateIndex)<4)
+ {
+ context.year = context.retValue+1900;
+ context.ambigousYear = true;
+ }
+ else
+ {
+ context.year = context.retValue;
+
+ }
+ }
+ else
+ {
+ this._formatNum(context,context.year,patternSub.length <= 3 ? 2 : 4,true);
+ }
+ }
+ else if(patternSub.charAt(0)=='M')
+ {
+ if(parse)
+ {
+ if (patternSub.length == 3) {
+ var fragment = dateStr.substr(dateIndex, 3);
+ var index = this._indexOf(this.dateFormatSymbols.shortMonths, fragment);
+ if (index != -1) {
+ context.month = index;
+ context.newIndex = dateIndex + 3;
+ }
+ } else if (patternSub.length >= 4) {
+ var fragment = dateStr.substr(dateIndex);
+ var index = this._prefixOf(this.dateFormatSymbols.months, fragment);
+ if (index != -1) {
+ context.month = index;
+ context.newIndex = dateIndex + this.dateFormatSymbols.months[index].length;
+ }
+ } else {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.month = context.retValue-1;
+ }
+ }
+ else
+ {
+ if (patternSub.length == 3) {
+ context.dateStr += this.dateFormatSymbols.shortMonths[context.month];
+ } else if (patternSub.length >= 4) {
+ context.dateStr += this.dateFormatSymbols.months[context.month];
+ } else {
+ this._formatNum(context,context.month+1,patternSub.length);
+ }
+ }
+ }
+ else if(patternSub.charAt(0)=='d')
+ {
+ if(parse)
+ {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.day = context.retValue;
+ }
+ else
+ {
+ this._formatNum(context,context.day,patternSub.length);
+ }
+ }
+ else if(patternSub.charAt(0)=='E')
+ {
+ if(parse)
+ {
+ // XXX dayOfWeek is not used to generate date at the moment
+ if (patternSub.length <= 3) {
+ var fragment = dateStr.substr(dateIndex, 3);
+ var index = this._indexOf(this.dateFormatSymbols.shortWeekdays, fragment);
+ if (index != -1) {
+ context.dayOfWeek = index;
+ context.newIndex = dateIndex + 3;
+ }
+ } else {
+ var fragment = dateStr.substr(dateIndex);
+ var index = this._prefixOf(this.dateFormatSymbols.weekdays, fragment);
+ if (index != -1) {
+ context.dayOfWeek = index;
+ context.newIndex = dateIndex + this.dateFormatSymbols.weekdays[index].length;
+ }
+ }
+ }
+ else
+ {
+ if (patternSub.length <= 3) {
+ context.dateStr += this.dateFormatSymbols.shortWeekdays[context.dayOfWeek];
+ } else {
+ context.dateStr += this.dateFormatSymbols.weekdays[context.dayOfWeek];
+ }
+ }
+ }
+ else if(patternSub.charAt(0)=='H' ||
+ patternSub.charAt(0)=='h')
+ {
+ if(parse)
+ {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.hour = context.retValue;
+ }
+ else
+ {
+ this._formatNum(context,context.hour,patternSub.length);
+ }
+ }
+ else if(patternSub.charAt(0)=='m')
+ {
+ if(parse)
+ {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.min = context.retValue;
+ }
+ else
+ {
+ this._formatNum(context,context.min,patternSub.length);
+ }
+ }
+ else if(patternSub.charAt(0)=='s')
+ {
+ if(parse)
+ {
+ this._parseNum(context, dateStr,2,dateIndex);
+ context.sec = context.retValue;
+ }
+ else
+ {
+ this._formatNum(context,context.sec,patternSub.length);
+ }
+ }
+ else if(patternSub.charAt(0)=='a')
+ {
+ if(parse)
+ {
+ this._parseString(context, dateStr,dateIndex,this.dateFormatSymbols.ampms);
+ context.ampm = context.retValue;
+ }
+ else
+ {
+ context.dateStr += this.dateFormatSymbols.ampms[context.ampm];
+ }
+ }
+ else
+ {
+ if(parse)
+ {
+ context.newIndex=dateIndex+patternSub.length;
+ }
+ else
+ {
+ context.dateStr+=patternSub;
+ }
+
+ }
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._formatNum = function (context, num, length, ensureLength)
+ {
+ var str = num+"";
+
+ while(str.length<length)
+ str="0"+str;
+
+ // XXX do we have to distinguish left and right 'cutting'
+ //ensureLength - enable cutting only for parameters like the year, the other
+ if (ensureLength && str.length > length) {
+ str = str.substr(str.length - length);
+ }
+
+ context.dateStr+=str;
+ };
+
+ // perhaps add to Array.prototype
+org_apache_myfaces_SimpleDateFormat.prototype._indexOf = function (array, value)
+ {
+ for (var i = 0; i < array.length; ++i) {
+ if (array[i] == value) {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._prefixOf = function (array, value)
+ {
+ for (var i = 0; i < array.length; ++i) {
+ if (value.indexOf(array[i]) == 0) {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+org_apache_myfaces_SimpleDateFormat.prototype._parseInt = function(value)
+ {
+ var sum = 0;
+
+ for(var i=0;i<value.length;i++)
+ {
+ var c = value.charAt(i);
+
+ if(c<'0'||c>'9')
+ {
+ return -1;
+ }
+ sum = sum*10+(c-'0');
+ }
+
+ return sum;
+ };
+org_apache_myfaces_SimpleDateFormat.prototype._fullYearFromDate = function(year)
+ {
+
+ var yearStr = year+"";
+
+ if (yearStr.length < 4)
+ {
+ return year+1900;
+ }
+
+ return year;
+ };
+org_apache_myfaces_SimpleDateFormat.prototype._adjustTwoDigitYear = function(context)
+ {
+
+ if(context.ambigousYear)
+ {
+ var date = this._createDateFromContext(context);
+ var threshold = this.dateFormatSymbols.twoDigitYearStart;
+
+ if(date.getTime()<threshold.getTime())
+ context.year += 100;
+ }
+ };
+
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/date.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/inputTextHelp/resource/inputTextHelp.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/inputTextHelp/resource/inputTextHelp.js?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/inputTextHelp/resource/inputTextHelp.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/inputTextHelp/resource/inputTextHelp.js Tue Aug 1 10:43:28 2006
@@ -1,17 +1,17 @@
-function resetHelpValue(helpText, id)
-{
- var element=document.getElementById(id);
- if(element.value==helpText)
- {
- element.value="";
- }
-}
-
-function selectText(helpText, id)
-{
- var element=document.getElementById(id);
- if(element.value==helpText)
- {
- element.select();
- }
+function resetHelpValue(helpText, id)
+{
+ var element=document.getElementById(id);
+ if(element.value==helpText)
+ {
+ element.value="";
+ }
+}
+
+function selectText(helpText, id)
+{
+ var element=document.getElementById(id);
+ if(element.value==helpText)
+ {
+ element.select();
+ }
}
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/inputTextHelp/resource/inputTextHelp.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js Tue Aug 1 10:43:28 2006
@@ -1,24 +1,24 @@
-startList = function()
-{
- if (document.all && document.getElementById)
- {
- navDivRoot = document.getElementById("hNav_outer");
- navRoot = navDivRoot.childNodes[0];
- for (i=0; i<navRoot.childNodes.length; i++)
- {
- node = navRoot.childNodes[i];
- if (node.nodeName=="LI")
- {
- node.onmouseover=function()
- {
- this.className+=" over";
- }
- node.onmouseout=function()
- {
- this.className=this.className.replace(" over", "");
- }
- }
- }
- }
-}
+startList = function()
+{
+ if (document.all && document.getElementById)
+ {
+ navDivRoot = document.getElementById("hNav_outer");
+ navRoot = navDivRoot.childNodes[0];
+ for (i=0; i<navRoot.childNodes.length; i++)
+ {
+ node = navRoot.childNodes[i];
+ if (node.nodeName=="LI")
+ {
+ node.onmouseover=function()
+ {
+ this.className+=" over";
+ }
+ node.onmouseout=function()
+ {
+ this.className=this.className.replace(" over", "");
+ }
+ }
+ }
+ }
+}
window.onload=startList;
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/prototype/resource/controls.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/prototype/resource/dragdrop.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/prototype/resource/effects.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/prototype/resource/prototype.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js Tue Aug 1 10:43:28 2006
@@ -1,294 +1,294 @@
-/** $Id: alphaAPI.js 349804 2005-11-29 20:12:53Z skitching $ */
-// {{{ license
-
-/*
- * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
- *
- * 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// }}}
-// {{{ intro
-
-/**
- * Title: alphaAPI
- * Original Author: chrisken
- * Original Url: http://www.cs.utexas.edu/users/chrisken/alphaapi.html
- *
- * Modified by Dan Allen <da...@mojavelinux.com>
- * Note: When the stopAlpha is reached and it is equal to 0, the element's
- * style is set to display: none to fix a bug in domTT
- */
-
-// }}}
-function alphaAPI(element, fadeInDelay, fadeOutDelay, startAlpha, stopAlpha, offsetTime, deltaAlpha)
-{
- // {{{ properties
-
- this.element = typeof(element) == 'object' ? element : document.getElementById(element);
- this.fadeInDelay = fadeInDelay || 40;
- this.fadeOutDelay = fadeOutDelay || this.fadeInDelay;
- this.startAlpha = startAlpha;
- this.stopAlpha = stopAlpha;
- // make sure a filter exists so an error is not thrown
- if (typeof(this.element.filters) == 'object')
- {
- if (typeof(this.element.filters.alpha) == 'undefined')
- {
- this.element.style.filter += 'alpha(opacity=100)';
- }
- }
-
- this.offsetTime = (offsetTime || 0) * 1000;
- this.deltaAlpha = deltaAlpha || 10;
- this.timer = null;
- this.paused = false;
- this.started = false;
- this.cycle = false;
- this.command = function() {};
- return this;
-
- // }}}
-}
-
-// use prototype methods to save memory
-// {{{ repeat()
-
-alphaAPI.prototype.repeat = function(repeat)
-{
- this.cycle = repeat ? true : false;
-}
-
-// }}}
-// {{{ setAlphaBy()
-
-alphaAPI.prototype.setAlphaBy = function(deltaAlpha)
-{
- this.setAlpha(this.getAlpha() + deltaAlpha);
-}
-
-// }}}
-// {{{ toggle()
-
-alphaAPI.prototype.toggle = function()
-{
- if (!this.started)
- {
- this.start();
- }
- else if (this.paused)
- {
- this.unpause();
- }
- else
- {
- this.pause();
- }
-}
-
-// }}}
-// {{{ timeout()
-
-alphaAPI.prototype.timeout = function(command, delay)
-{
- this.command = command;
- this.timer = setTimeout(command, delay);
-}
-
-// }}}
-// {{{ setAlpha()
-
-alphaAPI.prototype.setAlpha = function(opacity)
-{
- if (typeof(this.element.filters) == 'object')
- {
- this.element.filters.alpha.opacity = opacity;
- }
- else if (this.element.style.setProperty)
- {
- this.element.style.setProperty('opacity', opacity / 100, '');
- // handle the case of mozilla < 1.7
- this.element.style.setProperty('-moz-opacity', opacity / 100, '');
- // handle the case of old kthml
- this.element.style.setProperty('-khtml-opacity', opacity / 100, '');
- }
-}
-
-// }}}
-// {{{ getAlpha()
-
-alphaAPI.prototype.getAlpha = function()
-{
- if (typeof(this.element.filters) == 'object')
- {
- return this.element.filters.alpha.opacity;
- }
- else if (this.element.style.getPropertyValue)
- {
- var opacityValue = this.element.style.getPropertyValue('opacity');
- // handle the case of mozilla < 1.7
- if (opacityValue == '')
- {
- opacityValue = this.element.style.getPropertyValue('-moz-opacity');
- }
-
- // handle the case of old khtml
- if (opacityValue == '')
- {
- opacityValue = this.element.style.getPropertyValue('-khtml-opacity');
- }
-
- return opacityValue * 100;
- }
-
- return 100;
-}
-
-// }}}
-// {{{ start()
-
-alphaAPI.prototype.start = function()
-{
- this.started = true;
- this.setAlpha(this.startAlpha);
- // determine direction
- if (this.startAlpha > this.stopAlpha)
- {
- var instance = this;
- this.timeout(function() { instance.fadeOut(); }, this.offsetTime);
- }
- else
- {
- var instance = this;
- this.timeout(function() { instance.fadeIn(); }, this.offsetTime);
- }
-}
-
-// }}}
-// {{{ stop()
-
-alphaAPI.prototype.stop = function()
-{
- this.started = false;
- this.setAlpha(this.stopAlpha);
- if (this.stopAlpha == 0)
- {
- this.element.style.display = 'none';
- }
-
- this.stopTimer();
- this.command = function() {};
-}
-
-// }}}
-// {{{ reset()
-
-alphaAPI.prototype.reset = function()
-{
- this.started = false;
- this.setAlpha(this.startAlpha);
- this.stopTimer();
- this.command = function() {};
-}
-
-// }}}
-// {{{ pause()
-
-alphaAPI.prototype.pause = function()
-{
- this.paused = true;
- this.stopTimer();
-}
-
-// }}}
-// {{{ unpause()
-
-alphaAPI.prototype.unpause = function()
-{
- this.paused = false;
- if (!this.started)
- {
- this.start();
- }
- else
- {
- this.command();
- }
-}
-
-// }}}
-// {{{ stopTimer()
-
-alphaAPI.prototype.stopTimer = function()
-{
- clearTimeout(this.timer);
- this.timer = null;
-}
-
-// }}}
-// {{{ fadeOut()
-
-alphaAPI.prototype.fadeOut = function()
-{
- this.stopTimer();
- if (this.getAlpha() > this.stopAlpha)
- {
- this.setAlphaBy(-1 * this.deltaAlpha);
- var instance = this;
- this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
- }
- else
- {
- if (this.cycle)
- {
- var instance = this;
- this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
- }
- else
- {
- if (this.stopAlpha == 0)
- {
- this.element.style.display = 'none';
- }
- this.started = false;
- }
- }
-}
-
-// }}}
-// {{{ fadeIn()
-
-alphaAPI.prototype.fadeIn = function()
-{
- this.stopTimer();
- if (this.getAlpha() < this.startAlpha)
- {
- this.setAlphaBy(this.deltaAlpha);
- var instance = this;
- this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
- }
- else
- {
- if (this.cycle)
- {
- var instance = this;
- this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
- }
- else
- {
- this.started = false;
- }
- }
-}
-
-// }}}
+/** $Id: alphaAPI.js 349804 2005-11-29 20:12:53Z skitching $ */
+// {{{ license
+
+/*
+ * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// }}}
+// {{{ intro
+
+/**
+ * Title: alphaAPI
+ * Original Author: chrisken
+ * Original Url: http://www.cs.utexas.edu/users/chrisken/alphaapi.html
+ *
+ * Modified by Dan Allen <da...@mojavelinux.com>
+ * Note: When the stopAlpha is reached and it is equal to 0, the element's
+ * style is set to display: none to fix a bug in domTT
+ */
+
+// }}}
+function alphaAPI(element, fadeInDelay, fadeOutDelay, startAlpha, stopAlpha, offsetTime, deltaAlpha)
+{
+ // {{{ properties
+
+ this.element = typeof(element) == 'object' ? element : document.getElementById(element);
+ this.fadeInDelay = fadeInDelay || 40;
+ this.fadeOutDelay = fadeOutDelay || this.fadeInDelay;
+ this.startAlpha = startAlpha;
+ this.stopAlpha = stopAlpha;
+ // make sure a filter exists so an error is not thrown
+ if (typeof(this.element.filters) == 'object')
+ {
+ if (typeof(this.element.filters.alpha) == 'undefined')
+ {
+ this.element.style.filter += 'alpha(opacity=100)';
+ }
+ }
+
+ this.offsetTime = (offsetTime || 0) * 1000;
+ this.deltaAlpha = deltaAlpha || 10;
+ this.timer = null;
+ this.paused = false;
+ this.started = false;
+ this.cycle = false;
+ this.command = function() {};
+ return this;
+
+ // }}}
+}
+
+// use prototype methods to save memory
+// {{{ repeat()
+
+alphaAPI.prototype.repeat = function(repeat)
+{
+ this.cycle = repeat ? true : false;
+}
+
+// }}}
+// {{{ setAlphaBy()
+
+alphaAPI.prototype.setAlphaBy = function(deltaAlpha)
+{
+ this.setAlpha(this.getAlpha() + deltaAlpha);
+}
+
+// }}}
+// {{{ toggle()
+
+alphaAPI.prototype.toggle = function()
+{
+ if (!this.started)
+ {
+ this.start();
+ }
+ else if (this.paused)
+ {
+ this.unpause();
+ }
+ else
+ {
+ this.pause();
+ }
+}
+
+// }}}
+// {{{ timeout()
+
+alphaAPI.prototype.timeout = function(command, delay)
+{
+ this.command = command;
+ this.timer = setTimeout(command, delay);
+}
+
+// }}}
+// {{{ setAlpha()
+
+alphaAPI.prototype.setAlpha = function(opacity)
+{
+ if (typeof(this.element.filters) == 'object')
+ {
+ this.element.filters.alpha.opacity = opacity;
+ }
+ else if (this.element.style.setProperty)
+ {
+ this.element.style.setProperty('opacity', opacity / 100, '');
+ // handle the case of mozilla < 1.7
+ this.element.style.setProperty('-moz-opacity', opacity / 100, '');
+ // handle the case of old kthml
+ this.element.style.setProperty('-khtml-opacity', opacity / 100, '');
+ }
+}
+
+// }}}
+// {{{ getAlpha()
+
+alphaAPI.prototype.getAlpha = function()
+{
+ if (typeof(this.element.filters) == 'object')
+ {
+ return this.element.filters.alpha.opacity;
+ }
+ else if (this.element.style.getPropertyValue)
+ {
+ var opacityValue = this.element.style.getPropertyValue('opacity');
+ // handle the case of mozilla < 1.7
+ if (opacityValue == '')
+ {
+ opacityValue = this.element.style.getPropertyValue('-moz-opacity');
+ }
+
+ // handle the case of old khtml
+ if (opacityValue == '')
+ {
+ opacityValue = this.element.style.getPropertyValue('-khtml-opacity');
+ }
+
+ return opacityValue * 100;
+ }
+
+ return 100;
+}
+
+// }}}
+// {{{ start()
+
+alphaAPI.prototype.start = function()
+{
+ this.started = true;
+ this.setAlpha(this.startAlpha);
+ // determine direction
+ if (this.startAlpha > this.stopAlpha)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.offsetTime);
+ }
+ else
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.offsetTime);
+ }
+}
+
+// }}}
+// {{{ stop()
+
+alphaAPI.prototype.stop = function()
+{
+ this.started = false;
+ this.setAlpha(this.stopAlpha);
+ if (this.stopAlpha == 0)
+ {
+ this.element.style.display = 'none';
+ }
+
+ this.stopTimer();
+ this.command = function() {};
+}
+
+// }}}
+// {{{ reset()
+
+alphaAPI.prototype.reset = function()
+{
+ this.started = false;
+ this.setAlpha(this.startAlpha);
+ this.stopTimer();
+ this.command = function() {};
+}
+
+// }}}
+// {{{ pause()
+
+alphaAPI.prototype.pause = function()
+{
+ this.paused = true;
+ this.stopTimer();
+}
+
+// }}}
+// {{{ unpause()
+
+alphaAPI.prototype.unpause = function()
+{
+ this.paused = false;
+ if (!this.started)
+ {
+ this.start();
+ }
+ else
+ {
+ this.command();
+ }
+}
+
+// }}}
+// {{{ stopTimer()
+
+alphaAPI.prototype.stopTimer = function()
+{
+ clearTimeout(this.timer);
+ this.timer = null;
+}
+
+// }}}
+// {{{ fadeOut()
+
+alphaAPI.prototype.fadeOut = function()
+{
+ this.stopTimer();
+ if (this.getAlpha() > this.stopAlpha)
+ {
+ this.setAlphaBy(-1 * this.deltaAlpha);
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
+ }
+ else
+ {
+ if (this.cycle)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
+ }
+ else
+ {
+ if (this.stopAlpha == 0)
+ {
+ this.element.style.display = 'none';
+ }
+ this.started = false;
+ }
+ }
+}
+
+// }}}
+// {{{ fadeIn()
+
+alphaAPI.prototype.fadeIn = function()
+{
+ this.stopTimer();
+ if (this.getAlpha() < this.startAlpha)
+ {
+ this.setAlphaBy(this.deltaAlpha);
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
+ }
+ else
+ {
+ if (this.cycle)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
+ }
+ else
+ {
+ this.started = false;
+ }
+ }
+}
+
+// }}}
Propchange: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js
------------------------------------------------------------------------------
svn:eol-style = native