ASF Bugzilla – Attachment 3002 Details for
Bug 11992
Support defaults in Select tag for use with multiple attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Select.java patch file
Select.java.patch (text/plain), 2.23 KB, created by
Curt Wilhelm
on 2002-09-10 21:02:14 UTC
(
hide
)
Description:
Select.java patch file
Filename:
MIME Type:
Creator:
Curt Wilhelm
Created:
2002-09-10 21:02:14 UTC
Size:
2.23 KB
patch
obsolete
>Index: Select.java >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs/input/src/org/apache/taglibs/input/Select.java,v >retrieving revision 1.2 >diff -u -r1.2 Select.java >--- Select.java 14 Jul 2001 16:05:03 -0000 1.2 >+++ Select.java 23 Aug 2002 21:52:34 -0000 >@@ -74,7 +74,7 @@ > public class Select extends TagSupport { > > private String name; // name of the select element >- private String dVal; // default value if none is found >+ private Vector dVals; // default value if none is found > private Map attributes; // attributes of the <select> element > private Map options; // what are our options? :) > >@@ -86,8 +86,23 @@ > attributes = x; > } > >- public void setDefault(String x) { >- dVal = x; >+ public void setDefault(String x) { >+ if (dVals == null) >+ dVals = new Vector(); >+ if (x != null) >+ dVals.add(x); >+ } >+ >+ /** >+ * Acts more as an additive function than a normal accessor. >+ * (I'd call this addDefaults if I could.) >+ */ >+ public void setDefaults(String[] x) { >+ if (dVals == null) >+ dVals = new Vector(); >+ if (x != null) >+ for (int i = 0; i < x.length; i++) >+ dVals.add(x[i]); > } > > public void setOptions(Map x) { >@@ -164,10 +179,13 @@ > * this option pair with the KEY of the 'chosen' Map > * (We want to match <option>s on values, not keys.) > */ >+ for (int d = 0; d < dVals.size(); d++) { > if ((selected != null && chosen.containsKey(value)) >- || (selected == null && dVal != null && >- value.equals(dVal))) >- out.print(" selected=\"selected\""); >+ || (selected == null && dVals != null && >+ ((String) dVals.get(d)).equals(value))) >+ out.print(" selected=\"true\""); >+ >+ } > out.print(">"); > out.print(Util.quote(key)); > out.println("</option>");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 11992
:
3000
|
3001
| 3002