Beispiel #1
0
  @Override
  public void mouseDragged(final MouseEvent e) {
    final double prop = (max - min) * (mouseX - e.getX()) / (getWidth() - SLIDERW);

    final int old = value;
    value = Math.max(min, Math.min(max, (int) (oldValue - prop)));

    if (value != old) {
      if (dialog != null) dialog.action(null);
      for (final ActionListener al : listenerList.getListeners(ActionListener.class)) {
        al.actionPerformed(null);
      }
      repaint();
    }
  }
Beispiel #2
0
  public void _sendString(String text) {
    if (writeCommand == null) return;

    /* intercept sessions -i and deliver it to a listener within armitage */
    if (sessionListener != null) {
      Matcher m = interact.matcher(text);
      if (m.matches()) {
        sessionListener.actionPerformed(new ActionEvent(this, 0, m.group(1)));
        return;
      }
    }

    Map read = null;

    try {
      synchronized (this) {
        if (window != null && echo) {
          window.append(window.getPromptText() + text);
        }
      }

      if ("armitage.push".equals(writeCommand)) {
        read = (Map) connection.execute(writeCommand, new Object[] {session, text});
      } else {
        connection.execute(writeCommand, new Object[] {session, text});
        read = readResponse();
      }
      processRead(read);

      fireSessionWroteEvent(text);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Beispiel #3
0
  /** Removes the navigational data from another NavigatorView. */
  public void remove(NavigatorView view) {
    debug("removing " + view);

    // redo the search if necessary
    if (searchparams.getText() != null) {
      searchAction.actionPerformed(new ActionEvent(searchparams, ActionEvent.ACTION_PERFORMED, ""));
    }
  }
  /** @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) */
  public void mouseClicked(final MouseEvent e) {
    hasBeenClicked = true;

    // If the action is not null, perform the action
    if (action != null) {
      action.actionPerformed(new ActionEvent(this, 0, getText()));
    }
  }
Beispiel #5
0
  /** Merges in the navigational data from another NavigatorView. */
  public void merge(NavigatorView view) {
    debug("merging " + view);

    // redo the search if necessary
    String text = searchparams.getText();
    if (text != null && text.length() != 0) {
      searchAction.actionPerformed(new ActionEvent(searchparams, ActionEvent.ACTION_PERFORMED, ""));
    }
  }
Beispiel #6
0
 public void setStartAddress(int addr) {
   if (addr < 0) return;
   int endAddress = addr + fullRows() * 16 - 1;
   if (endAddress > SICXE.MAX_ADDR + 15 && addr > startAddress) return;
   int diff = addr - startAddress;
   startAddress = addr;
   cursorAddress += diff;
   repaint();
   if (onAddressChange != null) onAddressChange.actionPerformed(null);
 }
Beispiel #7
0
 public void setCursorAddress(int addr) {
   if (addr < 0 || addr > SICXE.MAX_ADDR) return;
   if (addr < startAddress) moveStartAddress(-1);
   if (addr > getEndAddress()) moveStartAddress(1);
   cursorAddress = addr;
   repaint();
   // if cursor was hidden due to window resize
   int col = cursorAddress % 16;
   if (cursorAddress > getEndAddress()) cursorAddress = getEndAddress() - 15 + col;
   if (onAddressChange != null) onAddressChange.actionPerformed(null);
 }
Beispiel #8
0
 @Override
 public void keyPressed(final KeyEvent e) {
   final int old = value;
   if (PREVCHAR.is(e) || PREVLINE.is(e)) {
     value = Math.max(min, value - 1);
   } else if (NEXTCHAR.is(e) || NEXTLINE.is(e)) {
     value = Math.min(max, value + 1);
   } else if (NEXTPAGE.is(e)) {
     value = Math.max(min, value + 10);
   } else if (PREVPAGE.is(e)) {
     value = Math.min(max, value - 10);
   } else if (LINESTART.is(e)) {
     value = min;
   } else if (LINEEND.is(e)) {
     value = max;
   }
   if (value != old) {
     if (dialog != null) dialog.action(null);
     for (final ActionListener al : listenerList.getListeners(ActionListener.class)) {
       al.actionPerformed(null);
     }
     repaint();
   }
 }
Beispiel #9
0
 public void run() {
   while (true) {
     try {
       sleep(m_fast ? 30 : m_delay);
     } catch (Exception e) {
     }
     if (m_paused) {
       try {
         synchronized (this) {
           this.wait();
         }
       } catch (InterruptedException ie) {
       }
     }
     synchronized (this) {
       m_cb.actionPerformed(null);
     }
   }
 }
  public void mouseReleased(MouseEvent e) {
    if (mMouseOverButton && mPressedButton != -1) {
      boolean needsUpdate = false;
      if (mColorListMode == VisualizationColor.cColorListModeCategories) {
        Color newColor =
            JColorChooser.showDialog(
                mOwner, "Select category color", mCategoryColorList[mPressedButton]);
        if (newColor != null) {
          mCategoryColorList[mPressedButton] = newColor;
          needsUpdate = true;
        }
      } else {
        if (mPressedButton == cColorWedgeButton) {
          if (++mColorListMode > VisualizationColor.cColorListModeStraight)
            mColorListMode = VisualizationColor.cColorListModeHSBShort;
          updateColorList(-1);
          needsUpdate = true;
        } else {
          int index = mPressedButton * (mWedgeColorList.length - 1);
          Color newColor =
              JColorChooser.showDialog(
                  mOwner, "Select color for min/max value", mWedgeColorList[index]);
          if (newColor != null) {
            mWedgeColorList[index] = newColor;
            updateColorList(-1);
            needsUpdate = true;
          }
        }
      }

      mPressedButton = -1;
      mMouseOverButton = false;

      if (needsUpdate) {
        mListener.actionPerformed(
            new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "colorChanged"));
        repaint();
      }
    }
  }
Beispiel #11
0
 /** Mouse action event handler. */
 protected void processActionEvent(ActionEvent e) {
   if (isEnabled() && actionListener != null && e != null) {
     actionListener.actionPerformed(e);
   }
 }
 private void signalAll(ActionEvent e) {
   for (ActionListener a : listeners) {
     a.actionPerformed(e);
   }
 }