Package org.pentaho.reporting.engine.classic.core.metadata

Examples of org.pentaho.reporting.engine.classic.core.metadata.ElementMetaData


    ElementTypeRegistry registry = ElementTypeRegistry.getInstance();
    final ElementMetaData[] elementMetaDatas = registry.getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++)
    {
      final ElementMetaData metaData = elementMetaDatas[i];
      if (metaData == null)
      {
        logger.warn("Null Expression encountered");
        continue;
      }

      missingProperties.clear();

      try
      {
        final Object type = metaData.create();
      }
      catch (InstantiationException e)
      {
        logger.warn("Expression class is null");

      }

      final String typeName = metaData.getName();
      logger.debug("Processing " + typeName);

      final Locale locale = Locale.getDefault();
      final String displayName = metaData.getDisplayName(locale);
      if (isValid(displayName, metaData.getName()) == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid display name");
      }
      if (metaData.isDeprecated())
      {
        deprecatedExpressionsCounter += 1;
        final String deprecateMessage = metaData.getDeprecationMessage(locale);
        if (isValid(deprecateMessage, "Use a Formula instead") == false)
        {
          logger.warn("ElementType '" + typeName + ": No valid deprecate message");
        }
      }
      final String grouping = metaData.getGrouping(locale);
      if (isValid(grouping, "Group") == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid grouping message");
      }

      expressionsByGroup.add(grouping, metaData);

      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()) == false)
        {
          logger.warn("ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping, "Group") == 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") == false)
          {
            logger.warn(
                "ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }
      }


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

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

      System.err.flush();
      try
      {
        Thread.sleep(25);
      }
      catch (InterruptedException e)
      {
      }

      for (int x = 0; x < missingProperties.size(); x++)
      {
        final String property = (String) missingProperties.get(x);
        System.out.println(property);
      }

      if (missingProperties.isEmpty() == false)
      {
        invalidExpressionsCounter += 1;
        missingProperties.clear();
      }
      System.out.flush();
      try
      {
        Thread.sleep(25);
      }
      catch (InterruptedException e)
      {
      }
    }

    logger.info("Validated " + elementMetaDatas.length + " expressions. Invalid: " +
        invalidExpressionsCounter + " Deprecated: " + deprecatedExpressionsCounter);

    final Object[] keys = expressionsByGroup.keySet().toArray();
    Arrays.sort(keys);
    for (int i = 0; i < keys.length; i++)
    {
      final Object key = keys[i];
      logger.info("Group: '" + key + "' Size: " + expressionsByGroup.getValueCount(key));
      final Object[] objects = expressionsByGroup.toArray(key);
      for (int j = 0; j < objects.length; j++)
      {
        ElementMetaData metaData = (ElementMetaData) objects[j];
        logger.info("   " + metaData.getName());

      }
    }
  }
View Full Code Here


    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);
      }
View Full Code Here

    e.style = (InternalElementStyleSheet) style.derive();
    e.datasource = (DataSource) datasource.clone();
    e.parent = null;
    e.style.updateElementReference(e);
    e.attributes = (ReportAttributeMap) attributes.clone();
    final ElementMetaData metaData = e.getMetaData();
    final String[] namespaces = e.attributes.getNameSpaces();
    for (int i = 0; i < namespaces.length; i++)
    {
      final String namespace = namespaces[i];
      final Map attrsNs = attributes.getAttributes(namespace);
      final Iterator it = attrsNs.entrySet().iterator();
      while (it.hasNext())
      {
        final Map.Entry entry = (Map.Entry) it.next();
        final Object value = entry.getValue();

        final String name = (String) entry.getKey();
        final AttributeMetaData data = metaData.getAttributeDescription(namespace, name);
        if (data == null)
        {
          if (logger.isDebugEnabled())
          {
            logger.debug(getElementTypeName() + ": Attribute " + namespace + "|" + name + " is not listed in the metadata.");
View Full Code Here

    {
      return false;
    }

    final ConverterRegistry instance = ConverterRegistry.getInstance();
    final ElementMetaData metaData = e.getMetaData();
    boolean retval = false;

    for (int namespaceIdx = 0; namespaceIdx < namespaces.length; namespaceIdx++)
    {
      final String namespace = namespaces[namespaceIdx];
      final String[] names = e.getAttributeExpressionNames(namespace);
      for (int nameIdx = 0; nameIdx < names.length; nameIdx++)
      {
        final String name = names[nameIdx];
        final Expression ex = e.getAttributeExpression(namespace, name);
        if (ex == null)
        {
          continue;
        }

        final AttributeMetaData attribute = metaData.getAttributeDescription(namespace, name);
        if (attribute != null && attribute.isDesignTimeValue())
        {
          continue;
        }
View Full Code Here

                                final ReportRenderContext reportRenderContext,
                                final InspectionResultListener resultHandler,
                                final String[] columnNames,
                                final ReportElement element)
  {
    final ElementMetaData elementMetaData = element.getMetaData();
    if (elementMetaData.getCompatibilityLevel() > compatibilityLevel)
    {
      // warn: ReportMigrationInspection.ElementInvalid
      resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
          Messages.getString("ReportMigrationInspection.ElementInvalid",
              element.getName(), compatibilityText), new LocationInfo(element)));
    }

    for (final AttributeMetaData attributeMetaData : elementMetaData.getAttributeDescriptions())
    {
      if (attributeMetaData.getCompatibilityLevel() > compatibilityLevel)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("ReportMigrationInspection.AttributeInvalid",
View Full Code Here

    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
  }

  public void dragGestureRecognized(final DragGestureEvent anEvent)
  {
    final ElementMetaData elementMetaData = ElementTypeRegistry.getInstance().getElementType(elementName);
    final ElementMetaDataTransferable transferable = new ElementMetaDataTransferable(elementMetaData);
    anEvent.startDrag(DragSource.DefaultCopyNoDrop, EMPTY_DRAG_IMAGE, new Point(), transferable, null);

    final ButtonModel model = getModel();
    model.setArmed(false);
View Full Code Here

      final Object formatString = data.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING);

      final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>();
      for (Element element : visualElements)
      {
        final ElementMetaData metaData = element.getMetaData();
        final ElementStyleSheet elementStyleSheet = element.getStyle();

        final Object[] oldStyleData = new Object[StyleKey.getDefinedStyleKeyCount()];
        final Object[] newStyleData = new Object[StyleKey.getDefinedStyleKeyCount()];
        for (int j = 0; j < definedPropertyNamesArray.length; j++)
        {
          final StyleKey styleKey = definedPropertyNamesArray[j];
          if (styleKey == null)
          {
            continue;
          }
          final StyleMetaData styleDescr = metaData.getStyleDescription(styleKey);
          if (styleDescr == null)
          {
            // skip if the target element does not have that style ..
            continue;
          }
View Full Code Here

                                final ReportDocumentContext reportRenderContext,
                                final InspectionResultListener resultHandler,
                                final String[] columnNames,
                                final ReportElement element)
  {
    final ElementMetaData metaData = element.getMetaData();
    final AttributeMetaData[] attributeDescriptions = metaData.getAttributeDescriptions();
    for (int i = 0; i < attributeDescriptions.length; i++)
    {
      final AttributeMetaData attributeMetaData = attributeDescriptions[i];
      final Object value = element.getAttribute(attributeMetaData.getNameSpace(), attributeMetaData.getName());
      if (value != null)
View Full Code Here

    }
    if (element instanceof Section)
    {
      return;
    }
    final ElementMetaData metaData = element.getMetaData();
    if (metaData.isContainerElement())
    {
      return;
    }

    if (isTextElement(metaData) == false)
View Full Code Here

  public void addAttributeOption(final ElementType type,
                                 final String nameSpace,
                                 final String name,
                                 final Object value)
  {
    final ElementMetaData metaData = type.getMetaData();
    final AttributeMetaData attributeDescription = metaData.getAttributeDescription(nameSpace, name);
    if (attributeDescription == null)
    {
      return;
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.metadata.ElementMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.