📄 104d145bbdb7001a1e5ff42f2510af1d
字号:
|| (nodeName.equals("allowUnbillableCalls"))
|| (nodeName.equals("conferenceBridge"))
|| (nodeName.equals("syncPort"))
|| (nodeName.equals("radiusServer"))
|| (nodeName.equals("billing"))
|| (nodeName.equals("maxThreads"))
|| (nodeName.equals("keepAliveTimer"))
|| (nodeName.equals("responseTime"))
|| (nodeName.equals("clientPort"))
|| (nodeName.equals("multiGroup"))
|| (nodeName.equals("hostname"))
|| (nodeName.equals("Camera1"))
|| (nodeName.equals("Camera2"))
|| (nodeName.equals("Camera3"))
|| (nodeName.equals("Camera4"))
|| (nodeName.equals("Camera5"))
|| (nodeName.equals("Camera6"))
|| (nodeName.equals("Camera7"))
|| (nodeName.equals("Camera8"))
|| (nodeName.equals("temperature"))
|| (nodeName.equals("smokeAlarm"))
|| (nodeName.equals("water"))
|| (nodeName.equals("key")))
{
// Uncomment for debug:
// System.out.println("skipping " + nodeName);
return NodeFilter.FILTER_SKIP;
}
return NodeFilter.FILTER_ACCEPT;
}
};
if (elementFilter.acceptNode(what) != NodeFilter.FILTER_ACCEPT)
{
return null;
}
String elementName = what.getNodeName();
String parentName = "";
String grandparentName = "";
Node parentNode = what.getParentNode();
Node grandparentNode = null;
if (parentNode != null)
{
parentName = parentNode.getNodeName();
grandparentNode = parentNode.getParentNode();
if (grandparentNode != null)
{
grandparentName = grandparentNode.getNodeName();
}
}
int type = UNKNOWN;
if (elementName.equals("system"))
{
type = SYSTEM;
}
else if (elementName.equals("servers"))
{
type = SERVERS;
}
else if (elementName.equals("uaclient"))
{
type = UA_CLIENT;
}
else if (elementName.equals("globalConfiguration"))
{
type = GLOBAL;
}
else if (elementName.equals("featureServers"))
{
type = FEATURE_SERVERS;
}
else if (elementName.equals("marshalServers"))
{
type = MARSHAL_SERVERS;
}
else if (elementName.equals("jtapiServers"))
{
type = JTAPI_SERVERS;
}
else if (elementName.equals("redirectServers"))
{
type = REDIRECT_SERVERS;
}
else if (elementName.equals("cdrServers"))
{
type = CDR_SERVERS;
}
else if (elementName.equals("heartbeatServers"))
{
type = HEARTBEAT_SERVERS;
}
else if (elementName.equals("pdpServers"))
{
type = PDP_SERVERS;
}
else if (elementName.equals("dvrClient"))
{
type = DVR_CLIENT;
}
else if (elementName.equals("envClient"))
{
type = ENV_CLIENT;
}
else if (elementName.equals("serverType"))
{
if (parentName.equals("featureServers"))
{
type = FEATURE_TYPE;
}
else if (parentName.equals("marshalServers"))
{
type = MARSHAL_TYPE;
}
}
else if (elementName.equals("serverGroup"))
{
if (grandparentName.equals("featureServers"))
{
type = FEATURE_GROUP;
}
else if (grandparentName.equals("marshalServers"))
{
type = MARSHAL_GROUP;
}
else if (parentName.equals("jtapiServers"))
{
type = JTAPI_GROUP;
}
else if (parentName.equals("redirectServers"))
{
type = REDIRECT_GROUP;
}
else if (parentName.equals("cdrServers"))
{
type = CDR_GROUP;
}
else if (parentName.equals("heartbeatServers"))
{
type = HEARTBEAT_GROUP;
}
else if (parentName.equals("pdpServers"))
{
type = PDP_GROUP;
}
else if (parentName.equals("dvrClient"))
{
type = DVR_GROUP;
}
else if (parentName.equals("envClient"))
{
type = ENV_GROUP;
}
}
/*
else if (elementName.equals("clientGroup"))
{
if (parentName.equals("dvrClient"))
{
type = DVR_GROUP;
}
else if (parentName.equals("envClient"))
{
type = ENV_GROUP;
}
}
*/
else if (elementName.equals("featureServer"))
{
type = FEATURE_SERVER;
}
else if (elementName.equals("marshalServer"))
{
type = MARSHAL_SERVER;
}
else if (elementName.equals("jtapiServer"))
{
type = JTAPI_SERVER;
}
else if (elementName.equals("redirectServer"))
{
type = REDIRECT_SERVER;
}
else if (elementName.equals("cdrServer"))
{
type = CDR_SERVER;
}
else if (elementName.equals("heartbeatServer"))
{
type = HEARTBEAT_SERVER;
}
else if (elementName.equals("pdpServer"))
{
type = PDP_SERVER;
}
else if (elementName.equals("ospServer"))
{
type = OSP_SERVER;
}
else if (elementName.equals("dvr"))
{
type = DVR;
}
else if (elementName.equals("env"))
{
type = ENV;
}
else if (elementName.equals("ipplan"))
{
type = IP_DIAL_PLAN;
}
else if (elementName.equals("digitalplan"))
{
type = DIGITAL_DIAL_PLAN;
}
StringBuffer name = new StringBuffer();
name.append(what.getNodeName());
NamedNodeMap attrs = what.getAttributes();
if (attrs != null)
{
Node qualifier = attrs.getNamedItem("value");
if (qualifier != null)
{
name.append(" " + ((Attr) qualifier).getValue());
}
else
{
qualifier = attrs.getNamedItem("host");
if (qualifier != null)
{
name.append(" " + ((Attr) qualifier).getValue());
}
qualifier = attrs.getNamedItem("port");
if (qualifier != null)
{
name.append(":" + ((Attr) qualifier).getValue());
}
qualifier = attrs.getNamedItem("callingPort");
if (qualifier != null)
{
name.append(":" + ((Attr) qualifier).getValue());
}
qualifier = attrs.getNamedItem("calledPort");
if (qualifier != null)
{
name.append(":" + ((Attr) qualifier).getValue());
}
}
}
MutableTreeNode element = insertNode(name.toString(), where, type);
// if this is a Servers type of node, expand it.
if ((type == SYSTEM) || (type == SERVERS) || (type == UA_CLIENT))
{
treeNodesToExpand.addElement(element);
}
nodeMap.put(element, what);
int attrCount = (attrs != null) ? attrs.getLength() : 0;
for (int i = 0; i < attrCount; i++)
{
Attr attr = (Attr) (attrs.item(i));
if ((attr.getName().equals("host"))
|| (attr.getName().equals("port"))
|| (attr.getName().equals("callingPort"))
|| (attr.getName().equals("calledPort"))
|| (attr.getName().equals("value"))
|| (attr.getName().equals("fileDir"))
|| (attr.getName().equals("fileName"))
|| (attr.getName().equals("fileType")))
{
continue;
}
StringBuffer line = new StringBuffer();
line.append(attr.getName());
line.append(" = ");
line.append(attr.getValue());
MutableTreeNode attrNode = insertNode(line.toString(), element);
nodeMap.put(attrNode, attr.getName());
}
// if this is a multiGroup, we do not include the children
if (elementName.equals("multiGroup"))
{
return element;
}
// gather up attributes and children nodes
NodeList children = what.getChildNodes();
int len = (children != null) ? children.getLength() : 0;
for (int i = 0; i < len; i++)
{
Node node = children.item(i);
switch (node.getNodeType())
{
case Node.CDATA_SECTION_NODE:
{
insertCDataSectionNode(node, element); // Add a Section Node
break;
}
case Node.TEXT_NODE:
{
insertTextNode(node, element);
break;
}
case Node.ELEMENT_NODE:
{
insertElementNode(node, element);
break;
}
}
}
return element;
} // insertElementNode(Node,MutableTreeNode):MutableTreeNode
/**
* Inserts a text node.
*/
private MutableTreeNode insertTextNode(Node what, MutableTreeNode where)
{
String value = what.getNodeValue().trim();
if (value.length() > 0)
{
MutableTreeNode treeNode = insertNode(value, where);
nodeMap.put(treeNode, what);
return treeNode;
}
return null;
}
/**
* Inserts a CData Section Node.
*/
private MutableTreeNode insertCDataSectionNode(Node what,
MutableTreeNode where)
{
StringBuffer CSectionBfr = new StringBuffer();
// --- optional --- CSectionBfr.append( "<![CDATA[" );
CSectionBfr.append(what.getNodeValue());
// --- optional --- CSectionBfr.append( "]]>" );
if (CSectionBfr.length() > 0)
{
MutableTreeNode treeNode = insertNode(CSectionBfr.toString(), where);
nodeMap.put(treeNode, what);
return treeNode;
}
return null;
}
} // class Model
} // class ConfigTree
/**
* There is one UserObject per DefaultMutableTreeNode.
*/
class AccUserObject implements TreeNodeTypes
{
private int nodeType = UNKNOWN;
private String displayString = "";
/**
*
*/
public String toString()
{
return displayString;
}
/**
*
* @param string
*/
public void setDisplayString(String string)
{
displayString = string;
}
/**
*
*/
public int getNodeType()
{
return nodeType;
}
/**
*
* @param type
* @param string
*/
AccUserObject(int type, String string)
{
nodeType = type;
setDisplayString(string);
}
} // class UserObject
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -