/** * Instantiates a new manual edit panel. * * @param manualEdit the manual edit */ public ManualEditPanel(ManualEdit manualEdit) { _manualEdit = manualEdit; initComponents(); _requestButtonModel = interceptRequestCheckBox.getModel(); _requestButtonModel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { boolean enabled = interceptRequestCheckBox.isSelected(); interceptIncludeRegexTextField.setEnabled(isEnabled() && enabled); interceptExcludeRegexTextField.setEnabled(isEnabled() && enabled); interceptMethodList.setEnabled(isEnabled() && enabled); _manualEdit.setInterceptRequest(enabled); } }); _responseButtonModel = interceptResponseCheckBox.getModel(); _responseButtonModel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { boolean enabled = interceptResponseCheckBox.isSelected(); interceptResponseTextField.setEnabled(isEnabled() && enabled); _manualEdit.setInterceptResponse(enabled); } }); configure(); interceptMethodList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { interceptMethodListValueChanged(evt); } }); _manualEdit.setUI(this); }
/** * Intercept include regex text field focus lost. * * @param evt the evt */ private void interceptIncludeRegexTextFieldFocusLost(java.awt.event.FocusEvent evt) { // GEN // - // FIRST // : // event_interceptIncludeRegexTextFieldFocusLost _manualEdit.setIncludeRegex(interceptIncludeRegexTextField.getText()); } // GEN-LAST:event_interceptIncludeRegexTextFieldFocusLost
/** * Intercept response text field action performed. * * @param evt the evt */ private void interceptResponseTextFieldActionPerformed(java.awt.event.ActionEvent evt) { // GEN // - // FIRST // : // event_interceptResponseTextFieldActionPerformed _manualEdit.setInterceptResponseRegex(interceptResponseTextField.getText()); } // GEN-LAST:event_interceptResponseTextFieldActionPerformed
/** * Sensitive check box action performed. * * @param evt the evt */ private void sensitiveCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { // GEN // - // FIRST // : // event_sensitiveCheckBoxActionPerformed _manualEdit.setCaseSensitive(sensitiveCheckBox.isSelected()); } // GEN-LAST:event_sensitiveCheckBoxActionPerformed
/** * Intercept method list value changed. * * @param evt the evt */ private void interceptMethodListValueChanged(ListSelectionEvent evt) { int[] indices = interceptMethodList.getSelectedIndices(); String[] methods = new String[indices.length]; ListModel lm = interceptMethodList.getModel(); for (int i = 0; i < indices.length; i++) { methods[i] = (String) lm.getElementAt(indices[i]); } _manualEdit.setInterceptMethods(methods); }
/** Configure. */ public void configure() { boolean enabled = _manualEdit.getInterceptRequest(); interceptRequestCheckBox.setSelected(enabled); sensitiveCheckBox.setSelected(_manualEdit.isCaseSensitive()); interceptIncludeRegexTextField.setEnabled(isEnabled() && enabled); interceptIncludeRegexTextField.setText(_manualEdit.getIncludeRegex()); interceptExcludeRegexTextField.setEnabled(isEnabled() && enabled); interceptExcludeRegexTextField.setText(_manualEdit.getExcludeRegex()); interceptMethodList.setEnabled(isEnabled() && enabled); String[] interceptMethods = _manualEdit.getInterceptMethods(); interceptMethodList.setSelectedIndices( getIndices(interceptMethods, interceptMethodList.getModel())); enabled = _manualEdit.getInterceptResponse(); interceptResponseTextField.setEnabled(isEnabled() && enabled); interceptResponseCheckBox.setSelected(_manualEdit.getInterceptResponse()); interceptResponseTextField.setText(_manualEdit.getInterceptResponseRegex()); }