1 16 package org.apache.cocoon.forms.formmodel; 17 18 23 public class RepeaterDefinition extends AbstractContainerDefinition { 24 private int initialSize = 0; 25 private int minSize; 26 private int maxSize; 27 28 public RepeaterDefinition(int initialSize, int minSize, int maxSize) { 29 super(); 30 this.initialSize = initialSize; 31 this.minSize = minSize; 32 this.maxSize = maxSize; 33 } 34 35 38 public void initializeFrom(WidgetDefinition definition) throws Exception { 39 super.initializeFrom(definition); 40 41 if(definition instanceof RepeaterDefinition) { 42 RepeaterDefinition other = (RepeaterDefinition)definition; 43 this.initialSize = other.initialSize; 44 this.maxSize = other.maxSize; 45 this.minSize = other.minSize; 46 } else { 47 throw new Exception ("Definition to inherit from is not of the right type! (at "+getLocation()+")"); 48 } 49 } 50 51 public Widget createInstance() { 52 return new Repeater(this); 53 } 54 55 public int getInitialSize() { 56 return this.initialSize; 57 } 58 59 public int getMaxSize() { 60 return this.maxSize; 61 } 62 63 public int getMinSize() { 64 return this.minSize; 65 } 66 } 67 | Popular Tags |