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

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


  private ElementType computeElementType(final FieldDefinition fieldDefinition)
  {
    // todo: Make this configurable or even better: drop it into the element metadata.

    final String field = fieldDefinition.getField();
    final DataAttributes attributes = flowController.getDataSchema().getAttributes(field);
    if (attributes == null)
    {
      logger.warn("Field '" + field + "' is declared in the wizard-specification, " +
          "but not present in the data. Assuming defaults.");
      return new TextFieldType();
    }
    final Class fieldType = (Class) attributes.getMetaAttribute
        (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE, Class.class, attributeContext);
    if (fieldType == null)
    {
      return new TextFieldType();
    }
View Full Code Here


      {
        return true;
      }
    }

    final DataAttributes tableAttributes = flowController.getDataSchema().getTableAttributes();
    final Object crosstabMode = tableAttributes.getMetaAttribute
        (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.CROSSTAB_MODE, String.class, attributeContext);
    if (MetaAttributeNames.Core.CROSSTAB_VALUE_NORMALIZED.equals(crosstabMode))
    {
      // the data-source indicates a high probability that a crosstab is requested.
      return true;
View Full Code Here

          processingStack = new FastStack();
        }
        final String[] columnSet = computeColumns(crosstabGroup);
        final ReportStateKey processKey = state.getProcessKey();
        final DataSchema dataSchema = getRuntime().getDataSchema();
        final DataAttributes tableAttributes = dataSchema.getTableAttributes();
        final DataAttributeContext context = new DefaultDataAttributeContext
            (getRuntime().getProcessingContext().getOutputProcessorMetaData(),
                getRuntime().getResourceBundleFactory().getLocale());

        final String mode = (String) tableAttributes.getMetaAttribute
            (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.CROSSTAB_MODE, String.class, context);
        if ("normalized".equals(mode))
        {
          processingStack.push(new OrderedMergeCrosstabSpecification(processKey, columnSet));
        }
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


    // 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();

    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();
      styleSheet.setStyleProperty(ElementStyleKeys.VALIGNMENT, vAlign);
      if (hAlign != null)
      {
        styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, hAlign);
      }
      else if (LabelType.INSTANCE.getMetaData().getName().equals(e.getElementTypeName()) == false &&
          ResourceLabelType.INSTANCE.getMetaData().getName().equals(e.getElementTypeName()) == false)
      {
        styleSheet.setStyleProperty(ElementStyleKeys.ALIGNMENT, computeAlignment(attributes, context));
      }
      styleSheet.setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, bgColor);
      styleSheet.setStyleProperty(ElementStyleKeys.PAINT, textColor);
      styleSheet.setStyleProperty(TextStyleKeys.FONT, font);
      styleSheet.setStyleProperty(TextStyleKeys.FONTSIZE, fontSize);
      styleSheet.setStyleProperty(TextStyleKeys.UNDERLINED, underline);
      styleSheet.setStyleProperty(TextStyleKeys.BOLD, bold);
      styleSheet.setStyleProperty(TextStyleKeys.STRIKETHROUGH, strikethrough);
      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(e.getElementTypeName()) == false &&
          ResourceLabelType.INSTANCE.getMetaData().getName().equals(e.getElementTypeName()) == 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(e.getElementTypeName())) // 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

  }

  public String getColumnName(final int column)
  {
    final DataAttributes attributes = columnAttributes.get(column);
    final String attribute = (String) attributes.getMetaAttribute
        (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.NAME, String.class, dataAttributeContext);
    return attribute;
  }
View Full Code Here

    return attribute;
  }

  public Class getColumnClass(final int columnIndex)
  {
    final DataAttributes attributes = columnAttributes.get(columnIndex);
    return (Class) attributes.getMetaAttribute
        (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.TYPE, Class.class, dataAttributeContext);
  }
View Full Code Here

    final ArrayList<String> fields = new ArrayList<String>();
    final String[] columnNames = dataSchemaModel.getColumnNames();
    final DataAttributeContext dac = dataSchemaModel.getDataAttributeContext();
    for (final String columnName : columnNames)
    {
      final DataAttributes attributes = dataSchemaModel.getDataSchema().getAttributes(columnName);
      final Object sourceAttribute = attributes.getMetaAttribute
          (MetaAttributeNames.Core.NAMESPACE, MetaAttributeNames.Core.SOURCE, String.class, dac);
      if (MetaAttributeNames.Core.SOURCE_VALUE_ENVIRONMENT.equals(sourceAttribute) ||
          MetaAttributeNames.Core.SOURCE_VALUE_PARAMETER.equals(sourceAttribute))
      {
        continue;
View Full Code Here

  private ElementMetaData createMetaData(final String fieldName)
  {

    final ContextAwareDataSchemaModel model = editorContext.getRenderContext().getReportDataSchemaModel();
    final DataSchema dataSchema = model.getDataSchema();
    final DataAttributes attributes = dataSchema.getAttributes(fieldName);
    final DataAttributeContext dataAttributeContext = new DefaultDataAttributeContext();
    if (attributes == null)
    {
      return null;
    }
View Full Code Here

    setIcon(IconLoader.getInstance().getEmptyIcon());

    if (model != null && value instanceof String)
    {
      String field = (String) value;
      final DataAttributes attributes = model.getDataSchema().getAttributes(field);
      final DataAttributeContext dac = model.getDataAttributeContext();
      if (attributes != null)
      {
        Class fieldClass = configureFieldType(attributes, dac);
        configureFieldText(field, fieldClass, attributes, dac);
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.