コード例 #1
0
 /** Return a button that invokes javascript when clicked. */
 Input jsButton(String label, String js) {
   Input btn = new Input("button", null);
   btn.attribute("value", label);
   setTabOrder(btn);
   btn.attribute("onClick", js);
   return btn;
 }
コード例 #2
0
 /**
  * Return a labelled rasio button
  *
  * @param label appears to right of circle if non null
  * @param value value assigned to key if box checked
  * @param key form key to which value is assigned
  * @param checked if true, is initially checked
  * @return a readio button Element
  */
 protected Element radioButton(String label, String value, String key, boolean checked) {
   Composite c = new Composite();
   Input in = new Input(Input.Radio, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   c.add(in);
   c.add(label);
   return c;
 }
コード例 #3
0
 /**
  * Return a (possibly labelled) checkbox.
  *
  * @param label appears to right of checkbox if non null
  * @param value value included in result set if box checked
  * @param key form key to which result set is assigned
  * @param checked if true, box is initially checked
  * @return a checkbox Element
  */
 Element checkBox(String label, String value, String key, boolean checked) {
   Input in = new Input(Input.Checkbox, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   if (StringUtil.isNullString(label)) {
     return in;
   } else {
     Composite c = new Composite();
     c.add(in);
     c.add(" ");
     c.add(label);
     return c;
   }
 }
コード例 #4
0
 /**
  * Return a button that invokes the javascript submit routine with the specified action, first
  * storing the value in the specified form prop.
  */
 protected Element submitButton(String label, String action, String prop, String value) {
   StringBuilder sb = new StringBuilder(40);
   sb.append("lockssButton(this, '");
   sb.append(action);
   sb.append("'");
   if (prop != null && value != null) {
     sb.append(", '");
     sb.append(prop);
     sb.append("', '");
     sb.append(value);
     sb.append("'");
   }
   sb.append(")");
   Input btn = jsButton(label, sb.toString());
   btn.attribute("id", "lsb." + (++submitButtonNumber));
   return btn;
 }