コード例 #1
0
  /** ***************************************************************************** */
  BddtHistoryBubble(BddtLaunchControl ctrl, BddtHistoryData hd) {
    history_data = hd;
    for_control = ctrl;
    history_graph = null;
    last_update = 0;
    update_needed = true;
    restart_needed = true;
    x_scale = 1;
    y_scale = 1;
    thread_colors = new HashMap<BumpThread, Color>();
    type_strokes = new EnumMap<LinkType, Stroke>(LinkType.class);
    type_strokes.put(
        LinkType.ENTER,
        new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, DOTTED, 0));
    type_strokes.put(
        LinkType.RETURN,
        new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, DASHED, 0));
    type_strokes.put(LinkType.NEXT, new BasicStroke(1));
    arrow_stroke = new BasicStroke(1);

    updateGraph();

    hd.addHistoryListener(this);

    setupPanel();

    draw_area.addMouseListener(new FocusOnEntry());
  }
コード例 #2
0
  private Color getThreadBlockColor(BumpThread bt) {
    if (bt == null) return Color.BLACK;

    synchronized (thread_colors) {
      Color c = thread_colors.get(bt);
      if (c == null) {
        double v;
        int ct = thread_colors.size();
        if (ct == 0) v = 0;
        else if (ct == 1) v = 1;
        else {
          v = 0.5;
          int p0 = ct - 1;
          int p1 = 1;
          for (int p = p0; p > 1; p /= 2) {
            v /= 2.0;
            p0 -= p1;
            p1 *= 2;
          }
          if ((p0 & 1) == 0) p0 = 2 * p1 - p0 + 1;
          v = v * p0;
        }
        float h = (float) (v * 0.8);
        float s = 0.7f;
        float b = 1.0f;
        int rgb = Color.HSBtoRGB(h, s, b);
        rgb |= 0xc0000000;
        c = new Color(rgb, true);
        thread_colors.put(bt, c);
      }
      return c;
    }
  }
コード例 #3
0
 void startBlock(BddtHistoryItem hi) {
   if (start_time == 0) start_time = hi.getTime();
   else start_time = Math.min(start_time, hi.getTime());
   GraphBlock gb = new GraphBlock(hi);
   all_blocks.add(gb);
   in_blocks.put(hi.getThread(), gb);
 }
コード例 #4
0
 GraphObject getObject(BddtHistoryItem hi) {
   BumpRunValue rv = hi.getThisValue();
   GraphObject go = null;
   if (rv != null) {
     String key = rv.getValue();
     go = object_map.get(key);
     if (go == null) {
       go = new GraphObject(rv);
       graph_objects.add(go);
       object_map.put(key, go);
     }
   } else {
     String cnm = hi.getClassName();
     go = object_map.get(cnm);
     if (go == null) {
       go = new GraphObject(cnm);
       graph_objects.add(go);
       object_map.put(cnm, go);
     }
   }
   return go;
 }
コード例 #5
0
  private void drawObject(Graphics2D g, int idx, GraphObject go) {
    double x0 = left_right_margin + (object_width + object_hspacing) * idx;
    Rectangle2D r = new Rectangle2D.Double(x0, top_bottom_margin, object_width, object_height);
    graph_locations.put(go, x0 + object_width / 2);

    g.setColor(Color.WHITE);
    g.fill(r);
    g.setColor(Color.BLACK);
    g.draw(r);
    g.setColor(Color.RED);
    SwingText.drawText(go.getName(), g, r);

    double x1 = x0 + object_width / 2;
    double y1 = top_bottom_margin + object_height;
    double y2 = time_end;
    Line2D tl = new Line2D.Double(x1, y1, x1, y2);
    g.setColor(Color.BLACK);
    g.draw(tl);

    for (GraphBlock gb : go.getBlocks()) {
      drawBlock(g, x1, gb);
    }
  }