Exemplo n.º 1
0
 private Preset(String name, Layout layout) {
   this.name = name;
   this.layoutClassName = layout.getClass().getName();
   for (LayoutProperty p : layout.getProperties()) {
     try {
       Object value = p.getProperty().getValue();
       if (value != null) {
         propertyNames.add(p.getCanonicalName());
         propertyValues.add(value);
       }
     } catch (Exception e) {
     }
   }
 }
Exemplo n.º 2
0
 public void loadPreset(Preset preset, Layout layout) {
   for (LayoutProperty p : layout.getProperties()) {
     for (int i = 0; i < preset.propertyNames.size(); i++) {
       if (p.getCanonicalName().equalsIgnoreCase(preset.propertyNames.get(i))
           || p.getProperty()
               .getName()
               .equalsIgnoreCase(
                   preset.propertyNames.get(
                       i))) { // Also compare with property name to maintain compatibility with old
                              // presets
         try {
           p.getProperty().setValue(preset.propertyValues.get(i));
         } catch (Exception ex) {
           ex.printStackTrace();
         }
       }
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public PropertySet[] getPropertySets() {
   if (propertySets == null) {
     try {
       Map<String, Sheet.Set> sheetMap = new HashMap<String, Sheet.Set>();
       for (LayoutProperty layoutProperty : layout.getProperties()) {
         Sheet.Set set = sheetMap.get(layoutProperty.getCategory());
         if (set == null) {
           set = Sheet.createPropertiesSet();
           set.setDisplayName(layoutProperty.getCategory());
           sheetMap.put(layoutProperty.getCategory(), set);
         }
         set.put(layoutProperty.getProperty());
       }
       propertySets = sheetMap.values().toArray(new PropertySet[0]);
     } catch (Exception ex) {
       Exceptions.printStackTrace(ex);
       return null;
     }
   }
   return propertySets;
 }