27 #include "../../../dataaccess/datasource/DataSourceManager.h"
28 #include "../../../dataaccess/datasource/DataSourceCapabilities.h"
29 #include "../../../datatype/DateTimeProperty.h"
30 #include "../../../datatype/NumericProperty.h"
31 #include "../../../datatype/SimpleProperty.h"
32 #include "../../../datatype/StringProperty.h"
33 #include "../../../geometry/GeometryProperty.h"
37 #include "ui_NewPropertyWidgetForm.h"
40 #include <QMessageBox>
45 m_ui(new Ui::NewPropertyWidgetForm),
53 m_layout->setAlignment(Qt::AlignTop);
62 delete m_simpleProperty;
70 m_ui->m_dataTypeComboBox->clear();
71 m_ui->m_dataTypeComboBox->addItem(
"");
155 if(m_ui->m_dataTypeComboBox->currentText().isEmpty())
157 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Type not selected."));
161 if(m_ui->m_nameLineEdit->text().isEmpty())
163 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Name not defined."));
166 std::string name = m_ui->m_nameLineEdit->text().toStdString();
168 std::string defaultValue =
"";
169 if(m_ui->m_defaultValueLineEdit->text().isEmpty() ==
false)
171 defaultValue = m_ui->m_defaultValueLineEdit->text().toStdString();
174 bool isRequired =
false;
175 if(m_ui->m_requiredCheckBox->isEnabled())
177 isRequired = m_ui->m_requiredCheckBox->isChecked();
180 bool isAutoNumber =
false;
181 if(m_ui->m_autoNumberCheckBox->isEnabled())
183 isAutoNumber = m_ui->m_autoNumberCheckBox->isChecked();
187 delete m_simpleProperty;
189 int index = m_ui->m_dataTypeComboBox->currentIndex();
190 int dataType = m_ui->m_dataTypeComboBox->itemData(index).toInt();
207 m_simpleProperty->setAutoNumber(isAutoNumber);
220 m_simpleProperty->setAutoNumber(isAutoNumber);
238 m_simpleProperty = 0;
245 m_spWidget->fillProperty(m_simpleProperty);
253 int dataType = m_ui->m_dataTypeComboBox->itemData(index).toInt();
260 m_layout->addWidget(m_spWidget);
269 m_ui->m_nameLineEdit->clear();
271 m_ui->m_defaultValueLineEdit->clear();
272 m_ui->m_defaultValueLineEdit->setEnabled(
false);
274 m_ui->m_autoNumberCheckBox->setChecked(
false);
275 m_ui->m_autoNumberCheckBox->setEnabled(
false);
277 m_ui->m_requiredCheckBox->setChecked(
false);
278 m_ui->m_requiredCheckBox->setEnabled(
false);
282 m_ui->m_defaultValueLineEdit->setEnabled(m_spWidget->hasAttributeDefaultValue());
283 m_ui->m_autoNumberCheckBox->setEnabled(m_spWidget->hasAttributeAutoNumber());
284 m_ui->m_requiredCheckBox->setEnabled(m_spWidget->hasAttributeRequired());
bool supportsUInt16() const
An atomic property like an integer or double.
bool supportsUInt32() const
bool supportsBoolean() const
bool supportsChar() const
boost::shared_ptr< DataSource > DataSourcePtr
const DataTypeCapabilities & getDataTypeCapabilities() const
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
bool supportsNumeric() const
A class that represents the supported data types of a specific data source.
The type for arbitrary precison numbers, like numeric(p, q).
bool supportsInt16() const
te::da::DataTypeCapabilities dataTypeCapabilities
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
bool supportsString() const
te::da::DataSourceCapabilities capabilities
bool supportsInt64() const
The type for string types: FIXED_STRING, VAR_STRING or STRING.
bool supportsFloat() const
virtual Property * clone() const
It returns a clone of the object.
bool supportsUInt64() const
bool supportsGeometry() const
static const factory_type * find(const int &factoryKey)
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
bool supportsInt32() const
bool supportsDateTime() const
bool supportsUChar() const
bool supportsDouble() const