PropertyBrowser: Add a JSON link and the path
This commit is contained in:
parent
033957003f
commit
6e3486349b
1 changed files with 16 additions and 4 deletions
|
@ -85,8 +85,8 @@ public:
|
|||
virtual ~DOMNode();
|
||||
|
||||
virtual std::string render() const;
|
||||
virtual void addChild( DOMElement * child );
|
||||
virtual void setAttribute( const string & name, const string & value );
|
||||
virtual DOMNode * addChild( DOMElement * child );
|
||||
virtual DOMNode * setAttribute( const string & name, const string & value );
|
||||
protected:
|
||||
string _name;
|
||||
typedef vector<const DOMElement*> Children_t;
|
||||
|
@ -129,14 +129,16 @@ string DOMNode::render() const
|
|||
return reply;
|
||||
}
|
||||
|
||||
void DOMNode::addChild( DOMElement * child )
|
||||
DOMNode * DOMNode::addChild( DOMElement * child )
|
||||
{
|
||||
_children.push_back( child );
|
||||
return dynamic_cast<DOMNode*>(child);
|
||||
}
|
||||
|
||||
void DOMNode::setAttribute( const string & name, const string & value )
|
||||
DOMNode * DOMNode::setAttribute( const string & name, const string & value )
|
||||
{
|
||||
_attributes[name] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
class SortedChilds : public simgear::PropertyList {
|
||||
|
@ -188,6 +190,16 @@ DOMElement * createHeader( const string & prefix, const string & propertyPath )
|
|||
root->addChild( headline );
|
||||
headline->addChild( new DOMTextElement("FlightGear Property Browser") );
|
||||
|
||||
{
|
||||
DOMNode * div = new DOMNode("div");
|
||||
root->addChild(div);
|
||||
div->addChild( new DOMNode("span"))->addChild( new DOMTextElement("Path:"));
|
||||
div->addChild( new DOMNode("span"))->addChild( new DOMTextElement( propertyPath ) );
|
||||
div->addChild( new DOMNode("a"))->
|
||||
setAttribute("href",string("/json/")+propertyPath+"?i=y")->
|
||||
addChild( new DOMTextElement( "As JSON" ) );
|
||||
}
|
||||
|
||||
DOMNode * breadcrumb = new DOMNode("ul");
|
||||
root->addChild( breadcrumb );
|
||||
|
||||
|
|
Loading…
Reference in a new issue