提交 c16b0e91 编写于 作者: K kohsuke

Use the class name as the key. This makes HTML scraping easier, which in turn...

Use the class name as the key. This makes HTML scraping easier, which in turn helps the test client.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13182 71c3de6d-444a-0410-be80-ed276b4c234a
上级 6cf14cf2
......@@ -33,7 +33,6 @@ import hudson.widgets.HistoryWidget;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.export.Exported;
import javax.servlet.ServletException;
......@@ -1019,10 +1018,10 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
JSONObject data = req.getSubmittedForm();
List<T> r = new Vector<T>();
for( int i=0; i< descriptors.size(); i++ ) {
String name = prefix + i;
if(req.getParameter(name)!=null) {
T instance = descriptors.get(i).newInstance(req,data.getJSONObject(name));
for (Descriptor<T> d : descriptors) {
String name = d.getJsonSafeClassName();
if (req.getParameter(name) != null) {
T instance = d.newInstance(req, data.getJSONObject(name));
r.add(instance);
}
}
......
......@@ -7,12 +7,15 @@ import com.thoughtworks.xstream.converters.collections.AbstractCollectionConvert
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.mapper.Mapper;
import hudson.model.*;
import hudson.model.AbstractProject;
import hudson.model.DependecyDeclarer;
import hudson.model.DependencyGraph;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.Descriptor.FormException;
import hudson.tasks.Builder;
import hudson.model.Saveable;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
import org.apache.maven.model.Dependency;
import java.io.IOException;
import java.util.ArrayList;
......@@ -20,8 +23,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Collections;
import java.security.acl.Owner;
/**
* Persisted list of {@link Describable}s with some operations specific
......@@ -134,10 +135,10 @@ public class DescribableList<T extends Describable<T>, D extends Descriptor<T>>
public void rebuild(StaplerRequest req, JSONObject json, List<? extends Descriptor<T>> descriptors, String prefix) throws FormException {
List<T> newList = new ArrayList<T>();
for( int i=0; i< descriptors.size(); i++ ) {
String name = prefix + i;
if(json.has(name)) {
T instance = descriptors.get(i).newInstance(req,json.getJSONObject(name));
for (Descriptor<T> d : descriptors) {
String name = d.getJsonSafeClassName();
if (json.has(name)) {
T instance = d.newInstance(req, json.getJSONObject(name));
newList.add(instance);
}
}
......
......@@ -14,7 +14,7 @@
<f:section title="${attrs.title}">
<d:invokeBody />
<j:forEach var="d" items="${descriptors}" varStatus="loop">
<f:optionalBlock name="${varName}${loop.index}" help="${d.helpFile}"
<f:optionalBlock name="${d.jsonSafeClassName}" help="${d.helpFile}"
title="${d.displayName}" checked="${instances.get(d)!=null}">
<j:set var="descriptor" value="${d}" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册