60 for (
const auto& attrProperty : tagProperties->getAttributeProperties()) {
62 if (attrProperty->isDialogEditor()) {
64 myLabels.push_back(std::make_pair(attrProperty->getAttr(),
new FXLabel(horizontalFrameLabels, attrProperty->getAttrStr().c_str(),
67 if (attrProperty->isNumerical()) {
68 mySortableAttrs.push_back(attrProperty->getAttr());
91 for (
const auto& label : myLabels) {
92 label.second->enable();
100 for (
const auto& label : myLabels) {
101 label.second->disable();
108 return myLabels.size();
112const std::vector<SumoXMLAttr>&
114 return mySortableAttrs;
120 for (
int i = 0; i < (int)myLabels.size(); i++) {
121 if (myLabels.at(i).first == attr) {
135 myElementTable(elementTable),
136 myRowIndex(rowIndex),
146 if (attrProperty->isDialogEditor()) {
151 textField->setText(AC->
getAttribute(attrProperty->getAttr()).c_str());
172 if (elementTable->id() != 0) {
185 myIndexLabel->enable();
187 for (
const auto& attributeTextField : myAttributeTextFields) {
188 attributeTextField.second->enable();
191 myRemoveButton->enable();
193 if (myOpenDialogButton) {
194 myOpenDialogButton->enable();
202 myIndexLabel->disable();
204 for (
const auto& attributeTextField : myAttributeTextFields) {
205 attributeTextField.second->disable();
208 myRemoveButton->disable();
210 if (myOpenDialogButton) {
211 myOpenDialogButton->disable();
221 for (
const auto& attributeTextField : myAttributeTextFields) {
223 const std::string value = myAC->getAttribute(attributeTextField.first);
225 attributeTextField.second->setText(value.c_str());
235 if (column < myAttributeTextFields.size()) {
237 return myAttributeTextFields.at(column).second->getText().text();
239 throw ProcessError(
"Column ndex out of bounds in GNEElementTable::Row::getValue");
247 for (
const auto& attributeTextField : myAttributeTextFields) {
261 for (
const auto& attributeTextField : myAttributeTextFields) {
263 if (attributeTextField.second == sender) {
265 const std::string value = attributeTextField.second->getText().text();
267 if (!myAC->isValid(attributeTextField.first, value)) {
276 myAC->setAttribute(attributeTextField.first, value, myAC->getNet()->getViewNet()->getUndoList());
280 attributeTextField.second->killFocus();
292 return myElementTable->myElementList->removeElement(myRowIndex);
298 return myElementTable->myElementList->openElementDialog(myRowIndex);
305 const int allowColumnIndex = myElementTable->myColumnHeader->getAttributeIndex(
SUMO_ATTR_ALLOW);
306 if (allowColumnIndex >= 0) {
308 const auto allowVClassesDialog =
new GNEVClassesDialog(myAC->getNet()->getViewNet()->getViewParent()->getGNEAppWindows(),
312 myAttributeTextFields.at(allowColumnIndex).second->setText(allowVClassesDialog->getModifiedVClasses().c_str(), TRUE);
323 FXVerticalFrame(elementList, LAYOUT_FIX_WIDTH | ((options &
GNEElementList::Options::FIXED_HEIGHT) ? LAYOUT_FIX_HEIGHT : LAYOUT_FILL_Y),
324 0, 0, 400, 300, 0, 0, 0, 0, 0, 0),
350 for (
const auto& row :
myRows) {
361 for (
const auto& row :
myRows) {
372 for (
const auto& row :
myRows) {
373 if (!row->isValid()) {
384 while (
myRows.size() > numRows) {
394 if (index <
myRows.size()) {
396 myRows.at(index)->updateRow(AC);
397 }
else if (index ==
myRows.size()) {
399 myRows.push_back(
new Row(
this, index, AC));
401 throw ProcessError(
"Index out of bounds in GNEElementTable::updateRow");
408 if (rowIndex <
myRows.size()) {
409 return myRows.at(rowIndex)->getValue(columnIndex);
411 throw ProcessError(
"Row index out of bounds in GNEElementTable::getValue");
FXDEFMAP(GNEElementTable::Row) RowMap[]
@ MID_GNE_ELEMENTTABLE_EDIT
@ MID_GNE_ELEMENTTABLE_DIALOG_VCLASS
open dialog vClass
@ MID_GNE_ELEMENTTABLE_DIALOG_ELEMENT
open dialog element
@ MID_GNE_ELEMENTTABLE_REMOVE
remove row
#define GUIDesignTextColorRed
red color (for invalid text)
#define GUIDesignLabelFixed(width)
label, icon before text, text centered and custom width
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignAuxiliarHorizontalFrameUniform
design for auxiliar (Without borders) horizontal frame used to pack another frames uniform
#define GUIDesignBackgroundColorRed
red background color (for invalid text)
#define GUIDesignLabelThick(justify)
label extended over frame with thick and with text justify to left
#define GUIDesignTextColorBlack
black color (for correct text)
#define GUIDesignBackgroundColorWhite
white background color (for valid text)
#define GUIDesignScrollWindowFixedWidth(customWidth)
design for scroll windows extended over Y and fix width
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
#define GUIDesignLabelIconThick
label squared over frame with thick and with text justify to center
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
int GUIDesignHeight
the default height for GUI elements
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
~ColumnHeader()
destructor
int getAttributeIndex(SumoXMLAttr attr) const
get column with the given
const std::vector< SumoXMLAttr > & getSortableAttributes()
get sortable attributes
void disableRowHeader()
disable row header
void enableRowHeader()
enable row header
size_t getNumColumns() const
get num columns
long onCmdEditRow(FXObject *sender, FXSelector, void *)
called when user edits a row
FXButton * myRemoveButton
remove button
long onCmdOpenVClassDialog(FXObject *sender, FXSelector, void *)
called when user press open vClass dialog button
std::vector< std::pair< SumoXMLAttr, MFXTextFieldIcon * > > myAttributeTextFields
list with textfields and their associated attribute
long onCmdOpenElementDialog(FXObject *sender, FXSelector, void *)
called when user press open element dialog button
void enableRow()
enable row
FXButton * myOpenDialogButton
open dialog button
Row(GNEElementTable *elementTable, const size_t rowIndex, GNEAttributeCarrier *AC)
fox declaration
void updateRow(GNEAttributeCarrier *AC)
update row
bool isValid() const
check if current value is valid
FXButton * myOpenVClassButton
open vClass button
FXLabel * myIndexLabel
index label
std::string getValue(const size_t column) const
get value of the given column index
long onCmdRemoveRow(FXObject *sender, FXSelector, void *)
called when user press remove button
void disableRow()
disable row
ColumnHeader * myColumnHeader
column header
GNEElementList * myElementList
pointer to the parent element list
std::string getValue(const size_t rowIndex, const size_t columnIndex) const
get value
GNEElementList::Options myOptions
GNEElementList options.
FXScrollWindow * myScrollWindow
scrollWindow for rows
bool isValid() const
check if the current values of the table are valid
void updateRow(const size_t index, GNEAttributeCarrier *AC)
update row
void disableTable()
Disable table.
std::vector< Row * > myRows
rows
~GNEElementTable()
destructor
FXVerticalFrame * myRowsFrame
vertical frame for rows
void resizeTable(const size_t numRows)
resize table
GNEElementTable(GNEElementList *elementList, const GNETagProperties *tagProperties, GNEElementList::Options options)
constructor
ColumnHeader * getColumnHeader() const
get column header
void enableTable()
Enable table.
GNEViewNet * getViewNet() const
get view net
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus