Skip to content

Commit

Permalink
- WIP
Browse files Browse the repository at this point in the history
		- Attributes Tab issues..

Signed-off-by: Gleb Aronsky <[email protected]>
  • Loading branch information
Gleb Aronsky committed Nov 12, 2014
1 parent 2fc9def commit 9cfa821
Show file tree
Hide file tree
Showing 10 changed files with 739 additions and 226 deletions.
122 changes: 119 additions & 3 deletions configurator/SchemaAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ void CAttributeArray::getDojoJS(StringBuffer &strJS) const
}
}

#ifdef _USE_OLD_GET_QML_
void CAttributeArray::getQML(StringBuffer &strQML, int idx) const
{
assert(this->getConstParentNode() != NULL);
Expand Down Expand Up @@ -946,18 +947,133 @@ void CAttributeArray::getQML(StringBuffer &strQML, int idx) const
CQMLMarkupHelper::setImplicitHeight(((this->length()) * 26)+30);
DEBUG_MARK_QML;

DEBUG_MARK_QML;
strQML.append(QML_GRID_LAYOUT_BEGIN);
//strQML.append(QML_GRID_LAYOUT_BEGIN);
//DEBUG_MARK_QML;

DEBUG_MARK_QML;
QUICK_QML_ARRAY2(strQML);
DEBUG_MARK_QML;

strQML.append(QML_TAB_END);
DEBUG_MARK_QML;
}
}
}
#else // _USE_OLD_GET_QML_

void CAttributeArray::getQML(StringBuffer &strQML, int idx) const
{
assert(strQML.length() > 0); // can't start the qml

const CElement *pElem = dynamic_cast<const CElement*>(this->getConstAncestorNode(3));

assert(pElem != NULL);
assert(pElem->getNodeType() == XSD_ELEMENT);

if (pElem->isTopLevelElement() == true)
{
//strQML.append(QML_TAB_VIEW_BEGIN);
//DEBUG_MARK_QML;
CQMLMarkupHelper::getTabQML(strQML, "Attributes");
DEBUG_MARK_QML;
strQML.append(QML_GRID_LAYOUT_BEGIN_1);
DEBUG_MARK_QML;
QUICK_QML_ARRAY2(strQML);
DEBUG_MARK_QML;
strQML.append(QML_GRID_LAYOUT_END);
DEBUG_MARK_QML;
strQML.append(QML_FLICKABLE_HEIGHT).append(CQMLMarkupHelper::getImplicitHeight() * 1.5);
DEBUG_MARK_QML;
strQML.append(QML_FLICKABLE_END);
DEBUG_MARK_QML;
strQML.append(QML_TAB_END);
DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_END);
DEBUG_MARK_QML;
}
else if (pElem->isATab() == true)
{
//strQML.append(QML_GRID_LAYOUT_BEGIN);
//DEBUG_MARK_QML;

QUICK_QML_ARRAY2(strQML);
DEBUG_MARK_QML;

//strQML.append(QML_GRID_LAYOUT_END);
DEBUG_MARK_QML;

//strQML.append(QML_FLICKABLE_END);
//DEBUG_MARK_QML;
}
else if (pElem->getMaxOccursInt() != 1 || pElem->getMinOccursInt() > 1) // table
{
const char *pName = pElem->getName();

assert(pName != NULL);
assert(pName[0] != 0);

strQML.append(QML_ROW_BEGIN);
DEBUG_MARK_QML;

strQML.append(QML_TABLE_VIEW_BEGIN);
DEBUG_MARK_QML;

strQML.append(QML_MODEL).append(modelNames[CConfigSchemaHelper::getInstance(0)->getNumberOfTables()]).append(QML_STYLE_NEW_LINE);
DEBUG_MARK_QML;

strQML.append(QML_PROPERTY_STRING_TABLE_BEGIN).append(modelNames[CConfigSchemaHelper::getInstance(0)->getNumberOfTables()]).append(QML_PROPERTY_STRING_TABLE_PART_1).append(pElem->getXSDXPath()).append(QML_PROPERTY_STRING_TABLE_END);
DEBUG_MARK_QML;

CConfigSchemaHelper::getInstance(0)->incTables();

QUICK_QML_ARRAY2(strQML);
DEBUG_MARK_QML;

strQML.append(QML_TABLE_VIEW_END);
DEBUG_MARK_QML;

strQML.append(QML_ROW_END);
DEBUG_MARK_QML;
}
else
{
//assert(!"add more logic");
//QUICK_QML_ARRAY2(strQML);

strQML.append(QML_ROW_BEGIN);
DEBUG_MARK_QML;

strQML.append(QML_TABLE_VIEW_BEGIN);
DEBUG_MARK_QML;

strQML.append(QML_MODEL).append(modelNames[CConfigSchemaHelper::getInstance(0)->getNumberOfTables()]).append(QML_STYLE_NEW_LINE);
DEBUG_MARK_QML;

strQML.append(QML_PROPERTY_STRING_TABLE_BEGIN).append(modelNames[CConfigSchemaHelper::getInstance(0)->getNumberOfTables()])\
.append(QML_PROPERTY_STRING_TABLE_PART_1).append(pElem->getXSDXPath()).append(QML_PROPERTY_STRING_TABLE_END);
DEBUG_MARK_QML;

CConfigSchemaHelper::getInstance(0)->incTables();

for (int idx=0; idx < this->length(); idx++)
{
(this->item(idx)).getQML(strQML);
DEBUG_MARK_QML;
}
DEBUG_MARK_QML;

strQML.append(QML_TABLE_VIEW_END);
DEBUG_MARK_QML;

strQML.append(QML_ROW_END);
DEBUG_MARK_QML;

//strQML.append(QML_TAB_END);
//DEBUG_MARK_QML;
}

}

