Beispiel #1
0
  private Component buildToolbar() {
    JXToolBar toolbar = UISupport.createSmallToolbar();

    toolbar.addFixed(UISupport.createToolbarButton(new AddPartAction()));
    removePartButton = UISupport.createToolbarButton(new RemovePartAction());
    toolbar.addFixed(removePartButton);

    return toolbar;
  }
  private Component buildToolbar() {
    JXToolBar toolbar = UISupport.createToolbar();

    toolbar.add(UISupport.createToolbarButton(runAction = new RunAction()));
    toolbar.add(UISupport.createToolbarButton(cancelAction = new CancelRunTestCaseAction(), false));
    toolbar.add(UISupport.createToolbarButton(optionsAction = new OptionsAction()));
    toolbar.add(UISupport.createToolbarButton(openTestCaseAction = new OpenTestCaseAction()));

    toolbar.addGlue();
    toolbar.add(
        UISupport.createToolbarButton(new ShowOnlineHelpAction(HelpUrls.RUNTESTCASESTEP_HELP_URL)));

    return toolbar;
  }
  public JPanel getForm() {
    if (sensitiveInfoTableForm == null) {
      sensitiveInfoTableForm = new JPanel(new BorderLayout());

      JXToolBar toolbar = UISupport.createToolbar();

      toolbar.add(UISupport.createToolbarButton(new AddTokenAction()));
      toolbar.add(UISupport.createToolbarButton(new RemoveTokenAction()));

      tokenTable = JTableFactory.getInstance().makeJXTable(sensitiveInformationTableModel);
      tokenTable.setPreferredSize(new Dimension(200, 100));
      sensitiveInfoTableForm.add(toolbar, BorderLayout.NORTH);
      sensitiveInfoTableForm.add(new JScrollPane(tokenTable), BorderLayout.CENTER);
    }

    return sensitiveInfoTableForm;
  }
  private JComponent buildToolbar() {
    configureAssertionAction = new ConfigureAssertionAction();
    removeAssertionAction = new RemoveAssertionAction();
    addLoadTestAssertionAction = new AddLoadTestAssertionAction();

    JXToolBar toolbar = UISupport.createSmallToolbar();

    JButton button = UISupport.createToolbarButton(addLoadTestAssertionAction);
    toolbar.addFixed(button);
    button = UISupport.createToolbarButton(removeAssertionAction);
    toolbar.addFixed(button);
    button = UISupport.createToolbarButton(configureAssertionAction);
    toolbar.addFixed(button);
    toolbar.addGlue();
    toolbar.add(new ShowOnlineHelpAction(HelpUrls.LOADTEST_ASSERTIONS_URL));

    return toolbar;
  }
    public SchemaTabs() {
      super();
      conflicts = new JPanel();
      conflicts.setLayout(new BorderLayout());
      auto = new JCheckBox("Auto-Resolve");
      auto.setToolTipText("Automatically modify inferred schema from received Responses");
      auto.setOpaque(false);
      UISupport.setFixedSize(auto, 120, 20);
      XmlBeansSettingsImpl settings = getRequest().getSettings();
      if (settings.isSet(AUTO_INFER_SCHEMAS)) {
        auto.setSelected(settings.getBoolean(AUTO_INFER_SCHEMAS));
      }
      auto.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              getRequest().getSettings().setBoolean(AUTO_INFER_SCHEMAS, auto.isSelected());
            }
          });
      resolveButton = new JButton("Resolve conflicts");
      resolveButton.setEnabled(false);
      resolveButton.setActionCommand("resolve");
      resolveButton.addActionListener(this);

      JXToolBar toolbar = UISupport.createToolbar();
      toolbar.addFixed(auto);
      toolbar.addFixed(resolveButton);

      log = new JLogList("Schema log");
      conflicts.add(toolbar, BorderLayout.NORTH);
      conflicts.add(log, BorderLayout.CENTER);
      addTab("Conflicts", conflicts);

      schemaList = new JList(InferredSchemaManager.getInferredSchema(service).getNamespaces());
      schemaList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      schemaList.addListSelectionListener(this);

      toolbar = UISupport.createToolbar();
      toolbar.addFixed(UISupport.createToolbarButton(new RemoveNamespaceAction()));

      JPanel listPanel = new JPanel();
      listPanel.setLayout(new BorderLayout());
      listPanel.add(toolbar, BorderLayout.NORTH);
      listPanel.add(new JScrollPane(schemaList), BorderLayout.CENTER);
      xsd = JXEditTextArea.createXmlEditor(false);
      xsd.setEditable(false);
      update();
      addTab(
          "Schemas", new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listPanel, new JScrollPane(xsd)));
    }
  private Component buildToolbar() {
    toolbar = UISupport.createSmallToolbar();

    if (holder instanceof MutableTestPropertyHolder) {
      removePropertyAction = new RemovePropertyAction();
      MutableTestPropertyHolder mutablePropertyHolder = (MutableTestPropertyHolder) holder;
      addPropertyAction =
          new AddParamAction(
              propertiesTable, mutablePropertyHolder, "Adds a property to the property list");
      movePropertyUpAction =
          new MovePropertyUpAction(
              propertiesTable, mutablePropertyHolder, "Moves selected property up one row");
      movePropertyDownAction =
          new MovePropertyDownAction(
              propertiesTable, mutablePropertyHolder, "Moves selected property down one row");

      JButton addPropertyButton = UISupport.createToolbarButton(addPropertyAction);
      toolbar.add(addPropertyButton);
      JButton removePropertyButton = UISupport.createToolbarButton(removePropertyAction);
      toolbar.add(removePropertyButton);

      toolbar.addRelatedGap();
      JButton movePropertyUpButton = UISupport.createToolbarButton(movePropertyUpAction);
      toolbar.add(movePropertyUpButton);
      JButton movePropertyDownButton = UISupport.createToolbarButton(movePropertyDownAction);
      toolbar.add(movePropertyDownButton);

      if (!(holder instanceof AMFRequestTestStep || holder instanceof JdbcRequestTestStep)) {
        toolbar.addRelatedGap();
        toolbar.add(UISupport.createToolbarButton(new SortPropertiesAction()));
        toolbar.addRelatedGap();
      }
    }

    JButton clearPropertiesButton = UISupport.createToolbarButton(new ClearPropertiesAction());
    toolbar.add(clearPropertiesButton);
    JButton loadPropertiesButton = UISupport.createToolbarButton(loadPropertiesAction);
    toolbar.add(loadPropertiesButton);
    toolbar.add(UISupport.createToolbarButton(new SavePropertiesAction()));

    return toolbar;
  }
  private JComponent buildScriptToolbar() {
    JXToolBar toolBar = UISupport.createToolbar();
    JButton runButton = UISupport.createToolbarButton(runScriptAction);
    toolBar.add(runButton);
    toolBar.add(Box.createHorizontalGlue());
    JLabel label =
        new JLabel(
            "<html>Script is invoked with <code>log</code>, <code>context</code>, "
                + "<code>requestContext</code>, <code>mockRequest</code> and <code>mockResponse</code> variables</html>");
    label.setToolTipText(label.getText());
    label.setMaximumSize(label.getPreferredSize());

    toolBar.add(label);
    toolBar.addUnrelatedGap();
    toolBar.addFixed(
        UISupport.createActionButton(
            new ShowOnlineHelpAction(mockResponse.getScriptHelpUrl()), true));

    return toolBar;
  }
  private void buildUI() {
    propertiesTable = createPropertyHolderTable();
    add(propertiesTable, BorderLayout.CENTER);

    JXToolBar toolbar = propertiesTable.getToolbar();

    toolbar.addRelatedGap();
    JButton reloadButton = UISupport.createToolbarButton(new ReloadPropertiesFromSourceAction());
    toolbar.add(reloadButton);

    toolbar.addSeparator();
    toolbar.add(new JLabel("Load from:"));
    sourceField =
        new JTextField(testStep.getSource(), 20) {
          @Override
          public String getToolTipText(MouseEvent event) {
            return testStep.getSource(true);
          }
        };
    sourceField.setToolTipText(
        "The filename/url or referring system-property to load properties from");
    sourceField
        .getDocument()
        .addDocumentListener(
            new DocumentListenerAdapter() {
              public void update(Document document) {
                if (updatingSource) {
                  return;
                }

                updatingSource = true;
                testStep.setSource(sourceField.getText());
                updatingSource = false;
              }
            });

    toolbar.addRelatedGap();
    toolbar.addFixed(sourceField);
    JButton setSourceButton = UISupport.createToolbarButton(new SetPropertiesSourceAction());
    toolbar.addRelatedGap();
    toolbar.add(setSourceButton);

    toolbar.addSeparator();
    toolbar.add(new JLabel("Save to:"));
    targetField =
        new JTextField(testStep.getTarget(), 20) {
          @Override
          public String getToolTipText(MouseEvent event) {
            return testStep.getTarget(true);
          }
        };

    targetField.setToolTipText(
        "The filename/url or referring system-property to save properties to");
    targetField
        .getDocument()
        .addDocumentListener(
            new DocumentListenerAdapter() {
              public void update(Document document) {
                if (updatingTarget) {
                  return;
                }

                updatingTarget = true;
                testStep.setTarget(targetField.getText());
                updatingTarget = false;
              }
            });

    toolbar.addRelatedGap();
    toolbar.addFixed(targetField);
    JButton setTargetButton = UISupport.createToolbarButton(new SetPropertiesTargetAction());
    toolbar.addRelatedGap();
    toolbar.add(setTargetButton);

    toolbar.add(Box.createHorizontalGlue());
    toolbar.addSeparator();
    toolbar.add(
        UISupport.createToolbarButton(
            new ShowOnlineHelpAction(HelpUrls.PROPERTIESSTEPEDITOR_HELP_URL)));

    componentEnabler.add(sourceField);
    componentEnabler.add(targetField);
    componentEnabler.add(setTargetButton);
    componentEnabler.add(setSourceButton);
    componentEnabler.add(propertiesTable);

    setPreferredSize(new Dimension(600, 400));
  }