1 25 26 package org.snipsnap.snip.label; 27 28 import java.util.Map ; 29 30 36 public class ComplexLabel extends BaseLabel { 37 public ComplexLabel() { 38 super(); 39 setPriority(1); 40 setSupervisor(""); 41 } 42 43 public ComplexLabel(String name, String value) { 44 super(name, value); 45 setPriority(1); 46 setSupervisor(""); 47 } 48 49 protected String supervisor; 50 protected int priority; 51 52 public String getType() { 53 return "ComplexLabel"; 54 } 55 56 public String getInputProxy() { 57 StringBuffer buffer = new StringBuffer (); 58 buffer.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">"); 59 buffer.append("<tr>"); 60 buffer.append("<td>Label name: </td>"); 61 buffer.append("<td><input type=\"text\" value=\""); 62 buffer.append(name); 63 buffer.append("\" name=\"label.name\"/></td>"); 64 buffer.append("</tr><tr>"); 65 buffer.append("<td>Label value: </td>"); 66 buffer.append("<td><input type=\"text\" value=\""); 67 buffer.append(value); 68 buffer.append("\" name=\"label.value\"/></td>"); 69 buffer.append("</tr><tr>"); 70 buffer.append("<td>Priority: </td>"); 71 buffer.append("<td><select name=\"label.priority\">"); 72 buffer.append("<option>1</option>"); 73 buffer.append("<option>2</option>"); 74 buffer.append("<option>3</option>"); 75 buffer.append("<option>4</option>"); 76 buffer.append("</select></td>"); 77 buffer.append("</tr><tr>"); 78 buffer.append("<td>Supervisor: </td>"); 79 buffer.append("<td><input type=\"text\" value=\""); 80 buffer.append(getSupervisor()); 81 buffer.append("\" name=\"label.supervisor\"/></td>"); 82 buffer.append("</tr></table>"); 83 return buffer.toString(); 84 } 85 86 public void handleInput(Map input) { 87 if (input.containsKey("label.name")) { 88 this.name = (String )input.get("label.name"); 89 } 90 if (input.containsKey("label.value")) { 91 this.value = (String )input.get("label.value"); 92 } 93 if (input.containsKey("label.priority")) { 94 this.setPriority(Integer.valueOf((String )input.get("label.priority")).intValue()); 95 } 96 if (input.containsKey("label.supervisor")) { 97 this.setSupervisor((String )input.get("label.supervisor")); 98 } 99 } 100 101 public String getSupervisor() { 102 return supervisor; 103 } 104 105 public void setSupervisor(String supervisor) { 106 this.supervisor = supervisor; 107 } 108 109 public int getPriority() { 110 return priority; 111 } 112 113 public void setPriority(int priority) { 114 this.priority = priority; 115 } 116 } 117 | Popular Tags |