Пример #1
0
 @Override
 public void mousePressed(MouseEvent e) {
   rightClick = AppD.isRightClick(e);
   table.stopEditing();
   mousePressedRow = rowHeader.locationToIndex(e.getPoint());
   rowHeader.requestFocus();
 }
Пример #2
0
 protected void highlightFirstResult() {
   if (resultsList.getModel().getSize() > 0) {
     resultsList.setSelectedIndex(0);
     resultsList.ensureIndexIsVisible(0);
     resultsList.requestFocus();
   }
 }
Пример #3
0
  private void doSearch() {
    ExtensionSearch.Type type = ExtensionSearch.Type.All;

    if (Constant.messages
        .getString("search.toolbar.label.type.url")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.URL;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.request")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Request;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.response")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Response;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.header")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Header;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.fuzz")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Fuzz;
    }

    extension.search(regEx.getText(), type, false, chkInverse.isSelected());

    // Select first result
    if (resultsList.getModel().getSize() > 0) {
      resultsList.setSelectedIndex(0);
      resultsList.requestFocus();
    }
  }
Пример #4
0
  private void ensureReturnAmount() {
    int row = this.jList1.getSelectedIndex();
    if (row != -1) {
      int selectedPaymentMode = vectPaymentModeIDs.get(row);
      ai.setPaymentMode(selectedPaymentMode);

      ai.setAmount(
          -1); // explicitly set it to negetive quantity, so that it can be catched at the
               // transaction page

      this.dispose();
    } else {
      JOptionPane.showMessageDialog(this, "Payment mode is not selected.");
      jList1.requestFocus();
    }
  }
