selectionprimitive.java

来自「考勤管理系统源码」· Java 代码 · 共 49 行

JAVA
49
字号
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>");  }}

⌨️ 快捷键说明

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