?? linkprimitive.java
字號:
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.util.*;/** * The LinkPrimitive class encapsulates the details of building * an a href tag for a simple link. It limits the content to text * and images. * */public class LinkPrimitive implements IHtmlPrimitive{ private String url; private Style style; private List producers = new ArrayList(); /** Construct a LinkPrimitive instance with the specified URL. */ public LinkPrimitive(String url) { this.url = url; } /** Set the style for this link. */ public void setStyle(Style style) { this.style = style; } /** Add a TextPrimitive object to this link. */ public void addText(TextPrimitive content) { producers.add(content); } /** Add some text to this link. */ public void addText(String content) { producers.add(new TextPrimitive(content)); } /** Add an ImagePrimitive object to this link. */ public void addImage(ImagePrimitive content) { producers.add(content); } /** Build the content for this primitive and append it to * the specified buffer.*/ public void buildContent(StringBuffer buffer) { String href_string = Formatting.convertToAttribute("href", url); String style_string = Formatting.convertToAttribute("class", this.style); buffer.append("<a" +style_string+href_string+ ">"); Iterator producers_iterator = producers.iterator(); while (producers_iterator.hasNext()) { IHtmlPrimitive content = (IHtmlPrimitive) producers_iterator.next(); content.buildContent(buffer); } buffer.append("</a>"); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -