From: <jfu...@us...> - 2008-01-08 02:00:45
|
Revision: 11680 http://jvcl.svn.sourceforge.net/jvcl/?rev=11680&view=rev Author: jfudickar Date: 2008-01-07 18:00:42 -0800 (Mon, 07 Jan 2008) Log Message: ----------- Odac Logon Dialog finished (now completly supports OracleHome and NetOption) Modified Paths: -------------- trunk/jvcl/run/JvBaseDBLogonDialog.pas trunk/jvcl/run/JvDBLogonDialogOdac.pas trunk/jvcl/run/JvResources.pas Modified: trunk/jvcl/run/JvBaseDBLogonDialog.pas =================================================================== --- trunk/jvcl/run/JvBaseDBLogonDialog.pas 2008-01-08 01:59:25 UTC (rev 11679) +++ trunk/jvcl/run/JvBaseDBLogonDialog.pas 2008-01-08 02:00:42 UTC (rev 11680) @@ -60,6 +60,7 @@ FShowConnectionsExport: Boolean; FShowSavePasswords: Boolean; FShowShortcuts: Boolean; + protected public constructor Create; virtual; destructor Destroy; override; @@ -278,6 +279,7 @@ protected procedure ActivateDatabaseControl; procedure ActivatePasswordControl; + procedure AlignControlTop(aControl: TControl); function CalculatePanelHeight(LastControl: TWinControl): Integer; function ChangePassword: Boolean; procedure ClearControlInterfaceObjects; virtual; @@ -638,17 +640,12 @@ ConnectListLabel := DynControlEngine.CreateStaticTextControl(AForm, ListPanel, 'ConnectListLabel', 'Connection List'); - with ConnectListLabel do - begin - Align := alTop; - Height := 18; - end; + AlignControlTop(ConnectListLabel); + ConnectListLabel.Height := 18; + ListBtnPanel := DynControlEngine.CreatePanelControl(AForm, MainPanel, 'ListBtnPanel', '', alLeft); - with ListBtnPanel do - begin - Width := 32; - end; + ListBtnPanel.Width := 32; AddToListBtn := DynControlEngine.CreateButton(AForm, ListBtnPanel, 'AddToListBtn', '>', RsBtnHintAddDefinitionToList, AddToListBtnClick, False, False); @@ -808,105 +805,71 @@ SavePasswordsCheckBox := DynControlEngine.CreateCheckboxControl(AForm, ListPanel, 'SavePasswordsCheckBox', RsCheckboxSavePasswords); - with SavePasswordsCheckBox do - begin - // Checked := True; - // State := cbChecked; - // OnClick := SavePasswordsCheckBoxClick; - Align := alBottom; - end; + // SavePasswordsCheckBoxChecked := True; + // SavePasswordsCheckBoxState := cbChecked; + // SavePasswordsCheckBoxOnClick := SavePasswordsCheckBoxClick; + SavePasswordsCheckBox.Align := alBottom; Supports(SavePasswordsCheckBox, IJvDynControlCheckBox, ISavePasswordsCheckBox); SavePasswordsCheckBox.Visible := Options.ShowSavePasswords; LeftPanel := DynControlEngine.CreatePanelControl(AForm, MainPanel, 'LeftPanel', '', alLeft); - with LeftPanel do - begin - Width := 216; - if Supports(LeftPanel, IJvDynControlBevelBorder, IDynControlBevelBorder) then - IDynControlBevelBorder.ControlSetBevelOuter(bvNone); - TabOrder := 0; - end; + LeftPanel.Width := 216; + if Supports(LeftPanel, IJvDynControlBevelBorder, IDynControlBevelBorder) then + IDynControlBevelBorder.ControlSetBevelOuter(bvNone); + LeftPanel.TabOrder := 0; ConnectPanel := DynControlEngine.CreatePanelControl(AForm, LeftPanel, 'ConnectPanel', '', alTop); - with ConnectPanel do - begin - Height := 126; - end; - LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'UserNameLabel', RsUsername, nil); - with LabelControl do - begin - Align := alTop; - end; + ConnectPanel.Height := 126; + + LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'UserNameLabel', RsUsername); + AlignControlTop(LabelControl); UsernameEdit := DynControlEngine.CreateEditControl(AForm, ConnectPanel, 'UserNameEdit'); - with UsernameEdit do - begin - Align := alTop; - TabOrder := 0; - Supports(UsernameEdit, IJvDynControlData, IUsernameEditData); - IUsernameEditData.ControlSetOnChange(PasswordEditChange); - IUsernameEditData.ControlValue := ''; - end; + AlignControlTop(UsernameEdit); + UsernameEdit.TabOrder := 0; + Supports(UsernameEdit, IJvDynControlData, IUsernameEditData); + IUsernameEditData.ControlSetOnChange(PasswordEditChange); + IUsernameEditData.ControlValue := ''; if Supports(LabelControl, IJvDynControlLabel, IDynControlLabel) then IDynControlLabel.ControlSetFocusControl(UserNameEdit); - LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'PasswordEditLabel', RsPassword, - PasswordEdit); - with LabelControl do - begin - Align := alTop; - end; + + LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'PasswordEditLabel', RsPassword); + AlignControlTop(LabelControl); + PasswordEdit := DynControlEngine.CreateEditControl(AForm, ConnectPanel, 'PasswordEdit'); - with PasswordEdit do - begin - Align := alTop; - TabOrder := 1; - if Supports(PasswordEdit, IJvDynControlEdit, IDynControlEdit) then - IDynControlEdit.ControlSetPasswordChar('*'); - Supports(PasswordEdit, IJvDynControlData, IPasswordEditData); - IPasswordEditData.ControlSetOnChange(PasswordEditChange); - IPasswordEditData.ControlValue := ''; - end; + AlignControlTop(PasswordEdit); + PasswordEdit.TabOrder := 1; + if Supports(PasswordEdit, IJvDynControlEdit, IDynControlEdit) then + IDynControlEdit.ControlSetPasswordChar('*'); + Supports(PasswordEdit, IJvDynControlData, IPasswordEditData); + IPasswordEditData.ControlSetOnChange(PasswordEditChange); + IPasswordEditData.ControlValue := ''; if Supports(LabelControl, IJvDynControlLabel, IDynControlLabel) then IDynControlLabel.ControlSetFocusControl(PasswordEdit); - LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'DatabaseLabel', RsDatabase, nil); - with LabelControl do - begin - Align := alTop; - end; + + LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectPanel, 'DatabaseLabel', RsDatabase); + AlignControlTop(LabelControl); DatabaseComboBox := DynControlEngine.CreateComboBoxControl(AForm, ConnectPanel, 'DatabaseComboBox', nil); - with DatabaseComboBox do - begin - Align := alTop; - Top := LabelControl.Top + 1; - TabOrder := 2; - Supports(DatabaseComboBox, IJvDynControlData, IDatabaseComboBoxData); - IDatabaseComboBoxData.ControlSetOnChange(DatabaseComboBoxChange); - if Supports(DatabaseComboBox, IJvDynControl, IDynControl) then - IDynControl.ControlSetOnClick(DatabaseComboBoxChange); - IDatabaseComboBoxData.ControlValue := ''; - end; + AlignControlTop(DatabaseComboBox); + DatabaseComboBox.TabOrder := 2; + Supports(DatabaseComboBox, IJvDynControlData, IDatabaseComboBoxData); + IDatabaseComboBoxData.ControlSetOnChange(DatabaseComboBoxChange); + if Supports(DatabaseComboBox, IJvDynControl, IDynControl) then + IDynControl.ControlSetOnClick(DatabaseComboBoxChange); + IDatabaseComboBoxData.ControlValue := ''; if Supports(LabelControl, IJvDynControlLabel, IDynControlLabel) then IDynControlLabel.ControlSetFocusControl(DatabaseComboBox); ShortCutPanel := DynControlEngine.CreatePanelControl(AForm, LeftPanel, 'ShortCutPanel', '', alTop); - with ShortCutPanel do - begin - Align := alTop; - end; - LabelControl := DynControlEngine.CreateLabelControl(AForm, ShortCutPanel, 'ShortCutLabel', RsShortcut, nil); - with LabelControl do - begin - Align := alTop; - end; + AlignControlTop(ShortCutPanel); + LabelControl := DynControlEngine.CreateLabelControl(AForm, ShortCutPanel, 'ShortCutLabel', RsShortcut); + AlignControlTop(LabelControl); Items := tStringList.Create; try FillShortCutList(Items); ShortCutComboBox := DynControlEngine.CreateComboBoxControl(AForm, ShortCutPanel, 'ShortCutComboBox', Items); Supports(ShortCutComboBox, IJvDynControlData, IShortCutComboBoxData); - with ShortCutComboBox do - begin - Align := alTop; - end; + AlignControlTop(ShortCutComboBox); finally Items.Free; end; @@ -915,25 +878,16 @@ ShortCutPanel.Visible := Options.ShowShortcuts; ConnectGroupPanel := DynControlEngine.CreatePanelControl(AForm, LeftPanel, 'ConnectGroupPanel', '', alTop); - with ConnectGroupPanel do - begin - Align := alTop; - end; - LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectGroupPanel, 'ConnectGroupLabel', 'Connect &Group', - nil); - with LabelControl do - begin - Align := alTop; - end; + AlignControlTop(ConnectGroupPanel); + + LabelControl := DynControlEngine.CreateLabelControl(AForm, ConnectGroupPanel, 'ConnectGroupLabel', 'Connect &Group'); + AlignControlTop(LabelControl); Items := tStringList.Create; try ConnectGroupComboBox := DynControlEngine.CreateComboBoxControl(AForm, ConnectGroupPanel, 'ConnectGroupComboBox', Items); Supports(ConnectGroupComboBox, IJvDynControlData, IConnectGroupComboBoxData); - with ConnectGroupComboBox do - begin - Align := alTop; - end; + AlignControlTop(ConnectGroupComboBox); finally Items.Free; end; @@ -1920,6 +1874,12 @@ inherited Destroy; end; +procedure TJvBaseDBLogonDialog.AlignControlTop(aControl: TControl); +begin + aControl.Align := alTop; + aControl.Top := aControl.Parent.Height; +end; + //=== { TJvBaseDBOracleLogonDialogOptions } ================================== constructor TJvBaseDBOracleLogonDialogOptions.Create; @@ -1948,15 +1908,9 @@ IDynControlLabel: IJvDynControlLabel; begin ConnectAsPanel := DynControlEngine.CreatePanelControl(AOwner, AParentControl, 'ConnectAsPanel', '', alTop); - with ConnectAsPanel do - begin - Align := alTop; - end; + AlignControlTop(ConnectAsPanel); LabelControl := DynControlEngine.CreateLabelControl(AOwner, ConnectAsPanel, 'ConnectAsLabel', RsConnectAs, nil); - with LabelControl do - begin - Align := alTop; - end; + AlignControlTop(LabelControl); Items := tStringList.Create; try Items.Add('NORMAL'); @@ -1964,10 +1918,7 @@ Items.Add('SYSOPER'); ConnectAsComboBox := DynControlEngine.CreateComboBoxControl(AOwner, ConnectAsPanel, 'ConnectAsComboBox', Items); Supports(ConnectAsComboBox, IJvDynControlData, IConnectAsComboBoxData); - with ConnectAsComboBox do - begin - Align := alTop; - end; + AlignControlTop(ConnectAsComboBox); finally Items.Free; end; Modified: trunk/jvcl/run/JvDBLogonDialogOdac.pas =================================================================== --- trunk/jvcl/run/JvDBLogonDialogOdac.pas 2008-01-08 01:59:25 UTC (rev 11679) +++ trunk/jvcl/run/JvDBLogonDialogOdac.pas 2008-01-08 02:00:42 UTC (rev 11680) @@ -38,6 +38,24 @@ JvDynControlEngine, JvBaseDBPasswordDialog, JvDynControlEngineIntf; type + + TJvOdacOracleConnectionInfo = class(TJvBaseOracleConnectionInfo) + private + FNet: Boolean; + FOracleHome: string; + public + constructor Create(AOwner: TComponent); override; + function ConnectString(ShowShortCut, ShowConnectGroup: Boolean): string; + override; + property Net: Boolean read FNet write FNet default false; + property OracleHome: string read FOracleHome write FOracleHome; + end; + + TJvOdacOracleConnectionList = class(TJvBaseOracleConnectionList) + protected + function CreateObject: TPersistent; override; + end; + TJvDBOdacLogonDialogOptions = class(TJvBaseDBOracleLogonDialogOptions) private FShowNetOption: Boolean; @@ -71,6 +89,9 @@ function CreatePasswordChangeDialog: TJvBaseDBPasswordDialog; override; procedure FillDatabaseComboBoxDefaultValues(Items: TStrings); override; { Retrieve the class that holds the storage options and format settings. } + class function GetDBLogonConnectionListClass: TJvBaseConnectionListClass; + override; + { Retrieve the class that holds the storage options and format settings. } class function GetDBLogonDialogOptionsClass: TJvBaseDBLogonDialogOptionsClass; override; procedure HandleExpiredPassword(const ErrorMessage: string); procedure ResizeFormControls; override; @@ -162,7 +183,7 @@ uses SysUtils, StdCtrls, Dialogs, - OraClasses, OraError, + OraClasses, OraError, OraCall, JvDSADialogs, JvDBPasswordDialogOdac, JvResources; //=== { TJvDBOdacLogonDialogOptions } ======================================== @@ -360,21 +381,31 @@ var LabelControl: TControl; IDynControlLabel: IJvDynControlLabel; + Items : TStringList; + i: Integer; begin inherited CreateAdditionalConnectDialogControls (AOwner, AParentControl); OracleHomePanel := DynControlEngine.CreatePanelControl(AOwner, AParentControl, 'OracleHomePanel', '', alTop); - OracleHomePanel.Align := alTop; + AlignControlTop(OracleHomePanel); LabelControl := DynControlEngine.CreateLabelControl(AOwner, OracleHomePanel, 'OracleHomeLabel', RsOracleHome, nil); - LabelControl.Align := alTop; - OracleHomeEdit := DynControlEngine.CreateEditControl(AOwner, OracleHomePanel, 'OracleHomeEdit'); + AlignControlTop(LabelControl); + Items := TStringList.Create; + try + for i := 0 to OracleHomeCount - 1 do + Items.Add(OracleHomeNames[i]); + OracleHomeEdit := DynControlEngine.CreateComboBoxControl(AOwner, OracleHomePanel, 'OracleHomeEdit', Items); + finally + Items.Free; + end; Supports(OracleHomeEdit, IJvDynControlData, IOracleHomeEditData); - OracleHomeEdit.Align := alTop; + IOracleHomeEditData.ControlValue := ''; + AlignControlTop(OracleHomeEdit); if Supports(LabelControl, IJvDynControlLabel, IDynControlLabel) then IDynControlLabel.ControlSetFocusControl(OracleHomeEdit); OracleHomePanel.Visible := Options.ShowOracleHome; NetOptionCheckBox := DynControlEngine.CreateCheckboxControl(AOwner,AParentControl, 'NetOptionCheckBox', RsUseNetOptionForDirectConnect); - NetOptionCheckBox.Align := alTop; + AlignControlTop(NetOptionCheckBox); NetOptionCheckBox.Visible := Options.ShowNetOption; Supports(NetOptionCheckBox, IJvDynControlCheckBox, INetOptionCheckBox); NetOptionCheckBox.Hint := RsNetOptionCheckBoxHint; @@ -395,6 +426,12 @@ begin end; +class function TJvDBOdacLogonDialog.GetDBLogonConnectionListClass: + TJvBaseConnectionListClass; +begin + Result := TJvOdacOracleConnectionList; +end; + class function TJvDBOdacLogonDialog.GetDBLogonDialogOptionsClass: TJvBaseDBLogonDialogOptionsClass; begin Result := TJvDBOdacLogonDialogOptions; @@ -453,11 +490,32 @@ procedure TJvDBOdacLogonDialog.TransferConnectionInfoFromDialog(ConnectionInfo: TJvBaseConnectionInfo); begin inherited TransferConnectionInfoFromDialog(ConnectionInfo); + if (ConnectionInfo is TJvOdacOracleConnectionInfo) then + begin + if Assigned (INetOptionCheckBox) then + TJvOdacOracleConnectionInfo(ConnectionInfo).Net := INetOptionCheckBox.ControlState = cbChecked + else + TJvOdacOracleConnectionInfo(ConnectionInfo).Net := False; + if Assigned (IOracleHomeEditData) then + TJvOdacOracleConnectionInfo(ConnectionInfo).OracleHome := IOracleHomeEditData.ControlValue + else + TJvOdacOracleConnectionInfo(ConnectionInfo).OracleHome := ''; + end; end; procedure TJvDBOdacLogonDialog.TransferConnectionInfoToDialog(ConnectionInfo: TJvBaseConnectionInfo); begin inherited TransferConnectionInfoToDialog(ConnectionInfo); + if (ConnectionInfo is TJvOdacOracleConnectionInfo) then + begin + if Assigned (INetOptionCheckBox) then + if TJvOdacOracleConnectionInfo(ConnectionInfo).Net then + INetOptionCheckBox.ControlState := cbChecked + else + INetOptionCheckBox.ControlState := cbunChecked; + if Assigned (IOracleHomeEditData) then + IOracleHomeEditData.ControlValue := TJvOdacOracleConnectionInfo(ConnectionInfo).OracleHome; + end; end; procedure TJvDBOdacLogonDialog.TransferSessionDataFromConnectionInfo(ConnectionInfo: TJvBaseConnectionInfo); @@ -476,10 +534,13 @@ OraSession.ConnectMode := cmSYSOper else OraSession.ConnectMode := cmNormal; - if Options.ShowNetOption and Assigned(INetOptionCheckBox) then - OraSession.Options.Net := INetOptionCheckBox.ControlState = cbChecked; - if Options.ShowNetOption and Assigned(IOracleHomeEditData) then - OraSession.HomeName := IOracleHomeEditData.ControlValue; + if (ConnectionInfo is TJvOdacOracleConnectionInfo) then + begin + if Options.ShowNetOption then + OraSession.Options.Net := TJvOdacOracleConnectionInfo(ConnectionInfo).Net; + if Options.ShowOracleHome then + OraSession.HomeName := TJvOdacOracleConnectionInfo(ConnectionInfo).OracleHome; + end; end; end; end; @@ -501,17 +562,38 @@ else TJvBaseOracleConnectionInfo(ConnectionInfo).ConnectAs := 'NORMAL'; end; - if Options.ShowNetOption and Assigned (INetOptionCheckBox) then - if OraSession.Options.Net then - INetOptionCheckBox.ControlState := cbChecked - else - INetOptionCheckBox.ControlState := cbUnChecked; - if Options.ShowNetOption and Assigned (IOracleHomeEditData) then - IOracleHomeEditData.ControlValue := OraSession.HomeName; + if (ConnectionInfo is TJvOdacOracleConnectionInfo) then + begin + if Options.ShowNetOption then + TJvOdacOracleConnectionInfo(ConnectionInfo).net := OraSession.Options.net; + if Options.ShowOracleHome and Assigned (IOracleHomeEditData) then + TJvOdacOracleConnectionInfo(ConnectionInfo).OracleHome := OraSession.HomeName; + end; end; end; end; +function TJvOdacOracleConnectionList.CreateObject: TPersistent; +begin + Result := TJvOdacOracleConnectionInfo.Create(Self); +end; + +constructor TJvOdacOracleConnectionInfo.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FNet := false; +end; + +function TJvOdacOracleConnectionInfo.ConnectString(ShowShortCut, + ShowConnectGroup: Boolean): string; +begin + Result := inherited ConnectString(ShowShortCut, ShowConnectGroup); + if OracleHome <> '' then + Result:= Result + ' - '+OracleHome; + if Net then + Result := Result + ' - '+RsNetOptionConnectionList; +end; + {$IFDEF UNITVERSIONING} initialization RegisterUnitVersion(HInstance, UnitVersioning); Modified: trunk/jvcl/run/JvResources.pas =================================================================== --- trunk/jvcl/run/JvResources.pas 2008-01-08 01:59:25 UTC (rev 11679) +++ trunk/jvcl/run/JvResources.pas 2008-01-08 02:00:42 UTC (rev 11680) @@ -266,6 +266,7 @@ ' Host is the address of server;'#13#10+ ' Port is the number of port that server listens to;'#13#10+ ' SID is system identifier that specifies Global Database Name.'; + RsNetOptionConnectionList = 'NET Option'; //=== JvBDEExceptionForm.pas ================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |