📄 formprimitive.java
字号:
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.FormPrimitives;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.util.*;/** The FormPrimitive encapsulates the details of building the HTML * for an input form. */public class FormPrimitive implements IHtmlPrimitive{ private String submitTarget; private String name; private ArrayList primitives = new ArrayList(); /** Construct a FormPrimitive with the specified submit target * and form name. */ public FormPrimitive(String submitTarget, String name) { this.submitTarget = submitTarget; this.name = name; } /** Add the producer to this form. */ public void addPrimitive(IHtmlPrimitive primitive) { this.primitives.add(primitive); } /** Build the content for this primitive and append it to * the specified buffer.*/ public void buildContent(StringBuffer buffer) { String name_string = Formatting.convertToAttribute("name", name); String action_string = Formatting.convertToAttribute("action", submitTarget); buffer.append("<form" +name_string+action_string+ " method=POST>"); // add the HTML from each producer to the HTML for this producer. Iterator producersIterator = primitives.iterator(); while (producersIterator.hasNext()) { IHtmlPrimitive producer = (IHtmlPrimitive) producersIterator.next(); producer.buildContent(buffer); } // end the form tag buffer.append("</form>\n"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -