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

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


  public void addStyleOption(final ElementType type,
                             final StyleKey styleKey,
                             final Object value)
  {
    final ElementMetaData metaData = type.getMetaData();
    final StyleMetaData styleDescription = metaData.getStyleDescription(styleKey);
    if (styleDescription == null)
    {
      return;
    }
View Full Code Here


  {
    try
    {
      if (ElementMetaDataTransferable.ELEMENT_FLAVOR.equals(getFlavor()))
      {
        final ElementMetaData data = (ElementMetaData) getTransferData();
        if (data == null)
        {
          return DnDConstants.ACTION_NONE;
        }

        if (dragHandler == null)
        {
          dragHandler = createDragHandler(data);
          if (dragHandler == null)
          {
            return DnDConstants.ACTION_NONE;
          }
          return dragHandler.dragStarted(event, editorContext, data, null);
        }
        else
        {
          return dragHandler.dragUpdated(event, editorContext, data, null);
        }
      }

      if (FieldDescriptionTransferable.ELEMENT_FLAVOR.equals(getFlavor()))
      {
        final String fieldName = (String) getTransferData();
        final ElementMetaData data = createMetaData(fieldName);
        if (data == null)
        {
          return DnDConstants.ACTION_NONE;
        }
View Full Code Here

    }
    try
    {
      if (ElementMetaDataTransferable.ELEMENT_FLAVOR.equals(getFlavor()))
      {
        final ElementMetaData metaData = (ElementMetaData) getTransferData();
        dragHandler.drop(dtde, editorContext, metaData, null);
        return;
      }

      if (FieldDescriptionTransferable.ELEMENT_FLAVOR.equals(getFlavor()))
      {
        final String fieldName = (String) getTransferData();
        final ElementMetaData metaData = createMetaData(fieldName);
        dragHandler.drop(dtde, editorContext, metaData, fieldName);
        return;
      }
      dtde.rejectDrop();
    }
View Full Code Here

  {
  }

  private String formatElement(final Element element)
  {
    final ElementMetaData data = element.getMetaData();
    final String displayName = data.getDisplayName(Locale.getDefault());
    if (WorkspaceSettings.getInstance().isElementsDisplayNames())
    {
      final String name = element.getName();

      if (StringUtils.isEmpty(name))
View Full Code Here

    setToolTipText(null);

    if (value instanceof Element)
    {
      final Element vr = (Element) value;
      final ElementMetaData data = vr.getMetaData();
      setText(formatElement(vr));
      final Image icon = data.getIcon(Locale.getDefault(), BeanInfo.ICON_COLOR_32x32);
      if (icon != null)
      {
        setIcon(new ImageIcon(icon));
      }
      setToolTipText(data.getDescription(Locale.getDefault()));
    }
    else if (value instanceof CompoundDataFactory)
    {
      setText(Messages.getString("StructureTreeCellRenderer.DataSets"));
      setIcon(IconLoader.getInstance().getDataSetsIcon());
    }
    else if (value instanceof ReportEnvironmentDataRow)
    {
      setText(Messages.getString("StructureTreeCellRenderer.Environment"));
      setIcon(IconLoader.getInstance().getPropertiesDataSetIcon());
    }
    else if (value instanceof ReportFunctionNode)
    {
      setText(Messages.getString("StructureTreeCellRenderer.Functions"));
      setIcon(IconLoader.getInstance().getFunctionsIcon());
    }
    else if (value instanceof ReportParametersNode || value instanceof SubReportParametersNode)
    {
      setText(Messages.getString("StructureTreeCellRenderer.Parameters"));
      setIcon(IconLoader.getInstance().getParameterIcon());
    }
    else if (value instanceof SubReportParametersNode.ExportParametersNode)
    {
      setText(Messages.getString("StructureTreeCellRenderer.ExportParameters"));
      setIcon(IconLoader.getInstance().getParameterIcon());
    }
    else if (value instanceof SubReportParametersNode.ImportParametersNode)
    {
      setText(Messages.getString("StructureTreeCellRenderer.ImportParameters"));
      setIcon(IconLoader.getInstance().getParameterIcon());
    }
    else if (value instanceof ParameterMapping)
    {
      final ParameterMapping mapping = (ParameterMapping) value;
      setText(Messages.getString("StructureTreeCellRenderer.ParameterMappingMessage", mapping.getAlias(), mapping.getName()));
      setIcon(IconLoader.getInstance().getParameterIcon());
    }
    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()));
      }
    }
    else if (value instanceof ReportQueryNode)
    {
      final ReportQueryNode queryNode = (ReportQueryNode) value;
      setText(queryNode.getQueryName());
      setToolTipText(queryNode.getDataFactory().getClass().getSimpleName());
    }
    else if (value instanceof Expression)
    {
      final Expression expression = (Expression) value;
      if (ExpressionRegistry.getInstance().isExpressionRegistered(expression.getClass().getName()) == false)
      {

        setText(expression.getClass().getName());
      }
      else
      {
        final ExpressionMetaData expressionMetaData =
            ExpressionRegistry.getInstance().getExpressionMetaData(expression.getClass().getName());

        if (expression.getName() == null)
        {
          setText(expressionMetaData.getDisplayName(Locale.getDefault()));
        }
        else
        {
          setText(Messages.getString("StructureTreeCellRenderer.NamedExpressionMessage",
              expressionMetaData.getDisplayName(Locale.getDefault()), expression.getName()));
        }
      }
    }
    else if (value instanceof ParameterDefinitionEntry)
    {
      final ParameterDefinitionEntry params = (ParameterDefinitionEntry) value;
      setText(params.getName());
    }
    else if (value instanceof DataFactory)
    {
      final DataFactory dfac = (DataFactory) value;
      final DataFactoryMetaData data = dfac.getMetaData();

      final Image image = data.getIcon(Locale.getDefault(), BeanInfo.ICON_COLOR_32x32);
      if (image != null)
      {
        setIcon(new ImageIcon(image));
      }

      final String connectionName = data.getDisplayConnectionName(dfac);
      if (connectionName != null)
      {
        setText(Messages.getString("StructureTreeCellRenderer.NamedDataFactoryMessage",
            data.getDisplayName(Locale.getDefault()), connectionName));
      }
      else
      {
        setText(data.getDisplayName(Locale.getDefault()));
      }
    }
    else if (value instanceof ParentDataFactoryNode)
    {
      setText(Messages.getString("StructureTreeCellRenderer.InheritedDataFactories"));
    }
    else if (value instanceof InheritedDataFactoryWrapper)
    {
      final InheritedDataFactoryWrapper wrapper = (InheritedDataFactoryWrapper) value;
      final DataFactory dfac = wrapper.getDataFactory();
      if (DataFactoryRegistry.getInstance().isRegistered(dfac.getClass().getName()) == false)
      {
        setText(dfac.getClass().getSimpleName());
      }
      else
      {
        final DataFactoryMetaData data = dfac.getMetaData();

        final Image image = data.getIcon(Locale.getDefault(), BeanInfo.ICON_COLOR_32x32);
        if (image != null)
        {
          setIcon(new ImageIcon(image));
        }

        final String connectionName = data.getDisplayConnectionName(dfac);
        if (connectionName != null)
        {
          setText(Messages.getString("StructureTreeCellRenderer.NamedDataFactoryMessage",
              data.getDisplayName(Locale.getDefault()), connectionName));
        }
        else
        {
          setText(data.getDisplayName(Locale.getDefault()));
        }
      }
    }
    return this;
  }
