コード例 #1
0
  public static void main(final String[] args) {
    final HashMap styles = new HashMap();

    ClassicEngineBoot.getInstance().start();
    final ElementMetaData[] elementMetaDatas =
        ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++) {
      final ElementMetaData elementMetaData = elementMetaDatas[i];
      final StyleMetaData[] styleMetaDatas = elementMetaData.getStyleDescriptions();
      for (int j = 0; j < styleMetaDatas.length; j++) {
        final StyleMetaData styleMetaData = styleMetaDatas[j];
        styles.put(styleMetaData.getName(), styleMetaData);
      }
    }

    final StyleMetaData[] stylesArray =
        (StyleMetaData[]) styles.values().toArray(new StyleMetaData[styles.size()]);
    Arrays.sort(stylesArray, new PlainMetaDataComparator());

    for (int i = 0; i < stylesArray.length; i++) {
      StyleMetaData metaData = stylesArray[i];
      final String name = metaData.getName();
      System.out.println("style." + name + ".display-name=" + name);
      System.out.println(
          "style." + name + ".grouping=" + filter(metaData.getGrouping(Locale.ENGLISH), "Group"));
      System.out.println(
          "style." + name + ".description=" + filter(metaData.getDescription(Locale.ENGLISH), ""));
      System.out.println(
          "style."
              + name
              + ".deprecated="
              + filter(metaData.getDeprecationMessage(Locale.ENGLISH), ""));
    }
  }
コード例 #2
0
  private static void validateStyleMetaData(
      final ElementMetaData metaData, final ArrayList<String> missingProperties) {
    final Locale locale = Locale.getDefault();
    final String typeName = metaData.getName();

    final StyleMetaData[] styleMetaDatas = metaData.getStyleDescriptions();
    for (int j = 0; j < styleMetaDatas.length; j++) {
      final StyleMetaData propertyMetaData = styleMetaDatas[j];
      final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
      if (isValid(propertyDisplayName, propertyMetaData.getName(), missingProperties) == false) {
        logger.warn(
            "ElementType '"
                + typeName
                + ": Style "
                + propertyMetaData.getName()
                + ": No DisplayName");
      }

      final String propertyGrouping = propertyMetaData.getGrouping(locale);
      if (isValid(propertyGrouping, "common", missingProperties) == false) {
        logger.warn(
            "ElementType '"
                + typeName
                + ": Style "
                + propertyMetaData.getName()
                + ": Grouping is not valid");
      }
      if (propertyMetaData.isDeprecated()) {
        final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
        if (isValid(deprecateMessage, "Deprecated", missingProperties) == false) {
          logger.warn(
              "ElementType '"
                  + typeName
                  + ": Style "
                  + propertyMetaData.getName()
                  + ": No valid deprecate message");
        }
      }
    }
  }