Ejemplo n.º 1
0
  @Override
  public Void processInBackground(Context context) throws Exception {
    UserSettings userSettings = context.getUserSettings();
    List<PropertyGroup> groups = null;
    if (userSettings != null) {
      groups = userSettings.getPropertiesDisplayOptions().get(model.getResourceType());
    }
    CategoryProcessorContext categoryCtx = new CategoryProcessorContext(node, context);

    // Categories must be selected in the model first and then optionally
    // PropertyGroups can be defined and you can specify which categories
    // you want included in each group
    if (groups != null) {
      for (PropertyGroup group : groups) {
        if (group.isDisplayed()) {
          DevicePropertyGroup pageGroup = createGroup(group);
          for (PropertyCategory category : group.getCategories()) {
            model.addCategory(category);
            pageGroup.addCategory(category.getResourceCategory());
          }
          model.addPropertyGroup(pageGroup);
        }
      }
    }

    for (DevicePropertyCategory pageCategory : model.getCategories()) {
      pageCategory.populate(categoryCtx);
    }
    return null;
  }
Ejemplo n.º 2
0
 protected DevicePropertyGroup createGroup(PropertyGroup propertyGroup) {
   DevicePropertyGroup group = new DevicePropertyGroup();
   String title = propertyGroup.getTitle();
   if (title == null || title.length() == 0) {
     String groupName = propertyGroup.getName();
     title = PropertyGroupViz.getPropertyGroupViz(groupName).getTitle();
   }
   group.setGroupName(title);
   return group;
 }