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 <QtGui/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 supportsDateTime() const
te::da::DataTypeCapabilities dataTypeCapabilities
An atomic property like an integer or double.
bool supportsGeometry() const
bool supportsChar() const
A base widget for simple properties.
bool supportsInt64() const
virtual Property * clone() const
It returns a clone of the object.
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.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
QGridLayout * m_layout
Qt Layout object.
static te::qt::widgets::SimplePropertyWidget * make(const int &type)
void onDataTypeComboBoxActivated(int index)
NewPropertyWidget(QWidget *parent=0, Qt::WindowFlags f=0)
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
static const factory_type * find(const int &factoryKey)
bool supportsUChar() const
bool supportsBoolean() const
te::dt::SimpleProperty * getProperty()
It returns a simple property class object.
boost::shared_ptr< DataSource > DataSourcePtr
bool supportsInt16() const
const DataTypeCapabilities & getDataTypeCapabilities() const
bool supportsNumeric() const
bool supportsDouble() const
bool supportsInt32() const
std::auto_ptr< Ui::NewPropertyWidgetForm > m_ui
bool supportsUInt64() const
A class used to define the NewPropertyWidget class.
bool supportsUInt16() const
bool supportsUInt32() const
The type for arbitrary precison numbers, like numeric(p, q).
bool supportsString() const
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
void setDataSourceId(std::string id)
Used to get all data types supported by this data source.
A class that represents the supported data types of a specific data source.
bool supportsFloat() const
te::da::DataSourceCapabilities capabilities