View Javadoc
1   package ca.uhn.hl7v2.testpanel.ui.find;
2   
3   import java.awt.BorderLayout;
4   import java.awt.Component;
5   import java.awt.FlowLayout;
6   import java.awt.GridBagConstraints;
7   import java.awt.GridBagLayout;
8   import java.awt.Insets;
9   
10  import javax.swing.Box;
11  import javax.swing.DefaultComboBoxModel;
12  import javax.swing.JButton;
13  import javax.swing.JCheckBox;
14  import javax.swing.JComboBox;
15  import javax.swing.JDialog;
16  import javax.swing.JLabel;
17  import javax.swing.JPanel;
18  import javax.swing.JTextField;
19  import javax.swing.border.EmptyBorder;
20  
21  public class Hl7V2FindDialog extends JDialog {
22  
23  	private final JPanel mycontentPanel = new JPanel();
24  	private JTextField myFindTextField;
25  	private JComboBox myFindTypeCombobox;
26  	private JCheckBox myIgnoreCaseCheckbox;
27  	private JComboBox myInComboBox;
28  	private JTextField myTerserPathTextField;
29  	private JTextField myReplaceWithTextField;
30  
31  	/**
32  	 * Launch the application.
33  	 */
34  	public static void main(String[] args) {
35  		try {
36  			Hl7V2FindDialog dialog = new Hl7V2FindDialog();
37  			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
38  			dialog.setVisible(true);
39  		} catch (Exception e) {
40  			e.printStackTrace();
41  		}
42  	}
43  
44  	/**
45  	 * Create the dialog.
46  	 */
47  	public Hl7V2FindDialog() {
48  		setBounds(100, 100, 450, 300);
49  		getContentPane().setLayout(new BorderLayout());
50  		mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
51  		getContentPane().add(mycontentPanel, BorderLayout.CENTER);
52  		GridBagLayout gbl_contentPanel = new GridBagLayout();
53  		gbl_contentPanel.columnWidths = new int[]{0, 0, 0, 0};
54  		gbl_contentPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0};
55  		gbl_contentPanel.columnWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
56  		gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
57  		mycontentPanel.setLayout(gbl_contentPanel);
58  		{
59  			JLabel lblFind = new JLabel("Find");
60  			GridBagConstraints gbc_lblFind = new GridBagConstraints();
61  			gbc_lblFind.insets = new Insets(0, 0, 5, 5);
62  			gbc_lblFind.anchor = GridBagConstraints.EAST;
63  			gbc_lblFind.gridx = 0;
64  			gbc_lblFind.gridy = 0;
65  			mycontentPanel.add(lblFind, gbc_lblFind);
66  		}
67  		{
68  			myFindTypeCombobox = new JComboBox();
69  			myFindTypeCombobox.setModel(new DefaultComboBoxModel(new String[] {"Text", "Regex"}));
70  			myFindTypeCombobox.setSelectedIndex(0);
71  			GridBagConstraints gbc_FindTypeCombobox = new GridBagConstraints();
72  			gbc_FindTypeCombobox.insets = new Insets(0, 0, 5, 5);
73  			gbc_FindTypeCombobox.fill = GridBagConstraints.HORIZONTAL;
74  			gbc_FindTypeCombobox.gridx = 1;
75  			gbc_FindTypeCombobox.gridy = 0;
76  			mycontentPanel.add(myFindTypeCombobox, gbc_FindTypeCombobox);
77  		}
78  		{
79  			myFindTextField = new JTextField();
80  			GridBagConstraints gbc_FindTextField = new GridBagConstraints();
81  			gbc_FindTextField.insets = new Insets(0, 0, 5, 0);
82  			gbc_FindTextField.fill = GridBagConstraints.HORIZONTAL;
83  			gbc_FindTextField.gridx = 2;
84  			gbc_FindTextField.gridy = 0;
85  			mycontentPanel.add(myFindTextField, gbc_FindTextField);
86  			myFindTextField.setColumns(10);
87  		}
88  		{
89  			myIgnoreCaseCheckbox = new JCheckBox("Ignore Case");
90  			GridBagConstraints gbc_IgnoreCaseCheckbox = new GridBagConstraints();
91  			gbc_IgnoreCaseCheckbox.insets = new Insets(0, 0, 5, 5);
92  			gbc_IgnoreCaseCheckbox.gridx = 1;
93  			gbc_IgnoreCaseCheckbox.gridy = 1;
94  			mycontentPanel.add(myIgnoreCaseCheckbox, gbc_IgnoreCaseCheckbox);
95  		}
96  		{
97  			Component verticalStrut = Box.createVerticalStrut(20);
98  			GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
99  			gbc_verticalStrut.insets = new Insets(0, 0, 5, 5);
100 			gbc_verticalStrut.gridx = 0;
101 			gbc_verticalStrut.gridy = 2;
102 			mycontentPanel.add(verticalStrut, gbc_verticalStrut);
103 		}
104 		{
105 			JLabel lblIn = new JLabel("In");
106 			GridBagConstraints gbc_lblIn = new GridBagConstraints();
107 			gbc_lblIn.anchor = GridBagConstraints.EAST;
108 			gbc_lblIn.insets = new Insets(0, 0, 5, 5);
109 			gbc_lblIn.gridx = 0;
110 			gbc_lblIn.gridy = 3;
111 			mycontentPanel.add(lblIn, gbc_lblIn);
112 		}
113 		{
114 			myInComboBox = new JComboBox();
115 			myInComboBox.setModel(new DefaultComboBoxModel(new String[] {"Anywhere", "Field Contents", "Terser Path"}));
116 			GridBagConstraints gbc_InComboBox = new GridBagConstraints();
117 			gbc_InComboBox.insets = new Insets(0, 0, 5, 5);
118 			gbc_InComboBox.fill = GridBagConstraints.HORIZONTAL;
119 			gbc_InComboBox.gridx = 1;
120 			gbc_InComboBox.gridy = 3;
121 			mycontentPanel.add(myInComboBox, gbc_InComboBox);
122 		}
123 		{
124 			myTerserPathTextField = new JTextField();
125 			GridBagConstraints gbc_TerserPathTextField = new GridBagConstraints();
126 			gbc_TerserPathTextField.insets = new Insets(0, 0, 5, 0);
127 			gbc_TerserPathTextField.fill = GridBagConstraints.HORIZONTAL;
128 			gbc_TerserPathTextField.gridx = 2;
129 			gbc_TerserPathTextField.gridy = 3;
130 			mycontentPanel.add(myTerserPathTextField, gbc_TerserPathTextField);
131 			myTerserPathTextField.setColumns(10);
132 		}
133 		{
134 			Component verticalStrut = Box.createVerticalStrut(20);
135 			GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
136 			gbc_verticalStrut.insets = new Insets(0, 0, 5, 5);
137 			gbc_verticalStrut.gridx = 0;
138 			gbc_verticalStrut.gridy = 4;
139 			mycontentPanel.add(verticalStrut, gbc_verticalStrut);
140 		}
141 		{
142 			JLabel lblReplace = new JLabel("Replace");
143 			GridBagConstraints gbc_lblReplace = new GridBagConstraints();
144 			gbc_lblReplace.insets = new Insets(0, 0, 0, 5);
145 			gbc_lblReplace.gridx = 0;
146 			gbc_lblReplace.gridy = 5;
147 			mycontentPanel.add(lblReplace, gbc_lblReplace);
148 		}
149 		{
150 			myReplaceWithTextField = new JTextField();
151 			GridBagConstraints gbc_ReplaceWithTextField = new GridBagConstraints();
152 			gbc_ReplaceWithTextField.gridwidth = 2;
153 			gbc_ReplaceWithTextField.fill = GridBagConstraints.HORIZONTAL;
154 			gbc_ReplaceWithTextField.gridx = 1;
155 			gbc_ReplaceWithTextField.gridy = 5;
156 			mycontentPanel.add(myReplaceWithTextField, gbc_ReplaceWithTextField);
157 			myReplaceWithTextField.setColumns(10);
158 		}
159 		{
160 			JPanel buttonPane = new JPanel();
161 			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
162 			getContentPane().add(buttonPane, BorderLayout.SOUTH);
163 			{
164 				JButton okButton = new JButton("OK");
165 				okButton.setActionCommand("OK");
166 				buttonPane.add(okButton);
167 				getRootPane().setDefaultButton(okButton);
168 			}
169 			{
170 				JButton cancelButton = new JButton("Cancel");
171 				cancelButton.setActionCommand("Cancel");
172 				buttonPane.add(cancelButton);
173 			}
174 		}
175 	}
176 
177 }