~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to pgadmin/schema/pgConstraints.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2011-06-07 23:03:54 UTC
  • mfrom: (1.3.1 upstream) (13 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110607230354-3td4j9y71u4ahcvj
Tags: 1.14.0~beta1-1
* New upstream development release, adding Build-Depends on
  postgresql-server-dev-all >= 117~.
* Add Build-Depends on quilt, (un)patch to debian/rules and patch for fixing
  the include for kwlist.h in pgadmin/db/keywords.c.
* Add pg_config --includedir-server output to CPPFLAGS.
* Remove unrecognized configure options: --with-wx-config,
  --with-pgsql-include, --enable-gtk2, --enable-unicode.
* Clean up manually the files that are left behind after the broken
  distclean.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//////////////////////////////////////////////////////////////////////////
2
2
//
3
3
// pgAdmin III - PostgreSQL Tools
4
 
// 
5
 
// Copyright (C) 2002 - 2010, The pgAdmin Development Team
 
4
//
 
5
// Copyright (C) 2002 - 2011, The pgAdmin Development Team
6
6
// This software is released under the PostgreSQL Licence
7
7
//
8
8
// pgConstraint.cpp - Constraint collection
21
21
#include "schema/pgForeignKey.h"
22
22
 
23
23
 
24
 
 
25
24
pgConstraintCollection::pgConstraintCollection(pgaFactory *factory, pgTable *table)
26
 
: pgTableObjCollection(factory, table)
27
 
 
25
        : pgTableObjCollection(factory, table)
 
26
{
28
27
}
29
28
 
30
29
wxMenu *pgConstraintCollection::GetNewMenu()
31
30
{
32
 
    if (!GetSchema()->GetCreatePrivilege())
33
 
        return 0;
 
31
        if (!GetSchema()->GetCreatePrivilege())
 
32
                return 0;
34
33
 
35
 
    wxMenu *menu=new wxMenu();
36
 
    if (table->GetPrimaryKey().IsEmpty())
37
 
        primaryKeyFactory.AppendMenu(menu);
38
 
    foreignKeyFactory.AppendMenu(menu);
39
 
    uniqueFactory.AppendMenu(menu);
40
 
    checkFactory.AppendMenu(menu);
41
 
    return menu;
 
34
        wxMenu *menu = new wxMenu();
 
35
        if (table->GetPrimaryKey().IsEmpty())
 
36
                primaryKeyFactory.AppendMenu(menu);
 
37
        foreignKeyFactory.AppendMenu(menu);
 
38
        excludeFactory.AppendMenu(menu);
 
39
        uniqueFactory.AppendMenu(menu);
 
40
        checkFactory.AppendMenu(menu);
 
41
        return menu;
42
42
}
43
43
 
44
44
 
45
45
void pgConstraintCollection::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
46
46
{
47
 
    if (browser->GetChildrenCount(GetId(), false) == 0)
48
 
    {
49
 
        wxTreeItemId id=browser->GetItemParent(GetId());
50
 
        wxASSERT(id);
51
 
        table = (pgTable*)browser->GetObject(id);
52
 
        wxASSERT(table && (table->GetMetaType() == PGM_TABLE || table->GetMetaType() == GP_PARTITION));
 
47
        if (browser->GetChildrenCount(GetId(), false) == 0)
 
48
        {
 
49
                wxTreeItemId id = browser->GetItemParent(GetId());
 
50
                wxASSERT(id);
 
51
                table = (pgTable *)browser->GetObject(id);
 
52
                wxASSERT(table && (table->GetMetaType() == PGM_TABLE || table->GetMetaType() == GP_PARTITION));
53
53
 
54
 
        primaryKeyFactory.CreateObjects(this, browser);
55
 
        foreignKeyFactory.CreateObjects(this, browser);
56
 
        uniqueFactory.CreateObjects(this, browser);
57
 
        checkFactory.CreateObjects(this, browser);
58
 
    }
59
 
    UpdateChildCount(browser);
60
 
    if (properties)
61
 
        ShowList(_("Constraints"), browser, properties);
 
54
                primaryKeyFactory.CreateObjects(this, browser);
 
55
                foreignKeyFactory.CreateObjects(this, browser);
 
56
                excludeFactory.CreateObjects(this, browser);
 
57
                uniqueFactory.CreateObjects(this, browser);
 
58
                checkFactory.CreateObjects(this, browser);
 
59
        }
 
60
        UpdateChildCount(browser);
 
61
        if (properties)
 
62
                ShowList(_("Constraints"), browser, properties);
62
63
}
63
64
 
64
65
 
65
66
 
66
67
/////////////////////////////
67
68
 
68
 
#include "images/constraints.xpm"
 
69
#include "images/constraints.pngc"
69
70
 
70
 
pgConstraintFactory::pgConstraintFactory() 
71
 
: pgTableObjFactory(__("Constraint"), 0, 0, 0)
 
71
pgConstraintFactory::pgConstraintFactory()
 
72
        : pgTableObjFactory(__("Constraint"), 0, 0, 0)
72
73
{
73
 
    metaType = PGM_CONSTRAINT;
 
74
        metaType = PGM_CONSTRAINT;
74
75
}
75
76
 
76
77
pgCollection *pgConstraintFactory::CreateCollection(pgObject *obj)
77
78
{
78
 
    return new pgConstraintCollection(GetCollectionFactory(), (pgTable*)obj);
 
79
        return new pgConstraintCollection(GetCollectionFactory(), (pgTable *)obj);
79
80
}
80
81
 
81
82
 
82
83
pgConstraintFactory constraintFactory;
83
 
pgaCollectionFactory constraintCollectionFactory(&constraintFactory, __("Constraints"), constraints_xpm);
 
84
pgaCollectionFactory constraintCollectionFactory(&constraintFactory, __("Constraints"), constraints_png_img);
84
85
 
85
86