ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/design/IBDBReg.pas
(Generate patch)

Comparing ibx/trunk/design/IBDBReg.pas (file contents):
Revision 19 by tony, Mon Jul 7 13:00:15 2014 UTC vs.
Revision 21 by tony, Thu Feb 26 10:33:34 2015 UTC

# Line 57 | Line 57 | interface
57   uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo,
58       DB, IBTable, IBDatabase,  IBEventsEditor,  LazarusPackageIntf,
59        IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor,
60 <     dbFieldLinkPropEditor;
60 >     dbFieldLinkPropEditor, dbFieldListPropEditor;
61  
62   type
63  
# Line 325 | Line 325 | type
325      procedure Edit; override;
326    end;
327  
328 +  { TDBDynamicGridFieldProperty }
329 +
330 +  TDBDynamicGridFieldProperty = class(TFieldProperty)
331 +  public
332 +    procedure FillValues(const Values: TStringList); override;
333 +  end;
334 +
335 +  { TDBLookupPropertiesGridFieldProperty }
336 +
337 +  TDBLookupPropertiesGridFieldProperty = class(TFieldProperty)
338 +  public
339 +    procedure FillValues(const Values: TStringList); override;
340 +  end;
341 +
342 +  { TIBTreeViewFieldProperty }
343 +
344 +  TIBTreeViewFieldProperty = class(TFieldProperty)
345 +  public
346 +    procedure FillValues(const Values: TStringList); override;
347 +  end;
348 +
349 +  { TIBDynamicGridIndexNamesProperty }
350 +
351 +  TIBDynamicGridIndexNamesProperty = class(TIndexFieldNamesProperty)
352 +  protected
353 +    function GetFieldDefs: TFieldDefs; override;
354 +    function GetIndexFieldNames: string; override;
355 +    procedure SetIndexFieldNames(const Value: string); override;
356 +  end;
357 +
358 +
359 +
360   procedure Register;
361  
362   implementation
# Line 332 | Line 364 | implementation
364   uses IB, IBQuery, IBStoredProc, IBCustomDataSet,
365       IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents,
366       IBServices, IBDatabaseEdit, IBTransactionEdit,
367 <     IBBatchMove, DBLoginDlg, IBExtract,LResources, IBSelectSQLEditor,
367 >     IBBatchMove, IBExtract,LResources, IBSelectSQLEditor,
368       IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
369       IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
370 <     IBSQLEditor, ibserviceeditor, LCLVersion;
370 >     IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox,
371 >     IBTreeView;
372  
373  
374  
# Line 360 | Line 393 | begin
393      RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
394        TIBRestoreService, TIBValidationService, TIBStatisticalService,
395        TIBLogService, TIBSecurityService, TIBServerProperties]);
396 +
397 +
398 +  RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView]);
399    RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize}
400    RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize}
401    RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty);
# Line 390 | Line 426 | begin
426    RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor);
427    RegisterComponentEditor(TIBSQL, TIBSQLEditor);
428    RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
429 +
430 +
431 +  {Firebird Data Access Controls}
432 +  RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'KeyField', TDBDynamicGridFieldProperty);
433 +  RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'ListField', TDBDynamicGridFieldProperty);
434 +  RegisterPropertyEditor(TypeInfo(string), TIBDynamicGrid, 'IndexFieldNames', TIBDynamicGridIndexNamesProperty);
435 +  RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'DataFieldName', TDBLookupPropertiesGridFieldProperty);
436 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'KeyField', TIBTreeViewFieldProperty);
437 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'TextField', TIBTreeViewFieldProperty);
438 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty);
439 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty);
440 +
441 + end;
442 +
443 + procedure LoadDataSourceFields(DataSource: TDataSource; List: TStrings);
444 + var
445 +  DataSet: TDataSet;
446 +  i: Integer;
447 + begin
448 +  if Assigned(DataSource) then
449 +  begin
450 +    DataSet := DataSource.DataSet;
451 +    if Assigned(DataSet) then
452 +    begin
453 +      if DataSet.Fields.Count > 0 then
454 +        DataSet.GetFieldNames(List)
455 +      else
456 +      begin
457 +        DataSet.FieldDefs.Update;
458 +        for i := 0 to DataSet.FieldDefs.Count - 1 do
459 +          List.Add(DataSet.FieldDefs[i].Name);
460 +      end;
461 +    end;
462 +  end;
463 + end;
464 +
465 + { TDBLookupPropertiesGridFieldProperty }
466 +
467 + procedure TDBLookupPropertiesGridFieldProperty.FillValues(
468 +  const Values: TStringList);
469 + var
470 +  P: TDBLookupProperties;
471 + begin
472 +  P :=TDBLookupProperties(GetComponent(0));
473 +  if not (P is TDBLookupProperties) then exit;
474 +  LoadDataSourceFields(TIBDynamicGrid(P.Owner.Grid).DataSource, Values);
475 + end;
476 +
477 + { TIBTreeViewFieldProperty }
478 +
479 + procedure TIBTreeViewFieldProperty.FillValues(const Values: TStringList);
480 + var ListSource: TDataSource;
481 + begin
482 +  ListSource :=  TIBTreeView(GetComponent(0)).DataSource;
483 +  LoadDataSourceFields(ListSource, Values);
484 + end;
485 +
486 + { TIBDynamicGridIndexNamesProperty }
487 +
488 + function TIBDynamicGridIndexNamesProperty.GetFieldDefs: TFieldDefs;
489 + var Grid: TIBDynamicGrid;
490 + begin
491 +  Result := nil;
492 +  Grid := TIBDynamicGrid(GetComponent(0));
493 +  if assigned(Grid.DataSource) and assigned(Grid.DataSource.DataSet) then
494 +     Result := Grid.DataSource.DataSet.FieldDefs
495 + end;
496 +
497 + function TIBDynamicGridIndexNamesProperty.GetIndexFieldNames: string;
498 + var Grid: TIBDynamicGrid;
499 + begin
500 +  Grid := TIBDynamicGrid(GetComponent(0));
501 +  Result := Grid.IndexFieldNames
502 + end;
503 +
504 + procedure TIBDynamicGridIndexNamesProperty.SetIndexFieldNames(
505 +  const Value: string);
506 + var Grid: TIBDynamicGrid;
507 + begin
508 +  Grid := TIBDynamicGrid(GetComponent(0));
509 +  Grid.IndexFieldNames := Value
510 + end;
511 +
512 + { TDBDynamicGridFieldProperty }
513 +
514 + procedure TDBDynamicGridFieldProperty.FillValues(const Values: TStringList);
515 + var
516 +  P: TDBLookupProperties;
517 + begin
518 +  P :=TDBLookupProperties(GetComponent(0));
519 +  if not (P is TDBLookupProperties) then exit;
520 +  LoadDataSourceFields(P.ListSource, Values);
521   end;
522  
523   { TIBServiceEditor }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines