« 患者検索でのID入力 | トップページ | カルテ検索機能 »

2009年6月11日 (木)

メモ欄の自動セーブ

本家の OpenDolphin は,バージョン 1.4 になって,メモ欄の update ボタンが無くなり,メモ欄は自動的にセーブされるようになった。確かに,その方が便利なので,そのように変更した。

 

client/MemoInspector.java

private void initComponents() {
//// update ボタンは使わないことにするので,すべてコメントアウト        
  //int[] memoSize = ClientContext.getIntArray("patientInspector.memoInspector.textArea.size"); // 5,10
////        ImageIcon updateIcon = ClientContext.getImageIcon("ref_16.gif");

  memoArea = new CompositeArea(5, 10);
  memoArea.setLineWrap(true);
  memoArea.setMargin(new java.awt.Insets(3, 3, 2, 2));
////        memoArea.addFocusListener(AutoKanjiListener.getInstance());

////        updateMemoBtn = new JButton(updateIcon);
////        updateMemoBtn.setMargin(new Insets(2, 2, 2, 2));
////        updateMemoBtn.setEnabled(false);
////        updateMemoBtn.addActionListener(ProxyActionListener.create(this, "updateMemo"));
////        JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
////        btnPanel.add(updateMemoBtn);

  memoPanel = new JPanel(new BorderLayout());
  memoPanel.add(memoArea, BorderLayout.CENTER);
////        memoPanel.add(btnPanel, BorderLayout.EAST);
}
////↓
/**
 * メモ内容が変化したかどうかチェック
 * @return
 */
public boolean isDirty() {
  String oldText = patientMemoModel==null? "" : patientMemoModel.getMemo();
  String newText = memoArea.getText().trim();
  return !oldText.equals(newText);
}
////↑

client/PatientInspector.java

public void dispose() {
  // List をクリアする
  docHistory.clear();
  allergyInspector.clear();
  physicalInspector.clear();

////↓   memo 欄の自動セーブ
  if (memoInspector.isDirty()) {
    memoInspector.updateMemo();
  }
////↑
}

« 患者検索でのID入力 | トップページ | カルテ検索機能 »

OpenDolphin」カテゴリの記事