1 25 26 package org.snipsnap.snip.label; 27 28 import org.apache.lucene.document.Document; 29 import org.apache.lucene.document.Field; 30 import org.snipsnap.container.Components; 31 import org.snipsnap.snip.Snip; 32 import org.snipsnap.serialization.LabelContext; 33 import org.radeox.api.engine.RenderEngine; 34 35 import java.util.Map ; 36 37 44 45 public class RenderEngineLabel implements Label { 46 protected String name; 47 protected String engine; 48 protected Snip snip; 49 50 public RenderEngineLabel() { 51 name = "RenderEngine"; 52 engine = Components.DEFAULT_ENGINE; 53 } 54 55 public void create() { 56 } 57 58 public void remove() { 59 } 60 61 public void change() { 62 } 63 64 public LabelContext getContext() { 65 return new LabelContext(snip, this); 66 } 67 68 public void setSnip(Snip snip) { 69 this.snip = snip; 70 } 71 72 public Snip getSnip() { 73 return snip; 74 } 75 76 public RenderEngineLabel(String name, String engine) { 77 this.name = name; 78 this.engine = engine; 79 } 80 81 public String getInputProxy() { 82 StringBuffer buffer = new StringBuffer (); 83 buffer.append("<select name=\"label.renderEngine\">"); 84 buffer.append("<option value=\"org.snipsnap.render.PlainTextRenderEngine\">"); 85 buffer.append("Plain Text</option>"); 86 buffer.append("<option value=\"defaultRenderEngine\">default</option>"); 87 buffer.append("</select>"); 88 return buffer.toString(); 89 } 90 91 public String getListProxy() { 92 return ""; } 101 102 public void handleInput(Map input) { 103 if (input.containsKey("label.renderEngine")) { 104 this.engine = (String ) input.get("label.renderEngine"); 105 this.name = "RenderEngine"; 106 } 107 108 } 109 110 public String getType() { 111 return "RenderEngine"; 112 } 113 114 public String getName() { 115 return name; 116 } 117 118 public String getValue() { 119 return engine; 120 } 121 122 public void setName(String name) { 123 this.name = name; 124 } 125 126 public void setValue(String value) { 127 this.engine = value; 128 } 129 130 public void index(Document document) { 131 document.add(Field.Text(name, "" + engine)); 133 } 134 } 135 | Popular Tags |