Ejemplo n.º 1
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();
    }
  }
Ejemplo n.º 2
0
  protected final void fireActionEvent(String command) {

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

    for (ActionListener listener : listeners) {
      listener.actionPerformed(event);
    }
  }
Ejemplo n.º 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()));
    }
  }
Ejemplo n.º 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, ""));
    }
  }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 8
0
  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);
   }
 }
Ejemplo n.º 10
0
 private void signalAll(ActionEvent e) {
   for (ActionListener a : listeners) {
     a.actionPerformed(e);
   }
 }