23 #ifndef LIAISONSCOPE20110609H 24 #define LIAISONSCOPE20110609H 26 #include <boost/circular_buffer.hpp> 27 #include <boost/thread.hpp> 30 #include <Wt/WBoxLayout> 32 #include <Wt/WCssDecorationStyle> 34 #include <Wt/WSortFilterProxyModel> 35 #include <Wt/WStandardItemModel> 38 #include <Wt/WTreeView> 39 #include <Wt/WVBoxLayout> 41 #include "goby/common/liaison_container.h" 42 #include "goby/moos/moos_node.h" 43 #include "goby/moos/protobuf/liaison_config.pb.h" 47 class WStandardItemModel;
58 Wt::WContainerWidget* parent = 0);
62 void handle_message(
CMOOSMsg& msg,
bool fresh_message);
64 static std::vector<Wt::WStandardItem*> create_row(
CMOOSMsg& msg);
65 static void attach_pb_rows(
const std::vector<Wt::WStandardItem*>& items,
CMOOSMsg& msg);
66 static void update_row(
CMOOSMsg& msg,
const std::vector<Wt::WStandardItem*>& items);
74 return (controls_div_->paused_mail_thread_ &&
75 controls_div_->paused_mail_thread_->joinable());
79 void handle_global_key(Wt::WKeyEvent
event);
83 if (last_scope_state_ == ACTIVE)
85 else if (last_scope_state_ == UNKNOWN)
88 last_scope_state_ = UNKNOWN;
93 if (last_scope_state_ == UNKNOWN)
95 last_scope_state_ = is_paused() ? STOPPED : ACTIVE;
110 Wt::WStringListModel* history_model_;
111 Wt::WStandardItemModel* model_;
112 Wt::WSortFilterProxyModel* proxy_;
114 Wt::WVBoxLayout* main_layout_;
116 Wt::WTimer scope_timer_;
123 ScopeState last_scope_state_;
125 struct SubscriptionsContainer : Wt::WContainerWidget
127 SubscriptionsContainer(
LiaisonScope* node, Wt::WStandardItemModel* model,
128 Wt::WStringListModel* history_model,
129 std::map<std::string, int>& msg_map,
130 Wt::WContainerWidget* parent = 0);
132 void handle_add_subscription();
133 void handle_remove_subscription(Wt::WPushButton* clicked_anchor);
134 void add_subscription(std::string type);
136 void refresh_with_newest();
137 void refresh_with_newest(
const std::string& type);
141 Wt::WStandardItemModel* model_;
142 Wt::WStringListModel* history_model_;
143 std::map<std::string, int>& msg_map_;
145 Wt::WText* add_text_;
146 Wt::WLineEdit* subscribe_filter_text_;
147 Wt::WPushButton* subscribe_filter_button_;
148 Wt::WBreak* subscribe_break_;
149 Wt::WText* remove_text_;
151 std::set<std::string> subscriptions_;
154 SubscriptionsContainer* subscriptions_div_;
156 struct HistoryContainer : Wt::WContainerWidget
158 HistoryContainer(MOOSNode* node, Wt::WVBoxLayout* main_layout,
159 Wt::WAbstractItemModel* model,
161 Wt::WContainerWidget* parent = 0);
163 void handle_add_history();
164 void handle_remove_history(std::string type);
166 void toggle_history_plot(Wt::WWidget* plot);
167 void display_message(
CMOOSMsg& msg);
173 Wt::WContainerWidget* container;
174 Wt::WStandardItemModel* model;
176 Wt::WSortFilterProxyModel* proxy;
180 Wt::WVBoxLayout* main_layout_;
183 std::map<std::string, MVC> history_models_;
185 Wt::WText* add_text_;
186 Wt::WComboBox* history_box_;
187 Wt::WPushButton* history_button_;
189 boost::circular_buffer<CMOOSMsg> buffer_;
192 HistoryContainer* history_header_div_;
194 struct ControlsContainer : Wt::WContainerWidget
196 ControlsContainer(Wt::WTimer* timer,
bool start_paused,
LiaisonScope* scope,
197 SubscriptionsContainer* subscriptions_div,
198 HistoryContainer* history_header_div, Wt::WContainerWidget* parent = 0);
199 ~ControlsContainer();
201 void handle_play_pause(
bool toggle_state);
206 void run_paused_mail();
207 boost::shared_ptr<boost::thread> paused_mail_thread_;
211 Wt::WPushButton* play_pause_button_;
214 Wt::WText* play_state_;
217 SubscriptionsContainer* subscriptions_div_;
218 HistoryContainer* history_header_div_;
221 ControlsContainer* controls_div_;
223 struct RegexFilterContainer : Wt::WContainerWidget
225 RegexFilterContainer(Wt::WStandardItemModel* model, Wt::WSortFilterProxyModel* proxy,
227 Wt::WContainerWidget* parent = 0);
229 void handle_set_regex_filter();
230 void handle_clear_regex_filter();
231 void toggle_regex_examples_table();
233 Wt::WStandardItemModel* model_;
234 Wt::WSortFilterProxyModel* proxy_;
237 Wt::WText* set_text_;
238 Wt::WComboBox* regex_column_select_;
239 Wt::WText* expression_text_;
240 Wt::WLineEdit* regex_filter_text_;
241 Wt::WPushButton* regex_filter_button_;
242 Wt::WPushButton* regex_filter_clear_;
243 Wt::WPushButton* regex_filter_examples_;
246 Wt::WTable* regex_examples_table_;
249 RegexFilterContainer* regex_filter_div_;
251 Wt::WTreeView* scope_tree_view_;
254 std::map<std::string, int> msg_map_;
256 WContainerWidget* bottom_fill_;
263 Wt::WContainerWidget* parent = 0);
273 Wt::WContainerWidget* parent = 0);
The global namespace for the Goby project.