Esempio n. 1
0
  private FieldSet wrapField(
      final Field field, final MetaField metaField, final LayoutContainer container) {
    FieldSet fs = new FieldSet();
    fs.setLayout(new FitLayout());
    fs.setHeading(metaField.getLabel());
    fs.setCheckboxToggle(true);
    fs.addListener(
        Events.Expand,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.put(metaField.getName(), field);
          }
        });
    fs.addListener(
        Events.Collapse,
        new Listener<BaseEvent>() {
          public void handleEvent(BaseEvent be) {
            enabledFields.remove(metaField.getName());
          }
        });
    fs.add(field);
    fs.setExpanded(false);

    return fs;
  }
Esempio n. 2
0
 protected void onClick(ComponentEvent ce) {
   if (checkboxToggle && ce.getTarget() == (Element) checkbox.cast()) {
     setExpanded(!isExpanded());
     boolean isExpanded = isExpanded();
     checkbox.setChecked(isExpanded);
     checkbox.setDefaultChecked(isExpanded);
   }
 }