Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JRPrintHyperlink


            }
          }
        }
        boolean hasImageMap = imageMap != null;

        JRPrintHyperlink hyperlink = null;
        if (element instanceof JRPrintHyperlink)
        {
          hyperlink = (JRPrintHyperlink) element;
        }
        boolean hasHyperlink = !hasImageMap
          && hyperlink != null && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE;
        boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

        if (hasHyperlink || hasImageMap || hasTooltip)
        {
          JPanel link;
          if (hasImageMap)
View Full Code Here


  }

  void hyperlinkClicked(MouseEvent evt)
  {
    JPanel link = (JPanel)evt.getSource();
    JRPrintHyperlink element = (JRPrintHyperlink)linksMap.get(link);
    hyperlinkClicked(element);
  }
View Full Code Here

      {
        // only set anchor + bookmark for the first chunk in the text
        setAnchor(chunk, textElement, textElement);
      }
     
      JRPrintHyperlink hyperlink = textElement;
      if (hyperlink.getHyperlinkTypeValue() == HyperlinkTypeEnum.NONE)
      {
        hyperlink = (JRPrintHyperlink)attributes.get(JRTextAttribute.HYPERLINK);
      }
     
      setHyperlinkInfo(chunk, hyperlink);
View Full Code Here

  }


  public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
  {
    JRPrintHyperlink printHyperlink = null;
    if (hasHyperlinks() && entity instanceof XYItemEntity)
    {
      XYItemEntity itemEntity = (XYItemEntity) entity;
      TimeSeriesCollection dataset = (TimeSeriesCollection) itemEntity.getDataset();
      TimeSeries series = dataset.getSeries(itemEntity.getSeriesIndex());
View Full Code Here

   * Determines the provider for the chart entity based on its dataset,
   * and delegates the call to it.
   */
  public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
  {
    JRPrintHyperlink hyperlink = null;
    ChartHyperlinkProvider provider = resolveEntityProvider(entity);
    if (provider != null && provider.hasHyperlinks())
    {
      hyperlink = provider.getEntityHyperlink(entity);
    }
View Full Code Here

  }


  public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
  {
    JRPrintHyperlink printHyperlink = null;
    if (hasHyperlinks() && entity instanceof XYItemEntity)
    {
      XYItemEntity itemEntity = (XYItemEntity) entity;
      XYDataset dataset = itemEntity.getDataset();
      Comparable serie = dataset.getSeriesKey(itemEntity.getSeriesIndex());
View Full Code Here

    int startOffset = 0;
    int endOffset = 0;
    int crtOffset = 0;
    String chunk = null;
    JRPrintHyperlink hyperlink = null;
    Element element = null;
    Element parent = null;
    boolean bodyOccurred = false;
    int[] orderedListIndex = new int[elements.size()];
    String whitespace = "    ";
    String[] whitespaces = new String[elements.size()];
    for(int i = 0; i < elements.size(); i++)
    {
      whitespaces[i] = "";
    }
    JRStyledText styledText = new JRStyledText();
   
    for(int i = 0; i < elements.size(); i++)
    {
      if (bodyOccurred && chunk != null)
      {
        styledText.append(chunk);
        Map styleAttributes = getAttributes(element.getAttributes());
        if (hyperlink != null)
        {
          styleAttributes.put(JRTextAttribute.HYPERLINK, hyperlink);
          hyperlink = null;
        }
        if (!styleAttributes.isEmpty())
        {
          styledText.addRun(new JRStyledText.Run(styleAttributes,
              startOffset + crtOffset, endOffset + crtOffset));
        }
      }

      chunk = null;
      element = (Element)elements.get(i);
      parent = element.getParentElement();
      startOffset = element.getStartOffset();
      endOffset = element.getEndOffset();
      AttributeSet attrs = element.getAttributes();

      Object elementName = attrs.getAttribute(AbstractDocument.ElementNameAttribute);
      Object object = (elementName != null) ? null : attrs.getAttribute(StyleConstants.NameAttribute);
      if (object instanceof HTML.Tag)
      {
       
        HTML.Tag htmlTag = (HTML.Tag) object;
        if(htmlTag == Tag.BODY)
        {
          bodyOccurred = true;
          crtOffset = - startOffset;
        }
        else if(htmlTag == Tag.BR)
        {
          chunk = "\n";
        }
        else if(htmlTag == Tag.OL)
        {
          orderedListIndex[i] = 0;
          String parentName = parent.getName().toLowerCase();
          whitespaces[i] = whitespaces[elements.indexOf(parent)] + whitespace;
          if(parentName.equals("li"))
          {
            chunk = "";
          }
          else
          {
            chunk = "\n";
            ++crtOffset;
          }
        }
        else if(htmlTag == Tag.UL)
        {
          whitespaces[i] = whitespaces[elements.indexOf(parent)] + whitespace;

          String parentName = parent.getName().toLowerCase();
          if(parentName.equals("li"))
          {
            chunk = "";
          }
          else
          {
            chunk = "\n";
            ++crtOffset;
          }
         
        }
        else if(htmlTag == Tag.LI)
        {
         
          whitespaces[i] = whitespaces[elements.indexOf(parent)];
          if(element.getElement(0) != null &&
              (element.getElement(0).getName().toLowerCase().equals("ol") || element.getElement(0).getName().toLowerCase().equals("ul"))
              )
          {
            chunk = "";
          }
          else if(parent.getName().equals("ol"))
          {
            int index = elements.indexOf(parent);
            chunk = whitespaces[index] + String.valueOf(++orderedListIndex[index]) + ".  ";
          }
          else
          {
            chunk = whitespaces[elements.indexOf(parent)] + "\u2022  ";
          }
          crtOffset += chunk.length();
        }
        else if (element instanceof LeafElement)
        {
          if (element instanceof RunElement)
          {
            RunElement runElement = (RunElement)element;
            AttributeSet attrSet = (AttributeSet)runElement.getAttribute(Tag.A);
            if (attrSet != null)
            {
              hyperlink = new JRBasePrintHyperlink();
              hyperlink.setHyperlinkType(HyperlinkTypeEnum.REFERENCE);
              hyperlink.setHyperlinkReference((String)attrSet.getAttribute(HTML.Attribute.HREF));
              hyperlink.setLinkTarget((String)attrSet.getAttribute(HTML.Attribute.TARGET));
            }
          }
          try
          {
            chunk = document.getText(startOffset, endOffset - startOffset);
View Full Code Here

        }
      }
    }
   
    boolean localHyperlink = false;
    JRPrintHyperlink hyperlink = (JRPrintHyperlink)attributes.get(JRTextAttribute.HYPERLINK);
    if (!hyperlinkStarted && hyperlink != null)
    {
      startHyperlink(hyperlink);
      localHyperlink = true;
    }
View Full Code Here

        }
      }
    }

    boolean localHyperlink = false;
    JRPrintHyperlink hyperlink = (JRPrintHyperlink)attributes.get(JRTextAttribute.HYPERLINK);
    if (!hyperlinkStarted && hyperlink != null)
    {
      startHyperlink(hyperlink);
      localHyperlink = true;
    }
View Full Code Here

      Matcher matcher = LINK_PATTERN.matcher(text);
      StringBuffer xml = new StringBuffer();
      while (matcher.find())
      {
        String paramName = matcher.group(LINK_PARAM_NAME_GROUP);
        JRPrintHyperlink hyperlink =
          (JRPrintHyperlink) element.getParameterValue(paramName);
       
        String replacement;
        if (hyperlink == null)
        {
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JRPrintHyperlink

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.