View Full Code Here

    final ArrayList<StyleMetaData> result = new ArrayList<StyleMetaData>();

    final ElementMetaData[] allElementTypes = ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < allElementTypes.length; i++)
    {
      final ElementMetaData elementType = allElementTypes[i];
      final StyleMetaData[] datas = elementType.getStyleDescriptions();
      for (int j = 0; j < datas.length; j++)
      {
        final StyleMetaData data = datas[j];

        if (seenKeys.add(data.getStyleKey()))
View Full Code Here

    return editor;
  }

  private AttributeMetaData selectMetaData(final ReportElement element)
  {
    final ElementMetaData elementMetaData = element.getMetaData();
    final AttributeMetaData fieldData =
            elementMetaData.getAttributeDescription(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
    if (fieldData != null)
    {
      return fieldData;
    }
    return elementMetaData.getAttributeDescription(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
  }
View Full Code Here

  private boolean deprecated;

  public MorphAction(final ElementType elementType)
  {
    targetElementType = elementType;
    final ElementMetaData metaData = elementType.getMetaData();
    putValue(Action.NAME, metaData.getDisplayName(Locale.getDefault()));

    experimental = metaData.isExperimental();
    expert = metaData.isExpert();
    deprecated = metaData.isDeprecated();

    settingsChanged();
    WorkspaceSettings.getInstance().addSettingsListener(this);
  }
View Full Code Here

    return editor;
  }

  private AttributeMetaData selectMetaData(final ReportElement element)
  {
    final ElementMetaData elementMetaData = element.getMetaData();
    if (Boolean.TRUE.equals(element.getAttribute
        (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES)))
    {
      return elementMetaData.getAttributeDescription(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR);
    }

    return elementMetaData.getAttributeDescription(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
  }
View Full Code Here

    {
      return;
    }

    final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>();
    final ElementMetaData targetMetaData = targetElementType.getMetaData();
    for (Element visualElement : visualElements)
    {
      if (visualElement instanceof Section)
      {
        continue;
      }
      if (ObjectUtilities.equal(visualElement.getElementTypeName(), targetElementType.getMetaData().getName()))
      {
        continue;
      }

      final ReportAttributeMap oldAttributes = visualElement.getAttributes();

      final ElementMetaData data = visualElement.getMetaData();
      final AttributeMetaData[] datas = data.getAttributeDescriptions();
      for (int j = 0; j < datas.length; j++)
      {
        final AttributeMetaData metaData = datas[j];
        final AttributeMetaData attributeMetaData =
            targetMetaData.getAttributeDescription(metaData.getNameSpace(), metaData.getName());
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.