⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combobox.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ComboBox.java

package org.apache.struts2.components;

import com.opensymphony.xwork2.util.ValueStack;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.util.MakeIterator;

// Referenced classes of package org.apache.struts2.components:
//			TextField

public class ComboBox extends TextField
{

	public static final String TEMPLATE = "combobox";
	protected String list;
	protected String listKey;
	protected String listValue;
	protected String headerKey;
	protected String headerValue;
	protected String emptyOption;

	public ComboBox(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
	{
		super(stack, request, response);
	}

	protected String getDefaultTemplate()
	{
		return "combobox";
	}

	public void evaluateExtraParams()
	{
		super.evaluateExtraParams();
		Object value = findListValue();
		if (headerKey != null)
			addParameter("headerKey", findString(headerKey));
		if (headerValue != null)
			addParameter("headerValue", findString(headerValue));
		if (emptyOption != null)
			addParameter("emptyOption", findValue(emptyOption, java/lang/Boolean));
		if (value != null)
			if (value instanceof Collection)
			{
				Collection tmp = (Collection)value;
				addParameter("list", tmp);
				if (listKey != null)
					addParameter("listKey", listKey);
				if (listValue != null)
					addParameter("listValue", listValue);
			} else
			if (value instanceof Map)
			{
				Map tmp = (Map)value;
				addParameter("list", MakeIterator.convert(tmp));
				addParameter("listKey", "key");
				addParameter("listValue", "value");
			} else
			if (value.getClass().isArray())
			{
				java.util.Iterator i = MakeIterator.convert(value);
				addParameter("list", i);
				if (listKey != null)
					addParameter("listKey", listKey);
				if (listValue != null)
					addParameter("listValue", listValue);
			} else
			{
				java.util.Iterator i = MakeIterator.convert(value);
				addParameter("list", i);
				if (listKey != null)
					addParameter("listKey", listKey);
				if (listValue != null)
					addParameter("listValue", listValue);
			}
	}

	protected Object findListValue()
	{
		return findValue(list, "list", "You must specify a collection/array/map/enumeration/iterator. Example: people or people.{name}");
	}

	public void setList(String list)
	{
		this.list = list;
	}

	public void setEmptyOption(String emptyOption)
	{
		this.emptyOption = emptyOption;
	}

	public void setHeaderKey(String headerKey)
	{
		this.headerKey = headerKey;
	}

	public void setHeaderValue(String headerValue)
	{
		this.headerValue = headerValue;
	}

	public void setListKey(String listKey)
	{
		this.listKey = listKey;
	}

	public void setListValue(String listValue)
	{
		this.listValue = listValue;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -