VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
setStatePropertyDialog.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
12 
13 #pragma once
14 
18 #include <vrfutil/rwProperties.h>
19 #include <QLabel>
20 #include <QGridLayout>
21 
22 namespace makVrf
23 {
27  {
28  Q_OBJECT
29  public:
30  //CTOR
31  DtSetStatePropertyDialog(makVrv::DtDe& de, QWidget* parent, const DtString& property,
32  const Qt::WindowFlags& flags = 0);
33 
34  //DTOR
35  virtual ~DtSetStatePropertyDialog();
36 
37  protected:
38  virtual void setupGui(const std::vector<makVrv::DtSimEntry*>& data);
39 
42  template<typename StateType>
43  void setupGui(const std::vector<makVrv::DtSimEntry*>& data)
44  {
46 
47  std::vector<makVrv::DtSimEntry*>::const_iterator iter = data.begin();
48  bool merge = false;
49  std::vector<DtString> props;
50 
51  myProperty.tokenize(';', props);
52 
53  clearProperties();
54 
55  bool allAggregate = true;
56  myStateProperties = DtRwProperties("");
57  myParameterData = DtRwProperties("");
58 
59  if(data.size() == 0)
60  {
62  setupGuiWhenNoSelection();
63  }
64  else
65  {
66  if (myInvalidSelectionLabel)
67  {
68  delete myInvalidSelectionLabel;
69  myInvalidSelectionLabel = 0;
70  }
71 
72  while (iter != data.end())
73  {
75  {
76  allAggregate = false;
77  break;
78  }
79 
80  ++iter;
81  }
82 
83  if (allAggregate)
84  {
85  DtAggregateRollUpManager::instance(myDe).statePropertiesFor(data, myStateProperties);
86  DtAggregateRollUpManager::instance(myDe).parameterData(data, myParameterData);
87  }
88  else
89  {
90  iter = data.begin();
91  while (iter != data.end())
92  {
94  {
95  if (iter == data.begin())
96  {
97  DtAggregateRollUpManager::instance(myDe).statePropertiesFor((*iter)->id(), myStateProperties);
98  DtAggregateRollUpManager::instance(myDe).parameterData((*iter)->id(), myParameterData);
99  }
100  else
101  {
102  DtRwProperties stateProperties("");
103  DtRwProperties parameterData("");
104 
105  DtAggregateRollUpManager::instance(myDe).statePropertiesFor((*iter)->id(), stateProperties);
106  myStateProperties.merge(stateProperties, DtPropertyInterface::RollUp);
107  DtAggregateRollUpManager::instance(myDe).parameterData((*iter)->id(), parameterData);
108  myParameterData.merge(parameterData, DtPropertyInterface::RollUp);
109  }
110  }
111  else
112  {
113  StateType* state = findStateFor<StateType*>(*iter);
114 
115  if(state)
116  {
117  if (iter == data.begin())
118  {
119  myStateProperties = state->myStateProperties;
120  }
121  else
122  {
123  myStateProperties.merge(state->myStateProperties, DtPropertyInterface::RollUp);
124  }
125  }
126  }
127 
128  ++iter;
129  }
130  }
131 
132  if (myStateProperties.registry().registryData().size())
133  {
134  int iLimit = props.size();
135  int i;
136  for (i = 0; i < iLimit; i++)
137  {
138  DtReaderWriter* rw = myStateProperties.findVariableBinding(props[i]);
139  DtPropertyInterface* prop = dynamic_cast<DtPropertyInterface*>(rw);
140 
141  if (prop)
142  {
143  if (!rw->registry().registryData().size())
144  {
145  myScrollArea->setFrameShape(QFrame::NoFrame);
146  myScrollArea->setFrameShadow(QFrame::Plain);
147  }
148 
149  addProperty(prop, merge);
150  }
151  }
152  }
153 
155  if (myPropertyItems.size() == 1)
156  {
157  if (myPropertyItems.begin()->second.modify)
158  {
159  myPropertyItems.begin()->second.modify->hide();
160  }
161  }
162  else if(myPropertyItems.size() == 0)
163  {
165  setupGuiWhenSelectionInvalid();
166  }
167  }
168  }
169 
172  virtual void setupGuiWhenNoSelection();
173 
176  virtual void setupGuiWhenSelectionInvalid();
177 
178  protected:
179 
183  };
184 
186  {
187  public:
189 
190  virtual DtTaskSetDialogInterface* create(makVrv::DtDe&, QWidget* parent);
191  bool supportsType(makVrv::DtDe&, const DtSetMessageType&, const DtSimStatement*) const;
192 
194  virtual bool isValidFor(makVrv::DtDe& de, const makVrv::DtSelectionManager::IdSet& ids,
195  int partOfPlanDialog) const;
196 
197  protected:
200  };
201 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)