#endif //_USE_OLD_GET_QML_
void CAttributeArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)
{
//assert(index == 1); // Only 1 array of elements per node
Expand Down
12 changes: 6 additions & 6 deletions configurator/SchemaComplexType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ void CComplexType::getQML(StringBuffer &strQML, int idx) const

if (m_pAttributeArray != NULL)
{
strQML.append(QML_GRID_LAYOUT_BEGIN_1);
DEBUG_MARK_QML;
// strQML.append(QML_GRID_LAYOUT_BEGIN_1);
// DEBUG_MARK_QML;
m_pAttributeArray->getQML(strQML);
strQML.append(QML_TAB_END);
DEBUG_MARK_QML;
// strQML.append(QML_TAB_END);
// DEBUG_MARK_QML;
}

if (m_pChoice != NULL)
Expand All @@ -228,10 +228,10 @@ void CComplexType::getQML(StringBuffer &strQML, int idx) const
m_pElementArray->getQML(strQML);
}

if (m_pAttributeGroupArray != NULL)
/*if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->getQML(strQML);
}
}*/
}

void CComplexType::populateEnvXPath(StringBuffer strXPath, unsigned int index)
Expand Down
5 changes: 5 additions & 0 deletions configurator/SchemaComplexType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class CComplexType : public CXSDNode
return m_pAttributeArray;
}

virtual const CAttributeGroupArray* getAttributeGroupArray() const
{
return m_pAttributeGroupArray;
}

