// Path: desktop-reader/src/main/java/net/vhati/openuhs/desktopreader/RegexDocument.java
// public class RegexDocument extends PlainDocument {
// 	private boolean dontCheck = false;
// 	private Pattern p = null;
// 
// 
// 	public RegexDocument( String regex ) {
// 		if ( regex == null || regex.length() == 0 ) dontCheck = true;
// 
// 		try {
// 			p = Pattern.compile( regex );
// 		}
// 		catch ( PatternSyntaxException e ) {
// 			dontCheck = true;
// 		}
// 	}
// 
// 	public RegexDocument() {
// 		dontCheck = true;
// 	}
// 
// 
// 	@Override
// 	public void insertString( int offs, String str, AttributeSet a ) throws BadLocationException {
// 		if ( str == null ) return;
// 
// 		boolean proceed = true;
// 
// 		if ( dontCheck == false ) {
// 			String tmp = super.getText( 0, offs ) + str + (( super.getLength() > offs ) ? super.getText( offs,super.getLength()-offs ) : "");
// 			Matcher m = p.matcher( tmp );
// 			proceed = m.matches();
// 		}
// 
// 		if ( proceed == true ) super.insertString( offs, str, a );
// 	}
// 
// 
// 	@Override
// 	public void remove( int offs, int len ) throws BadLocationException {
// 		boolean proceed = true;
// 
// 		if ( dontCheck == false ) {
// 			try {
// 				String tmp = super.getText( 0, offs ) + (( super.getLength() > (offs+len) ) ? super.getText( offs+len, super.getLength()-(offs+len) ) : "");
// 				Matcher m = p.matcher( tmp );
// 				proceed = m.matches();
// 			}
// 			catch ( BadLocationException e ) {
// 			}
// 		}
// 
// 		if ( proceed == true ) super.remove( offs, len );
// 	}
// }


import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.HashMap;
import java.util.Map;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.vhati.openuhs.desktopreader.RegexDocument;
			gridC.anchor = GridBagConstraints.WEST;
			JTextArea valueArea = new JTextArea();
			valueArea.setBackground( null );
			valueArea.setEditable( false );
			valueArea.setBorder( null );
			valueArea.setLineWrap( true );
			valueArea.setWrapStyleWord( true );
			valueArea.setFocusable( false );
			valueArea.setFont( UIManager.getFont( "Label.font" ) );

			wrappedLabelMap.put( valueName, valueArea );
			this.add( valueArea, gridC );
		}
		else if ( contentType == ContentType.LABEL ) {
			gridC.anchor = GridBagConstraints.WEST;
			JLabel valueLbl = new JLabel();
			valueLbl.setHorizontalAlignment( SwingConstants.CENTER );
			labelMap.put( valueName, valueLbl );
			this.add( valueLbl, gridC );
		}
		else if ( contentType == ContentType.STRING ) {
			gridC.anchor = GridBagConstraints.WEST;
			JTextField valueField = new JTextField();
			stringMap.put( valueName, valueField );
			this.add( valueField, gridC );
		}
		else if ( contentType == ContentType.INTEGER ) {
			gridC.anchor = GridBagConstraints.WEST;
			JTextField valueField = new JTextField();
			valueField.setHorizontalAlignment( JTextField.RIGHT );
// Path: desktop-reader/src/main/java/net/vhati/openuhs/desktopreader/RegexDocument.java
// public class RegexDocument extends PlainDocument {
// 	private boolean dontCheck = false;
// 	private Pattern p = null;
// 
// 
// 	public RegexDocument( String regex ) {
// 		if ( regex == null || regex.length() == 0 ) dontCheck = true;
// 
// 		try {
// 			p = Pattern.compile( regex );
// 		}
// 		catch ( PatternSyntaxException e ) {
// 			dontCheck = true;
// 		}
// 	}
// 
// 	public RegexDocument() {
// 		dontCheck = true;
// 	}
// 
// 
// 	@Override
// 	public void insertString( int offs, String str, AttributeSet a ) throws BadLocationException {
// 		if ( str == null ) return;
// 
// 		boolean proceed = true;
// 
// 		if ( dontCheck == false ) {
// 			String tmp = super.getText( 0, offs ) + str + (( super.getLength() > offs ) ? super.getText( offs,super.getLength()-offs ) : "");
// 			Matcher m = p.matcher( tmp );
// 			proceed = m.matches();
// 		}
// 
// 		if ( proceed == true ) super.insertString( offs, str, a );
// 	}
// 
// 
// 	@Override
// 	public void remove( int offs, int len ) throws BadLocationException {
// 		boolean proceed = true;
// 
// 		if ( dontCheck == false ) {
// 			try {
// 				String tmp = super.getText( 0, offs ) + (( super.getLength() > (offs+len) ) ? super.getText( offs+len, super.getLength()-(offs+len) ) : "");
// 				Matcher m = p.matcher( tmp );
// 				proceed = m.matches();
// 			}
// 			catch ( BadLocationException e ) {
// 			}
// 		}
// 
// 		if ( proceed == true ) super.remove( offs, len );
// 	}
// }


// Path: desktop-reader/src/main/java/net/vhati/openuhs/desktopreader/FieldEditorPanel.java
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.HashMap;
import java.util.Map;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.vhati.openuhs.desktopreader.RegexDocument;

			gridC.anchor = GridBagConstraints.WEST;
			JTextArea valueArea = new JTextArea();
			valueArea.setBackground( null );
			valueArea.setEditable( false );
			valueArea.setBorder( null );
			valueArea.setLineWrap( true );
			valueArea.setWrapStyleWord( true );
			valueArea.setFocusable( false );
			valueArea.setFont( UIManager.getFont( "Label.font" ) );

			wrappedLabelMap.put( valueName, valueArea );
			this.add( valueArea, gridC );
		}
		else if ( contentType == ContentType.LABEL ) {
			gridC.anchor = GridBagConstraints.WEST;
			JLabel valueLbl = new JLabel();
			valueLbl.setHorizontalAlignment( SwingConstants.CENTER );
			labelMap.put( valueName, valueLbl );
			this.add( valueLbl, gridC );
		}
		else if ( contentType == ContentType.STRING ) {
			gridC.anchor = GridBagConstraints.WEST;
			JTextField valueField = new JTextField();
			stringMap.put( valueName, valueField );
			this.add( valueField, gridC );
		}
		else if ( contentType == ContentType.INTEGER ) {
			gridC.anchor = GridBagConstraints.WEST;
			JTextField valueField = new JTextField();
			valueField.setHorizontalAlignment( JTextField.RIGHT );
			valueField.setDocument( new RegexDocument( "[0-9]*" ) );