示例#1
0
void DOMTreeView::initializeOptionsFromNode(const DOM::Node &node)
{
  infoNode = node;

  nodeName->clear();
  nodeType->clear();
  nodeNamespace->clear();
  nodeValue->clear();

  if (node.isNull()) {
    nodeInfoStack->raiseWidget(EmptyPanel);
    return;
  }

  nodeName->setText(node.nodeName().string());
  nodeType->setText(QString::number(node.nodeType()));
  nodeNamespace->setText(node.namespaceURI().string());
//   nodeValue->setText(node.value().string());

  DOM::Element element = node;
  if (!element.isNull()) {
    initializeOptionsFromElement(element);
    return;
  }

  DOM::CharacterData cdata = node;
  if (!cdata.isNull()) {
    initializeOptionsFromCData(cdata);
    return;
  }

  // Fallback
  nodeInfoStack->raiseWidget(EmptyPanel);
}
示例#2
0
void DOMTreeView::slotApplyContent()
{
  DOM::CharacterData cdata = infoNode;

  if (cdata.isNull()) return;

  ManipulationCommand *cmd = new ChangeCDataCommand(cdata, contentEditor->text());
  mainWindow()->executeAndAddCommand(cmd);
}
示例#3
0
void DOMTreeView::initializeOptionsFromCData(const DOM::CharacterData &cdata)
{
  contentEditor->setText(cdata.data().string());

  DOM::Text text = cdata;
  contentEditor->setEnabled(!text.isNull());

  nodeInfoStack->raiseWidget(CDataPanel);
}
示例#4
0
void DOMTreeView::initializeDOMInfoFromCData(const DOM::CharacterData &cdata)
{
  contentEditor->setText(cdata.data().string());

  DOM::Text text = cdata;
  contentEditor->setEnabled(!text.isNull());

  nodeInfoStack->setCurrentIndex(CDataPanel);
}
示例#5
0
KJSO DOMCharacterData::tryGet(const UString &p) const
{
  DOM::CharacterData data = static_cast<DOM::CharacterData>(node);
  if (p == "data")
    return String(data.data());
  else if (p == "length")
    return Number(data.length());
  else if (p == "substringData")
    return new DOMCharacterDataFunction(data, DOMCharacterDataFunction::SubstringData);
  else if (p == "appendData")
    return new DOMCharacterDataFunction(data, DOMCharacterDataFunction::AppendData);
  else if (p == "insertData")
    return new DOMCharacterDataFunction(data, DOMCharacterDataFunction::InsertData);
  else if (p == "deleteData")
    return new DOMCharacterDataFunction(data, DOMCharacterDataFunction::DeleteData);
  else if (p == "replaceData")
    return new DOMCharacterDataFunction(data, DOMCharacterDataFunction::ReplaceData);
  else
    return DOMNode::tryGet(p);
}