void TableWidget::showTableObjectForm(ObjectType obj_type) { TableObject *object=nullptr; ObjectTableWidget *obj_table=nullptr; Table *table=nullptr; //Selects the object table based upon the passed object type obj_table=getObjectTable(obj_type); //Gets the object reference if there is an item select on table if(obj_table->getSelectedRow()>=0) object=reinterpret_cast<TableObject *>(obj_table->getRowData(obj_table->getSelectedRow()).value<void *>()); table=dynamic_cast<Table *>(this->object); switch(obj_type) { case OBJ_COLUMN: column_wgt->setAttributes(this->model, table, this->op_list, dynamic_cast<Column *>(object)); column_wgt->show(); break; case OBJ_CONSTRAINT: constraint_wgt->setAttributes(this->model, table, this->op_list, dynamic_cast<Constraint *>(object)); constraint_wgt->show(); break; case OBJ_TRIGGER: trigger_wgt->setAttributes(this->model, table, this->op_list, dynamic_cast<Trigger *>(object)); trigger_wgt->show(); break; case OBJ_INDEX: index_wgt->setAttributes(this->model, table, this->op_list, dynamic_cast<Index *>(object)); index_wgt->show(); break; default: case OBJ_RULE: rule_wgt->setAttributes(this->model, table, this->op_list, dynamic_cast<Rule *>(object)); rule_wgt->show(); break; } }
void TableWidget::handleObject(void) { ObjectType obj_type=BASE_OBJECT; TableObject *object=nullptr; ObjectTableWidget *obj_table=nullptr; try { obj_type=getObjectType(sender()); //Selects the object table based upon the passed object type obj_table=getObjectTable(obj_type); //Gets the object reference if there is an item select on table if(obj_table->getSelectedRow()>=0) object=reinterpret_cast<TableObject *>(obj_table->getRowData(obj_table->getSelectedRow()).value<void *>()); if(obj_type==OBJ_COLUMN) openEditingForm<Column, ColumnWidget>(object); else if(obj_type==OBJ_CONSTRAINT) openEditingForm<Constraint, ConstraintWidget>(object); else if(obj_type==OBJ_TRIGGER) openEditingForm<Trigger, TriggerWidget>(object); else if(obj_type==OBJ_INDEX) openEditingForm<Index, IndexWidget>(object); else openEditingForm<Rule, RuleWidget>(object); listObjects(obj_type); } catch(Exception &e) { listObjects(obj_type); throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }