1 15 package org.apache.tapestry.form; 16 17 import org.apache.tapestry.IMarkupWriter; 18 import org.apache.tapestry.IRequestCycle; 19 20 27 28 public class SelectPropertySelectionRenderer 29 implements IPropertySelectionRenderer 30 { 31 38 39 public void beginRender( 40 PropertySelection component, 41 IMarkupWriter writer, 42 IRequestCycle cycle) 43 { 44 writer.begin("select"); 45 writer.attribute("name", component.getName()); 46 47 if (component.isDisabled()) 48 writer.attribute("disabled", "disabled"); 49 50 writer.println(); 51 } 52 53 57 58 public void endRender( 59 PropertySelection component, 60 IMarkupWriter writer, 61 IRequestCycle cycle) 62 { 63 writer.end(); } 65 66 70 71 public void renderOption( 72 PropertySelection component, 73 IMarkupWriter writer, 74 IRequestCycle cycle, 75 IPropertySelectionModel model, 76 Object option, 77 int index, 78 boolean selected) 79 { 80 writer.beginEmpty("option"); 81 writer.attribute("value", model.getValue(index)); 82 83 if (selected) 84 writer.attribute("selected", "selected"); 85 86 writer.print(model.getLabel(index)); 87 88 writer.end(); 89 90 writer.println(); 91 } 92 } | Popular Tags |