Beispiel #1
0
  /**
   * @author [email protected]
   * @since version 2.5
   * @param fileName
   * @return MessageContainer - content read from db
   */
  public Vector<MessageContainer> read(String fileName, String sessionId, JBroFuzzWindow mWindow) {
    Vector<MessageContainer> mcv = new Vector<MessageContainer>();

    if (dbHandler.getClass().getName().equals(CouchDBHandler.class)) {
      Logger.log("TODO: reading from CouchDB", 0);
    } else {
      SQLiteHandler sqlH = (SQLiteHandler) dbHandler;
      String dbName = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "");
      Connection conn = sqlH.getConnection(dbName);

      mcv = sqlH.read(conn, sessionId, fileName, mWindow.getPanelFuzzing());
    }
    return mcv;
  }
Beispiel #2
0
  /**
   * The constructor of the help topics JDialog.
   *
   * @param parent
   * @author [email protected]
   * @version 2.0
   * @since 2.0
   */
  public Shortcuts(final JBroFuzzWindow parent) {

    if (shortcutsShowing) {
      return;
    }
    shortcutsShowing = true;

    // super(parent, " JBroFuzz - Help Topics ", true);
    setTitle(" JBroFuzz - Keyboard Shortcuts ");

    setIconImage(ImageCreator.IMG_FRAME.getImage());
    setLayout(new BorderLayout());
    setFont(new Font("SansSerif", Font.PLAIN, 12));

    final URL shortcutsURL = ClassLoader.getSystemClassLoader().getResource("help/shortcuts.html");

    final JEditorPane helpPane = new JEditorPane();
    ;
    try {
      helpPane.setPage(shortcutsURL);
    } catch (final IOException e1) {
      helpPane.setContentType("text/html");
      helpPane.setText(FILE_NOT_FOUND);
    }
    helpPane.setEditable(false);

    // Add the split pane to this panel
    getContentPane().add(new JScrollPane(helpPane), BorderLayout.CENTER);

    // Bottom buttons
    final JButton printBun = new JButton(" Print ");
    final JButton okButton = new JButton(" Close ");

    final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 15, 15));
    buttonPanel.add(printBun);
    buttonPanel.add(okButton);

    printBun.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent aEvent) {

            try {
              final boolean complete = helpPane.print();
              if (!complete) {
                Logger.log("User cancelled Printing", 1);
              }
            } catch (final PrinterException prException) {
              Logger.log("A Printing Exception Occured", 4);
            }
          }
        });

    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent aEvent) {

            shortcutsShowing = false;
            Shortcuts.this.dispose();
          }
        });

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    // Where to show the shortcuts frame
    this.setLocation(
        parent.getLocation().x + (parent.getWidth() - SIZE_X) / 2,
        parent.getLocation().y + (parent.getHeight() - SIZE_Y) / 2);

    this.setSize(Shortcuts.SIZE_X, Shortcuts.SIZE_Y);
    setMinimumSize(new Dimension(SIZE_X / 2, SIZE_Y / 2));

    setResizable(true);
    setVisible(true);

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(final WindowEvent wEvent) {
            shortcutsShowing = false;
            dispose();
          }
        });
  }