Examples of GCStringPrinter


Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

          Color oldColor = e.gc.getForeground();

          Rectangle printArea = ((Composite) e.widget).getClientArea();
          int fullWidth = printArea.width;
          int fullHeight = printArea.height;
          GCStringPrinter sp = new GCStringPrinter(e.gc,
              MessageText.getString("remote.pairing.accesscode"), printArea,
              false, false, SWT.NONE);
          sp.calculateMetrics();
          Point sizeAccess = sp.getCalculatedSize();

          String drawAccessCode = accessCode == null ? "      " : accessCode;

          int numBoxes = drawAccessCode == null ? 0 : drawAccessCode.length();
          int boxSize = 25;
          int boxSizeAndPadding = 30;
          int allBoxesWidth = numBoxes * boxSizeAndPadding;
          int textPadding = 15;
          printArea.x = (fullWidth - (allBoxesWidth + sizeAccess.x + textPadding)) / 2;
          printArea.width = sizeAccess.x;

          sp.printString(e.gc, printArea, 0);
          e.gc.setBackground(Colors.white);
          e.gc.setForeground(Colors.blue);

          int xStart = printArea.x + sizeAccess.x + textPadding;
          int yStart = (fullHeight - boxSize) / 2;
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

      }
      gc.setFont(font);

      Rectangle bounds = getDrawBounds(cell);

      GCStringPrinter sp = new GCStringPrinter(gc, text, bounds, true, true,
          SWT.WRAP | SWT.CENTER);

      sp.calculateMetrics();

      if (sp.hasHitUrl()) {
        URLInfo[] hitUrlInfo = sp.getHitUrlInfo();
        for (int i = 0; i < hitUrlInfo.length; i++) {
          URLInfo info = hitUrlInfo[i];
            // handle fake row when showing in column editor
         
          info.urlUnderline = cell.getTableRow() == null || cell.getTableRow().isSelected();
          if (info.urlUnderline) {
            info.urlColor = null;
          } else {
            info.urlColor = colorLinkNormal;
          }
        }
        int[] mouseOfs = cell.getMouseOffset();
        if (mouseOfs != null) {
          Rectangle realBounds = cell.getBounds();
          URLInfo hitUrl = sp.getHitUrl(mouseOfs[0] + realBounds.x, mouseOfs[1]
              + realBounds.y);
          if (hitUrl != null) {
            hitUrl.urlColor = colorLinkHover;
          }
        }
      }

      sp.printString();
    }
  }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

    String text = (String) event.cell.getTableRow().getData("text");
    if (text == null) {
      return;
    }

    GCStringPrinter sp = null;
    GC gc = new GC(Display.getDefault());
    try {
      if (font != null) {
        gc.setFont(font);
      }
      Rectangle drawBounds = getDrawBounds((TableCellSWT) event.cell);
      sp = new GCStringPrinter(gc, text, drawBounds, true, true, SWT.WRAP
          | SWT.CENTER);
      sp.calculateMetrics();
    } catch (Exception e) {
      Debug.out(e);
    } finally {
      gc.dispose();
    }

    if (sp != null) {
      URLInfo hitUrl = sp.getHitUrl(event.x + bounds.x, event.y + bounds.y);
      int newCursor;
      if (hitUrl != null) {
        if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
          if (hitUrl.url.equals("download")) {
            String referal = null;
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

      String sPercent = DisplayFormatters.formatPercentFromThousands(percentDone);

      Rectangle area = new Rectangle(xStart + xRelProgressFillStart + 3, yStart
          + yRelProgressFillStart, xRelProgressFillEnd - xRelProgressFillStart
          - 6, yRelProgressFillEnd - yRelProgressFillStart);
      GCStringPrinter sp = new GCStringPrinter(gc, sPercent + sSpeed, area,
          true, false, SWT.LEFT);
      if (cTextDrop != null) {
        area.x++;
        area.y++;
        gc.setForeground(cTextDrop);
        sp.printString();
        area.x--;
        area.y--;
      }
      gc.setForeground(cText);
      sp.printString();
      Point pctExtent = sp.getCalculatedSize();

      area.width -= (pctExtent.x + 3);
      area.x += (pctExtent.x + 3);

      if (!showSecondLine && sETALine != null) {
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

    colorLinkHover = skinProperties.getColor("color.links.hover");
  }

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, TableCellSWT cell) {
    GCStringPrinter sp = setupStringPrinter(gc, cell);

    if (sp.hasHitUrl()) {
      URLInfo[] hitUrlInfo = sp.getHitUrlInfo();
      for (int i = 0; i < hitUrlInfo.length; i++) {
        URLInfo info = hitUrlInfo[i];
        info.urlUnderline = cell.getTableRow().isSelected();
        if (info.urlUnderline) {
          info.urlColor = null;
        } else {
          info.urlColor = colorLinkNormal;
        }
      }
      int[] mouseOfs = cell.getMouseOffset();
      if (mouseOfs != null) {
        Rectangle realBounds = cell.getBounds();
        URLInfo hitUrl = sp.getHitUrl(mouseOfs[0] + realBounds.x, mouseOfs[1]
            + realBounds.y);
        if (hitUrl != null) {
          hitUrl.urlColor = colorLinkHover;
        }
      }
    }

    sp.printString();
    gc.setFont(null);
  }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

      gc.setFont(font);
    }
   
    int style = (drawBounds.height < 40) ? 0 : SWT.WRAP;

    GCStringPrinter sp = new GCStringPrinter(gc, text, drawBounds, true, true,
        style);

    sp.calculateMetrics();

    return sp;
  }
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

    Rectangle bounds = ((TableCellSWT) event.cell).getBounds();

    String text = entry.getText();

    GC gc = new GC(Display.getDefault());
    GCStringPrinter sp = null;
    try {
      sp = setupStringPrinter(gc, (TableCellSWT) event.cell);
    } catch (Exception e) {
      Debug.out(e);
    } finally {
      gc.dispose();
    }

    if (sp != null) {
      URLInfo hitUrl = sp.getHitUrl(event.x + bounds.x, event.y + bounds.y);
      int newCursor;
      if (hitUrl != null) {
        boolean ourUrl = UrlFilter.getInstance().urlCanRPC(hitUrl.url)
            || hitUrl.url.startsWith("/") || hitUrl.url.startsWith("#");
        if (event.eventType == TableCellMouseEvent.EVENT_MOUSEDOWN) {
View Full Code Here

Examples of org.gudy.azureus2.ui.swt.shells.GCStringPrinter

      System.err.println("you broke it");
      return;
    }
    GC gc = new GC(Display.getDefault());
    try {
      GCStringPrinter sp = setupStringPrinter(gc, (TableCellSWT) cell);
     
      if (sp.isCutoff()) {
        cell.setToolTip(GeneralUtils.stripOutHyperlinks(sp.getText()));
      }
    } catch (Throwable t) {
      Debug.out(t);
    } finally {
      gc.dispose();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.