Ejemplo n.º 1
0
 private void setBeanList(Field.BeanTable beanTable, String name, PersistentBean bean) {
   List value = (List) bean.getObject("localMetadata." + name); // local, non inheritable
   if ((value != null) && (value.size() > 0)) {
     beanTable.setValue(value);
     setMode(beanTable, 0);
   } else {
     value = (List) bean.getObject("localMetadataInheritable." + name); // local, inheritable
     if ((value != null) && (value.size() > 0)) {
       beanTable.setValue(value);
       setMode(beanTable, 1);
     } else {
       value = (List) bean.getObject(name); // inherited
       beanTable.setValue(value);
       setMode(beanTable, (value == null || value.size() == 0) ? 1 : 2);
     }
   }
 }
Ejemplo n.º 2
0
 private void setEditValue(PrefPanel pp, String name, PersistentBean bean, int mode) {
   Field fld = pp.getField(name);
   if (bean == null) fld.setValue(null);
   else {
     Object value = bean.getObject(name);
     fld.setValue(value);
   }
   setMode(fld, mode);
 }
Ejemplo n.º 3
0
  private void storeBeanList(Field.BeanTable beanTable, String name, PersistentBean bean) {
    if (bean == null) return;

    List newValue = (List) beanTable.getValue();

    // if it matches whats already stored (inherited or not), dont need to store it
    List oldValue = (List) bean.getObject(name);
    if (newValue.equals(oldValue)) return;

    // otherwise store it
    if (isInheritable(beanTable)) bean.putObject("localMetadataInheritable." + name, newValue);
    else bean.putObject("localMetadata." + name, newValue);
  }
Ejemplo n.º 4
0
  private void setEditValueWithInheritence(String name, PersistentBean bean) {
    Field fld = metadataPP.getField(name);
    if (bean == null) {
      fld.setValue(null);
      return;
    }

    Object value = bean.getObject("localMetadata." + name); // local, non inheritable
    if (value != null) {
      fld.setValue(value);
      setMode(fld, 0);
    } else {
      value = bean.getObject("localMetadataInheritable." + name); // local, inheritable
      if (value != null) {
        fld.setValue(value);
        setMode(fld, 1);

      } else {
        value = bean.getObject(name); // inherited
        fld.setValue(value);
        setMode(fld, (value == null) ? 1 : 2);
      }
    }
  }
Ejemplo n.º 5
0
  private void setStoreValue(PrefPanel pp, String name, PersistentBean bean, boolean inheritable) {
    if (bean == null) return;

    Field fld = pp.getField(name);
    Object newValue = fld.getValue();

    // if (newValue == null) return; // LOOK remove from store ??

    // if it matches whats already stored (inherited or not), dont need to store it
    Object oldValue = bean.getObject(name);
    if (newValue == oldValue) return;
    if ((newValue != null) && newValue.equals(oldValue)) return;

    // otherwise store it
    if (!inheritable) bean.putObject(name, newValue);
    else if (isInheritable(fld)) bean.putObject("localMetadataInheritable." + name, newValue);
    else bean.putObject("localMetadata." + name, newValue);
  }