示例#1
0
  protected final void fireActionEvent(String command) {

    ActionEvent event = new ActionEvent(this, 0, command);

    for (ActionListener listener : listeners) {
      listener.actionPerformed(event);
    }
  }
示例#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();
    }
  }
示例#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()));
    }
  }
示例#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, ""));
    }
  }
示例#6
0
文件: HexEdit.java 项目: khyuna/hyun
 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);
 }
示例#7
0
文件: HexEdit.java 项目: khyuna/hyun
 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);
 }
  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();
      }
    }
  }
 private void fireActionEvent(ActionEvent evt) {
   for (ActionListener l : actionListeners) {
     l.actionPerformed(evt);
   }
 }
示例#10
0
 private void signalAll(ActionEvent e) {
   for (ActionListener a : listeners) {
     a.actionPerformed(e);
   }
 }