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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)