Changeset 16 for trunk/Forms/UMainForm.pas
- Timestamp:
- Jun 13, 2011, 12:43:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r15 r16 289 289 Database.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `' + TypeRelationOne + '` ( ' + 290 290 '`Id` int(11) NOT NULL AUTO_INCREMENT,' + 291 '` Type` int(11) NOT NULL,' +291 '`CustomType` int(11) NOT NULL,' + 292 292 '`Object` int(11) NOT NULL,' + 293 'KEY ` Type` (`Type`),' +293 'KEY `CustomType` (`CustomType`),' + 294 294 'PRIMARY KEY (`Id`)' + 295 295 ') ENGINE=InnoDB DEFAULT CHARSET=utf8'); … … 299 299 Database.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `' + TypeRelationMany + '` ( ' + 300 300 '`Id` int(11) NOT NULL AUTO_INCREMENT,' + 301 '` Type` int(11) NOT NULL,' +301 '`CustomType` int(11) NOT NULL,' + 302 302 '`ObjectProperty` int(11) NOT NULL,' + 303 'KEY ` Type` (`Type`),' +303 'KEY `CustomType` (`CustomType`),' + 304 304 'PRIMARY KEY (`Id`)' + 305 305 ') ENGINE=InnoDB DEFAULT CHARSET=utf8'); … … 365 365 var 366 366 ObjectId: Integer; 367 ObjectGroupId: Integer; 368 PropertyParentId: Integer; 369 ObjectPropertyGroupId: Integer; 370 PropertyTypeId: Integer; 371 ObjectPropertyId: Integer; 372 ObjectPropertyIdGroup: Integer; 373 PropertyObjectId: Integer; 374 CustomTypeId: Integer; 375 CustomTypeIdType: Integer; 376 ObjectIdGroupId: Integer; 367 377 TypeNumber: Integer; 378 ObjectGroupParentId: Integer; 368 379 TypeString: Integer; 369 380 TypeBoolean: Integer; … … 405 416 GroupId := AddObjectGroup('System'); 406 417 407 ObjectId := AddObject('Object groups', 'ObjectGroup', Core.System.Database.Database, GroupId); 408 AddPropertyString(ObjectId, 'Name', 'Name'); 409 AddPropertyNumber(ObjectId, 'Parent', 'Parent'); 418 ObjectGroupId := AddObject('Object groups', 'ObjectGroup', Core.System.Database.Database, GroupId); 419 AddPropertyString(ObjectGroupId, 'Name', 'Name'); 420 ObjectGroupParentId := AddPropertyRelationOne(ObjectGroupId, 'Parent', 'Parent', ObjectGroupId); 421 410 422 ObjectId := AddObject('Objects', 'Object', Core.System.Database.Database, GroupId); 411 423 AddPropertyString(ObjectId, 'Name', 'Name'); 412 AddPropertyNumber(ObjectId, 'Group', 'Group');424 ObjectIdGroupId := AddPropertyRelationOne(ObjectId, 'Group', 'Group', ObjectGroupId); 413 425 AddPropertyString(ObjectId, 'Schema', 'Schema'); 414 426 AddPropertyString(ObjectId, 'Table', 'Table'); 415 427 AddPropertyString(ObjectId, 'Primary key', 'PrimaryKey'); 416 428 AddPropertyNumber(ObjectId, 'Sequence', 'Sequence'); 417 ObjectId := AddObject('Property types', 'Type', Core.System.Database.Database, GroupId); 418 AddPropertyString(ObjectId, 'Name', 'Name'); 419 AddPropertyString(ObjectId, 'Type', 'DbType'); 429 430 PropertyTypeId := AddObject('Property types', 'Type', Core.System.Database.Database, GroupId); 431 AddPropertyString(PropertyTypeId, 'Name', 'Name'); 432 AddPropertyString(PropertyTypeId, 'Type', 'DbType'); 420 433 //AddPropertyNumber(ObjectId, 'Parent', 'Parent'); 421 ObjectId := AddObject('Property groups', 'PropertyGroup', Core.System.Database.Database, GroupId); 422 ObjectId := AddObject('Properties', 'Property', Core.System.Database.Database, GroupId); 423 AddPropertyString(ObjectId, 'Name', 'Name'); 424 AddPropertyNumber(ObjectId, 'Object', 'Object'); 425 AddPropertyNumber(ObjectId, 'Property group', 'PropertyGroup'); 426 AddPropertyNumber(ObjectId, 'Custom type', 'CustomType'); 427 AddProperty(ObjectId, 'Editable', 'Editable', TypeBoolean); 428 AddPropertyString(ObjectId, 'Column name', 'ColumnName'); 434 435 CustomTypeId := AddObject('Custom types', 'TypeCustom', Core.System.Database.Database, GroupId); 436 CustomTypeIdType := AddPropertyRelationOne(CustomTypeId, 'Type', 'Type', PropertyTypeId); 437 438 ObjectPropertyGroupId := AddObject('Property groups', 'PropertyGroup', Core.System.Database.Database, GroupId); 439 440 ObjectPropertyId := AddObject('Properties', 'Property', Core.System.Database.Database, GroupId); 441 AddPropertyString(ObjectPropertyId, 'Name', 'Name'); 442 PropertyObjectId := AddPropertyRelationOne(ObjectPropertyId, 'Object', 'Object', ObjectId); 443 ObjectPropertyIdGroup := AddPropertyRelationOne(ObjectPropertyId, 'Property group', 'PropertyGroup', ObjectPropertyGroupId); 444 AddPropertyNumber(ObjectPropertyId, 'Custom type', 'CustomType'); 445 AddProperty(ObjectPropertyId, 'Editable', 'Editable', TypeBoolean); 446 AddPropertyString(ObjectPropertyId, 'Column name', 'ColumnName'); 447 448 AddPropertyRelationMany(ObjectGroupId, 'Childs', 'Childs', PropertyParentId); 449 AddPropertyRelationMany(ObjectGroupId, 'Objects', 'Objects', ObjectIdGroupId); 450 AddPropertyRelationMany(ObjectId, 'Properties', 'Properties', PropertyParentId); 451 AddPropertyRelationMany(ObjectPropertyGroupId, 'Properties', 'Properties', ObjectPropertyIdGroup); 452 AddPropertyRelationMany(PropertyTypeId, 'Custom types', 'CustomTypes', CustomTypeIdType); 429 453 end; 430 454 end; … … 464 488 procedure TMainForm.AItemViewExecute(Sender: TObject); 465 489 begin 466 ItemViewForm.Show; 490 if Assigned(ListView1.Selected) then 491 ItemViewForm.Show; 467 492 end; 468 493 … … 573 598 Item.Caption := Items[0]; 574 599 for I := 1 to Items.Count - 1 do 600 if not TReportColumn(Report.Columns[I]).VirtualItem then 575 601 Item.SubItems.Add(Items[I]); 576 602 end; … … 680 706 681 707 Columns.Clear; 682 for I := 0 to Report.Columns.Count - 1 do begin 708 for I := 0 to Report.Columns.Count - 1 do 709 if not TReportColumn(Report.Columns[I]).VirtualItem then begin 683 710 NewColumn := Columns.Add; 684 711 NewColumn.Caption := TReportColumn(Report.Columns[I]).Caption; … … 688 715 end; 689 716 ListView1Resize(Self); 717 ListView1SelectItem(Self, nil, False); 690 718 end; 691 719
Note:
See TracChangeset
for help on using the changeset viewer.