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

Examples of org.pentaho.reporting.engine.classic.core.wizard.DataAttributes


    }

    for (int i = columnNames.length - 1; i >= 0; i -= 1)
    {
      final String columnName = columnNames[i];
      final DataAttributes attributes = dataSchema.getAttributes(columnName);
      if (attributes == null)
      {
        throw new IllegalStateException("No data-schema for field with name '" + columnName + '\'');
      }
      if (DataSchemaUtility.isFiltered(attributes, dataAttributeContext))
View Full Code Here


    }
    else if (value instanceof ReportFieldNode)
    {
      final ReportFieldNode fieldNode = (ReportFieldNode) value;
      final ContextAwareDataSchemaModel model = fieldNode.getDataSchemaModel();
      final DataAttributes attributes = model.getDataSchema().getAttributes(fieldNode.getFieldName());
      setToolTipText(fieldNode.getFieldClass().getSimpleName());
      if (attributes == null)
      {
        setText(fieldNode.toString());
      }
      else
      {
        final String displayName = (String) attributes.getMetaAttribute
            (MetaAttributeNames.Formatting.NAMESPACE, MetaAttributeNames.Formatting.LABEL,
                String.class, model.getDataAttributeContext());
        setText(formatFieldType(displayName, fieldNode.getFieldName(), fieldNode.getFieldClass()));
      }
    }
View Full Code Here

      if (isSelectedDataSource(queryNode))
      {
        final String[] names = getDataFactoryColumns();
        final String name = names[index];
        final ContextAwareDataSchemaModel model = context.getReportDataSchemaModel();
        final DataAttributes attributes = model.getDataSchema().getAttributes(name);
        final Class type = (Class) attributes.getMetaAttribute
            (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE, Class.class, model.getDataAttributeContext());
        final DataFactory dataFactory = queryNode.getDataFactory();
        return new ReportFieldNode(context, dataFactory, name, type);
      }
View Full Code Here

    final String[] columnNames = model.getColumnNames();
    final ArrayList<String> targetCols = new ArrayList<String>(columnNames.length);
    for (int i = 0; i < columnNames.length; i++)
    {
      final String columnName = columnNames[i];
      final DataAttributes attributes = model.getDataSchema().getAttributes(columnName);
      if (attributes == null)
      {
        // if in doubt, then do not add.
        continue;
      }
      if (DataSchemaUtility.isFiltered(attributes, model.getDataAttributeContext()))
      {
        continue;
      }

      if ("table".equals(attributes.getMetaAttribute
          (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.SOURCE,
              String.class, model.getDataAttributeContext())))
      {
        targetCols.add(columnName);
      }
View Full Code Here

    if (fieldName == null)
    {
      return;
    }

    final DataAttributes attributes = model.getDataSchema().getAttributes(fieldName);
    final String source = (String) attributes.getMetaAttribute
        (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.SOURCE, String.class, model.getDataAttributeContext());
    if (!MetaAttributeNames.Core.SOURCE_VALUE_TABLE.equals(source))
    {
      return;
    }
View Full Code Here

    {
      return this;
    }
    final ReportFieldNode fieldNode = (ReportFieldNode) value;
    final ContextAwareDataSchemaModel model = fieldNode.getDataSchemaModel();
    final DataAttributes attributes = model.getDataSchema().getAttributes(fieldNode.getFieldName());
    setToolTipText(fieldNode.getFieldClass().getSimpleName());
    if (attributes == null)
    {
      setText(fieldNode.toString());
      setIcon(IconLoader.getInstance().getBlankDocumentIcon());
View Full Code Here

    final String[] columnNames = model.getColumnNames();
    final ArrayList<ReportFieldNode> nodes = new ArrayList<ReportFieldNode>(columnNames.length);
    for (int i = 0; i < columnNames.length; i++)
    {
      final String name = columnNames[i];
      final DataAttributes attributes = model.getDataSchema().getAttributes(name);
      if (attributes != null)
      {
        if (DataSchemaUtility.isFiltered(attributes, model.getDataAttributeContext()))
        {
          continue;
        }
        final Class type = (Class) attributes.getMetaAttribute
            (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE, Class.class, model.getDataAttributeContext());
        nodes.add(new ReportFieldNode(context, name, type));
      }
      else
      {
View Full Code Here

    {
      type = String.class;
    }
   
    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    final DataAttributes data = rfc.getDataSchema().getAttributes(fieldName);
    if (data == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
    final DefaultDataAttributeContext attributeContext =
        new DefaultDataAttributeContext(rfc.getProcessingContext().getOutputProcessorMetaData(),
            rfc.getLocalizationContext().getLocale());
    final Object o = data.getMetaAttribute(metaNamespace, metaName, type, attributeContext);
    return new TypeValuePair(AnyType.TYPE, o);
  }
View Full Code Here

    if (fieldName == null)
    {
      throw new NullPointerException();
    }
    this.fieldName = fieldName;
    final DataAttributes attributes = dataSchema.getAttributes(fieldName);
    if (attributes != null)
    {
      final DefaultDataAttributeContext dataAttributeContext = new DefaultDataAttributeContext();
      displayName = (String) attributes.getMetaAttribute
          (MetaAttributeNames.Formatting.NAMESPACE, MetaAttributeNames.Formatting.LABEL,
              String.class, dataAttributeContext);
      if (displayName != null)
      {
        final Object indexColumn = attributes.getMetaAttribute
            (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.INDEXED_COLUMN, Boolean.class, dataAttributeContext);
        if (Boolean.TRUE.equals(indexColumn))
        {
          displayName += (" (" + fieldName + ")");
        }
View Full Code Here


    // the element always overrides all properties; properties not defined in the meta-data layer
    // will be removed from the stylesheet or attribute collection.

    final DataAttributes attributes = dataSchema.getAttributes(fieldName);
    if (attributes == null)
    {
      return false;
    }

    final MetaDataStyleEvaluator.VolatileDataAttributeContext context = getAttributeContext();
    final String typeName = e.getElementType().getMetaData().getName();

    if (Boolean.TRUE.equals(allowStylingFlag))
    {
      final Boolean bold = (Boolean) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.BOLD, Boolean.class, context);
      final Boolean italic = (Boolean) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.ITALIC, Boolean.class, context);
      final Boolean strikethrough = (Boolean) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.STRIKETHROUGH, Boolean.class, context);
      final Boolean underline = (Boolean) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.UNDERLINE, Boolean.class, context);
      final Integer fontSize = (Integer) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.FONTSIZE, Integer.class, context);
      final String font = (String) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.FONTFAMILY, String.class, context);
      final Color textColor = (Color) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.COLOR, Color.class, context);
      final Color bgColor = (Color) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.BACKGROUND_COLOR, Color.class, context);
      final ElementAlignment hAlign = (ElementAlignment) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT,
              ElementAlignment.class, context);
      final ElementAlignment vAlign = (ElementAlignment) attributes.getMetaAttribute
          (MetaAttributeNames.Style.NAMESPACE, MetaAttributeNames.Style.VERTICAL_ALIGNMENT, ElementAlignment.class,
              context);

      final ElementStyleSheet styleSheet = e.getStyle();
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_VALIGNMENT)))
      {
        styleSheet.setStyleProperty(ElementStyleKeys.VALIGNMENT, vAlign);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_ALIGNMENT)))
      {
        if (hAlign != null)
        {
          styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, hAlign);
        }
        else
        {
          if (LabelType.INSTANCE.getMetaData().getName().equals(typeName) == false &&
              ResourceLabelType.INSTANCE.getMetaData().getName().equals(typeName) == false)
          {
            styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, computeAlignment(attributes, context));
          }
        }
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_BACKGROUND_COLOR)))
      {
        styleSheet.setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, bgColor);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_COLOR)))
      {
        styleSheet.setStyleProperty(ElementStyleKeys.PAINT, textColor);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_FONTFAMILY)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.FONT, font);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_FONTSIZE)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.FONTSIZE, fontSize);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_UNDERLINE)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.UNDERLINED, underline);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_BOLD)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.BOLD, bold);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_STRIKETHROUGH)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.STRIKETHROUGH, strikethrough);
      }
      if (isMetaStylingEnabled(e.getAttributes().getAttribute
          (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE_STYLE_ITALICS)))
      {
        styleSheet.setStyleProperty(TextStyleKeys.ITALIC, italic);
      }
    }

    final boolean legacyMode = isLegacyMode();
    if (Boolean.TRUE.equals(allowAttributesFlag) &&
        ((legacyMode == false) || (Boolean.TRUE.equals(allowStylingFlag))))
    {
      if (LabelType.INSTANCE.getMetaData().getName().equals(typeName) == false &&
          ResourceLabelType.INSTANCE.getMetaData().getName().equals(typeName) == false)
      {
        final String format = (String) attributes.getMetaAttribute
            (MetaAttributeNames.Formatting.NAMESPACE, MetaAttributeNames.Formatting.FORMAT,
                String.class, context);
        if (format != null)
        {
          e.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, format);
        }
        else
        {
          final String autoFormat = AutoGeneratorUtility.computeFormatString(attributes, context);
          e.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, autoFormat);
        }
      }
      else
      {
        // only change the static text of labels. We do not touch anything else.
        if ("label".equals(typeName)) // NON-NLS
        {
          final String format = (String) attributes.getMetaAttribute
              (MetaAttributeNames.Formatting.NAMESPACE, MetaAttributeNames.Formatting.LABEL,
                  String.class, context);
          e.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, format);
        }
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.wizard.DataAttributes

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.