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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/*
* Copyright (c) 2010, 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 _WB_OVERVIEW_PHYSICAL_H_
#define _WB_OVERVIEW_PHYSICAL_H_
#include "workbench/wb_overview.h"
#include "base/notifications.h"
namespace mforms
{
class MenuBar;
class ToolBar;
};
namespace wb {
class PhysicalOverviewBE;
namespace internal {
class PhysicalSchemaNode;
class PhysicalSchemataNode : public OverviewBE::ContainerNode
{
virtual OverviewBE::Node * create_child_node(db_SchemaRef schema);
workbench_physical_ModelRef model;
virtual bool add_object(WBContext *wb);
virtual void delete_object(WBContext *wb);
virtual void refresh_children();
public:
PhysicalSchemataNode(workbench_physical_ModelRef model);
virtual void init();
};
class SQLScriptsNode : public OverviewBE::ContainerNode
{
private:
PhysicalOverviewBE *_owner;
std::string id;
workbench_physical_ModelRef _model;
bool add_new(WBContext *wb);
public:
SQLScriptsNode(workbench_physical_ModelRef model, PhysicalOverviewBE *owner);
virtual void refresh_children();
virtual int get_popup_menu_items(WBContext *wb, bec::MenuItemList &items);
virtual std::string get_unique_id()
{
return id;
}
};
class NotesNode : public OverviewBE::ContainerNode
{
private:
PhysicalOverviewBE *_owner;
std::string id;
workbench_physical_ModelRef _model;
bool add_new(WBContext *wb);
public:
NotesNode(workbench_physical_ModelRef model, PhysicalOverviewBE *owner);
virtual void refresh_children();
virtual int get_popup_menu_items(WBContext *wb, bec::MenuItemList &items);
virtual std::string get_unique_id()
{
return id;
}
};
};
//
// Node Layout:
//
// -root: ORoot (model) (stable nodeid)
// -diagrams: ODivision (stable noteid) <RefreshChildren>
// -[diagram nodes]: OItem <RefreshNode>
// -schemata: ODivision (stable nodeid) <RefreshChildren>
// -[schema]: OGroup (kind of stable by oid*) <RefreshNode>
// -table: OSection (stable for parent) <RefreshChildren>
// -[table nodes]: OItem <RefreshNode>
// -view: OSection (stable for parent) <RefreshChildren>
// -[view nodes]: OItem <RefreshNode>
// -routine: OSection (stable for parent) <RefreshChildren>
// -[routine nodes]: OItem <RefreshNode>
// -routineGroup: OSection (stable for parent)<RefreshChildren>
// -[routineGroup nodes]: OItem <RefreshNode>
// -privileges: ODivision (stable nodeid) <RefreshChildren>
// -users: OSection (stable nodeid)
// -[users]: OItem
// -roles: OSection (stable nodeid) <RefreshChildren>
// -[roles]: OItem
// -scripts: ODivision (stable nodeid) <RefreshChildren>
// -[scripts] OItem
// -notes: ODivision (stable nodeid) <RefreshChildren>
// -[notes] OItem
//
// Nodes marked <RefreshChildren> must have their contents refreshable when
// Refresh message is received by the frontend. Arguments are paths.
class MYSQLWBBACKEND_PUBLIC_FUNC PhysicalOverviewBE : public OverviewBE, public base::Observer
{
workbench_physical_ModelRef _model;
virtual OverviewBE::ContainerNode * create_root_node(workbench_physical_ModelRef model, PhysicalOverviewBE *owner);
protected:
mforms::MenuBar *_menu;
mforms::ToolBar *_toolbar;
int _schemata_node_index;
void handle_notification(const std::string &name, void *sender, base::NotificationInfo &info);
void update_toolbar_icons();
public: // backend internal
virtual std::string identifier() const;
virtual std::string get_title();
virtual std::string get_form_context_name() const;
virtual void send_refresh_diagram(const model_DiagramRef &view);
void send_refresh_users();
void send_refresh_roles();
void send_refresh_scripts();
void send_refresh_notes();
void send_refresh_schema_list();
void send_refresh_for_schema(const db_SchemaRef &schema, bool refresh_object_itself);
void send_refresh_for_schema_object(const GrtObjectRef &object, bool refresh_object_itself);
void set_model(workbench_physical_ModelRef model);
virtual mforms::ToolBar *get_toolbar();
virtual mforms::MenuBar *get_menubar();
public:
PhysicalOverviewBE(WBContext *wb);
virtual ~PhysicalOverviewBE();
virtual bool can_undo();
virtual bool can_redo();
virtual void undo();
virtual void redo();
virtual bool can_close();
virtual void close();
virtual model_ModelRef get_model();
internal::PhysicalSchemaNode *get_active_schema_node();
virtual int get_default_tab_page_index();
virtual std::string get_node_drag_type(const bec::NodeId &node);
virtual bool should_accept_file_drop_to_node(const bec::NodeId &node, const std::string &path);
virtual void add_file_to_node(const bec::NodeId &node, const std::string &path);
virtual bool get_file_data_for_node(const bec::NodeId &node, char *&data, size_t &length);
virtual std::string get_file_for_node(const bec::NodeId &node);
virtual void refresh_node(const bec::NodeId &node, bool children);
};
};
#endif /* _WB_OVERVIEW_PHYSICAL_H_ */
|