GME  13
AlterNmspDlg.cpp
Go to the documentation of this file.
00001 // AlterNmspDlg.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "MgaUtil.h"
00006 #include "AlterNmspDlg.h"
00007 
00008 
00009 // AlterNmspDlg dialog
00010 
00011 IMPLEMENT_DYNAMIC(AlterNmspDlg, CDialog)
00012 AlterNmspDlg::AlterNmspDlg(CWnd* pParent /*=NULL*/)
00013         : CDialog(AlterNmspDlg::IDD, pParent)
00014 {
00015         m_strPrefix   = _T("");
00016         m_strTrunc    = _T("");
00017         m_vRadAlter   = 0;
00018         m_bAlterSticky= FALSE;
00019 
00020         //m_storedStrPrefix = _T("");
00021         //m_storedStrTrunc  = _T("");
00022         //m_storedAltOption = 0;
00023         //m_storedAltSticky = TRUE;
00024 }
00025 
00026 AlterNmspDlg::~AlterNmspDlg()
00027 {
00028 }
00029 
00030 void AlterNmspDlg::DoDataExchange(CDataExchange* pDX)
00031 {
00032         CDialog::DoDataExchange(pDX);
00033         DDX_Control( pDX, IDC_EDTPREFIX, m_edtPrefix);
00034         DDX_Control( pDX, IDC_EDTTRUNC,  m_edtTrunc);
00035         DDX_Control( pDX, IDC_RAD_ALTER0, m_radAlter0);
00036         DDX_Control( pDX, IDC_RAD_ALTER1, m_radAlter1);
00037         DDX_Control( pDX, IDC_RAD_ALTER2, m_radAlter2);
00038         DDX_Control( pDX, IDC_RAD_ALTER3, m_radAlter3);
00039         DDX_Control( pDX, IDC_APPLY_ALL,  m_chkAlterSticky);
00040 
00041         DDX_Text(    pDX, IDC_EDTPREFIX, m_strPrefix);
00042         DDX_Text(    pDX, IDC_EDTTRUNC,  m_strTrunc);
00043         DDX_Radio(   pDX, IDC_RAD_ALTER0, m_vRadAlter);
00044         DDX_Check(   pDX, IDC_APPLY_ALL,  m_bAlterSticky);
00045 }
00046 
00047 
00048 BEGIN_MESSAGE_MAP(AlterNmspDlg, CDialog)
00049         ON_BN_CLICKED(IDC_RAD_ALTER0, OnBnClickedRadAlter0)
00050         ON_BN_CLICKED(IDC_RAD_ALTER1, OnBnClickedRadAlter1)
00051         ON_BN_CLICKED(IDC_RAD_ALTER2, OnBnClickedRadAlter2)
00052         ON_BN_CLICKED(IDC_RAD_ALTER3, OnBnClickedRadAlter3)
00053         ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00054 END_MESSAGE_MAP()
00055 
00056 
00057 // AlterNmspDlg message handlers
00058 BOOL AlterNmspDlg::OnInitDialog() 
00059 {
00060         CDialog::OnInitDialog();
00061         
00062         // TODO: Add extra initialization here
00063         //m_strPrefix    = m_storedStrPrefix;
00064         //m_strTrunc     = m_storedStrTrunc;
00065         //m_vRadAlter    = m_storedAltOption;
00066         //m_bAlterSticky = m_storedAltSticky;
00067 
00068         m_edtPrefix.EnableWindow( FALSE);
00069         m_edtTrunc.EnableWindow(  FALSE);
00070         m_chkAlterSticky.ShowWindow( SW_HIDE);
00071 
00072         UpdateData( FALSE);
00073         return TRUE;
00074 }
00075 
00076 void AlterNmspDlg::OnOK() 
00077 {
00078         UpdateData( TRUE);
00079 
00080         // TODO: Add extra validation here
00081         if( m_vRadAlter == 1 && m_strPrefix.IsEmpty()
00082          || m_vRadAlter == 2 && m_strTrunc.IsEmpty()
00083          || m_vRadAlter == 3 && ( m_strPrefix.IsEmpty() || m_strTrunc.IsEmpty()))
00084         {
00085                 AfxMessageBox( _T("Please do NOT specify empty string in the edit box!"));
00086                 return; // don't allow these scenarios
00087         }
00088 
00089         // completing the namespaces with the operator: '::'
00090         if( !m_strPrefix.IsEmpty() && m_strPrefix.Right(2) != _T("::")) m_strPrefix += _T("::");
00091         if( !m_strTrunc.IsEmpty()  && m_strTrunc.Right(2)  != _T("::")) m_strTrunc  += _T("::");
00092 
00093         UpdateData( FALSE);
00094         //m_storedStrPrefix = m_strPrefix;
00095         //m_storedStrTrunc  = m_strTrunc;
00096         //m_storedAltOption = m_vRadAlter;
00097         //m_storedAltSticky = m_bAlterSticky;
00098 
00099         CDialog::OnOK();
00100 }
00101 
00102 void AlterNmspDlg::OnBnClickedRadAlter0()
00103 {
00104         m_edtPrefix.EnableWindow( FALSE);
00105         m_edtTrunc.EnableWindow(  FALSE);
00106 }
00107 
00108 void AlterNmspDlg::OnBnClickedRadAlter1()
00109 {
00110         m_edtPrefix.EnableWindow( TRUE);
00111         m_edtTrunc.EnableWindow(  FALSE);
00112 }
00113 
00114 void AlterNmspDlg::OnBnClickedRadAlter2()
00115 {
00116         m_edtPrefix.EnableWindow( FALSE);
00117         m_edtTrunc.EnableWindow(  TRUE);
00118 }
00119 
00120 void AlterNmspDlg::OnBnClickedRadAlter3()
00121 {
00122         m_edtPrefix.EnableWindow( TRUE);
00123         m_edtTrunc.EnableWindow(  TRUE);
00124 }
00125 void AlterNmspDlg::OnBnClickedButton1()
00126 {
00127         AfxMessageBox(_T("Kinds may differ in this paradigm compared to the originating one. You might choose to ")
00128                 _T("prefix the originating object kinds and roles with a specific namespace string. ")
00129                 _T("You might also choose to disregard namespace related information from the XML data by using the Trunc option. ")
00130                 _T("To migrate from one namespace to another you can specify the namespace string to be removed (in the 2nd edit box) and the namespace ")
00131                 _T("string to be used then as a prefix (in the 1st edit box)."), MB_OK | MB_ICONINFORMATION);
00132 }