Пример #5
0
  private void showCompletion() {
    try {
      int caretPosition = editorTextArea.getCaretPosition();
      int wordStart = getWordStart();
      CompletionCandidate[] words =
          getFilteredWords(wordStart, editorTextArea.getText(wordStart, caretPosition - wordStart));
      if (words.length == 0) {
        return;
      }
      final JPopupMenu w = new JPopupMenu();
      final JList jList = new JList(words);
      jList.setCellRenderer(
          new DefaultListCellRenderer() {
            private ImageIcon tableIcon =
                new ImageIcon(
                    getClass().getResource("/org/jooq/debug/console/resources/Table16.png"));
            private ImageIcon tableColumnIcon =
                new ImageIcon(
                    getClass().getResource("/org/jooq/debug/console/resources/TableColumn16.png"));
            private ImageIcon sqlIcon =
                new ImageIcon(
                    getClass().getResource("/org/jooq/debug/console/resources/SQL16.png"));

            @Override
            public Component getListCellRendererComponent(
                JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
              Component c =
                  super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
              if (c instanceof JLabel) {
                Icon icon;
                switch (((CompletionCandidate) value).getKeyWordType()) {
                  case TABLE:
                    icon = tableIcon;
                    break;
                  case TABLE_COlUMN:
                    icon = tableColumnIcon;
                    break;
                  default:
                    icon = sqlIcon;
                    break;
                }
                ((JLabel) c).setIcon(icon);
              }
              return c;
            }
          });
      jList.setSelectedIndex(0);
      jList.addKeyListener(
          new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
              switch (e.getKeyCode()) {
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_PAGE_DOWN:
                case KeyEvent.VK_UP:
                case KeyEvent.VK_DOWN:
                case KeyEvent.VK_HOME:
                case KeyEvent.VK_END:
                  return;
                case KeyEvent.VK_ESCAPE:
                  w.setVisible(false);
                  return;
                case KeyEvent.VK_ENTER:
                  editorTextArea.replaceRange(
                      ((CompletionCandidate) jList.getSelectedValue()).toString(),
                      getWordStart(),
                      editorTextArea.getCaretPosition());
                  w.setVisible(false);
                  return;
              }
              editorTextArea.dispatchEvent(
                  new KeyEvent(
                      editorTextArea,
                      e.getID(),
                      e.getWhen(),
                      e.getModifiers(),
                      e.getKeyCode(),
                      e.getKeyChar(),
                      e.getKeyLocation()));
              if (e.getKeyChar() != KeyEvent.CHAR_UNDEFINED
                  || e.getKeyCode() == KeyEvent.VK_LEFT
                  || e.getKeyCode() == KeyEvent.VK_RIGHT) {
                adjustListContent();
              }
            }

            @Override
            public void keyReleased(KeyEvent e) {
              switch (e.getKeyCode()) {
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_PAGE_DOWN:
                case KeyEvent.VK_UP:
                case KeyEvent.VK_DOWN:
                case KeyEvent.VK_HOME:
                case KeyEvent.VK_END:
                case KeyEvent.VK_ESCAPE:
                case KeyEvent.VK_ENTER:
                  return;
              }
              editorTextArea.dispatchEvent(
                  new KeyEvent(
                      editorTextArea,
                      e.getID(),
                      e.getWhen(),
                      e.getModifiers(),
                      e.getKeyCode(),
                      e.getKeyChar(),
                      e.getKeyLocation()));
              if (e.getKeyChar() != KeyEvent.CHAR_UNDEFINED
                  || e.getKeyCode() == KeyEvent.VK_LEFT
                  || e.getKeyCode() == KeyEvent.VK_RIGHT) {
                adjustListContent();
              }
            }

            @Override
            public void keyTyped(KeyEvent e) {
              switch (e.getKeyCode()) {
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_PAGE_DOWN:
                case KeyEvent.VK_UP:
                case KeyEvent.VK_DOWN:
                case KeyEvent.VK_HOME:
                case KeyEvent.VK_END:
                case KeyEvent.VK_ESCAPE:
                case KeyEvent.VK_ENTER:
                  return;
              }
              editorTextArea.dispatchEvent(
                  new KeyEvent(
                      editorTextArea,
                      e.getID(),
                      e.getWhen(),
                      e.getModifiers(),
                      e.getKeyCode(),
                      e.getKeyChar(),
                      e.getKeyLocation()));
              if (e.getKeyChar() != KeyEvent.CHAR_UNDEFINED
                  || e.getKeyCode() == KeyEvent.VK_LEFT
                  || e.getKeyCode() == KeyEvent.VK_RIGHT) {
                adjustListContent();
              }
            }

            private void adjustListContent() {
              try {
                int wordStart = getWordStart();
                CompletionCandidate[] words =
                    getFilteredWords(
                        wordStart,
                        editorTextArea.getText(
                            wordStart, editorTextArea.getCaretPosition() - wordStart));
                if (words.length == 0) {
                  w.setVisible(false);
                  return;
                }
                jList.setListData(words);
                jList.setSelectedIndex(0);
              } catch (BadLocationException e) {
                e.printStackTrace();
              }
            }
          });
      jList.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
              if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                editorTextArea.replaceRange(
                    ((CompletionCandidate) jList.getSelectedValue()).toString(),
                    getWordStart(),
                    editorTextArea.getCaretPosition());
                w.setVisible(false);
              }
            }
          });
      w.add(new JScrollPane(jList), BorderLayout.CENTER);
      w.setPreferredSize(new Dimension(200, 200));
      Rectangle position = editorTextArea.modelToView(caretPosition);
      w.show(editorTextArea, position.x + position.width, position.y + position.height);
      jList.requestFocus();
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
Пример #6
0
  // 리스너 자리
  @Override
  public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    System.out.println("버튼눌림" + arg0.getActionCommand());
    switch (arg0.getActionCommand()) {
      case "< 폴더선택":
        pathSearch();
        break;
      case "< 선택삭제":
        List<String> temp = list_image.getSelectedValuesList();
        int[] number = list_image.getSelectedIndices();

        if (temp.size() <= 0) {
          JOptionPane.showMessageDialog(this, "삭제할 파일을 선택해 주세요!!");
          break;
        }

        if (JOptionPane.showConfirmDialog(this, "선택한 파일을 삭제 할까요?", "", JOptionPane.YES_NO_OPTION)
            == 1) {
          break;
        }

        for (int i = temp.size() - 1; i >= 0; i--) {
          String file = temp.get(i);
          File tempFile = new File(text_path.getText(), file);
          if (tempFile.isFile()) {
            if (tempFile.delete()) {
              dlm.remove(number[i]);
            }
          }
        }
        break;

      case "< 전체선택":
        if (dlm.size() <= 0) {
          JOptionPane.showMessageDialog(this, "목록에 파일이 존재 하지 않습니다.");
          break;
        }

        Robot robot;
        try {
          robot = new Robot();
        } catch (AWTException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          break;
        }
        list_image.requestFocus();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_A);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.keyRelease(KeyEvent.VK_A);
        break;

      case "업로드 >>":
        uploadImage();
        break;
      case "검색":
        viewImgaeSearch();
        break;
      case "삭제":
        if (table_ftp_view.getSelectedRow() == -1) {
          JOptionPane.showMessageDialog(this, "삭제할 파일을 선택해 주세요!!");
          return;
        }
        if (JOptionPane.showConfirmDialog(
                this, "선택한 파일을 삭제 하시겠습니까?", "파일삭제", JOptionPane.OK_CANCEL_OPTION)
            == 0) {
          ftp_image_delete();
        }
        break;
      case "다운로드":
        if (table_ftp_view.getSelectedRow() == -1) {
          JOptionPane.showMessageDialog(this, "다운로드할 파일을 선택해 주세요!!");
          return;
        }
        ftpFile_DownLoad();
        break;
    }
  }