void AsistenteJerarquia::on_botonAceptar_click() {
	VistaEntidadNueva* entidadPadre = NULL;
	VistaEntidadNueva* entidad = NULL;
	VistaEntidad * vep = NULL;
	Gtk::RadioButton* radio = NULL;
	bool musthide = false;
	int countSelected=0;
	Gtk::Entry *entryNombre = 0;
	this->m_builder->get_widget("entryNombre", entryNombre);
	string nom =entryNombre->get_text();
	if ( nom != "") {
		this->vjerarquia->setNombre(nom);
		Gtk::TreeModel::iterator iter = this->comboBox.get_active();
		if (iter) {
			//Si esta nodificando y ya tenia un padre
			vep = this->vjerarquia->getEntidadPadre();
			if (vep != NULL){
				vep->getEntidad()->quitarJerarquiaHija();
			}
			Gtk::TreeModel::Row row = *iter;
			entidadPadre = row[this->m_ColumnasCombo.m_col_vEnt_Pointer];
			this->vjerarquia->setEntidadPadre(entidadPadre);
			entidadPadre->getEntidad()->setJerarquiaHija(this->vjerarquia->getJerarquia());

			//cobertura, interseccion
			this->m_builder->get_widget("radioParcial", radio);
			if (radio->get_active() == true){
				this->vjerarquia->getJerarquia()->setCobertura(TIPO_COBERTURA_PARCIAL);
			}else{
				this->vjerarquia->getJerarquia()->setCobertura(TIPO_COBERTURA_TOTAL);
			}
			this->m_builder->get_widget("radioExclusiva", radio);
			if (radio->get_active() == true){
				this->vjerarquia->getJerarquia()->setInterseccion(TIPO_INTERSECCION_EXCLUSIVA);
			}else{
				this->vjerarquia->getJerarquia()->setInterseccion(TIPO_INTERSECCION_SUPERPUESTA);
			}

			//Ahora seteo las entidades hijas
			typedef Gtk::TreeModel::Children type_children;
			type_children children = this->refTreeModel->children();
			type_children::iterator iter = children.begin();
			type_children::iterator iter1 = children.end();
			while (iter != iter1) {
				Gtk::TreeModel::Row row = *iter;
				// si esta seleccionada la agrego o actualizo
				if (row[this->m_Columnas.m_col_selected] == true) {
					countSelected++;
					if (this->vjerarquia->unidaConEntidad(row[this->m_Columnas.m_col_vEnt_Pointer]) == false){
						entidad = row[this->m_Columnas.m_col_vEnt_Pointer];
						this->vjerarquia->agregarEntidadEspecializada(entidad);
						this->vjerarquia->getJerarquia()->agregarEntidadEspecializada(entidad->getEntidadNueva());
						entidad->getEntidadNueva()->agregarJerarquiaPadre(this->vjerarquia->getJerarquia());
					}
				}else{
					if (this->vjerarquia->unidaConEntidad(row[this->m_Columnas.m_col_vEnt_Pointer]) == true){
						this->vjerarquia->removerEntidadEspecializada(row[this->m_Columnas.m_col_vEnt_Pointer]);
					}
				}
				iter++;
			}
			if (countSelected>0){
				musthide = true;
			}else{
				Gtk::MessageDialog err_dialog1(*this, "Select at least one children", false,
										Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
				err_dialog1.run();
			}
		}else{
			Gtk::MessageDialog err_dialog2(*this, "Select the father", false,
													Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
							err_dialog2.run();
		}
	} else {
		Gtk::MessageDialog err_dialog(*this, "No name", false,
						Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
		err_dialog.run();
	}
	if (musthide==true){
		this->vjerarquia->resetearLanzarProp();
		this->hide();
	}
	Ide::getInstance()->getDiagActual()->queue_draw();
	Ide::getInstance()->regenerarTreePanel();
}
Example #2
0
	Axis get_axis()const { return radiobutton_axis_x.get_active()?AXIS_X:AXIS_Y; }
Example #3
0
bool getRadioButtonState(string b) {
    Gtk::RadioButton* tbut;
    VRGuiBuilder()->get_widget(b, tbut);
    return tbut->get_active();
}