Beispiel #1
0
FunctionWidget::FunctionWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_FUNCTION)
{
	try
	{
		QStringList types;
		QGridLayout *grid=NULL, *grid1=NULL;
		map<QString, vector<QWidget *> > fields_map;
		QFrame *frame=NULL;

		Ui_FunctionWidget::setupUi(this);

		configureFormLayout(function_grid, OBJ_FUNCTION);
		connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void)));

		source_code_hl=new SyntaxHighlighter(source_code_txt, true);
		ret_type=new PgSQLTypeWidget(this);

		return_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																			 ObjectTableWidget::UPDATE_BUTTON, true, this);
		return_tab->setColumnCount(2);
		return_tab->setHeaderLabel(trUtf8("Column"), 0);
		return_tab->setHeaderIcon(QPixmap(":/icones/icones/column.png"),0);
		return_tab->setHeaderLabel(trUtf8("Type"), 1);
		return_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);

		parameters_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																					 ObjectTableWidget::UPDATE_BUTTON, true, this);
		parameters_tab->setColumnCount(4);
		parameters_tab->setHeaderLabel(trUtf8("Name"),0);
		parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/parameter.png"),0);
		parameters_tab->setHeaderLabel(trUtf8("Type"),1);
		parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);
		parameters_tab->setHeaderLabel(trUtf8("IN/OUT"),2);
		parameters_tab->setHeaderLabel(trUtf8("Default Value"),3);

		grid=new QGridLayout;
		grid->addWidget(parameters_tab,0,0,1,1);
		grid->setContentsMargins(2,2,2,2);
		func_config_twg->widget(1)->setLayout(grid);

		grid=dynamic_cast<QGridLayout *>(func_config_twg->widget(0)->layout());
		grid->addWidget(ret_type, grid->count(), 0, 1, 4);
		grid->addWidget(ret_table_gb, grid->count()-1, 0, 1, 4);

		grid1=new QGridLayout;
		grid1->addWidget(return_tab, 0, 0, 1, 1);
		grid1->setContentsMargins(2,2,2,2);
		ret_table_gb->setLayout(grid1);
		ret_table_gb->setVisible(false);

		fields_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_84)].push_back(table_rb);
		fields_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_84)].push_back(window_func_lbl);
		frame=generateVersionWarningFrame(fields_map);
		grid->addWidget(frame, grid->count()+1, 0, 1, 0);
		frame->setParent(func_config_twg->widget(0));

		parent_form->setMinimumSize(645, 675);

		SecurityType::getTypes(types);
		security_cmb->addItems(types);

		FunctionType::getTypes(types);
		func_type_cmb->addItems(types);

		BehaviorType::getTypes(types);
		behavior_cmb->addItems(types);

		connect(simple_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(set_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(table_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(language_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectLanguage(void)));

		connect(parameters_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm()));
		connect(parameters_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm()));
		connect(return_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm()));
		connect(return_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm()));
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
ConstraintWidget::ConstraintWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_CONSTRAINT)
{
	try
	{
		QStringList list;
		map<QString, vector<QWidget *> > fields_map;
		QGridLayout *grid=nullptr;

		Ui_ConstraintWidget::setupUi(this);

		excl_elems_wgt=new ElementsWidget(this);
		grid=new QGridLayout;
		grid->setContentsMargins(4,4,4,4);
		grid->addWidget(excl_elems_wgt,0,0);
		excl_elems_grp->setLayout(grid);

    expression_hl=new SyntaxHighlighter(expression_txt);
    expression_hl->loadConfiguration(GlobalAttributes::SQL_HIGHLIGHT_CONF_PATH);

		columns_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																				(ObjectTableWidget::EDIT_BUTTON |
																				 ObjectTableWidget::UPDATE_BUTTON), true, this);

		ref_columns_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																						(ObjectTableWidget::EDIT_BUTTON |
																						 ObjectTableWidget::UPDATE_BUTTON), true, this);

		ref_table_sel=new ObjectSelectorWidget(OBJ_TABLE, true, this);

		columns_tab->setColumnCount(2);
		columns_tab->setHeaderLabel(trUtf8("Column"), 0);
    columns_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/column.png")),0);
		columns_tab->setHeaderLabel(trUtf8("Type"), 1);
    columns_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),1);

		ref_columns_tab->setEnabled(false);
		ref_columns_tab->setColumnCount(2);
		ref_columns_tab->setHeaderLabel(trUtf8("Column"), 0);
    ref_columns_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/column.png")),0);
		ref_columns_tab->setHeaderLabel(trUtf8("Type"), 1);
    ref_columns_tab->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),1);

		dynamic_cast<QGridLayout *>(columns_tbw->widget(0)->layout())->addWidget(columns_tab, 1,0,1,3);
		dynamic_cast<QGridLayout *>(columns_tbw->widget(1)->layout())->addWidget(ref_table_sel, 0,1,1,2);
		dynamic_cast<QGridLayout *>(columns_tbw->widget(1)->layout())->addWidget(ref_columns_tab, 3,0,1,3);

		configureFormLayout(constraint_grid, OBJ_CONSTRAINT);

		ConstraintType::getTypes(list);
		constr_type_cmb->addItems(list);

		MatchType::getTypes(list);
		match_cmb->addItems(list);

		DeferralType::getTypes(list);
		deferral_cmb->addItems(list);

		ActionType::getTypes(list);
		on_delete_cmb->addItems(list);
		on_update_cmb->addItems(list);

		IndexingType::getTypes(list);
		indexing_cmb->addItems(list);

		info_frm=generateInformationFrame(trUtf8("Columns which were included by relationship can not be added / removed manually from the primary key. If done such changes they can raise errors. To create primary key using columns included by relationship use the following options: identifier field, attributes & constraints tab or primary key tab on the relationship form."));
		constraint_grid->addWidget(info_frm, constraint_grid->count()+1, 0, 1, 0);
		info_frm->setParent(this);

    fields_map[generateVersionsInterval(AFTER_VERSION, PgSQLVersions::PGSQL_VERSION_92)].push_back(no_inherit_lbl);
		warn_frm=generateVersionWarningFrame(fields_map);
		constraint_grid->addWidget(warn_frm, constraint_grid->count()+1, 0, 1, 0);
		warn_frm->setParent(this);

		connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void)));
		connect(constr_type_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectConstraintType(void)));
		connect(deferrable_chk, SIGNAL(toggled(bool)), deferral_cmb, SLOT(setEnabled(bool)));
		connect(deferrable_chk, SIGNAL(toggled(bool)), deferral_lbl, SLOT(setEnabled(bool)));
		connect(indexing_chk, SIGNAL(toggled(bool)), indexing_cmb, SLOT(setEnabled(bool)));
		connect(columns_tab, SIGNAL(s_rowAdded(int)), this, SLOT(addColumn(int)));
		connect(columns_tab, SIGNAL(s_rowRemoved(int)), this, SLOT(removeColumn(int)));
		connect(columns_tab, SIGNAL(s_rowsRemoved(void)), this, SLOT(removeColumns(void)));
		connect(ref_columns_tab, SIGNAL(s_rowAdded(int)), this, SLOT(addColumn(int)));
		connect(ref_columns_tab, SIGNAL(s_rowRemoved(int)), this, SLOT(removeColumn(int)));
		connect(ref_columns_tab, SIGNAL(s_rowsRemoved(void)), this, SLOT(removeColumns(void)));
		connect(ref_table_sel, SIGNAL(s_selectorCleared(void)), this, SLOT(selectReferencedTable(void)));
		connect(ref_table_sel, SIGNAL(s_objectSelected(void)), this, SLOT(selectReferencedTable(void)));
		connect(fill_factor_chk, SIGNAL(toggled(bool)), fill_factor_sb, SLOT(setEnabled(bool)));

		parent_form->setMinimumSize(600, 640);

    selectConstraintType();

    configureTabOrder();
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Beispiel #3
0
FunctionWidget::FunctionWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_FUNCTION)
{
	try
	{
		QStringList types;
		QGridLayout *grid=nullptr, *grid1=nullptr;
    QVBoxLayout *vlayout=nullptr;
    QSpacerItem *spacer=nullptr;

		map<QString, vector<QWidget *> > fields_map;
		map<QWidget *, vector<QString> > value_map;
		QFrame *frame=nullptr;

		Ui_FunctionWidget::setupUi(this);

		configureFormLayout(function_grid, OBJ_FUNCTION);
		connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void)));

    source_code_hl=new SyntaxHighlighter(source_code_txt, false);
		source_code_cp=new CodeCompletionWidget(source_code_txt);

		ret_type=new PgSQLTypeWidget(this);
    vlayout=new QVBoxLayout;
    spacer=new QSpacerItem(5,5,QSizePolicy::Preferred,QSizePolicy::Expanding);
    vlayout->addWidget(ret_type);
    vlayout->addSpacerItem(spacer);

		return_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																			 ObjectTableWidget::UPDATE_BUTTON, true, this);
		return_tab->setColumnCount(2);
		return_tab->setHeaderLabel(trUtf8("Column"), 0);
		return_tab->setHeaderIcon(QPixmap(":/icones/icones/column.png"),0);
		return_tab->setHeaderLabel(trUtf8("Type"), 1);
		return_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);

		parameters_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																					 ObjectTableWidget::UPDATE_BUTTON, true, this);
		parameters_tab->setColumnCount(4);
		parameters_tab->setHeaderLabel(trUtf8("Name"),0);
		parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/parameter.png"),0);
		parameters_tab->setHeaderLabel(trUtf8("Type"),1);
		parameters_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);
		parameters_tab->setHeaderLabel(trUtf8("Mode"),2);
		parameters_tab->setHeaderLabel(trUtf8("Default Value"),3);

		grid=new QGridLayout;
		grid->addWidget(parameters_tab,0,0,1,1);
		grid->setContentsMargins(4,4,4,4);
		func_config_twg->widget(1)->setLayout(grid);

		grid=dynamic_cast<QGridLayout *>(func_config_twg->widget(0)->layout());
    grid->addLayout(vlayout, grid->count(), 0, 1, 5);
		grid->addWidget(ret_table_gb, grid->count()-1, 0, 1, 5);

		grid1=new QGridLayout;
		grid1->addWidget(return_tab, 0, 0, 1, 1);
		grid1->setContentsMargins(2,2,2,2);
		ret_table_gb->setLayout(grid1);
		ret_table_gb->setVisible(false);

		fields_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_92)].push_back(leakproof_chk);
		frame=generateVersionWarningFrame(fields_map, &value_map);
		grid->addWidget(frame, grid->count()+1, 0, 1, 5);
		frame->setParent(func_config_twg->widget(0));

		parent_form->setMinimumSize(645, 675);

		SecurityType::getTypes(types);
		security_cmb->addItems(types);

		FunctionType::getTypes(types);
		func_type_cmb->addItems(types);

		BehaviorType::getTypes(types);
		behavior_cmb->addItems(types);

		connect(simple_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(set_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(table_rb, SIGNAL(clicked(bool)), this, SLOT(alternateReturnTypes(void)));
		connect(language_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectLanguage(void)));

		connect(parameters_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm()));
		connect(parameters_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm()));
		connect(return_tab, SIGNAL(s_rowAdded(int)), this, SLOT(showParameterForm()));
		connect(return_tab, SIGNAL(s_rowEdited(int)), this, SLOT(showParameterForm()));

		setRequiredField(language_lbl);
		setRequiredField(ret_method_lbl);
		setRequiredField(symbol_lbl);
		setRequiredField(library_lbl);
		setRequiredField(sourc_code_lbl);
    configureTabOrder();
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Beispiel #4
0
IndexWidget::IndexWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_INDEX)
{
	try
	{
		map<QString, vector<QWidget *> > field_map;
		map<QWidget *, vector<QString> > value_map;
		QFrame *frame=NULL;
		QStringList list;
		QGridLayout *grid=NULL;

		Ui_IndexWidget::setupUi(this);

		//Cria um destacador de sintaxe no campo de expressão de checagem
		cond_expr_hl=new SyntaxHighlighter(cond_expr_txt, false);
		cond_expr_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR +
																						GlobalAttributes::DIR_SEPARATOR +
																						GlobalAttributes::SQL_HIGHLIGHT_CONF +
																						GlobalAttributes::CONFIGURATION_EXT);

		elem_expr_hl=new SyntaxHighlighter(elem_expr_txt, false);
		elem_expr_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR +
																				 GlobalAttributes::DIR_SEPARATOR +
																				 GlobalAttributes::SQL_HIGHLIGHT_CONF +
																				 GlobalAttributes::CONFIGURATION_EXT);

		elements_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS, true, this);
		op_class_sel=new ObjectSelectorWidget(OBJ_OPCLASS, true, this);

		elements_tab->setColumnCount(5);
		elements_tab->setHeaderLabel(trUtf8("Element"), 0);
		elements_tab->setHeaderIcon(QPixmap(":/icones/icones/column.png"),0);
		elements_tab->setHeaderLabel(trUtf8("Type"), 1);
		elements_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);
		elements_tab->setHeaderLabel(trUtf8("Operator Class"), 2);
		elements_tab->setHeaderIcon(QPixmap(":/icones/icones/opclass.png"),2);
		elements_tab->setHeaderLabel(trUtf8("Sorting"), 3);
		elements_tab->setHeaderLabel(trUtf8("Nulls First"), 4);

		grid=dynamic_cast<QGridLayout *>(elements_grp->layout());
		grid->addWidget(op_class_sel, 2,2);
		grid->addWidget(elements_tab, 5,0,1,4);

		configureFormLayout(index_grid, OBJ_INDEX);
		parent_form->setMinimumSize(600, 640);

		IndexingType::getTypes(list);
		indexing_cmb->addItems(list);

		field_map[generateVersionsInterval(UNTIL_VERSION, SchemaParser::PGSQL_VERSION_81)].push_back(indexing_lbl);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(concurrent_chk);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_82)].push_back(fill_factor_chk);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_83)].push_back(sorting_chk);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_84)].push_back(fast_update_chk);
		value_map[indexing_lbl].push_back(~IndexingType(IndexingType::rtree));

		frame=generateVersionWarningFrame(field_map, &value_map);
		index_grid->addWidget(frame, index_grid->count()+1, 0, 1, 0);
		frame->setParent(this);

		connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void)));
		connect(elements_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleElement(int)));
		connect(elements_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleElement(int)));
		connect(elements_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editElement(int)));
		connect(column_rb, SIGNAL(toggled(bool)), this, SLOT(selectElementObject(void)));
		connect(expression_rb, SIGNAL(toggled(bool)), this, SLOT(selectElementObject(void)));
		connect(indexing_cmb, SIGNAL(currentIndexChanged(int)), this, SLOT(selectIndexingType(void)));

		connect(sorting_chk, SIGNAL(toggled(bool)), ascending_rb, SLOT(setEnabled(bool)));
		connect(sorting_chk, SIGNAL(toggled(bool)), descending_rb, SLOT(setEnabled(bool)));
		connect(sorting_chk, SIGNAL(toggled(bool)), nulls_first_chk, SLOT(setEnabled(bool)));

		connect(fill_factor_chk, SIGNAL(toggled(bool)), fill_factor_sb, SLOT(setEnabled(bool)));
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Beispiel #5
0
TriggerWidget::TriggerWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_TRIGGER)
{
	try
	{
		QStringList list;
		map<QString, vector<QWidget *> > field_map;
		map<QWidget *, vector<QString> > value_map;
		QFrame *frame=NULL;

		Ui_TriggerWidget::setupUi(this);

		cond_expr_hl=new SyntaxHighlighter(cond_expr_txt, false);
		cond_expr_hl->loadConfiguration(GlobalAttributes::CONFIGURATIONS_DIR +
																						GlobalAttributes::DIR_SEPARATOR +
																						GlobalAttributes::SQL_HIGHLIGHT_CONF +
																						GlobalAttributes::CONFIGURATION_EXT);

		columns_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
																				(ObjectTableWidget::EDIT_BUTTON |
																				 ObjectTableWidget::UPDATE_BUTTON), true, this);

		arguments_tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS, true, this);

		ref_table_sel=new ObjectSelectorWidget(OBJ_TABLE, true, this);
		function_sel=new ObjectSelectorWidget(OBJ_FUNCTION, true, this);
		trigger_grid->addWidget(function_sel, 5, 1, 1, 2);
		trigger_grid->addWidget(ref_table_sel, 6, 1, 1, 2);

		columns_tab->setColumnCount(2);
		columns_tab->setHeaderLabel(trUtf8("Column"), 0);
		columns_tab->setHeaderIcon(QPixmap(":/icones/icones/column.png"),0);
		columns_tab->setHeaderLabel(trUtf8("Type"), 1);
		columns_tab->setHeaderIcon(QPixmap(":/icones/icones/usertype.png"),1);

		dynamic_cast<QGridLayout *>(arg_cols_tbw->widget(0)->layout())->addWidget(columns_tab, 1,0,1,3);
		dynamic_cast<QGridLayout *>(arg_cols_tbw->widget(1)->layout())->addWidget(arguments_tab, 1,0,1,3);

		DeferralType::getTypes(list);
		deferral_type_cmb->addItems(list);

		FiringType::getTypes(list);
		firing_mode_cmb->addItems(list);

		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_84)].push_back(truncate_chk);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_90)].push_back(cond_expr_lbl);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_90)].push_back(column_lbl);
		field_map[generateVersionsInterval(AFTER_VERSION, SchemaParser::PGSQL_VERSION_91)].push_back(firing_mode_lbl);
		value_map[firing_mode_lbl].push_back(firing_mode_cmb->itemText(firing_mode_cmb->count()-1));

		frame=generateVersionWarningFrame(field_map, &value_map);
		trigger_grid->addWidget(frame, trigger_grid->count()+1, 0, 1, 0);
		frame->setParent(this);

		configureFormLayout(trigger_grid, OBJ_TRIGGER);
		parent_form->setMinimumSize(600, 640);

		connect(parent_form->apply_ok_btn,SIGNAL(clicked(bool)), this, SLOT(applyConfiguration(void)));
		connect(deferrable_chk, SIGNAL(toggled(bool)), deferral_type_cmb, SLOT(setEnabled(bool)));
		connect(deferrable_chk, SIGNAL(toggled(bool)), deferral_type_lbl, SLOT(setEnabled(bool)));
		connect(columns_tab, SIGNAL(s_rowAdded(int)), this, SLOT(addColumn(int)));
		connect(columns_tab, SIGNAL(s_rowRemoved(int)), this, SLOT(updateColumnsCombo(void)));
		connect(columns_tab, SIGNAL(s_rowsRemoved(void)), this, SLOT(updateColumnsCombo(void)));
		connect(arguments_tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleArgument(int)));
		connect(arguments_tab, SIGNAL(s_rowUpdated(int)), this, SLOT(handleArgument(int)));
		connect(arguments_tab, SIGNAL(s_rowEdited(int)), this, SLOT(editArgument(int)));
		connect(constr_trig_chk, SIGNAL(toggled(bool)), this, SLOT(setConstraintTrigger(bool)));
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Beispiel #6
0
TableWidget::TableWidget(QWidget *parent): BaseObjectWidget(parent, OBJ_TABLE)
{
    QGridLayout *grid=nullptr;
    ObjectTableWidget *tab=nullptr;
    ObjectType types[]= { OBJ_COLUMN, OBJ_CONSTRAINT, OBJ_TRIGGER, OBJ_RULE, OBJ_INDEX };
    map<QString, vector<QWidget *> > fields_map;
    QFrame *frame=nullptr;

    Ui_TableWidget::setupUi(this);

    fields_map[generateVersionsInterval(AFTER_VERSION, PgSQLVersions::PGSQL_VERSION_91)].push_back(unlogged_chk);
    frame=generateVersionWarningFrame(fields_map);
    table_grid->addWidget(frame, table_grid->count()+1, 0, 1, 2);
    frame->setParent(this);

    parent_tables = new ObjectTableWidget(ObjectTableWidget::NO_BUTTONS, true, this);
    parent_tables->setColumnCount(3);
    parent_tables->setHeaderLabel(trUtf8("Name"), 0);
    parent_tables->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    parent_tables->setHeaderLabel(trUtf8("Schema"), 1);
    parent_tables->setHeaderIcon(QPixmap(QString(":/icones/icones/schema.png")),1);
    parent_tables->setHeaderLabel(trUtf8("Type"), 2);
    parent_tables->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),2);

    tag_sel=new ObjectSelectorWidget(OBJ_TAG, false, this);
    dynamic_cast<QGridLayout *>(options_gb->layout())->addWidget(tag_sel, 0, 1, 1, 3);

    grid=new QGridLayout;
    grid->addWidget(parent_tables, 0,0,1,1);
    grid->setContentsMargins(4,4,4,4);
    attributes_tbw->widget(5)->setLayout(grid);

    //Configuring the table objects that stores the columns, triggers, constraints, rules and indexes
    for(unsigned i=0; i < 5; i++)
    {
        tab=new ObjectTableWidget(ObjectTableWidget::ALL_BUTTONS ^
                                  (ObjectTableWidget::UPDATE_BUTTON), true, this);

        objects_tab_map[types[i]]=tab;

        grid=new QGridLayout;
        grid->addWidget(tab, 0,0,1,1);
        grid->setContentsMargins(4,4,4,4);
        attributes_tbw->widget(i)->setLayout(grid);

        connect(tab, SIGNAL(s_rowsRemoved(void)), this, SLOT(removeObjects(void)));
        connect(tab, SIGNAL(s_rowRemoved(int)), this, SLOT(removeObject(int)));
        connect(tab, SIGNAL(s_rowAdded(int)), this, SLOT(handleObject(void)));
        connect(tab, SIGNAL(s_rowEdited(int)), this, SLOT(handleObject(void)));
        connect(tab, SIGNAL(s_rowsMoved(int,int)), this, SLOT(swapObjects(int,int)));
    }

    objects_tab_map[OBJ_COLUMN]->setColumnCount(4);
    objects_tab_map[OBJ_COLUMN]->setHeaderLabel(trUtf8("Name"), 0);
    objects_tab_map[OBJ_COLUMN]->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    objects_tab_map[OBJ_COLUMN]->setHeaderLabel(trUtf8("Type"), 1);
    objects_tab_map[OBJ_COLUMN]->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),1);
    objects_tab_map[OBJ_COLUMN]->setHeaderLabel(trUtf8("Default Value"), 2);
    objects_tab_map[OBJ_COLUMN]->setHeaderLabel(trUtf8("Attribute"), 3);

    objects_tab_map[OBJ_CONSTRAINT]->setColumnCount(4);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderLabel(trUtf8("Name"), 0);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderLabel(trUtf8("Type"), 1);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderIcon(QPixmap(QString(":/icones/icones/usertype.png")),1);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderLabel(trUtf8("ON DELETE"), 2);
    objects_tab_map[OBJ_CONSTRAINT]->setHeaderLabel(trUtf8("ON UPDATE"), 3);

    objects_tab_map[OBJ_TRIGGER]->setColumnCount(4);
    objects_tab_map[OBJ_TRIGGER]->setHeaderLabel(trUtf8("Name"), 0);
    objects_tab_map[OBJ_TRIGGER]->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    objects_tab_map[OBJ_TRIGGER]->setHeaderLabel(trUtf8("Refer. Table"), 1);
    objects_tab_map[OBJ_TRIGGER]->setHeaderIcon(QPixmap(QString(":/icones/icones/table.png")),1);
    objects_tab_map[OBJ_TRIGGER]->setHeaderLabel(trUtf8("Firing"), 2);
    objects_tab_map[OBJ_TRIGGER]->setHeaderIcon(QPixmap(QString(":/icones/icones/trigger.png")),2);
    objects_tab_map[OBJ_TRIGGER]->setHeaderLabel(trUtf8("Events"), 3);

    objects_tab_map[OBJ_RULE]->setColumnCount(3);
    objects_tab_map[OBJ_RULE]->setHeaderLabel(trUtf8("Name"), 0);
    objects_tab_map[OBJ_RULE]->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    objects_tab_map[OBJ_RULE]->setHeaderLabel(trUtf8("Execution"), 1);
    objects_tab_map[OBJ_RULE]->setHeaderLabel(trUtf8("Event"), 2);

    objects_tab_map[OBJ_INDEX]->setColumnCount(2);
    objects_tab_map[OBJ_INDEX]->setHeaderLabel(trUtf8("Name"), 0);
    objects_tab_map[OBJ_INDEX]->setHeaderIcon(QPixmap(QString(":/icones/icones/uid.png")),0);
    objects_tab_map[OBJ_INDEX]->setHeaderLabel(trUtf8("Indexing"), 1);

    configureFormLayout(table_grid, OBJ_TABLE);
    configureTabOrder({ tag_sel });

    setMinimumSize(600, 610);
}