From: Guido N. <cu...@us...> - 2008-04-04 20:32:22
|
Update of /cvsroot/wonder/Wonder/Ajax/Ajax/Sources/er/ajax In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv20350/Sources/er/ajax Modified Files: AjaxUpdateContainer.java Log Message: Second try on checking for 0 on the frequency Index: AjaxUpdateContainer.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Ajax/Ajax/Sources/er/ajax/AjaxUpdateContainer.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** AjaxUpdateContainer.java 3 Apr 2008 19:12:42 -0000 1.53 --- AjaxUpdateContainer.java 4 Apr 2008 20:32:17 -0000 1.54 *************** *** 3,6 **** --- 3,8 ---- //Generated by the WOLips Templateengine Plug-in at 27.03.2006 21:36:50 + import java.math.BigDecimal; + import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WOComponent; *************** *** 166,185 **** if (frequency != null) { ! String type = "PeriodicalUpdater"; ! boolean stopped = false; ! if (associations().objectForKey("stopped") != null) { ! stopped = booleanValueForBinding("stopped", false, component); ! if (stopped) { ! type = "StoppedPeriodicalUpdater"; ! } else { ! type = "ActivePeriodicalUpdater"; } } ! response.appendContentString(id + "PeriodicalUpdater = new Ajax." + type + "('" + id + "', $('" + id + "').getAttribute('updateUrl'), "); ! AjaxOptions.appendToResponse(options, response, context); ! response.appendContentString(");"); ! response.appendContentString(id + "Stop = function() { " + id + "PeriodicalUpdater.stop() };"); ! if(stopped) { ! response.appendContentString(id + "Stop();"); } } --- 168,200 ---- if (frequency != null) { ! // try to convert to a number to check whether it is 0 ! boolean isNotZero = true; ! try { ! BigDecimal numberFrequency = new BigDecimal(frequency.toString()); ! if (numberFrequency.doubleValue() == 0.0d) { ! // set this only to false if it can be converted to 0 ! isNotZero = false; } } ! catch (Exception e) {} ! ! if (isNotZero) { ! String type = "PeriodicalUpdater"; ! boolean stopped = false; ! if (associations().objectForKey("stopped") != null) { ! stopped = booleanValueForBinding("stopped", false, component); ! if (stopped) { ! type = "StoppedPeriodicalUpdater"; ! } else { ! type = "ActivePeriodicalUpdater"; ! } ! } ! response.appendContentString(id + "PeriodicalUpdater = new Ajax." + type + "('" + id + "', $('" + id + "').getAttribute('updateUrl'), "); ! AjaxOptions.appendToResponse(options, response, context); ! response.appendContentString(");"); ! response.appendContentString(id + "Stop = function() { " + id + "PeriodicalUpdater.stop() };"); ! if(stopped) { ! response.appendContentString(id + "Stop();"); ! } } } |