Пример #1
0
 public void setShowMouseSpy(final boolean showDeveloperStatus) {
   if (spy.isVisible()) {
     spy.close();
   } else {
     spy.open();
   }
 }
Пример #2
0
  public void init() {
    if (updateNotifier == null) {
      throw new NullPointerException("No update notifier set for " + this);
    }
    if (rootView == null) {
      throw new NullPointerException("No root view set for " + this);
    }

    insets = new Insets(0, 0, 0, 0);

    spy = new InteractionSpy(new SpyWindow());

    keyboardManager = new KeyboardManager(this);
    final InteractionHandler interactionHandler =
        new InteractionHandler(this, feedbackManager, keyboardManager, spy);
    renderingArea.addMouseMotionListener(interactionHandler);
    renderingArea.addMouseListener(interactionHandler);
    renderingArea.addKeyListener(interactionHandler);

    if (IsisContext.getConfiguration()
        .getBoolean(Properties.PROPERTY_BASE + "show-mouse-spy", false)) {
      spy.open();
    }

    setKeyboardFocus(rootView);

    APPLICATION_OPTIONS = new ApplicationOptions(listener);
  }
Пример #3
0
 /*
  * public void clearStatus() { setStatus(""); }
  */
 public void quit() {
   if (spy != null) {
     spy.close();
   }
   DebugFrame.disposeAll();
   if (listener != null) {
     listener.quit();
   }
   close();
 }
Пример #4
0
  @Override
  public void markDamaged(final Bounds bounds) {
    if (spy != null) {
      spy.addDamagedArea(bounds);
    }

    synchronized (redrawArea) {
      if (redrawArea.equals(NO_REDRAW)) {
        redrawArea.setBounds(bounds);
        UI_LOG.debug("damage - new area " + redrawArea);
      } else {
        if (!bounds.getSize().equals(NO_SIZE)) {
          redrawArea.union(bounds);
          UI_LOG.debug("damage - extend area " + redrawArea + " - to include " + bounds);
        }
      }
    }
  }
Пример #5
0
 public void showSpy() {
   spy.open();
 }
Пример #6
0
  public void paint(final Graphics graphic) {
    redrawCount++;
    graphic.translate(insets.left, insets.top);
    final Rectangle paintArea = graphic.getClipBounds();
    final Rectangle layoutArea = layoutViews();
    if (layoutArea != null) {
      paintArea.union(layoutArea);
    }

    if (spy != null) {
      spy.redraw(paintArea.toString(), redrawCount);
    }
    if (UI_LOG.isDebugEnabled()) {
      UI_LOG.debug(
          "------ repaint viewer #"
              + redrawCount
              + " "
              + paintArea.x
              + ","
              + paintArea.y
              + " "
              + paintArea.width
              + "x"
              + paintArea.height);
    }

    final Canvas c = createCanvas(graphic, paintArea);
    if (background != null) {
      background.draw(c.createSubcanvas(), rootView.getSize());
    }

    // paint views
    if (rootView != null) {
      rootView.draw(c.createSubcanvas());
    }
    // paint overlay

    final Bounds bounds = overlayView.getBounds();
    if (paintArea.intersects(
        new Rectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()))) {
      overlayView.draw(c.createSubcanvas(bounds));
    }

    /*
     * for (int i = 0; i < panes.length; i++) {
     * panes[i].draw(c.createSubcanvas()); }
     */
    // paint status
    // paintUserStatus(bufferGraphics);
    // blat to screen
    if (doubleBuffering) {
      graphic.drawImage(doubleBuffer, 0, 0, null);
    }
    if (showRepaintArea) {
      graphic.setColor(
          ((AwtColor) Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BOUNDS_REPAINT)).getAwtColor());
      graphic.drawRect(paintArea.x, paintArea.y, paintArea.width - 1, paintArea.height - 1);
      graphic.drawString("#" + redrawCount, paintArea.x + 3, paintArea.y + 15);
    }

    // paint status
    paintStatus(graphic);
  }
Пример #7
0
 public boolean isShowingMouseSpy() {
   return spy.isVisible();
 }
Пример #8
0
 public void addSpyAction(final String actionMessage) {
   if (spy != null) {
     spy.addAction(actionMessage);
   }
 }