click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r933609 - in /click/trunk/click/extras/src/org/apache/click/extras: cayenne/PropertySelect.java cayenne/QuerySelect.java control/CountrySelect.java
Date Tue, 13 Apr 2010 13:59:11 GMT
Author: sabob
Date: Tue Apr 13 13:59:11 2010
New Revision: 933609

URL: http://svn.apache.org/viewvc?rev=933609&view=rev
Log:
lookup optionList only once

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/cayenne/PropertySelect.java
    click/trunk/click/extras/src/org/apache/click/extras/cayenne/QuerySelect.java
    click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/cayenne/PropertySelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/cayenne/PropertySelect.java?rev=933609&r1=933608&r2=933609&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/cayenne/PropertySelect.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/cayenne/PropertySelect.java Tue Apr
13 13:59:11 2010
@@ -562,9 +562,11 @@ public class PropertySelect extends Sele
      */
     protected void loadOptionList() {
 
+        List optionList = getOptionList();
+
         // Determine whether option list should be loaded
-        if (getOptionList().size() == 1) {
-            Option option = (Option) getOptionList().get(0);
+        if (optionList.size() == 1) {
+            Option option = (Option) optionList.get(0);
             if (option.getValue().equals(Option.EMPTY_OPTION.getValue())) {
                 // continue and load option list
 
@@ -573,7 +575,7 @@ public class PropertySelect extends Sele
                 return;
             }
 
-        } else if (getOptionList().size() > 1) {
+        } else if (optionList.size() > 1) {
             // Don't load list
             return;
         }
@@ -627,8 +629,8 @@ public class PropertySelect extends Sele
                 list = dataContext.performQuery(query);
             }
 
-            if (isRequired() && getOptionList().isEmpty() || isOptional()) {
-                getOptionList().add(Option.EMPTY_OPTION);
+            if (isRequired() && optionList.isEmpty() || isOptional()) {
+                optionList.add(Option.EMPTY_OPTION);
             }
 
             Context context = getContext();

Modified: click/trunk/click/extras/src/org/apache/click/extras/cayenne/QuerySelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/cayenne/QuerySelect.java?rev=933609&r1=933608&r2=933609&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/cayenne/QuerySelect.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/cayenne/QuerySelect.java Tue Apr
13 13:59:11 2010
@@ -414,9 +414,11 @@ public class QuerySelect extends Select 
             throw new IllegalStateException(msg);
         }
 
+        List optionList = getOptionList();
+
         // Determine whether option list should be loaded
-        if (getOptionList().size() == 1) {
-            Option option = (Option) getOptionList().get(0);
+        if (optionList.size() == 1) {
+            Option option = (Option) optionList.get(0);
             if (option.getValue().equals(Option.EMPTY_OPTION.getValue())) {
                 // continue and load option list
 
@@ -425,7 +427,7 @@ public class QuerySelect extends Select 
                 return;
             }
 
-        } else if (getOptionList().size() > 1) {
+        } else if (optionList.size() > 1) {
             // Don't load list
             return;
         }
@@ -444,8 +446,8 @@ public class QuerySelect extends Select 
             list = dataContext.performQuery(getQueryName(), getExpireCache());
         }
 
-        if (isRequired() && getOptionList().isEmpty() || isOptional()) {
-            getOptionList().add(Option.EMPTY_OPTION);
+        if (isRequired() && optionList.isEmpty() || isOptional()) {
+            optionList.add(Option.EMPTY_OPTION);
         }
 
         Context context = getContext();
@@ -505,7 +507,7 @@ public class QuerySelect extends Select 
             value = (value != null) ? value : "";
             label = (label != null) ? label : "";
 
-            getOptionList().add(new Option(value.toString(), label.toString()));
+            optionList.add(new Option(value.toString(), label.toString()));
         }
     }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java?rev=933609&r1=933608&r2=933609&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java Tue Apr
13 13:59:11 2010
@@ -20,6 +20,7 @@ package org.apache.click.extras.control;
 
 import java.text.Collator;
 import java.util.Comparator;
+import java.util.List;
 import java.util.Locale;
 
 import java.util.Set;
@@ -193,9 +194,11 @@ public class CountrySelect extends Selec
      * the country as the value and the localized country name as the label.
      */
     protected void loadOptionList() {
+        List optionList = getOptionList();
+
         // Determine whether option list should be loaded
-        if (getOptionList().size() == 1) {
-            Option option = (Option) getOptionList().get(0);
+        if (optionList.size() == 1) {
+            Option option = (Option) optionList.get(0);
             if (option.getValue().equals(Option.EMPTY_OPTION.getValue())) {
                 // Continue and load option list
 
@@ -204,7 +207,7 @@ public class CountrySelect extends Selec
                 return;
             }
 
-        } else if (getOptionList().size() > 1) {
+        } else if (optionList.size() > 1) {
             // Don't load list
             return;
         }
@@ -222,7 +225,7 @@ public class CountrySelect extends Selec
             }
         }
 
-        if (isRequired() && getOptionList().isEmpty()) {
+        if (isRequired() && optionList.isEmpty()) {
             add(Option.EMPTY_OPTION);
         }
 



Mime
View raw message