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);
  }
Пример #2
0
 private void setBeanList(Field.BeanTableField beanTableField, String name, PersistentBean bean) {
   List value = (List) bean.getObject("localMetadata." + name); // local, non inheritable
   if ((value != null) && (value.size() > 0)) {
     beanTableField.setValue(value);
     setMode(beanTableField, 0);
   } else {
     value = (List) bean.getObject("localMetadataInheritable." + name); // local, inheritable
     if ((value != null) && (value.size() > 0)) {
       beanTableField.setValue(value);
       setMode(beanTableField, 1);
     } else {
       value = (List) bean.getObject(name); // inherited
       beanTableField.setValue(value);
       setMode(beanTableField, (value == null || value.size() == 0) ? 1 : 2);
     }
   }
 }
Пример #3
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.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);
  }
Пример #4
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);
 }
Пример #5
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);
      }
    }
  }