Beispiel #1
0
  public ReportErrorDialog(
      MathletContext mathlet, Dialog owner, final QualityFeedbackReport report) {
    super(mathlet, owner, null);

    setDialogID(DIALOG_ID);
    setTitle(mathlet.getMessage("errorhandler.report.title.bar"));
    setContentTitle(mathlet.getMessage("errorhandler.report.title.content"));
    addText(mathlet.getMessage("errorhandler.report.text.top"));
    insertLineBreak();
    JButton detailsButton =
        new JButton(
            new AbstractAction(mathlet.getMessage("errorhandler.button.details")) {
              public void actionPerformed(ActionEvent e) {
                new QualityFeedbackDetailsDialog(getContext(), ReportErrorDialog.this, report)
                    .showDialog();
              }
            });
    addControl(detailsButton);
    insertLineBreaks(2);

    addText(mathlet.getMessage("errorhandler.report.text.middle"));
    insertLineBreak();
    m_userCommentArea = new JTextArea(3, 32);
    m_userCommentArea.setBackground(Color.WHITE);
    JScrollPane areaScroller = new JScrollPane(m_userCommentArea);
    addControl(areaScroller);
    insertLineBreaks(2);

    addText(mathlet.getMessage("errorhandler.report.text.bottom"));
    m_userMailAddressField = new JTextField(32);
    m_userMailAddressField.setBackground(Color.WHITE);
    insertLineBreak();
    addControl(m_userMailAddressField);
    insertLineBreaks(2);

    addAction(DialogAction.APPROVE_ACTION, mathlet.getMessage("errorhandler.button.submit"));
    addAction(DialogAction.CANCEL_ACTION, mathlet.getMessage("dialog.action.cancel"));

    pack();
  }
Beispiel #2
0
 private void setNotFoundBackground() {
   mySearchTextComponent.setBackground(LightColors.RED);
 }
Beispiel #3
0
 private void setRegularBackground() {
   mySearchTextComponent.setBackground(myDefaultBackground);
 }
Beispiel #4
0
  private boolean updateTextComponent(final boolean search) {
    JTextComponent oldComponent = search ? mySearchTextComponent : myReplaceTextComponent;
    Color oldBackground = oldComponent != null ? oldComponent.getBackground() : null;
    Wrapper wrapper = search ? mySearchFieldWrapper : myReplaceFieldWrapper;
    boolean multiline = myFindModel.isMultiline();
    if (multiline && oldComponent instanceof JTextArea) return false;
    if (!multiline && oldComponent instanceof JTextField) return false;

    final JTextComponent textComponent;
    if (multiline) {
      textComponent = new JTextArea();
      ((JTextArea) textComponent).setColumns(25);
      ((JTextArea) textComponent).setRows(2);
      wrapper.setContent(
          new SearchWrapper(textComponent, new ShowHistoryAction(textComponent, this)));
    } else {
      SearchTextField searchTextField = new SearchTextField(true);
      searchTextField.setOpaque(false);
      textComponent = searchTextField.getTextEditor();
      searchTextField.getTextEditor().setColumns(25);
      if (UIUtil.isUnderGTKLookAndFeel()) {
        textComponent.setOpaque(false);
      }
      setupHistoryToSearchField(
          searchTextField,
          search
              ? FindSettings.getInstance().getRecentFindStrings()
              : FindSettings.getInstance().getRecentReplaceStrings());
      textComponent.registerKeyboardAction(
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
              final String text = textComponent.getText();
              myFindModel.setMultiline(true);
              ApplicationManager.getApplication()
                  .invokeLater(
                      new Runnable() {
                        @Override
                        public void run() {
                          if (search) {
                            mySearchTextComponent.setText(text + "\n");
                          } else {
                            myReplaceTextComponent.setText(text + "\n");
                          }
                        }
                      });
            }
          },
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_DOWN_MASK),
          JComponent.WHEN_FOCUSED);
      wrapper.setContent(searchTextField);
    }

    if (search) {
      mySearchTextComponent = textComponent;
    } else {
      myReplaceTextComponent = textComponent;
    }

    UIUtil.addUndoRedoActions(textComponent);
    Utils.setSmallerFont(textComponent);

    textComponent.putClientProperty("AuxEditorComponent", Boolean.TRUE);
    if (oldBackground != null) {
      textComponent.setBackground(oldBackground);
    }
    textComponent.addFocusListener(
        new FocusListener() {
          @Override
          public void focusGained(final FocusEvent e) {
            textComponent.repaint();
          }

          @Override
          public void focusLost(final FocusEvent e) {
            textComponent.repaint();
          }
        });
    new CloseOnESCAction(this, textComponent);
    return true;
  }