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

📄 linkprimitive.java

📁 考勤管理系统源码
💻 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 + -