?? selectionprimitive.java
字號:
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.FormPrimitives;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.util.*;/** * The SelectionPrimitive class encapsulates the details of * building the HTML for a pulldown selector widget. * */public class SelectionPrimitive implements IHtmlPrimitive{ private String name; private Style style; private StringBuffer optionsBuffer = new StringBuffer(); /** Construct a SelectionPrimitive with the specified name * of the form input element. */ public SelectionPrimitive(String name) { this.name = name; } /** Specify the style class that is applied to the selection. */ public void setStyle(Style style) { this.style = style; } /** Add a value to the selector. */ public void addValue(String displayValue, String dataValue, boolean selected) { String class_string = Formatting.convertToAttribute("class", style); String data_value_string = Formatting.convertToAttribute("value", dataValue); String selected_string = Formatting.convertToAttribute("selected", selected); optionsBuffer.append("<option" +data_value_string+selected_string+class_string+ ">" +displayValue+ "</option>\n"); } /** Build the content for this primitive and append it to * the specified buffer.*/ public void buildContent(StringBuffer buffer) { String name_string = Formatting.convertToAttribute("name", this.name); buffer.append("<select" +name_string+ ">\n"); buffer.append(this.optionsBuffer.toString()); buffer.append("</select>"); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -