All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstraintsIndexesPropertyDialog.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/property/ConstraintsIndexesPropertyDialog.cpp
22 
23  \brief A class used to define a constraint or index property creator.
24 */
25 
26 // TerraLib
27 #include "../../../dataaccess/dataset/DataSetType.h"
29 #include "IndexWidget.h"
32 #include "ui_ConstraintsIndexesPropertyDialogForm.h"
33 
34 
36  : QDialog(parent, f),
37  m_ui(new Ui::ConstraintsIndexesPropertyDialogForm),
38  m_pkConstraintWidget(0),
39  m_ukConstraintWidget(0),
40  m_indexWidget(0)
41 {
42  m_ui->setupUi(this);
43 
44  m_dsType = dsType;
45 
46  //set layout
47  m_widgetLayout = new QGridLayout(m_ui->m_widget);
48 
49  //connects
50  connect(m_ui->m_pkRadioButton, SIGNAL(toggled(bool)), this, SLOT(onpkRadioButtonToggled(bool)));
51  connect(m_ui->m_ukRadioButton, SIGNAL(toggled(bool)), this, SLOT(onukRadioButtonToggled(bool)));
52  connect(m_ui->m_idxRadioButton, SIGNAL(toggled(bool)), this, SLOT(onidxRadioButtonToggled(bool)));
53  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onokPushButtonClicked()));
54 
55  m_ui->m_helpPushButton->setPageReference("widgets/property/constraints_indexes.html");
56 }
57 
59 {
60 }
61 
63 {
64  if(status == false)
65  return;
66 
67  freeWidget();
68 
69  m_pkConstraintWidget = new te::qt::widgets::PrimaryKeyConstraintWidget(m_dsType, m_ui->m_widget);
70 
71  m_widgetLayout->addWidget(m_pkConstraintWidget);
72 }
73 
75 {
76  if(status == false)
77  return;
78 
79  freeWidget();
80 
81  m_ukConstraintWidget = new te::qt::widgets::UniqueKeyConstraintWidget(m_dsType, m_ui->m_widget);
82 
83  m_widgetLayout->addWidget(m_ukConstraintWidget);
84 }
85 
87 {
88  if(status == false)
89  return;
90 
91  freeWidget();
92 
93  m_indexWidget = new te::qt::widgets::IndexWidget(m_dsType, m_ui->m_widget);
94 
95  m_widgetLayout->addWidget(m_indexWidget);
96 }
97 
99 {
100  if(m_ui->m_pkRadioButton->isChecked())
101  {
102  if(m_pkConstraintWidget->checkParameters() == false)
103  return;
104 
105  m_pkConstraintWidget->getConstraint();
106  }
107  else if(m_ui->m_ukRadioButton->isChecked())
108  {
109  if(m_ukConstraintWidget->checkParameters() == false)
110  return;
111 
112  m_ukConstraintWidget->getConstraint();
113  }
114  else if(m_ui->m_idxRadioButton->isChecked())
115  {
116  if(m_indexWidget->checkParameters() == false)
117  return;
118 
119  m_indexWidget->getIndex();
120  }
121  else
122  {
123  return;
124  }
125 
126  accept();
127 }
128 
130 {
131  if(m_indexWidget)
132  {
133  m_widgetLayout->removeWidget(m_indexWidget);
134  delete m_indexWidget;
135  m_indexWidget = 0;
136  }
137 
138  if(m_pkConstraintWidget)
139  {
140  m_widgetLayout->removeWidget(m_pkConstraintWidget);
141  delete m_pkConstraintWidget;
142  m_pkConstraintWidget = 0;
143  }
144 
145  if(m_ukConstraintWidget)
146  {
147  m_widgetLayout->removeWidget(m_ukConstraintWidget);
148  delete m_ukConstraintWidget;
149  m_ukConstraintWidget = 0;
150  }
151 }
std::auto_ptr< Ui::ConstraintsIndexesPropertyDialogForm > m_ui
A class used to define a constraint or index property creator.
This class is used to define a Unique Key Constraint DataSet class object.
This file has the IndexWidget class.
This class is used to define a Primare Key Constraint DataSet class object.
This class is used to define a Index DataSet class object.
Definition: IndexWidget.h:53
A class that models the description of a dataset.
Definition: DataSetType.h:72
ConstraintsIndexesPropertyDialog(te::da::DataSetType *dsType, QWidget *parent=0, Qt::WindowFlags f=0)
This file has the PrimaryKeyConstraintWidget class.