Isis 3 Programmer Reference
CnetEditorViewWorkOrder.cpp
Go to the documentation of this file.
1 
24 
25 #include <QtDebug>
26 
27 #include <QAction>
28 #include <QUndoCommand>
29 
30 #include "CnetEditorView.h"
31 #include "Control.h"
32 #include "ControlList.h"
33 #include "Directory.h"
34 #include "Project.h"
35 
36 namespace Isis {
37 
38  CnetEditorViewWorkOrder::CnetEditorViewWorkOrder(Project *project) :
39  WorkOrder(project) {
40  QAction::setText(tr("View &Network..."));
41  m_isSavedToHistory = false;
42  m_isUndoable = false;
43  }
44 
45 
46  CnetEditorViewWorkOrder::CnetEditorViewWorkOrder(const CnetEditorViewWorkOrder &other) :
47  WorkOrder(other) {
48  }
49 
50 
51  CnetEditorViewWorkOrder::~CnetEditorViewWorkOrder() {
52  }
53 
54 
55  CnetEditorViewWorkOrder *CnetEditorViewWorkOrder::clone() const {
56  return new CnetEditorViewWorkOrder(*this);
57  }
58 
59 
61 
62 
63  if (controls) {
64  return (controls->count() >= 1);
65  }
66  return false;
67  }
68 
69 
71  bool success = WorkOrder::setupExecution();
72 
73  if (success) {
74  QUndoCommand::setText(tr("View control network [%1] in new cnet editor view")
75  .arg(controlList()->first()->displayProperties()->displayName()));
76  }
77 
78  return success;
79  }
80 
81 
83  // depend on types of ourselves.
84  return dynamic_cast<CnetEditorViewWorkOrder *>(other);
85  }
86 
87 
89 
90  for (int i = 0; i < controlList()->size(); i++) {
92  }
93  project()->setClean(false);
94  }
95 
97  delete project()->directory()->cnetEditorViews().last();
98  }
99 }
QList< CnetEditorView * > cnetEditorViews()
Returns a list of all the control network views for this directory.
Definition: Directory.cpp:1334
bool setupExecution()
This sets up the state for the work order.
virtual bool isExecutable(ControlList *controls)
Re-implement this method if your work order utilizes a control for data in order to operate...
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:36
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1275
void undoExecution()
Execute the steps necessary to undo this workorder.
bool dependsOn(WorkOrder *other) const
Indicate workorder dependency This is a virtual function whose role in child classes is to determine ...
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:1229
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:322
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition: WorkOrder.h:534
This work order allows the user to open a cnet editor (table) view of a single control network...
$Date$ $Revision$
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
CnetEditorView * addCnetEditorView(Control *control, QString objectName="")
Add the widget for the cnet editor view to the window.
Definition: Directory.cpp:670
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1314
QPointer< ControlList > controlList()
Returns the Control List for this WorkOrder (a list of control networks).
Definition: WorkOrder.cpp:720
bool m_isSavedToHistory
Set the work order to be shown in the HistoryTreeWidget.
Definition: WorkOrder.h:548
void execute()
Execute the workorder.
void setClean(bool value)
Function to change the clean state of the project.
Definition: Project.cpp:1595