/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * KarteSettingPanel.java
 *
 * Created on 2010/03/10, 15:36:06
 */
package open.dolphin.client.settings;

import open.dolphin.project.GlobalConstants;
import open.dolphin.container.NameValuePair;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.beans.EventHandler;
import java.io.File;
import java.util.prefs.Preferences;

import javax.swing.JFileChooser;
import javax.swing.JSpinner;
import javax.swing.SpinnerModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import open.dolphin.log.LogWriter;
import open.dolphin.project.GlobalVariables;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;

import open.dolphin.client.AutoKanjiListener;
import open.dolphin.client.AutoRomanListener;
import open.dolphin.utils.Adapter;
import open.dolphin.utils.StringTool;

/**
* カルテ設定画面　MEMO:画面
 * @author
 */
public class KarteSettingPanel extends javax.swing.JPanel implements IAbstractSettingPanel {

    private ProjectSettingDialog context;
    private PropertyChangeSupport boundSupport;
    /**
     * 
     */
    protected State state = State.NONE_STATE;
    private boolean loginState;
    private String title;
    private String icon;
    private String id;
    private static final String ID = "karteSetting";
    private static final String TITLE = "カルテ";
    private static final String ICON = "hist_24.gif";
    private Preferences prefs;
    // デフォルト値
    //  private boolean defaultLocator;
    private boolean defaultShowModified;
    private boolean defaultShowUnsend;
    private boolean defaultShowSend;
    private boolean defaultNewestSend;
    private int defaultFetchCount;
    private int minFetchCount;
    private int maxFetchCount;
    private int stepFetchCount;
    private boolean defaultScDirection;
    private int defaultPeriod;
    private boolean defaultKarteAsc;
    private boolean defaultDiagnosisAsc;
    private int defaultDiagnosisPeriod;
    private boolean defaultAutoOutcomeInput;
    private int defaultOffsetOutcomeDate;
    private int defaultLaboTestPeriod;
    private NameValuePair[] periodObjects;    // インスペクタ画面
    private NameValuePair[] diagnosisPeriodObjects;    // 病名関係
    private NameValuePair[] laboTestPeriodObjects;    // 検体検査
    private KarteModel model;
    private boolean ok = true;
    private Adapter<Boolean, Boolean> adapter;

    /** 
     * Creates new form KarteSettingPanel
     */
    public KarteSettingPanel() {
        boundSupport = new PropertyChangeSupport(this);
        initComponents();
        this.setId(ID);
        this.setTitle(TITLE);
        this.setIcon(ICON);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bg1 = new javax.swing.ButtonGroup();
        bg2 = new javax.swing.ButtonGroup();
        bg3 = new javax.swing.ButtonGroup();
        bg4 = new javax.swing.ButtonGroup();
        bg5 = new javax.swing.ButtonGroup();
        bg6 = new javax.swing.ButtonGroup();
        bg7 = new javax.swing.ButtonGroup();
        bg8 = new javax.swing.ButtonGroup();
        bg9 = new javax.swing.ButtonGroup();
        bg10 = new javax.swing.ButtonGroup();
        bg11 = new javax.swing.ButtonGroup();
        laboPanel = new javax.swing.JPanel();
        label16 = new javax.swing.JLabel();
        laboTestPeriodCombo = new javax.swing.JComboBox();
        karteAscDescGroup = new javax.swing.ButtonGroup();
        tabbedPane = new javax.swing.JTabbedPane();
        inspectorPanel = new javax.swing.JPanel();
        pdfP = new javax.swing.JPanel();
        pdfPanel = new javax.swing.JPanel();
        label7 = new javax.swing.JLabel();
        pdfStore = new javax.swing.JTextField();
        pdfDir = new javax.swing.JButton();
        docPanel = new javax.swing.JPanel();
        kartePanel = new javax.swing.JPanel();
        fetchCount = new javax.swing.JPanel();
        spinner = new javax.swing.JSpinner();
        label9 = new javax.swing.JLabel();
        scrP = new javax.swing.JPanel();
        vSc = new javax.swing.JRadioButton();
        hSc = new javax.swing.JRadioButton();
        label10 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        label8 = new javax.swing.JLabel();
        showModifiedCB = new javax.swing.JCheckBox();
        showUnsendCB = new javax.swing.JCheckBox();
        showSendCB = new javax.swing.JCheckBox();
        showNewestCB = new javax.swing.JCheckBox();
        jPanel2 = new javax.swing.JPanel();
        periodCombo = new javax.swing.JComboBox();
        label11 = new javax.swing.JLabel();
        karteAscDesc = new javax.swing.JPanel();
        karteAsc = new javax.swing.JRadioButton();
        label23 = new javax.swing.JLabel();
        karteDesc = new javax.swing.JRadioButton();
        diagnosisPanel = new javax.swing.JPanel();
        label13 = new javax.swing.JLabel();
        diagAscDesc = new javax.swing.JPanel();
        diagnosisAsc = new javax.swing.JRadioButton();
        diagnosisDesc = new javax.swing.JRadioButton();
        label12 = new javax.swing.JLabel();
        label14 = new javax.swing.JLabel();
        autoOutcomeInput = new javax.swing.JCheckBox();
        outcomeSpinner = new javax.swing.JSpinner();
        label15 = new javax.swing.JLabel();
        diagnosisPeriodCombo = new javax.swing.JComboBox();
        cmd = new javax.swing.JPanel();
        restoreDefaultBtn = new javax.swing.JButton();
        stampPanel = new javax.swing.JPanel();
        stampAction = new javax.swing.JPanel();
        stmpP = new javax.swing.JPanel();
        label17 = new javax.swing.JLabel();
        replaceStamp = new javax.swing.JRadioButton();
        showAlert = new javax.swing.JRadioButton();
        stampSpace = new javax.swing.JCheckBox();
        laboFold = new javax.swing.JCheckBox();
        stampDefault = new javax.swing.JPanel();
        p21 = new javax.swing.JPanel();
        label18 = new javax.swing.JLabel();
        defaultZyozaiNum = new javax.swing.JTextField();
        label41 = new javax.swing.JLabel();
        p22 = new javax.swing.JPanel();
        label19 = new javax.swing.JLabel();
        defaultMizuyakuNum = new javax.swing.JTextField();
        label42 = new javax.swing.JLabel();
        p23 = new javax.swing.JPanel();
        label20 = new javax.swing.JLabel();
        defaultSanyakuNum = new javax.swing.JTextField();
        label43 = new javax.swing.JLabel();
        p24 = new javax.swing.JPanel();
        label21 = new javax.swing.JLabel();
        defaultRpNum = new javax.swing.JTextField();
        label44 = new javax.swing.JLabel();
        sendPanel = new javax.swing.JPanel();
        karteTitle = new javax.swing.JPanel();
        useTop15AsTitle = new javax.swing.JCheckBox();
        label22 = new javax.swing.JLabel();
        defaultKarteTitle = new javax.swing.JTextField();
        sendDefault = new javax.swing.JPanel();
        p12 = new javax.swing.JPanel();
        label26 = new javax.swing.JLabel();
        sendDiagnosis = new javax.swing.JRadioButton();
        noSendDiagnosis = new javax.swing.JRadioButton();
        confirmPanel = new javax.swing.JPanel();
        newKarte = new javax.swing.JPanel();
        noConfirmAtNew = new javax.swing.JCheckBox();
        p = new javax.swing.JPanel();
        label27 = new javax.swing.JLabel();
        applyRp = new javax.swing.JRadioButton();
        copyNew = new javax.swing.JRadioButton();
        emptyNew = new javax.swing.JRadioButton();
        p2 = new javax.swing.JPanel();
        label28 = new javax.swing.JLabel();
        placeWindow = new javax.swing.JRadioButton();
        palceTabbedPane = new javax.swing.JRadioButton();
        label29 = new javax.swing.JLabel();
        isHospitalCheckBox = new javax.swing.JCheckBox();
        saveKarte = new javax.swing.JPanel();
        noConfirmAtSave = new javax.swing.JCheckBox();
        printCount = new javax.swing.JFormattedTextField();
        p4 = new javax.swing.JPanel();
        label31 = new javax.swing.JLabel();
        save = new javax.swing.JRadioButton();
        saveTmp = new javax.swing.JRadioButton();
        label30 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        Label1 = new javax.swing.JLabel();
        GreetingsEdit = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        fepControlCheckbox = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();

        laboPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("ラボテスト"));
        laboPanel.setName("laboPanel"); // NOI18N
        laboPanel.setLayout(new java.awt.BorderLayout());

        label16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label16.setText("抽出期間:");
        label16.setName("label16"); // NOI18N
        laboPanel.add(label16, java.awt.BorderLayout.CENTER);

        laboTestPeriodCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        laboTestPeriodCombo.setName("laboTestPeriodCombo"); // NOI18N
        laboPanel.add(laboTestPeriodCombo, java.awt.BorderLayout.PAGE_START);

        setLayout(new java.awt.BorderLayout());

        tabbedPane.setName("tabbedPane"); // NOI18N
        tabbedPane.setPreferredSize(new java.awt.Dimension(600, 400));

        inspectorPanel.setName("inspectorPanel"); // NOI18N

        pdfP.setBorder(javax.swing.BorderFactory.createTitledBorder("紹介状等PDFの出力先"));
        pdfP.setName("pdfP"); // NOI18N

        pdfPanel.setName("pdfPanel"); // NOI18N
        pdfPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label7.setText("出力先:");
        label7.setName("label7"); // NOI18N
        pdfPanel.add(label7);

        pdfStore.setColumns(15);
        pdfStore.setName("pdfStore"); // NOI18N
        pdfStore.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });
        pdfPanel.add(pdfStore);

        pdfDir.setText("設定");
        pdfDir.setName("pdfDir"); // NOI18N
        pdfPanel.add(pdfDir);

        javax.swing.GroupLayout pdfPLayout = new javax.swing.GroupLayout(pdfP);
        pdfP.setLayout(pdfPLayout);
        pdfPLayout.setHorizontalGroup(
            pdfPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pdfPLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(pdfPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 418, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(231, Short.MAX_VALUE))
        );
        pdfPLayout.setVerticalGroup(
            pdfPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pdfPLayout.createSequentialGroup()
                .addComponent(pdfPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout inspectorPanelLayout = new javax.swing.GroupLayout(inspectorPanel);
        inspectorPanel.setLayout(inspectorPanelLayout);
        inspectorPanelLayout.setHorizontalGroup(
            inspectorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(inspectorPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pdfP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        inspectorPanelLayout.setVerticalGroup(
            inspectorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(inspectorPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pdfP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(449, Short.MAX_VALUE))
        );

        tabbedPane.addTab("インスペクタ", inspectorPanel);

        docPanel.setName("docPanel"); // NOI18N
        docPanel.setPreferredSize(new java.awt.Dimension(680, 400));

        kartePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("カルテ"));
        kartePanel.setName("kartePanel"); // NOI18N

        fetchCount.setName("fetchCount"); // NOI18N

        spinner.setName("spinner"); // NOI18N
        spinner.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label9.setText("自動文書取得数:");
        label9.setName("label9"); // NOI18N

        javax.swing.GroupLayout fetchCountLayout = new javax.swing.GroupLayout(fetchCount);
        fetchCount.setLayout(fetchCountLayout);
        fetchCountLayout.setHorizontalGroup(
            fetchCountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fetchCountLayout.createSequentialGroup()
                .addComponent(label9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        fetchCountLayout.setVerticalGroup(
            fetchCountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fetchCountLayout.createSequentialGroup()
                .addGroup(fetchCountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label9)
                    .addComponent(spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        scrP.setName("scrP"); // NOI18N

        bg3.add(vSc);
        vSc.setText("垂直");
        vSc.setName("vSc"); // NOI18N
        vSc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        bg3.add(hSc);
        hSc.setText("水平");
        hSc.setName("hSc"); // NOI18N
        hSc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label10.setText("スクロール方向:");
        label10.setName("label10"); // NOI18N

        javax.swing.GroupLayout scrPLayout = new javax.swing.GroupLayout(scrP);
        scrP.setLayout(scrPLayout);
        scrPLayout.setHorizontalGroup(
            scrPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(scrPLayout.createSequentialGroup()
                .addComponent(label10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(vSc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                .addComponent(hSc)
                .addContainerGap())
        );
        scrPLayout.setVerticalGroup(
            scrPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(scrPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(vSc)
                .addComponent(hSc)
                .addComponent(label10, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel1.setName("jPanel1"); // NOI18N

        label8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label8.setText("文書履歴:");
        label8.setName("label8"); // NOI18N

        showModifiedCB.setText("修正履歴表示");
        showModifiedCB.setName("showModifiedCB"); // NOI18N
        showModifiedCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        showUnsendCB.setText("未送信履歴表示");
        showUnsendCB.setName("showUnsendCB"); // NOI18N
        showUnsendCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        showSendCB.setText("送信履歴表示");
        showSendCB.setName("showSendCB"); // NOI18N
        showSendCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showSendCBActionPerformed(evt);
            }
        });
        showSendCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        showNewestCB.setText("最新カルテ表示");
        showNewestCB.setName("showNewestCB"); // NOI18N
        showNewestCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(label8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(showModifiedCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(showUnsendCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(showSendCB, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(showNewestCB)
                .addContainerGap(51, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label8)
                    .addComponent(showModifiedCB)
                    .addComponent(showUnsendCB)
                    .addComponent(showSendCB)
                    .addComponent(showNewestCB))
                .addContainerGap())
        );

        jPanel2.setName("jPanel2"); // NOI18N

        periodCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        periodCombo.setName("periodCombo"); // NOI18N
        periodCombo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label11.setText("文書抽出期間:");
        label11.setName("label11"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(label11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(periodCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label11)
                    .addComponent(periodCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        karteAscDesc.setName("karteAscDesc"); // NOI18N
        karteAscDesc.setPreferredSize(new java.awt.Dimension(176, 30));
        karteAscDesc.setRequestFocusEnabled(false);

        karteAscDescGroup.add(karteAsc);
        karteAsc.setText("昇順");
        karteAsc.setName("karteAsc"); // NOI18N
        karteAsc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label23.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label23.setText("表示順:");
        label23.setName("label23"); // NOI18N

        karteAscDescGroup.add(karteDesc);
        karteDesc.setText("降順");
        karteDesc.setName("karteDesc"); // NOI18N
        karteDesc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        javax.swing.GroupLayout karteAscDescLayout = new javax.swing.GroupLayout(karteAscDesc);
        karteAscDesc.setLayout(karteAscDescLayout);
        karteAscDescLayout.setHorizontalGroup(
            karteAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, karteAscDescLayout.createSequentialGroup()
                .addComponent(label23, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(karteAsc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(karteDesc)
                .addContainerGap())
        );
        karteAscDescLayout.setVerticalGroup(
            karteAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(karteAscDescLayout.createSequentialGroup()
                .addContainerGap(13, Short.MAX_VALUE)
                .addGroup(karteAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label23)
                    .addComponent(karteAsc)
                    .addComponent(karteDesc)))
        );

        javax.swing.GroupLayout kartePanelLayout = new javax.swing.GroupLayout(kartePanel);
        kartePanel.setLayout(kartePanelLayout);
        kartePanelLayout.setHorizontalGroup(
            kartePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kartePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kartePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(kartePanelLayout.createSequentialGroup()
                        .addComponent(karteAscDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(scrP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(kartePanelLayout.createSequentialGroup()
                        .addComponent(fetchCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(94, Short.MAX_VALUE))
        );
        kartePanelLayout.setVerticalGroup(
            kartePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, kartePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(kartePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(fetchCount, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(kartePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(karteAscDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(scrP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        diagnosisPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("傷病名"));
        diagnosisPanel.setName("diagnosisPanel"); // NOI18N

        label13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label13.setText("抽出期間:");
        label13.setName("label13"); // NOI18N

        diagAscDesc.setName("diagAscDesc"); // NOI18N

        bg1.add(diagnosisAsc);
        diagnosisAsc.setText("昇順");
        diagnosisAsc.setName("diagnosisAsc"); // NOI18N
        diagnosisAsc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        bg1.add(diagnosisDesc);
        diagnosisDesc.setText("降順");
        diagnosisDesc.setName("diagnosisDesc"); // NOI18N
        diagnosisDesc.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label12.setText("表示順:");
        label12.setName("label12"); // NOI18N

        javax.swing.GroupLayout diagAscDescLayout = new javax.swing.GroupLayout(diagAscDesc);
        diagAscDesc.setLayout(diagAscDescLayout);
        diagAscDescLayout.setHorizontalGroup(
            diagAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(diagAscDescLayout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addComponent(label12)
                .addGap(4, 4, 4)
                .addComponent(diagnosisAsc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(diagnosisDesc)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        diagAscDescLayout.setVerticalGroup(
            diagAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(diagAscDescLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(diagAscDescLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label12)
                    .addComponent(diagnosisAsc)
                    .addComponent(diagnosisDesc))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        label14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label14.setText("転帰入力時:");
        label14.setName("label14"); // NOI18N

        autoOutcomeInput.setText("終了日を自動入力する");
        autoOutcomeInput.setName("autoOutcomeInput"); // NOI18N
        autoOutcomeInput.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        outcomeSpinner.setName("outcomeSpinner"); // NOI18N
        outcomeSpinner.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        label15.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label15.setText("入力する日(前):");
        label15.setName("label15"); // NOI18N

        diagnosisPeriodCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        diagnosisPeriodCombo.setName("diagnosisPeriodCombo"); // NOI18N
        diagnosisPeriodCombo.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                KarteSettingPanel.this.propertyChange(evt);
            }
        });

        javax.swing.GroupLayout diagnosisPanelLayout = new javax.swing.GroupLayout(diagnosisPanel);
        diagnosisPanel.setLayout(diagnosisPanelLayout);
        diagnosisPanelLayout.setHorizontalGroup(
            diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(diagnosisPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(diagnosisPanelLayout.createSequentialGroup()
                        .addComponent(label14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(autoOutcomeInput)
                        .addGap(28, 28, 28)
                        .addComponent(label15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(outcomeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(diagnosisPanelLayout.createSequentialGroup()
                        .addComponent(diagAscDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(label13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(diagnosisPeriodCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(297, Short.MAX_VALUE))
        );
        diagnosisPanelLayout.setVerticalGroup(
            diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(diagnosisPanelLayout.createSequentialGroup()
                .addGroup(diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(diagAscDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(diagnosisPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(label13)
                            .addComponent(diagnosisPeriodCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(diagnosisPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label14, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(autoOutcomeInput)
                    .addComponent(label15)
                    .addComponent(outcomeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        cmd.setName("cmd"); // NOI18N

        javax.swing.GroupLayout cmdLayout = new javax.swing.GroupLayout(cmd);
        cmd.setLayout(cmdLayout);
        cmdLayout.setHorizontalGroup(
            cmdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 549, Short.MAX_VALUE)
        );
        cmdLayout.setVerticalGroup(
            cmdLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 42, Short.MAX_VALUE)
        );

        restoreDefaultBtn.setText("デフォルト設定に戻す");
        restoreDefaultBtn.setName("restoreDefaultBtn"); // NOI18N

        javax.swing.GroupLayout docPanelLayout = new javax.swing.GroupLayout(docPanel);
        docPanel.setLayout(docPanelLayout);
        docPanelLayout.setHorizontalGroup(
            docPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(docPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(docPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(kartePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(docPanelLayout.createSequentialGroup()
                        .addComponent(restoreDefaultBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cmd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(diagnosisPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        docPanelLayout.setVerticalGroup(
            docPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(docPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(kartePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(diagnosisPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(docPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(restoreDefaultBtn)
                    .addComponent(cmd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(211, 211, 211))
        );

        tabbedPane.addTab("文 書", docPanel);

        stampPanel.setName("stampPanel"); // NOI18N

        stampAction.setBorder(javax.swing.BorderFactory.createTitledBorder("スタンプ動作の設定"));
        stampAction.setName("stampAction"); // NOI18N

        stmpP.setName("stmpP"); // NOI18N
        stmpP.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label17.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label17.setText("スタンプの上にDnDした場合:");
        label17.setName("label17"); // NOI18N
        stmpP.add(label17);

        bg4.add(replaceStamp);
        replaceStamp.setText("置き換える");
        replaceStamp.setName("replaceStamp"); // NOI18N
        stmpP.add(replaceStamp);

        bg4.add(showAlert);
        showAlert.setText("警告する");
        showAlert.setName("showAlert"); // NOI18N
        stmpP.add(showAlert);

        stampSpace.setText("DnD時にスタンプの間隔を空ける");
        stampSpace.setName("stampSpace"); // NOI18N

        laboFold.setText("検体検査の項目を折りたたみ表示する");
        laboFold.setName("laboFold"); // NOI18N

        javax.swing.GroupLayout stampActionLayout = new javax.swing.GroupLayout(stampAction);
        stampAction.setLayout(stampActionLayout);
        stampActionLayout.setHorizontalGroup(
            stampActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stampActionLayout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(stampActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(laboFold)
                    .addComponent(stampSpace)
                    .addComponent(stmpP, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(190, Short.MAX_VALUE))
        );
        stampActionLayout.setVerticalGroup(
            stampActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stampActionLayout.createSequentialGroup()
                .addComponent(stmpP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(stampSpace)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(laboFold)
                .addContainerGap())
        );

        stampDefault.setBorder(javax.swing.BorderFactory.createTitledBorder("スタンプエディタのデフォルト数量"));
        stampDefault.setName("stampDefault"); // NOI18N

        p21.setName("p21"); // NOI18N
        p21.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 7));

        label18.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label18.setText("錠剤の場合:");
        label18.setName("label18"); // NOI18N
        p21.add(label18);

        defaultZyozaiNum.setColumns(3);
        defaultZyozaiNum.setName("defaultZyozaiNum"); // NOI18N
        p21.add(defaultZyozaiNum);

        label41.setText("T");
        label41.setName("label41"); // NOI18N
        p21.add(label41);

        p22.setName("p22"); // NOI18N
        p22.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 7));

        label19.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label19.setText("水薬の場合:");
        label19.setName("label19"); // NOI18N
        p22.add(label19);

        defaultMizuyakuNum.setColumns(3);
        defaultMizuyakuNum.setName("defaultMizuyakuNum"); // NOI18N
        p22.add(defaultMizuyakuNum);

        label42.setText("ml");
        label42.setName("label42"); // NOI18N
        p22.add(label42);

        p23.setName("p23"); // NOI18N
        p23.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 7));

        label20.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label20.setText("散薬の場合:");
        label20.setName("label20"); // NOI18N
        p23.add(label20);

        defaultSanyakuNum.setColumns(3);
        defaultSanyakuNum.setName("defaultSanyakuNum"); // NOI18N
        p23.add(defaultSanyakuNum);

        label43.setText("g");
        label43.setName("label43"); // NOI18N
        p23.add(label43);

        p24.setName("p24"); // NOI18N
        p24.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 7));

        label21.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label21.setText("処方日数:");
        label21.setName("label21"); // NOI18N
        p24.add(label21);

        defaultRpNum.setColumns(3);
        defaultRpNum.setName("defaultRpNum"); // NOI18N
        p24.add(defaultRpNum);

        label44.setText("日/回");
        label44.setName("label44"); // NOI18N
        p24.add(label44);

        javax.swing.GroupLayout stampDefaultLayout = new javax.swing.GroupLayout(stampDefault);
        stampDefault.setLayout(stampDefaultLayout);
        stampDefaultLayout.setHorizontalGroup(
            stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stampDefaultLayout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p22, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p23, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(308, 308, 308))
        );
        stampDefaultLayout.setVerticalGroup(
            stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, stampDefaultLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(p21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(stampDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(78, 78, 78))
        );

        javax.swing.GroupLayout stampPanelLayout = new javax.swing.GroupLayout(stampPanel);
        stampPanel.setLayout(stampPanelLayout);
        stampPanelLayout.setHorizontalGroup(
            stampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stampPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(stampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(stampAction, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(stampDefault, javax.swing.GroupLayout.DEFAULT_SIZE, 687, Short.MAX_VALUE))
                .addContainerGap())
        );
        stampPanelLayout.setVerticalGroup(
            stampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stampPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(stampAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(stampDefault, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(269, 269, 269))
        );

        tabbedPane.addTab("スタンプ", stampPanel);

        sendPanel.setName("sendPanel"); // NOI18N

        karteTitle.setBorder(javax.swing.BorderFactory.createTitledBorder("カルテの保存時に設定するタイトル"));
        karteTitle.setName("karteTitle"); // NOI18N

        useTop15AsTitle.setText("カルテの先頭15文字を使用する");
        useTop15AsTitle.setName("useTop15AsTitle"); // NOI18N

        label22.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label22.setText("デフォルトのタイトル:");
        label22.setName("label22"); // NOI18N

        defaultKarteTitle.setColumns(10);
        defaultKarteTitle.setName("defaultKarteTitle"); // NOI18N

        javax.swing.GroupLayout karteTitleLayout = new javax.swing.GroupLayout(karteTitle);
        karteTitle.setLayout(karteTitleLayout);
        karteTitleLayout.setHorizontalGroup(
            karteTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(karteTitleLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(karteTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(useTop15AsTitle)
                    .addGroup(karteTitleLayout.createSequentialGroup()
                        .addComponent(label22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(defaultKarteTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(419, Short.MAX_VALUE))
        );
        karteTitleLayout.setVerticalGroup(
            karteTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(karteTitleLayout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addComponent(useTop15AsTitle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(karteTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label22)
                    .addComponent(defaultKarteTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        sendDefault.setBorder(javax.swing.BorderFactory.createTitledBorder("診療行為送信のデフォルト設定"));
        sendDefault.setName("sendDefault"); // NOI18N

        p12.setName("p12"); // NOI18N
        p12.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label26.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label26.setText("傷病名:");
        label26.setName("label26"); // NOI18N
        p12.add(label26);

        bg10.add(sendDiagnosis);
        sendDiagnosis.setText("送信する");
        sendDiagnosis.setName("sendDiagnosis"); // NOI18N
        p12.add(sendDiagnosis);

        bg10.add(noSendDiagnosis);
        noSendDiagnosis.setText("送信しない");
        noSendDiagnosis.setName("noSendDiagnosis"); // NOI18N
        p12.add(noSendDiagnosis);

        javax.swing.GroupLayout sendDefaultLayout = new javax.swing.GroupLayout(sendDefault);
        sendDefault.setLayout(sendDefaultLayout);
        sendDefaultLayout.setHorizontalGroup(
            sendDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sendDefaultLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(p12, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                .addGap(429, 429, 429))
        );
        sendDefaultLayout.setVerticalGroup(
            sendDefaultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sendDefaultLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(p12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout sendPanelLayout = new javax.swing.GroupLayout(sendPanel);
        sendPanel.setLayout(sendPanelLayout);
        sendPanelLayout.setHorizontalGroup(
            sendPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sendPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(sendPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(karteTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sendDefault, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        sendPanelLayout.setVerticalGroup(
            sendPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sendPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(karteTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sendDefault, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(335, Short.MAX_VALUE))
        );

        tabbedPane.addTab("診療行為", sendPanel);

        confirmPanel.setName("confirmPanel"); // NOI18N

        newKarte.setBorder(javax.swing.BorderFactory.createTitledBorder("新規カルテ作成時"));
        newKarte.setName("newKarte"); // NOI18N

        noConfirmAtNew.setText("確認ダイアログを表示しない");
        noConfirmAtNew.setName("noConfirmAtNew"); // NOI18N
        noConfirmAtNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noConfirmAtNewActionPerformed(evt);
            }
        });

        p.setName("p"); // NOI18N
        p.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label27.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label27.setText("作成方法:");
        label27.setName("label27"); // NOI18N
        p.add(label27);

        bg5.add(applyRp);
        applyRp.setText("前回処方を適用");
        applyRp.setName("applyRp"); // NOI18N
        p.add(applyRp);

        bg5.add(copyNew);
        copyNew.setText("全てコピー");
        copyNew.setName("copyNew"); // NOI18N
        p.add(copyNew);

        bg5.add(emptyNew);
        emptyNew.setText("空白の新規カルテ");
        emptyNew.setName("emptyNew"); // NOI18N
        p.add(emptyNew);

        p2.setName("p2"); // NOI18N
        p2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label28.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label28.setText("配置方法:");
        label28.setName("label28"); // NOI18N
        p2.add(label28);

        bg6.add(placeWindow);
        placeWindow.setText("別ウィンドウで編集");
        placeWindow.setName("placeWindow"); // NOI18N
        p2.add(placeWindow);

        bg6.add(palceTabbedPane);
        palceTabbedPane.setText("タブパネルへ追加");
        palceTabbedPane.setName("palceTabbedPane"); // NOI18N
        palceTabbedPane.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                palceTabbedPaneActionPerformed(evt);
            }
        });
        p2.add(palceTabbedPane);

        label29.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label29.setText("診療種別:");
        label29.setName("label29"); // NOI18N

        isHospitalCheckBox.setText("入院");
        isHospitalCheckBox.setName("isHospitalCheckBox"); // NOI18N

        javax.swing.GroupLayout newKarteLayout = new javax.swing.GroupLayout(newKarte);
        newKarte.setLayout(newKarteLayout);
        newKarteLayout.setHorizontalGroup(
            newKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newKarteLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(newKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(p, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                    .addComponent(noConfirmAtNew)
                    .addGroup(newKarteLayout.createSequentialGroup()
                        .addComponent(label29)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(isHospitalCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(p2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(301, Short.MAX_VALUE))
        );
        newKarteLayout.setVerticalGroup(
            newKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newKarteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(noConfirmAtNew)
                .addGap(18, 18, 18)
                .addComponent(p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(p2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(newKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(label29)
                    .addComponent(isHospitalCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11))
        );

        saveKarte.setBorder(javax.swing.BorderFactory.createTitledBorder("カルテ保存時"));
        saveKarte.setName("saveKarte"); // NOI18N

        noConfirmAtSave.setText("確認ダイアログを表示しない");
        noConfirmAtSave.setName("noConfirmAtSave"); // NOI18N
        noConfirmAtSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noConfirmAtSaveActionPerformed(evt);
            }
        });

        printCount.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        printCount.setName("printCount"); // NOI18N

        p4.setName("p4"); // NOI18N
        p4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 5));

        label31.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label31.setText("動 作:");
        label31.setName("label31"); // NOI18N
        p4.add(label31);

        bg11.add(save);
        save.setText("保 存");
        save.setName("save"); // NOI18N
        p4.add(save);

        bg11.add(saveTmp);
        saveTmp.setText("仮保存");
        saveTmp.setName("saveTmp"); // NOI18N
        p4.add(saveTmp);

        label30.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        label30.setText("印刷枚数:");
        label30.setName("label30"); // NOI18N

        javax.swing.GroupLayout saveKarteLayout = new javax.swing.GroupLayout(saveKarte);
        saveKarte.setLayout(saveKarteLayout);
        saveKarteLayout.setHorizontalGroup(
            saveKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(saveKarteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(noConfirmAtSave)
                .addGap(24, 24, 24)
                .addComponent(label30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(printCount, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(p4, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                .addGap(164, 164, 164))
        );
        saveKarteLayout.setVerticalGroup(
            saveKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(saveKarteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(saveKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(saveKarteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(noConfirmAtSave, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(printCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(label30, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(p4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout confirmPanelLayout = new javax.swing.GroupLayout(confirmPanel);
        confirmPanel.setLayout(confirmPanelLayout);
        confirmPanelLayout.setHorizontalGroup(
            confirmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(confirmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(confirmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(newKarte, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(saveKarte, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        confirmPanelLayout.setVerticalGroup(
            confirmPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(confirmPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(newKarte, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(saveKarte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(237, Short.MAX_VALUE))
        );

        tabbedPane.addTab("確認ダイアログ", confirmPanel);

        jPanel3.setName("jPanel3"); // NOI18N

        Label1.setText("紹介状の頭書き");
        Label1.setName("Label1"); // NOI18N

        GreetingsEdit.setText("下記の患者さんを紹介致します。ご高診の程宜しくお願い申し上げます。");
        GreetingsEdit.setName("GreetingsEdit"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Label1)
                .addGap(18, 18, 18)
                .addComponent(GreetingsEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 502, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(100, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Label1)
                    .addComponent(GreetingsEdit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(500, Short.MAX_VALUE))
        );

        tabbedPane.addTab("紹介状", jPanel3);

        jPanel4.setName("jPanel4"); // NOI18N

        fepControlCheckbox.setText("漢字変換をコントロールする");
        fepControlCheckbox.setName("fepControlCheckbox"); // NOI18N

        jLabel1.setText("＊この設定をオンにした場合、OS、漢字変換の種類、組み合わせによっては不具合が発生することがあります。");
        jLabel1.setName("jLabel1"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(fepControlCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(177, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(fepControlCheckbox)
                .addGap(18, 18, 18)
                .addComponent(jLabel1)
                .addContainerGap(449, Short.MAX_VALUE))
        );

        tabbedPane.addTab("入力", jPanel4);

        add(tabbedPane, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    /**
     *
     * @param evt
     */
    private void noConfirmAtSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noConfirmAtSaveActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_noConfirmAtSaveActionPerformed
    /**
     *
     * @param evt
     */
    private void palceTabbedPaneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_palceTabbedPaneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_palceTabbedPaneActionPerformed
    /**
     *
     * @param evt
     */
    private void noConfirmAtNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noConfirmAtNewActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_noConfirmAtNewActionPerformed
    /**
     *
     * @param evt
     */
	private void showSendCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showSendCBActionPerformed
            // TODO add your handling code here:
	}//GEN-LAST:event_showSendCBActionPerformed
    /**
     *
     * @param evt
     */
        private void propertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_propertyChange
            change();
        }//GEN-LAST:event_propertyChange
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField GreetingsEdit;
    private javax.swing.JLabel Label1;
    private javax.swing.JRadioButton applyRp;
    private javax.swing.JCheckBox autoOutcomeInput;
    private javax.swing.ButtonGroup bg1;
    private javax.swing.ButtonGroup bg10;
    private javax.swing.ButtonGroup bg11;
    private javax.swing.ButtonGroup bg2;
    private javax.swing.ButtonGroup bg3;
    private javax.swing.ButtonGroup bg4;
    private javax.swing.ButtonGroup bg5;
    private javax.swing.ButtonGroup bg6;
    private javax.swing.ButtonGroup bg7;
    private javax.swing.ButtonGroup bg8;
    private javax.swing.ButtonGroup bg9;
    private javax.swing.JPanel cmd;
    private javax.swing.JPanel confirmPanel;
    private javax.swing.JRadioButton copyNew;
    private javax.swing.JTextField defaultKarteTitle;
    private javax.swing.JTextField defaultMizuyakuNum;
    private javax.swing.JTextField defaultRpNum;
    private javax.swing.JTextField defaultSanyakuNum;
    private javax.swing.JTextField defaultZyozaiNum;
    private javax.swing.JPanel diagAscDesc;
    private javax.swing.JRadioButton diagnosisAsc;
    private javax.swing.JRadioButton diagnosisDesc;
    private javax.swing.JPanel diagnosisPanel;
    private javax.swing.JComboBox diagnosisPeriodCombo;
    private javax.swing.JPanel docPanel;
    private javax.swing.JRadioButton emptyNew;
    private javax.swing.JCheckBox fepControlCheckbox;
    private javax.swing.JPanel fetchCount;
    private javax.swing.JRadioButton hSc;
    private javax.swing.JPanel inspectorPanel;
    private javax.swing.JCheckBox isHospitalCheckBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JRadioButton karteAsc;
    private javax.swing.JPanel karteAscDesc;
    private javax.swing.ButtonGroup karteAscDescGroup;
    private javax.swing.JRadioButton karteDesc;
    private javax.swing.JPanel kartePanel;
    private javax.swing.JPanel karteTitle;
    private javax.swing.JLabel label10;
    private javax.swing.JLabel label11;
    private javax.swing.JLabel label12;
    private javax.swing.JLabel label13;
    private javax.swing.JLabel label14;
    private javax.swing.JLabel label15;
    private javax.swing.JLabel label16;
    private javax.swing.JLabel label17;
    private javax.swing.JLabel label18;
    private javax.swing.JLabel label19;
    private javax.swing.JLabel label20;
    private javax.swing.JLabel label21;
    private javax.swing.JLabel label22;
    private javax.swing.JLabel label23;
    private javax.swing.JLabel label26;
    private javax.swing.JLabel label27;
    private javax.swing.JLabel label28;
    private javax.swing.JLabel label29;
    private javax.swing.JLabel label30;
    private javax.swing.JLabel label31;
    private javax.swing.JLabel label41;
    private javax.swing.JLabel label42;
    private javax.swing.JLabel label43;
    private javax.swing.JLabel label44;
    private javax.swing.JLabel label7;
    private javax.swing.JLabel label8;
    private javax.swing.JLabel label9;
    private javax.swing.JCheckBox laboFold;
    private javax.swing.JPanel laboPanel;
    private javax.swing.JComboBox laboTestPeriodCombo;
    private javax.swing.JPanel newKarte;
    private javax.swing.JCheckBox noConfirmAtNew;
    private javax.swing.JCheckBox noConfirmAtSave;
    private javax.swing.JRadioButton noSendDiagnosis;
    private javax.swing.JSpinner outcomeSpinner;
    private javax.swing.JPanel p;
    private javax.swing.JPanel p12;
    private javax.swing.JPanel p2;
    private javax.swing.JPanel p21;
    private javax.swing.JPanel p22;
    private javax.swing.JPanel p23;
    private javax.swing.JPanel p24;
    private javax.swing.JPanel p4;
    private javax.swing.JRadioButton palceTabbedPane;
    private javax.swing.JButton pdfDir;
    private javax.swing.JPanel pdfP;
    private javax.swing.JPanel pdfPanel;
    private javax.swing.JTextField pdfStore;
    private javax.swing.JComboBox periodCombo;
    private javax.swing.JRadioButton placeWindow;
    private javax.swing.JFormattedTextField printCount;
    private javax.swing.JRadioButton replaceStamp;
    private javax.swing.JButton restoreDefaultBtn;
    private javax.swing.JRadioButton save;
    private javax.swing.JPanel saveKarte;
    private javax.swing.JRadioButton saveTmp;
    private javax.swing.JPanel scrP;
    private javax.swing.JPanel sendDefault;
    private javax.swing.JRadioButton sendDiagnosis;
    private javax.swing.JPanel sendPanel;
    private javax.swing.JRadioButton showAlert;
    private javax.swing.JCheckBox showModifiedCB;
    private javax.swing.JCheckBox showNewestCB;
    private javax.swing.JCheckBox showSendCB;
    private javax.swing.JCheckBox showUnsendCB;
    private javax.swing.JSpinner spinner;
    private javax.swing.JPanel stampAction;
    private javax.swing.JPanel stampDefault;
    private javax.swing.JPanel stampPanel;
    private javax.swing.JCheckBox stampSpace;
    private javax.swing.JPanel stmpP;
    private javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JCheckBox useTop15AsTitle;
    private javax.swing.JRadioButton vSc;
    // End of variables declaration//GEN-END:variables

    /**
     *
     * @param adapter
     */
    @Override
    public void onChenge(Adapter<Boolean, Boolean> adapter) {
        this.adapter = adapter;
    }

    /**
     *
     */
    private void change() {
        if (adapter != null) {
            try {
                adapter.onResult(true);
            } catch (Exception ex) {
                LogWriter.error(getClass(), ex);
            }
        }
    }

    /**
     * 設定画面を開始する。
     */
    @Override
    public void start() {

        //   projectStub = GlobalVariables.getGlobalVariables();
        prefs = GlobalVariables.getPreferences();

        // モデルを生成し初期化する
        model = new KarteModel();
        model.populate();

        initCustomComponents(); // GUI を構築する
        bindModelToView(); // bindModel
    }

    /**
     * 設定値を保存する。
     */
    @Override
    public void save() {
        bindViewToModel();
        model.restore();
    }

    /**
     * GUI を構築する。
     */
    private void initCustomComponents() {

        // デフォルト値を取得する
        //   defaultLocator = false;
        defaultShowModified = false;
        defaultShowUnsend = false;
        defaultShowSend = false;
        defaultNewestSend = false;
        defaultFetchCount = 1;
        minFetchCount = 1;
        maxFetchCount = 10;
        stepFetchCount = 1;
        defaultScDirection = false;
        defaultPeriod = -12;
        defaultKarteAsc = true;
        defaultDiagnosisAsc = false;
        defaultDiagnosisPeriod = 0;
        defaultAutoOutcomeInput = false;
        defaultOffsetOutcomeDate = -7;
        defaultLaboTestPeriod = -6;

        periodObjects = GlobalConstants.getNameValuePair("docHistory.combo.period");
        periodCombo.setModel(new DefaultComboBoxModel(periodObjects));
        diagnosisPeriodObjects = GlobalConstants.getNameValuePair("diagnosis.combo.period");
        diagnosisPeriodCombo.setModel(new DefaultComboBoxModel(diagnosisPeriodObjects));
        laboTestPeriodObjects = GlobalConstants.getNameValuePair("docHistory.combo.period");
        laboTestPeriodCombo.setModel(new DefaultComboBoxModel(laboTestPeriodObjects));

        int currentFetchCount = prefs.getInt(GlobalVariables.DOC_HISTORY_FETCHCOUNT, defaultFetchCount);
        SpinnerModel fetchModel = new SpinnerNumberModel(currentFetchCount, minFetchCount, maxFetchCount, stepFetchCount);
        spinner.setModel(fetchModel);
        spinner.setEditor(new JSpinner.NumberEditor(spinner, "#"));

        int currentOffsetOutcomeDate = prefs.getInt(GlobalVariables.OFFSET_OUTCOME_DATE, defaultOffsetOutcomeDate);
        SpinnerModel outcomeModel = new SpinnerNumberModel(currentOffsetOutcomeDate, -31, 0, 1);
        outcomeSpinner.setModel(outcomeModel);
        outcomeSpinner.setEditor(new JSpinner.NumberEditor(outcomeSpinner, "#"));

        restoreDefaultBtn.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "restoreDefault"));

        printCount.setColumns(1);
        printCount.setValue(new Integer(0));

        tabbedPane.setPreferredSize(docPanel.getPreferredSize());
    }

    /**
     *
     */
    private void checkState() {

        boolean inspectorOk = true;

        setState(State.VALID_STATE);
        boolean titleOk = true;
        if (!useTop15AsTitle.isSelected()) {
            String test = defaultKarteTitle.getText().trim();
            if (test.equals("")) {
                titleOk = false;
            }
        }

        boolean newOk = (inspectorOk && titleOk) ? true : false;

        if (ok != newOk) {
            ok = newOk;
            if (ok) {
                setState(State.VALID_STATE);
            } else {
                setState(State.INVALID_STATE);
            }
        }
    }

    /**
     *
     * @param state
     */
    public void inspectorChanged(int state) {
        if (state == ItemEvent.SELECTED) {
            checkState();
        }
    }

    /**
     *
     */
    private void choosePDFDirectory() {
        JFileChooser chooser = new JFileChooser();
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

        String baseDir = pdfStore.getText().trim();
        if (baseDir != null && (!baseDir.equals(""))) {
            File f = new File(baseDir);
            chooser.setSelectedFile(f);
        }
        int returnVal = chooser.showOpenDialog(null);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            pdfStore.setText(chooser.getSelectedFile().getPath());
        }
    }

    /**
     * ModelToView
     */
    private void bindModelToView() {

        // PDF 出力先
        pdfStore.setText(model.getPdfStore());
        pdfDir.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                choosePDFDirectory();
            }
        });

        // カルテの昇順表示
        boolean currentAsc = model.isAscendingKarte();
        karteAsc.setSelected(currentAsc);
        karteDesc.setSelected(!currentAsc);

        // 修正履歴表示
        showModifiedCB.setSelected(model.isShowModifiedKarte());
        showUnsendCB.setSelected(model.isShowUnsendKarte());
        showSendCB.setSelected(model.isShowSendKarte());
        showNewestCB.setSelected(model.isShowNewestKarte());

        // 抽出期間
        int currentPeriod = model.getKarteExtractionPeriod();
        periodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(currentPeriod), periodObjects));

        // カルテの取得枚数
        spinner.setValue(new Integer(model.getFetchKarteCount()));

        // 複数カルテのスクロール方向
        boolean vscroll = model.isScrollKarteV();
        vSc.setSelected(vscroll);
        hSc.setSelected(!vscroll);

        // 病名の昇順表示
        boolean currentDiagnosisAsc = model.isAscendingDiagnosis();
        diagnosisAsc.setSelected(currentDiagnosisAsc);
        diagnosisDesc.setSelected(!currentDiagnosisAsc);

        // 病名の抽出期間
        int currentDiagnosisPeriod = model.getDiagnosisExtractionPeriod();
        diagnosisPeriodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(currentDiagnosisPeriod), diagnosisPeriodObjects));

        // 転帰のオフセット
        autoOutcomeInput.setSelected(model.isAutoOutcomeInput());
        outcomeSpinner.setEnabled(autoOutcomeInput.isSelected());
        autoOutcomeInput.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                outcomeSpinner.setEnabled(autoOutcomeInput.isSelected());
            }
        });

        // ラボテストの抽出期間
        int currentLaboTestPeriod = model.getLaboTestExtractionPeriod();
        laboTestPeriodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(currentLaboTestPeriod), laboTestPeriodObjects));

        // スタンプ動作
        replaceStamp.setSelected(model.isReplaceStamp());
        showAlert.setSelected(!model.isReplaceStamp());
        stampSpace.setSelected(model.isStampSpace());
        laboFold.setSelected(model.isLaboFold());
        defaultZyozaiNum.setText(model.getDefaultZyozaiNum());
        defaultMizuyakuNum.setText(model.getDefaultMizuyakuNum());
        defaultSanyakuNum.setText(model.getDefaultSanyakuNum());
        defaultRpNum.setText(model.getDefaultRpNum());

        defaultZyozaiNum.addFocusListener(AutoRomanListener.getInstance());
        defaultMizuyakuNum.addFocusListener(AutoRomanListener.getInstance());
        defaultSanyakuNum.addFocusListener(AutoRomanListener.getInstance());
        defaultRpNum.addFocusListener(AutoRomanListener.getInstance());


        // 病名送信
        if (model.isSendDiagnosis()) {
            sendDiagnosis.doClick();
        } else {
            noSendDiagnosis.doClick();
        }

        // カルテタイトル
        ActionListener a = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                boolean enabled = useTop15AsTitle.isSelected();
                defaultKarteTitle.setEnabled(!enabled);
            }
        };
        useTop15AsTitle.addActionListener(a);
        defaultKarteTitle.setText(model.getDefaultKarteTitle());
        if (model.isUseTop15AsTitle()) {
            useTop15AsTitle.doClick();
        }
        DocumentListener emptyListener = new DocumentListener() {

            @Override
            public void insertUpdate(DocumentEvent arg0) {
                checkState();
            }

            @Override
            public void removeUpdate(DocumentEvent arg0) {
                checkState();
            }

            @Override
            public void changedUpdate(DocumentEvent arg0) {
                checkState();
            }
        };
        defaultKarteTitle.getDocument().addDocumentListener(emptyListener);

        defaultKarteTitle.addFocusListener(AutoKanjiListener.getInstance());


        //
        // 確認ダイアログ関係
        //
        ActionListener al = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                //     boolean enabled = noConfirmAtNew.isSelected();
                //     emptyNew.setEnabled(enabled);
                //     applyRp.setEnabled(enabled);
                //     copyNew.setEnabled(enabled);
                //     placeWindow.setEnabled(enabled);
                //     palceTabbedPane.setEnabled(enabled);
            }
        };

        ActionListener al2 = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                boolean enabled = noConfirmAtSave.isSelected();
                printCount.setEnabled(enabled);
                save.setEnabled(enabled);
                saveTmp.setEnabled(enabled);
            }
        };

        // カルテの作成モード
        switch (model.getCreateKarteMode()) {
            case 0:
                emptyNew.setSelected(true);
                break;
            case 1:
                applyRp.setSelected(true);
                break;
            case 2:
                copyNew.setSelected(true);
                break;
            default: LogWriter.fatal(getClass(), "case default");
        }

        // 配置方法
        if (model.isPlaceKarteMode()) {
            placeWindow.setSelected(true);
        } else {
            palceTabbedPane.setSelected(true);
        }

        isHospitalCheckBox.setSelected(model.getIsHospital());
        if (!StringTool.isEmptyString(model.getLetterGreetings())) {
            GreetingsEdit.setText(model.getLetterGreetings());
        }

        // 新規カルテ時の確認ダイログ
        boolean curConfirmAtNew = model.isConfirmAtNew();
        noConfirmAtNew.setSelected(!curConfirmAtNew);
        noConfirmAtNew.addActionListener(al);

        // 保存時のデフォルト動作
        if (model.getSaveKarteMode() == 0) {
            save.setSelected(true);
        } else {
            saveTmp.setSelected(true);
        }

        // 保存時の確認ダイログ
        boolean curConfirmAtSave = model.isConfirmAtSave();
        noConfirmAtSave.setSelected(!curConfirmAtSave);
        printCount.setValue(new Integer(model.getPrintKarteCount()));
        printCount.setEnabled(!curConfirmAtSave);
        save.setEnabled(!curConfirmAtSave);
        saveTmp.setEnabled(!curConfirmAtSave);
        noConfirmAtSave.addActionListener(al2);

        // この設定画面は常に有効状態である
        setState(State.VALID_STATE);

        fepControlCheckbox.setSelected(model.getFepControl());
    }

    /**
     * ViewToModel
     */
    private void bindViewToModel() {

        model.setIsHospital(isHospitalCheckBox.isSelected());
        model.setLetterGreetings(GreetingsEdit.getText());

        model.setPdfStore(pdfStore.getText().trim());

        // インスペクタ画面のロケータ
        //    model.setLocateByPlatform(pltform.isSelected());

        // カルテの昇順表示
        model.setAscendingKarte(karteAsc.isSelected());

        // カルテの修正履歴表示
        model.setShowModifiedKarte(showModifiedCB.isSelected());
        model.setShowUnsendKarte(showUnsendCB.isSelected());
        model.setShowSendKarte(showSendCB.isSelected());
        model.setShowNewestKarte(showNewestCB.isSelected());


        // カルテの取得枚数
        String value = spinner.getValue().toString();
        model.setFetchKarteCount(Integer.parseInt(value));

        // 複数カルテのスクロール方向
        model.setScrollKarteV(vSc.isSelected());

        // カルテの抽出期間
        String code = ((NameValuePair) periodCombo.getSelectedItem()).getValue();
        model.setKarteExtractionPeriod(Integer.parseInt(code));

        // 病名の昇順表示
        model.setAscendingDiagnosis(diagnosisAsc.isSelected());

        // 病名の抽出期間
        code = ((NameValuePair) diagnosisPeriodCombo.getSelectedItem()).getValue();
        model.setDiagnosisExtractionPeriod(Integer.parseInt(code));

        // 転帰入力時の終了日オフセット
        model.setAutoOutcomeInput(autoOutcomeInput.isSelected());
        String val = outcomeSpinner.getValue().toString();
        prefs.putInt(GlobalVariables.OFFSET_OUTCOME_DATE, Integer.parseInt(val));

        // ラボテストの抽出期間
        code = ((NameValuePair) laboTestPeriodCombo.getSelectedItem()).getValue();
        model.setLaboTestExtractionPeriod(Integer.parseInt(code));

        // スタンプ関連
        model.setReplaceStamp(replaceStamp.isSelected());
        model.setStampSpace(stampSpace.isSelected());
        model.setLaboFold(laboFold.isSelected());


        //空欄の場合は0とみなす
        if (defaultZyozaiNum.getText().trim().equals("")) {
            model.setDefaultZyozaiNum("0");
        } else {
            model.setDefaultZyozaiNum(defaultZyozaiNum.getText().trim());
        }

        if (defaultMizuyakuNum.getText().trim().equals("")) {
            model.setDefaultMizuyakuNum("0");
        } else {
            model.setDefaultMizuyakuNum(defaultMizuyakuNum.getText().trim());
        }

        if (defaultSanyakuNum.getText().trim().equals("")) {
            model.setDefaultSanyakuNum("0");
        } else {
            model.setDefaultSanyakuNum(defaultSanyakuNum.getText().trim());
        }

        if (defaultRpNum.getText().trim().equals("")) {
            model.setDefaultRpNum("0");
        } else {
            model.setDefaultRpNum(defaultRpNum.getText().trim());
        }

        // 保存時に設定するカルテのタイトル
        model.setUseTop15AsTitle(useTop15AsTitle.isSelected());
        model.setDefaultKarteTitle(defaultKarteTitle.getText().trim());

        // 病名の CLAIM 送信
        model.setSendDiagnosis(sendDiagnosis.isSelected());

        // 新規カルテ時の確認ダイアログ
        model.setConfirmAtNew(!noConfirmAtNew.isSelected());

        // 保存時の確認ダイアログ
        model.setConfirmAtSave(!noConfirmAtSave.isSelected());

        // 新規カルテの作成モード
        int cMode = 0;
        if (emptyNew.isSelected()) {
            cMode = 0;
        } else if (applyRp.isSelected()) {
            cMode = 1;
        } else if (copyNew.isSelected()) {
            cMode = 2;
        }
        model.setCreateKarteMode(cMode); // 0=emptyNew, 1=applyRp, 2=copyNew

        // 新規カルテの配置方法
        model.setPlaceKarteMode(placeWindow.isSelected());

        // 印刷枚数

        Integer ival = Integer.decode(printCount.getValue().toString());
        model.setPrintKarteCount(ival.intValue());

        // 保存時のデフォルト動作
        int sMode = save.isSelected() ? 0 : 1;
        model.setSaveKarteMode(sMode); // 0=save, 1=saveTmp

        model.setFepControl(fepControlCheckbox.isSelected());
    }

    /**
     * 画面モデルクラス。
     */
    class KarteModel {

        // インスペクタ
        //     private String topInspector;
        //    private String secondInspector;
        //     private String thirdInspector;
        //     private String forthInspector;
        private String pdfStore;
        // インスペクタ画面のロケータ
        //    private boolean locateByPlatform;
        // カルテ文書関係
        private int fetchKarteCount;
        private boolean ascendingKarte;
        private boolean showModifiedKarte;
        private boolean showUnsendKarte;
        private boolean showSendKarte;
        private boolean showNewestKarte;
        private boolean scrollKarteV;
        private int karteExtractionPeriod;
        // 病名関係
        private boolean ascendingDiagnosis;
        private int diagnosisExtractionPeriod;
        private boolean autoOutcomeInput;
        // 検体検査
        private int labotestExtractionPeriod;
        // スタンプ動作
        private boolean replaceStamp;
        private boolean stampSpace;
        private boolean laboFold;
        private String defaultZyozaiNum;
        private String defaultMizuyakuNum;
        private String defaultSanyakuNum;
        private String defaultRpNum;
        // CLAIM 送信関係
        //   private boolean sendClaimTmp;
        //    private boolean sendClaimSave;
        //   private boolean sendClaimModify;
        private boolean sendDiagnosis;
        private String defaultKarteTitle;
        private boolean useTop15AsTitle;
        // 確認ダイアログ関係
        private boolean confirmAtNew;
        private int createKarteMode;
        private boolean placeKarteMode;
        private boolean confirmAtSave;
        private int saveKarteMode;
        private int printKarteCount;
        private boolean isHospital;
        private String Greetings;
        private boolean fepControl;

        /**
         * ProjectStub から populate する。
         */
        public void populate() {
            setPdfStore(GlobalVariables.getPDFStore());
            setFetchKarteCount(GlobalVariables.getFetchKarteCount());
            setScrollKarteV(GlobalVariables.getScrollKarteV());
            setAscendingKarte(GlobalVariables.getAscendingKarte());
            setKarteExtractionPeriod(GlobalVariables.getKarteExtractionPeriod());
            setShowModifiedKarte(GlobalVariables.getShowModifiedKarte());
            setShowUnsendKarte(GlobalVariables.getShowUnsendKarte());
            setShowSendKarte(GlobalVariables.getShowSendKarte());
            setShowNewestKarte(GlobalVariables.getShowNewestKarte());

            setAscendingDiagnosis(GlobalVariables.getAscendingDiagnosis());
            setDiagnosisExtractionPeriod(GlobalVariables.getDiagnosisExtractionPeriod());
            setAutoOutcomeInput(GlobalVariables.isAutoOutcomeInput());
            setLaboTestExtractionPeriod(GlobalVariables.getLaboTestExtractionPeriod());
            setReplaceStamp(GlobalVariables.isReplaceStamp());
            setStampSpace(GlobalVariables.isStampSpace());
            setLaboFold(GlobalVariables.isLaboFold());
            setDefaultZyozaiNum(GlobalVariables.getDefaultZyozaiNum());
            setDefaultMizuyakuNum(GlobalVariables.getDefaultMizuyakuNum());
            setDefaultSanyakuNum(GlobalVariables.getDefaultSanyakuNum());
            setDefaultRpNum(GlobalVariables.getDefaultRpNum());
            setUseTop15AsTitle(GlobalVariables.isUseTop15AsTitle());
            setDefaultKarteTitle(GlobalVariables.getDefaultKarteTitle());
            setSendDiagnosis(GlobalVariables.getSendDiagnosis());
            setConfirmAtNew(GlobalVariables.getConfirmAtNew());
            setCreateKarteMode(GlobalVariables.getCreateKarteMode());
            setPlaceKarteMode(GlobalVariables.getPlaceKarteMode());
            setConfirmAtSave(GlobalVariables.getConfirmAtSave());
            setPrintKarteCount(GlobalVariables.getPrintKarteCount());
            setSaveKarteMode(GlobalVariables.getSaveKarteMode());
            setIsHospital(GlobalVariables.getIsHospital());
            setLetterGreetings(GlobalVariables.getLetterGreetings());
            setFepControl(GlobalVariables.getFepControl());

        }

        /**
         *
         */
        public void restore() {

            String pdfDir = getPdfStore();
            if (pdfDir != null && (!pdfDir.equals(""))) {
                GlobalVariables.setPDFStore(pdfDir);
            }

            GlobalVariables.setFetchKarteCount(getFetchKarteCount());
            GlobalVariables.setScrollKarteV(isScrollKarteV());
            GlobalVariables.setAscendingKarte(isAscendingKarte());
            GlobalVariables.setKarteExtractionPeriod(getKarteExtractionPeriod());
            GlobalVariables.setShowModifiedKarte(isShowModifiedKarte());
            GlobalVariables.setShowUnsendKarte(isShowUnsendKarte());
            GlobalVariables.setShowSendKarte(isShowSendKarte());
            GlobalVariables.setShowNewestKarte(isShowNewestKarte());

            GlobalVariables.setAscendingDiagnosis(isAscendingDiagnosis());
            GlobalVariables.setDiagnosisExtractionPeriod(getDiagnosisExtractionPeriod());
            GlobalVariables.setAutoOutcomeInput(isAutoOutcomeInput());
            GlobalVariables.setLaboTestExtractionPeriod(getLaboTestExtractionPeriod());
            GlobalVariables.setReplaceStamp(isReplaceStamp());
            GlobalVariables.setStampSpace(isStampSpace());
            GlobalVariables.setLaboFold(isLaboFold());

            String test = testNumber(getDefaultZyozaiNum());
            if (test != null) {
                GlobalVariables.setDefaultZyozaiNum(test);
            }

            test = testNumber(getDefaultMizuyakuNum());
            if (test != null) {
                GlobalVariables.setDefaultMizuyakuNum(test);
            }

            test = testNumber(getDefaultSanyakuNum());
            if (test != null) {
                GlobalVariables.setDefaultSanyakuNum(test);
            }

            test = testNumber(getDefaultRpNum());
            if (test != null) {
                GlobalVariables.setDefaultRpNum(test);
            }

            //     GlobalVariables.setSendClaimTmp(isSendClaimTmp());
            //    GlobalVariables.setSendClaimSave(isSendClaimSave());
            //    GlobalVariables.setSendClaimModify(isSendClaimModify());
            GlobalVariables.setUseTop15AsTitle(isUseTop15AsTitle());

            test = getDefaultKarteTitle();
            if (test != null && (!test.equals(""))) {
                GlobalVariables.setDefaultKarteTitle(test);
            }

            GlobalVariables.setSendDiagnosis(isSendDiagnosis());
            GlobalVariables.setConfirmAtNew(isConfirmAtNew());
            GlobalVariables.setCreateKarteMode(getCreateKarteMode());
            GlobalVariables.setPlaceKarteMode(isPlaceKarteMode());
            GlobalVariables.setConfirmAtSave(isConfirmAtSave());
            GlobalVariables.setPrintKarteCount(getPrintKarteCount());
            GlobalVariables.setSaveKarteMode(getSaveKarteMode());
            GlobalVariables.setIsHospital(getIsHospital());
            GlobalVariables.setLetterGreetings(getLetterGreetings());
            GlobalVariables.setFepControl(getFepControl());
        }

        /**
         *
         * @return
         */
        public int getFetchKarteCount() {
            return fetchKarteCount;
        }

        /**
         *
         * @param fetchKarteCount
         */
        public void setFetchKarteCount(int fetchKarteCount) {
            this.fetchKarteCount = fetchKarteCount;
        }

        /**
         *
         * @return
         */
        public boolean isAscendingKarte() {
            return ascendingKarte;
        }

        /**
         *
         * @param ascendingKarte
         */
        public void setAscendingKarte(boolean ascendingKarte) {
            this.ascendingKarte = ascendingKarte;
        }

        /**
         *
         * @return
         */
        public boolean isShowModifiedKarte() {
            return showModifiedKarte;
        }

        /**
         *
         * @param showModifiedKarte
         */
        public void setShowModifiedKarte(boolean showModifiedKarte) {
            this.showModifiedKarte = showModifiedKarte;
        }

        /**
         *
         * @return
         */
        public boolean isShowUnsendKarte() {
            return showUnsendKarte;
        }

        /**
         *
         * @param showUnsendKarte
         */
        public void setShowUnsendKarte(boolean showUnsendKarte) {
            this.showUnsendKarte = showUnsendKarte;
        }

        /**
         *
         * @return
         */
        public boolean isShowSendKarte() {
            return showSendKarte;
        }

        /**
         *
         * @param showSendKarte
         */
        public void setShowSendKarte(boolean showSendKarte) {
            this.showSendKarte = showSendKarte;
        }

        /**
         *
         * @return
         */
        public boolean isShowNewestKarte() {
            return showNewestKarte;
        }

        /**
         *
         * @param showNewestKarte
         */
        public void setShowNewestKarte(boolean showNewestKarte) {
            this.showNewestKarte = showNewestKarte;
        }

        /**
         *
         * @return
         */
        public boolean isScrollKarteV() {
            return scrollKarteV;
        }

        /**
         *
         * @param scrollKarteV
         */
        public void setScrollKarteV(boolean scrollKarteV) {
            this.scrollKarteV = scrollKarteV;
        }

        /**
         *
         * @return
         */
        public int getKarteExtractionPeriod() {
            return karteExtractionPeriod;
        }

        /**
         *
         * @param karteExtractionPeriod
         */
        public void setKarteExtractionPeriod(int karteExtractionPeriod) {
            this.karteExtractionPeriod = karteExtractionPeriod;
        }

        /**
         *
         * @return
         */
        public boolean isAscendingDiagnosis() {
            return ascendingDiagnosis;
        }

        /**
         *
         * @param ascendingDiagnosis
         */
        public void setAscendingDiagnosis(boolean ascendingDiagnosis) {
            this.ascendingDiagnosis = ascendingDiagnosis;
        }

        /**
         *
         * @return
         */
        public int getDiagnosisExtractionPeriod() {
            return diagnosisExtractionPeriod;
        }

        /**
         *
         * @param diagnosisExtractionPeriod
         */
        public void setDiagnosisExtractionPeriod(int diagnosisExtractionPeriod) {
            this.diagnosisExtractionPeriod = diagnosisExtractionPeriod;
        }

        /**
         *
         * @return
         */
        public boolean isAutoOutcomeInput() {
            return autoOutcomeInput;
        }

        /**
         *
         * @param b
         */
        public void setAutoOutcomeInput(boolean b) {
            autoOutcomeInput = b;
        }

        /**
         *
         * @return
         */
        public int getLaboTestExtractionPeriod() {
            return labotestExtractionPeriod;
        }

        /**
         *
         * @param laboTestExtractionPeriod
         */
        public void setLaboTestExtractionPeriod(int laboTestExtractionPeriod) {
            this.labotestExtractionPeriod = laboTestExtractionPeriod;
        }

        /**
         *
         * @return
         */
        public boolean isSendDiagnosis() {
            return sendDiagnosis;
        }

        /**
         *
         * @param sendDiagnosis
         */
        public void setSendDiagnosis(boolean sendDiagnosis) {
            this.sendDiagnosis = sendDiagnosis;
        }

        /**
         *
         * @return
         */
        public boolean isConfirmAtNew() {
            return confirmAtNew;
        }

        /**
         *
         * @param confirmAtNew
         */
        public void setConfirmAtNew(boolean confirmAtNew) {
            this.confirmAtNew = confirmAtNew;
        }

        /**
         *
         * @return
         */
        public int getCreateKarteMode() {
            return createKarteMode;
        }

        /**
         *
         * @param createKarteMode
         */
        public void setCreateKarteMode(int createKarteMode) {
            this.createKarteMode = createKarteMode;
        }

        /**
         *
         * @return
         */
        public boolean isPlaceKarteMode() {
            return placeKarteMode;
        }

        /**
         *
         * @param placeKarteMode
         */
        public void setPlaceKarteMode(boolean placeKarteMode) {
            this.placeKarteMode = placeKarteMode;
        }

        /**
         *
         * @return
         */
        public boolean isConfirmAtSave() {
            return confirmAtSave;
        }

        /**
         *
         * @param confirmAtSave
         */
        public void setConfirmAtSave(boolean confirmAtSave) {
            this.confirmAtSave = confirmAtSave;
        }

        /**
         *
         * @return
         */
        public int getSaveKarteMode() {
            return saveKarteMode;
        }

        /**
         *
         * @param saveKarteMode
         */
        public void setSaveKarteMode(int saveKarteMode) {
            this.saveKarteMode = saveKarteMode;
        }

        /**
         *
         * @return
         */
        public int getPrintKarteCount() {
            return printKarteCount;
        }

        /**
         *
         * @param printKarteCount
         */
        public void setPrintKarteCount(int printKarteCount) {
            this.printKarteCount = printKarteCount;
        }

        /**
         *
         * @return
         */
        public boolean isReplaceStamp() {
            return replaceStamp;
        }

        /**
         *
         * @param replaceStamp
         */
        public void setReplaceStamp(boolean replaceStamp) {
            this.replaceStamp = replaceStamp;
        }

        /**
         *
         * @return
         */
        public boolean isStampSpace() {
            return stampSpace;
        }

        /**
         *
         * @param stampSpace
         */
        public void setStampSpace(boolean stampSpace) {
            this.stampSpace = stampSpace;
        }

        /**
         *
         * @return
         */
        public boolean isLaboFold() {
            return laboFold;
        }

        /**
         *
         * @param laboFold
         */
        public void setLaboFold(boolean laboFold) {
            this.laboFold = laboFold;
        }

        /**
         *
         * @return
         */
        public String getDefaultZyozaiNum() {
            return defaultZyozaiNum;
        }

        /**
         *
         * @param defaultZyozaiNum
         */
        public void setDefaultZyozaiNum(String defaultZyozaiNum) {
            this.defaultZyozaiNum = defaultZyozaiNum;
        }

        /**
         *
         * @return
         */
        public String getDefaultMizuyakuNum() {
            return defaultMizuyakuNum;
        }

        /**
         *
         * @param defaultMizuyakuNum
         */
        public void setDefaultMizuyakuNum(String defaultMizuyakuNum) {
            this.defaultMizuyakuNum = defaultMizuyakuNum;
        }

        /**
         *
         * @return
         */
        public String getDefaultSanyakuNum() {
            return defaultSanyakuNum;
        }

        /**
         *
         * @param defaultSanyakuNum
         */
        public void setDefaultSanyakuNum(String defaultSanyakuNum) {
            this.defaultSanyakuNum = defaultSanyakuNum;
        }

        /**
         *
         * @return
         */
        public String getDefaultRpNum() {
            return defaultRpNum;
        }

        /**
         *
         * @param defaultRpNum
         */
        public void setDefaultRpNum(String defaultRpNum) {
            this.defaultRpNum = defaultRpNum;
        }

        /**
         *
         * @return
         */
        public String getDefaultKarteTitle() {
            return defaultKarteTitle;
        }

        /**
         *
         * @param defaultKarteTitle
         */
        public void setDefaultKarteTitle(String defaultKarteTitle) {
            this.defaultKarteTitle = defaultKarteTitle;
        }

        /**
         *
         * @return
         */
        public boolean isUseTop15AsTitle() {
            return useTop15AsTitle;
        }

        /**
         *
         * @param useTop15AsTitle
         */
        public void setUseTop15AsTitle(boolean useTop15AsTitle) {
            this.useTop15AsTitle = useTop15AsTitle;
        }

        /**
         *
         * @return
         */
        public String getPdfStore() {
            return pdfStore;
        }

        /**
         *
         * @param pdfStore
         */
        public void setPdfStore(String pdfStore) {
            this.pdfStore = pdfStore;
        }

        /**
         *
         * @return
         */
        public boolean getIsHospital() {
            return isHospital;
        }

        /**
         *
         * @param isHospital
         */
        public void setIsHospital(boolean isHospital) {
            this.isHospital = isHospital;
        }

        /**
         *
         * @return
         */
        public String getLetterGreetings() {
            return Greetings;
        }

        /**
         *
         * @param Greetings
         */
        public void setLetterGreetings(String Greetings) {
            this.Greetings = Greetings;
        }

        /**
         *
         * @param value
         */
        public void setFepControl(boolean value) {
            fepControl = value;
        }

        /**
         *
         * @return
         */
        public boolean getFepControl() {
            return fepControl;
        }
    }

    /**
     *
     */
    public void restoreDefault() {

        //       pltform.setSelected(defaultLocator);
        //     prefLoc.setSelected(!defaultLocator);
        showModifiedCB.setSelected(defaultShowModified);
        showUnsendCB.setSelected(defaultShowUnsend);
        showSendCB.setSelected(defaultShowSend);
        showNewestCB.setSelected(defaultNewestSend);
        spinner.setValue(new Integer(defaultFetchCount));
        periodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(defaultPeriod), periodObjects));
        vSc.setSelected(defaultScDirection);
        karteAsc.setSelected(defaultKarteAsc);
        karteDesc.setSelected(!defaultKarteAsc);
        diagnosisAsc.setSelected(defaultDiagnosisAsc);
        diagnosisDesc.setSelected(!defaultDiagnosisAsc);
        diagnosisPeriodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(defaultDiagnosisPeriod), diagnosisPeriodObjects));
        autoOutcomeInput.setSelected(defaultAutoOutcomeInput);
        outcomeSpinner.setValue(new Integer(defaultOffsetOutcomeDate));
        outcomeSpinner.setEnabled(autoOutcomeInput.isSelected());
        laboTestPeriodCombo.setSelectedIndex(NameValuePair.getIndex(String.valueOf(defaultLaboTestPeriod), laboTestPeriodObjects));
    }

    /**
     *
     * @param test
     * @return
     */
    private String testNumber(String test) {
        String result = null;
        Float.parseFloat(test);
        result = StringTool.zenkakuNumToHankaku(test);
        return result;
    }

    /**
     *
     * @return
     */
    @Override
    public String getId() {
        return id;
    }

    /**
     *
     * @param id
     */
    @Override
    public void setId(String id) {
        this.id = id;
    }

    /**
     *
     * @return
     */
    @Override
    public String getTitle() {
        return title;
    }

    /**
     *
     * @param title
     */
    @Override
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     *
     * @return
     */
    @Override
    public String getIcon() {
        return icon;
    }

    /**
     *
     * @param icon
     */
    @Override
    public void setIcon(String icon) {
        this.icon = icon;
    }

    /**
     *
     * @return
     */
    @Override
    public ProjectSettingDialog getContext() {
        return context;
    }

    /**
     *
     * @param context
     */
    @Override
    public void setContext(ProjectSettingDialog context) {
        this.context = context;
        this.addPropertyChangeListener(STATE_PROP, context);
        this.setLogInState(context.getLoginState());
    }

    /**
     *
     * @return
     */
    @Override
    public boolean isLoginState() {
        return loginState;
    }

    /**
     *
     * @param login
     */
    @Override
    public void setLogInState(boolean login) {
        loginState = login;
    }

    /**
     *
     * @return
     */
    @Override
    public JPanel getPanel() {
        return this;
    }

    /**
     *
     * @param prop
     * @param l
     */
    @Override
    public void addPropertyChangeListener(String prop, PropertyChangeListener l) {
        boundSupport.addPropertyChangeListener(prop, l);
    }

    /**
     *
     * @param prop
     * @param l
     */
    @Override
    public void removePropertyChangeListener(String prop, PropertyChangeListener l) {
        boundSupport.removePropertyChangeListener(prop, l);
    }

    /**
     * @param state The state to set.
     */
    @Override
    public void setState(State state) {
        this.state = state;
        boundSupport.firePropertyChange(STATE_PROP, null, this.state);
    }

    /**
     * @return Returns the state.
     */
    @Override
    public State getState() {
        return state;
    }
}
