private void updateUIValues() {
    if (fURLValue.getLabel() == null) {
      org.eclipse.birt.chart.model.component.Label l = ComponentFactoryImpl.eINSTANCE.createLabel();
      fURLValue.setLabel(l);
      l.eAdapters().addAll(fURLValue.eAdapters());
      org.eclipse.birt.chart.model.attribute.Text t = AttributeFactoryImpl.eINSTANCE.createText();
      l.setCaption(t);
      t.eAdapters().addAll(l.eAdapters());
    }
    String v = fURLValue.getLabel().getCaption().getValue();
    fTxtHyperlinkLabel.setText(v == null ? "" : v); // $NON-NLS-1$

    fsBaseURL = fURLValue.getBaseUrl();

    fTxtBaseParm.setText(
        fURLValue.getBaseParameterName() == null
            ? "" //$NON-NLS-1$
            : fURLValue.getBaseParameterName());
    fTxtSeriesParm.setText(
        fURLValue.getSeriesParameterName() == null
            ? "" //$NON-NLS-1$
            : fURLValue.getSeriesParameterName());
    fTxtValueParm.setText(
        fURLValue.getValueParameterName() == null
            ? "" //$NON-NLS-1$
            : fURLValue.getValueParameterName());
  }
Example #2
0
 public IText getCaption() {
   Text caption = label.getCaption();
   if (caption == null) {
     caption = ChartComponentUtil.createEMFText();
     label.setCaption(caption);
   }
   return ChartComponentUtil.convertText(caption);
 }
Example #3
0
  /**
   * Allows reuse of the multi-line text element for computing bounds of changed font/text content
   *
   * @param fd
   */
  public final void reuse(Label la, double forceWrappingSize) {

    final Font f = (Font) xs.createFont(la.getCaption().getFont());
    fm = g2d.getFontMetrics(f);
    final FontRenderContext frc = g2d.getFontRenderContext();

    cachedwidth = Double.NaN;

    String s = la.getCaption().getValue();
    if (s == null) {
      s = IConstants.NULL_STRING;
    } else {
      // trim leading and trailing spaces.
      s = s.trim();
    }

    if (s.length() == 0) // TextLayout DOESN'T LIKE EMPTY STRINGS
    {
      s = IConstants.ONE_SPACE;
    }
    String[] sa = splitOnBreaks(s, forceWrappingSize, f);
    if (sa == null) {
      iLineCount = 1;
      oText = s;
      tla = new TextLayout[1];
      fsa = new String[1];
      tla[0] = new TextLayout(s, f.getAttributes(), frc);
      fsa[0] = s;
    } else {
      iLineCount = sa.length;
      oText = sa;
      tla = new TextLayout[iLineCount];
      fsa = new String[iLineCount];
      for (int i = 0; i < iLineCount; i++) {
        tla[i] = new TextLayout(sa[i], f.getAttributes(), frc);
        fsa[i] = sa[i];
      }
    }
    ins = la.getInsets().scaledInstance(pointsToPixels());

    if (forceWrappingSize > 0) {
      // update label with new broken content.
      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < fsa.length; i++) {
        sb.append(fsa[i]).append("\n"); // $NON-NLS-1$
      }

      if (sb.length() > 0) {
        sb.deleteCharAt(sb.length() - 1);
      }

      la.getCaption().setValue(sb.toString());
    }
  }
Example #4
0
  /** Only anti-alias rotated, bold text, and font size > 13 */
  private void computeTextAntialiasing() {
    FontDefinition font = la.getCaption().getFont();

    if (font.isBold() || (font.getRotation() % 90 != 0) || font.getSize() > 13) {
      g2d.setRenderingHint(
          RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    } else {
      g2d.setRenderingHint(
          RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
  }
Example #5
0
 public void setVisible(boolean visible) {
   label.setVisible(visible);
 }
Example #6
0
 public void setCaption(IText text) {
   label.setCaption(ChartComponentUtil.convertIText(text));
 }
Example #7
0
 public boolean isVisible() {
   return label.isVisible();
 }