virtual const CSequence* getSequence() const
{
return m_pSequence;
Expand Down
72 changes: 56 additions & 16 deletions configurator/SchemaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,12 @@ void CElement::getQML(StringBuffer &strQML, int idx) const

/*if (this->isTopLevelElement()) // handle qml imports etc...
{
//strQML.append(QML_TAB_VIEW_BEGIN);
//DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_BEGIN);
DEBUG_MARK_QML;
CQMLMarkupHelper::getTabQML(strQML, this->getTitle());
DEBUG_MARK_QML;
strQML.append(QML_GRID_LAYOUT_BEGIN_1);
DEBUG_MARK_QML;
if (m_pAnnotation != NULL)
{
Expand All @@ -745,16 +749,16 @@ void CElement::getQML(StringBuffer &strQML, int idx) const
m_pComplexTypeArray->getQML(strQML);
}
//strQML.append(QML_TAB_VIEW_STYLE);
//DEBUG_MARK_QML;
//strQML.append(QML_TAB_VIEW_END);
//DEBUG_MARK_QML;
//strQML.append(QML_TAB_TEXT_STYLE);
//DEBUG_MARK_QML
strQML.append(QML_TAB_VIEW_STYLE);
DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_END);
DEBUG_MARK_QML;
strQML.append(QML_TAB_TEXT_STYLE);
DEBUG_MARK_QML
return;
}
else */if (this->isATab()) // Tabs will be made for all elements in a sequence
else */if (this->isATab())/// || this->isTopLevelElement() == true) // Tabs will be made for all elements in a sequence
{
if (idx == 0)
{
Expand All @@ -763,7 +767,7 @@ void CElement::getQML(StringBuffer &strQML, int idx) const
//strQML.append(QML_GRID_LAYOUT_BEGIN_1);
//DEBUG_MARK_QML;
}
CQMLMarkupHelper::getTabQML(strQML, this->getTitle());
CQMLMarkupHelper::getTabQML(strQML, /*this->isTopLevelElement() == true ? "Attributes" : */this->getTitle());
DEBUG_MARK_QML;
strQML.append(QML_GRID_LAYOUT_BEGIN_1);
DEBUG_MARK_QML;
Expand All @@ -790,17 +794,31 @@ void CElement::getQML(StringBuffer &strQML, int idx) const
DEBUG_MARK_QML;


if (static_cast<CElementArray*>(this->getParentNode())->length()-1 == idx)
//if (static_cast<CElementArray*>(this->getParentNode())->getCountOfElementsInXSD()-1 == idx)
if (static_cast<CElementArray*>(this->getParentNode())->getCountOfElementsInXSD()-1 == idx)
{
//strQML.append(QML_GRID_LAYOUT_END);
//DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_HEIGHT).append(CQMLMarkupHelper::getImplicitHeight());
DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_STYLE);
DEBUG_MARK_QML;
strQML.append(QML_TAB_VIEW_END);
DEBUG_MARK_QML;

const CComplexType *pComplexType = dynamic_cast<const CComplexType*>(this->getConstAncestorNode(3));

if (pComplexType != NULL)
{
if ((pComplexType->getAttributeArray() != NULL && pComplexType->getAttributeArray()->length() > 0) ||\
(pComplexType->getAttributeGroupArray() != NULL && pComplexType->getAttributeGroupArray()->length() > 0))
{
DEBUG_MARK_QML;
}

}
else
{
strQML.append(QML_TAB_VIEW_END);
DEBUG_MARK_QML;
}
//strQML.append(QML_TAB_TEXT_STYLE);
//DEBUG_MARK_QML;
//strQML.append(QML_TAB_VIEW_END);
Expand Down Expand Up @@ -836,8 +854,15 @@ void CElement::getQML(StringBuffer &strQML, int idx) const

bool CElement::isATab() const
{
if (this->getConstAncestorNode(2)->getNodeType() != XSD_SCHEMA && (this->hasChildElements() == true || \
(this->hasChildElements() == false && strcmp(this->getMaxOccurs(), TAG_UNBOUNDED) != 0)))
const CComplexTypeArray *pComplexTypArray = this->getComplexTypeArray();
const CAttributeGroupArray *pAttributeGroupArray = (pComplexTypArray != NULL && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeGroupArray() : NULL;
const CAttributeArray *pAttributeArray = (pComplexTypArray != NULL && pComplexTypArray->length() > 0) ? pComplexTypArray->item(0).getAttributeArray() : NULL;

if (this->getConstAncestorNode(2)->getNodeType() != XSD_SCHEMA && \
(this->hasChildElements() == true || \
(this->hasChildElements() == false && (static_cast<const CElementArray*>(this->getConstParentNode()))->anyElementsHaveMaxOccursGreaterThanOne() == false)/* || \
(this->isTopLevelElement() == true && (pAttributeGroupArray != NULL || pAttributeArray != NULL))*/))

{
return true;
}
Expand Down Expand Up @@ -1367,6 +1392,21 @@ int CElementArray::getSiblingIndex(const char* pXSDXPath, const CElement* pEleme
return nSiblingIndex;
}


bool CElementArray::anyElementsHaveMaxOccursGreaterThanOne() const
{
int len = this->length();

for (int i = 0; i < len; i++)
{
if ((this->item(i)).getMaxOccursInt() > 1 || this->item(i).getMaxOccursInt() == -1)
{
return true;

}
}
return false;
}
void CElement::setIsInXSD(bool b)
{
m_bIsInXSD = b;
Expand Down
26 changes: 24 additions & 2 deletions configurator/SchemaElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,24 @@ class CElement : public CXSDNodeWithType

bool hasChildElements() const;

int getMaxOccursInt() const
{
if (strcmp(m_strMaxOccurs.str(), TAG_UNBOUNDED) == 0)
{
return -1;
}
else
{
return atoi(m_strMaxOccurs.str());
}
}

int getMinOccursInt() const
{\
return atoi(m_strMinOccurs.str());
//return m_nMinOccurs;
}

static CElement* load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath, bool bIsInXSD = true);

GETTERSETTER(Name)
Expand All @@ -136,9 +154,9 @@ class CElement : public CXSDNodeWithType

protected:

CElement(CXSDNodeBase* pParentNode, const char* pName = "") : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ELEMENT), m_strMinOccurs(""), m_strMaxOccurs(""), m_strName(pName), m_pAnnotation(NULL),
CElement(CXSDNodeBase* pParentNode, const char* pName = "") : CXSDNodeWithType::CXSDNodeWithType(pParentNode, XSD_ELEMENT), m_strMinOccurs("1"), m_strMaxOccurs("1"), m_strName(pName), m_pAnnotation(NULL),
m_pComplexTypeArray(NULL)/*, m_pAttributeArray(NULL)*/, m_pKeyArray(NULL), m_pKeyRefArray(NULL), m_pReverseKeyRefArray(NULL), m_pElementRefNode(NULL), m_pSimpleType(NULL),\
m_bTopLevelElement(false), m_nParentIndex(-1), m_bIsInXSD(true)
m_bTopLevelElement(false), m_nParentIndex(-1), m_bIsInXSD(true)//, m_nMaxOccurs(1), m_nMinOccurs(1)
{
}

Expand All @@ -156,6 +174,8 @@ class CElement : public CXSDNodeWithType
bool m_bTopLevelElement;
int m_nParentIndex;
bool m_bIsInXSD;
//int m_nMaxOccurs;
//int m_nMinOccurs;

private:

Expand Down Expand Up @@ -223,6 +243,8 @@ class CElementArray : public CIArrayOf<CElement>, public InterfaceImpl, public C
m_nCountOfElementsInXSD++;
}

bool anyElementsHaveMaxOccursGreaterThanOne() const;

static CElementArray* load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath = DEFAULT_ELEMENT_ARRAY_XPATH);

static CElementArray* load(const char *pSchemaFile);
Expand Down
12 changes: 6 additions & 6 deletions xsds/buildset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
</Software>
<Programs>
<Build name="_" url="/opt/HPCCSystems">
<!--BuildSet installSet="deploy_map.xml"
<BuildSet installSet="deploy_map.xml"
name="hardware"
path="componentfiles/hardware"
processName="Hardware"
schema="hardware.xsd"/>
<BuildSet installSet="deploy_map.xml"
<!--BuildSet installSet="deploy_map.xml"
name="sample"
path="componentfiles/sample"
processName="Sample"
Expand All @@ -57,13 +57,13 @@
name="dafilesrv"
path="componentfiles/dafilesrv"
processName="DafilesrvProcess"
schema="dafilesrv.xsd"/>
<BuildSet installSet="deploy_map.xml"
schema="dafilesrv.xsd"/-->
<!--BuildSet installSet="deploy_map.xml"
name="dali"
path="componentfiles/dali"
processName="DaliServerProcess"
schema="dali.xsd"/>
<BuildSet installSet="deploy_map.xml"
schema="dali.xsd"/-->
<!--BuildSet installSet="deploy_map.xml"
name="dfuplus"
path="componentfiles/dfuplus"
processName="DfuplusProcess"
Expand Down
Loading

0 comments on commit 9cfa821

Please sign in to comment.