UIInput.java :  » Web-Framework » RSF » uk » org » ponder » rsf » components » Java Open Source

Java Open Source » Web Framework » RSF 
RSF » uk » org » ponder » rsf » components » UIInput.java
/*
 * Created on Jul 28, 2005
 */
package uk.org.ponder.rsf.components;

/**
 * Input of a single String-typed value. May
 * peer, in HTML, for example, with <input type="text" or with
 * <textarea>.
 * 
 * @since RSF-0.5
 * @author Antranig Basman (antranig@caret.cam.ac.uk)
 * 
 */
public class UIInput extends UIBoundString {
  public UIInput() {
    fossilize = true;
    willinput = true;
  }

  /**
   * Construct a new UIInput component with the specified container as parent.
   * 
   * @param parent Parent container to which the component is to be added.
   * @param ID (RSF) ID of this component.
   * @param binding An EL expression to be used as the value binding for the
   *          contained String value. May be <code>null</code>.
   * @param initvalue An initial value for the bound value. May be left
   *          <code>null</code>. If neither this field nor
   *          <code>binding</code> is set. the value present in the template
   *          will be used.
   * @return The constructed UIInput component.
   */
  public static UIInput make(UIContainer parent, String ID, String binding,
      String initvalue) {
    UIInput togo = new UIInput();
    togo.valuebinding = ELReference.make(binding);
    if (initvalue != null) {
      togo.setValue(initvalue);
    }
    togo.ID = ID;
    parent.addComponent(togo);
    return togo;
  }

  public static UIInput make(UIContainer parent, String ID, String binding) {
    return make(parent, ID, binding, null);
  }

  /**
   * A "bare" constructor suitable for the selection member of a single
   * selection control (UIInput);
   */
  public static UIInput make(String valuebinding) {
    UIInput togo = new UIInput();
    togo.valuebinding = ELReference.make(valuebinding);
    return togo;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.