Esempio n. 1
0
  public SimpleForm getForm() {
    if (editorForm == null) {
      ButtonBarBuilder builder = new ButtonBarBuilder();
      editorFontTextField = new JTextField(20);
      editorFontTextField.setEnabled(false);
      builder.addFixed(editorFontTextField);
      builder.addRelatedGap();
      builder.addFixed(
          new JButton(
              new AbstractAction("Select Font..") {
                public void actionPerformed(ActionEvent e) {
                  Font font =
                      JFontChooser.showDialog(
                          UISupport.getMainFrame(),
                          "Select XML Editor Font",
                          Font.decode(editorFontTextField.getText()));

                  if (font != null) {
                    editorFontTextField.setText(encodeFont(font));
                  }
                }
              }));

      editorForm = new SimpleForm();
      editorForm.addSpace(5);
      editorForm.append("Editor Font", builder.getPanel());
      editorForm.appendSeparator();
      editorForm.appendCheckBox(
          XML_LINE_NUMBERS, "Show line numbers in XML editors by default", true);
      editorForm.appendCheckBox(
          GROOVY_LINE_NUMBERS, "Show line numbers in Groovy editors by default", true);
      editorForm.appendSeparator();
      editorForm.appendCheckBox(
          NO_RESIZE_REQUEST_EDITOR, "Disables automatic resizing of Request editors", true);
      editorForm.appendCheckBox(
          START_WITH_REQUEST_TABS, "Defaults the Request editor to the tabbed layout", true);
      editorForm.appendSeparator();

      autoValidateCheckBox =
          editorForm.appendCheckBox(
              AUTO_VALIDATE_REQUEST, "Always validate request messages before they are sent", true);
      abortCheckBox =
          editorForm.appendCheckBox(ABORT_ON_INVALID_REQUEST, "Abort invalid requests", true);
      editorForm.appendCheckBox(AUTO_VALIDATE_RESPONSE, "Always validate response messages", true);

      autoValidateCheckBox.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              abortCheckBox.setEnabled(autoValidateCheckBox.isSelected());
            }
          });
    }

    return editorForm;
  }
Esempio n. 2
0
    public ContentDialog(String title, String description) throws HeadlessException {
      super(UISupport.getMainFrame());
      setTitle(title);
      setModal(true);

      getContentPane().setLayout(new BorderLayout());
      JLabel label = new JLabel(description);
      label.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
      getContentPane().add(label, BorderLayout.NORTH);
      getContentPane().add(buildContent(), BorderLayout.CENTER);

      ButtonBarBuilder builder = ButtonBarBuilder.createLeftToRightBuilder();
      builder.addGlue();
      JButton closeButton = new JButton(new CloseAction());
      builder.addFixed(closeButton);

      builder.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
      getContentPane().add(builder.getPanel(), BorderLayout.SOUTH);

      pack();

      UISupport.initDialogActions(this, null, closeButton);
    }
Esempio n. 3
0
  private void buildDialog() {
    Window window = SwingUtilities.windowForComponent(target.getEditComponent());

    dialog = new JDialog(window, "Find / Replace");
    dialog.setModal(false);

    JPanel panel = new JPanel(new BorderLayout());
    findCombo = new JComboBox();
    findCombo.setEditable(true);
    replaceCombo = new JComboBox();
    replaceCombo.setEditable(true);

    // create inputs
    GridLayout gridLayout = new GridLayout(2, 2);
    gridLayout.setVgap(5);
    JPanel inputPanel = new JPanel(gridLayout);
    inputPanel.add(new JLabel("Find:"));
    inputPanel.add(findCombo);
    inputPanel.add(new JLabel("Replace with:"));
    inputPanel.add(replaceCombo);
    inputPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    // create direction panel
    ButtonGroup directionGroup = new ButtonGroup();
    forwardButton = new JRadioButton("Forward", true);
    forwardButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    directionGroup.add(forwardButton);
    backwardButton = new JRadioButton("Backward");
    backwardButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    directionGroup.add(backwardButton);

    JPanel directionPanel = new JPanel(new GridLayout(2, 1));
    directionPanel.add(forwardButton);
    directionPanel.add(backwardButton);
    directionPanel.setBorder(BorderFactory.createTitledBorder("Direction"));

    // create scope panel
    ButtonGroup scopeGroup = new ButtonGroup();
    allButton = new JRadioButton("All", true);
    allButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    selectedLinesButton = new JRadioButton("Selected Lines");
    selectedLinesButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    scopeGroup.add(allButton);
    scopeGroup.add(selectedLinesButton);

    JPanel scopePanel = new JPanel(new GridLayout(2, 1));
    scopePanel.add(allButton);
    scopePanel.add(selectedLinesButton);
    scopePanel.setBorder(BorderFactory.createTitledBorder("Scope"));

    // create options
    caseCheck = new JCheckBox("Case Sensitive");
    caseCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    wholeWordCheck = new JCheckBox("Whole Word");
    wholeWordCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    wrapCheck = new JCheckBox("Wrap Search");
    wrapCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    JPanel optionsPanel = new JPanel(new GridLayout(3, 1));
    optionsPanel.add(caseCheck);
    optionsPanel.add(wholeWordCheck);
    optionsPanel.add(wrapCheck);
    optionsPanel.setBorder(BorderFactory.createTitledBorder("Options"));

    // create panel with options
    JPanel options = new JPanel(new GridLayout(1, 2));

    JPanel radios = new JPanel(new GridLayout(2, 1));
    radios.add(directionPanel);
    radios.add(scopePanel);

    options.add(optionsPanel);
    options.add(radios);
    options.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));

    // create buttons
    ButtonBarBuilder builder = new ButtonBarBuilder();
    findButton = new JButton(new FindAction());
    builder.addFixed(findButton);
    builder.addRelatedGap();
    replaceButton = new JButton(new ReplaceAction());
    builder.addFixed(replaceButton);
    builder.addRelatedGap();
    replaceAllButton = new JButton(new ReplaceAllAction());
    builder.addFixed(replaceAllButton);
    builder.addUnrelatedGap();
    builder.addFixed(new JButton(new CloseAction()));
    builder.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    // tie it up!
    panel.add(inputPanel, BorderLayout.NORTH);
    panel.add(options, BorderLayout.CENTER);
    panel.add(builder.getPanel(), BorderLayout.SOUTH);

    dialog.getContentPane().add(panel);
    dialog.pack();
    UISupport.initDialogActions(dialog, null, findButton);
  }