@Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   String categoryName = (String) value;
   boolean disabled = true;
   Font boldFont = getFont().deriveFont(Font.BOLD);
   SortedSet<AssertionListEntry> assertions = categoriesAssertionsMap.get(categoryName);
   for (AssertionListEntry assertionListEntry : assertions) {
     if (isAssertionApplicable(assertionListEntry.getTypeId())) {
       disabled = false;
       break;
     }
   }
   JLabel label = new JLabel(categoryName);
   SimpleForm form = new SimpleForm();
   form.addComponent(label);
   label.setFont(boldFont);
   if (disabled || !((CategoriesListTable) table).isSelectable(row)) {
     label.setForeground(Color.GRAY);
   }
   if (isSelected) {
     form.getPanel().setBackground(Color.LIGHT_GRAY);
   } else {
     form.getPanel().setBackground(Color.WHITE);
   }
   return form.getPanel();
 }
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

      boldFont = getFont().deriveFont(Font.BOLD);

      AssertionListEntry entry = (AssertionListEntry) value;
      String type = TestAssertionRegistry.getInstance().getAssertionTypeForName(entry.getName());
      boolean canAssert = false;
      boolean disable = true;
      JLabel label;
      JTextArea descText;
      JLabel disabledInfo;
      if (type != null && assertable != null && assertable.getModelItem() != null) {
        canAssert =
            isAssertionApplicable(type, assertable.getModelItem(), getSelectedPropertyName());
        disable = !categoriesListTable.isEnabled() || !canAssert;
      }
      String str = entry.getName();
      label = new JLabel(str);
      label.setFont(boldFont);
      descText = new JTextArea(((AssertionListEntry) value).getDescription());
      descText.setSize(new Dimension(80, 20));
      descText.setLineWrap(true);
      descText.setWrapStyleWord(true);
      disabledInfo = new JLabel("Not applicable with selected Source and Property");
      descText.setFont(disabledInfo.getFont());
      if (disable) {
        label.setForeground(Color.LIGHT_GRAY);
        descText.setForeground(Color.LIGHT_GRAY);
        disabledInfo.setForeground(Color.LIGHT_GRAY);
      }
      SimpleForm form = new SimpleForm();
      form.addComponent(label);
      if (!isHideDescriptionSelected()) {
        form.addComponent(descText);
        //				if( disable )
        //				{
        //					form.addComponent( disabledInfo );
        //				}
        getAssertionsTable().setRowHeight(70);
      } else {
        if (disable) {
          form.addComponent(disabledInfo);
        }
        getAssertionsTable().setRowHeight(40);
      }
      if (isSelected) {
        descText.setBackground(Color.LIGHT_GRAY);
        form.getPanel().setBackground(Color.LIGHT_GRAY);
      } else {
        descText.setBackground(Color.WHITE);
        form.getPanel().setBackground(Color.WHITE);
      }
      return form.getPanel();
    }
  protected Component buildAssertionsList() {
    assertionsForm = new SimpleForm();

    assertionsListTableModel = new AssertionsListTableModel();
    assertionsTable = new AssertionsListTable(assertionsListTableModel);
    int selectedRow = categoriesListTable.getSelectedRow();
    String category = (String) categoriesListTable.getModel().getValueAt(selectedRow, 0);
    if (category != null && categoriesAssertionsMap.containsKey(category)) {
      assertions = categoriesAssertionsMap.get(category);
      assertionsListTableModel.setListEntriesSet(assertions);
    }
    assertionsTable.setTableHeader(null);
    assertionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    assertionsTable.getSelectionModel().addListSelectionListener(selectionListener);
    assertionsTable.setEditable(false);
    assertionsTable.setGridColor(Color.BLACK);
    assertionsTable.addMouseListener(mouseAdapter);

    assertionsTable.getColumnModel().getColumn(0).setCellRenderer(assertionEntryRenderer);
    assertionsForm.addComponent(assertionsTable);
    return new JScrollPane(assertionsForm.getPanel());
  }
    protected Component buildContent() {
      SimpleForm form = new SimpleForm();

      form.addSpace(5);
      Interface[] ifaces = getInterfaces(project);
      DefaultComboBoxModel sourceStepComboModel = new DefaultComboBoxModel();
      sourceStepCombo = form.appendComboBox("Interfaces", sourceStepComboModel, "Target Interface");
      sourceStepCombo.setRenderer(new ModelItemListCellRenderer());
      for (Interface element : ifaces) {
        sourceStepComboModel.addElement(element);
      }

      propertiesCombo =
          form.appendComboBox(
              operationType,
              ((Interface) sourceStepCombo.getSelectedItem()).getOperationList().toArray(),
              "Target " + operationType);
      propertiesCombo.setRenderer(new ModelItemListCellRenderer());

      sourceStepCombo.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              Interface iface =
                  project.getInterfaceByName(
                      ((Interface) sourceStepCombo.getSelectedItem()).getName());
              propertiesCombo.removeAllItems();
              if (iface != null) {
                propertiesCombo.setEnabled(true);
                for (Operation op : iface.getOperationList()) {
                  propertiesCombo.addItem(op);
                }
              } else {
                propertiesCombo.setEnabled(false);
              }
            }
          });

      form.addSpace(5);
      return form.getPanel();
    }
Exemple #5
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;
  }
Exemple #6
0
  public void setFormValues(Settings settings) {
    editorFontTextField.setText(encodeFont(UISupport.getEditorFont()));
    editorForm.setValues(getValues(settings));

    abortCheckBox.setEnabled(settings.getBoolean(UISettings.AUTO_VALIDATE_REQUEST));
  }
Exemple #7
0
 public void getFormValues(Settings settings) {
   StringToStringMap values = new StringToStringMap();
   editorForm.getValues(values);
   storeValues(values, settings);
 }