1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; version 2 of the
* License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _SCHEMA_SELECTION_PAGE_H_
#define _SCHEMA_SELECTION_PAGE_H_
#include "grtui/wizard_schema_filter_page.h"
class SchemaSelectionPage : public WizardSchemaFilterPage
{
public:
SchemaSelectionPage(WizardForm *form, const char *name= "pickSchemata")
: WizardSchemaFilterPage(form, name), _dbplugin(0)
{
set_short_title(_("Select Schemas"));
set_title(_("Select Schemas to Reverse Engineer"));
add(&_missing_label, false, true);
_missing_label.show(false);
}
virtual void leave(bool advancing)
{
if (advancing)
{
grt::StringListRef list(_form->grtm()->get_grt());
std::vector<std::string> selection= _check_list.get_selection();
for (std::vector<std::string>::const_iterator iter= _schemas.begin();
iter != _schemas.end(); ++iter)
if (std::find(selection.begin(),selection.end(),*iter) == selection.end())
list.insert(*iter);
values().set("unSelectedSchemata", list);
}
WizardSchemaFilterPage::leave(advancing);
}
virtual void enter(bool advancing)
{
if (advancing)
{
_schemas.clear();
grt::ListRef<db_Schema> schemas(_dbplugin->model_catalog()->schemata());
GRTLIST_FOREACH(db_Schema, schemas, schema)
_schemas.push_back((*schema)->name());
WizardSchemaFilterPage::enter(advancing);
for (std::vector<std::string>::const_iterator iter= _schemas.begin();
iter != _schemas.end(); ++iter)
_check_list.set_selected(*iter, true);
}
}
void set_db_plugin(Db_plugin *pl)
{
_dbplugin= pl;
}
private:
std::vector<std::string> _schemas;
Db_plugin *_dbplugin;
mforms::Label _missing_label;
};
#endif /* _SCHEMA_SELECTION_PAGE_H_ */
|