use of javax.swing.JTextArea in project zaproxy by zaproxy.
the class HttpTextViewUtilsUnitTest method shouldNotAllowUndefinedViewWhenGettingHeaderToViewPosition.
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowUndefinedViewWhenGettingHeaderToViewPosition() {
// Given
JTextArea undefinedView = null;
// When
HttpTextViewUtils.getHeaderToViewPosition(undefinedView, HEADER, 0, 0);
// Then = IllegalArgumentException
}
use of javax.swing.JTextArea in project zaproxy by zaproxy.
the class HttpTextViewUtilsUnitTest method shouldReturnInvalidPositionIfOffsetStartIsGreaterThanViewLengthWhenGettingHeaderToViewPosition.
@Test
public void shouldReturnInvalidPositionIfOffsetStartIsGreaterThanViewLengthWhenGettingHeaderToViewPosition() {
// Given
JTextArea view = new JTextArea("ABC");
int start = 5;
int end = 6;
// When
int[] pos = HttpTextViewUtils.getHeaderToViewPosition(view, HEADER, start, end);
// Then
assertThat(pos, is(equalTo(HttpTextViewUtils.INVALID_POSITION)));
}
use of javax.swing.JTextArea in project zaproxy by zaproxy.
the class HttpTextViewUtilsUnitTest method shouldReturnInvalidPositionIfOffsetEndIsGreaterThanViewLengthWhenGettingHeaderToViewPosition.
@Test
public void shouldReturnInvalidPositionIfOffsetEndIsGreaterThanViewLengthWhenGettingHeaderToViewPosition() {
// Given
JTextArea view = new JTextArea("ABC");
int start = 2;
int end = 6;
// When
int[] pos = HttpTextViewUtils.getHeaderToViewPosition(view, HEADER, start, end);
// Then
assertThat(pos, is(equalTo(HttpTextViewUtils.INVALID_POSITION)));
}
use of javax.swing.JTextArea in project nhin-d by DirectProject.
the class ValidatePanel method initUI.
protected void initUI() {
setLayout(new BorderLayout());
setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
// File Load Fields
policyFileField = new FileField("Policy Definition File:", "");
certFileField = new FileField("Certificate File: ", "");
final JPanel filePanel = new JPanel(new GridLayout(1, 2));
filePanel.add(certFileField);
filePanel.add(policyFileField);
this.add(filePanel, BorderLayout.NORTH);
// Report panel
final JLabel reportHeaderLabel = new JLabel("Validation Report");
reportText = new JTextArea();
reportText.setLineWrap(true);
reportText.setWrapStyleWord(true);
reportText.setEditable(false);
final JScrollPane scrollPane = new JScrollPane(reportText);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
final JPanel reportPanel = new JPanel(new BorderLayout());
reportPanel.add(reportHeaderLabel, BorderLayout.NORTH);
reportPanel.add(scrollPane, BorderLayout.CENTER);
this.add(reportPanel, BorderLayout.CENTER);
// Button Panel
cmdValidate = new JButton("Validate");
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(cmdValidate);
this.add(buttonPanel, BorderLayout.SOUTH);
}
use of javax.swing.JTextArea in project nhin-d by DirectProject.
the class EditorPanel method initUI.
protected void initUI() {
setLayout(new BorderLayout());
setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
policyText = new JTextArea();
policyText.setLineWrap(true);
policyText.setWrapStyleWord(true);
policyText.setEditable(true);
final JScrollPane scrollPane = new JScrollPane(policyText);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
fileNameLabel = new JLabel("*New File*");
final JPanel reportPanel = new JPanel(new BorderLayout());
reportPanel.add(fileNameLabel, BorderLayout.NORTH);
reportPanel.add(scrollPane, BorderLayout.CENTER);
//this.add(reportPanel, BorderLayout.CENTER);
validatePanel = new ValidatePanel();
validatePanel.setFeedMode(PolicyLexicon.SIMPLE_TEXT_V1, policyText.getDocument());
final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, reportPanel, validatePanel);
splitPane.setDividerLocation(400);
this.add(splitPane, BorderLayout.CENTER);
}
Aggregations