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); }
/** Creates new form ManualEditPanel */ 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); addHierarchyListener( new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { SwingUtilities.invokeLater( new Runnable() { public void run() { installShortcuts(); } }); // disconnect from the hierarchy after installing the shortcuts once removeHierarchyListener(this); } }); // installShortcuts(); }
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()); }
private void interceptIncludeRegexTextFieldActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_interceptIncludeRegexTextFieldActionPerformed _manualEdit.setIncludeRegex(interceptIncludeRegexTextField.getText()); } // GEN-LAST:event_interceptIncludeRegexTextFieldActionPerformed
private void interceptIncludeRegexTextFieldFocusLost( java.awt.event.FocusEvent evt) { // GEN-FIRST:event_interceptIncludeRegexTextFieldFocusLost _manualEdit.setIncludeRegex(interceptIncludeRegexTextField.getText()); } // GEN-LAST:event_interceptIncludeRegexTextFieldFocusLost
private void sensitiveCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_sensitiveCheckBoxActionPerformed _manualEdit.setCaseSensitive(sensitiveCheckBox.isSelected()); } // GEN-LAST:event_sensitiveCheckBoxActionPerformed