📄 report.java
字号:
}
else if (nodeChild.getNodeType() == Node.ELEMENT_NODE && nodeChild.getNodeName().equals("groupHeader")) {
// Take the band...
NodeList list_child = nodeChild.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
if ( bandAttributes.getNamedItem("height") != null) group.getGroupHeader().setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) group.getGroupHeader().setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,group.getGroupHeader());
}
}
}
else if (nodeChild.getNodeType() == Node.ELEMENT_NODE && nodeChild.getNodeName().equals("groupFooter")) {
// Take the band...
NodeList list_child = nodeChild.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
if ( bandAttributes.getNamedItem("height") != null) group.getGroupFooter().setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) group.getGroupFooter().setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,group.getGroupFooter());
}
}
}
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("background")) {
// Load background band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("background");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("title")) {
// Load title band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("title");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("pageHeader")) {
// Load pageHeader band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("pageHeader");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("columnHeader")) {
// Load columnHeader band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("columnHeader");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("detail")) {
// Load detail band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("detail");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("columnFooter")) {
// Load columnFooter band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("columnFooter");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("pageFooter")) {
// Load pageFooter band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("pageFooter");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("lastPageFooter")) {
// Load title band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("lastPageFooter");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("summary")) {
// Load summary band
NodeList list_child = node.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node bandNode = (Node)list_child.item(ck);
if (bandNode.getNodeType() == Node.ELEMENT_NODE && bandNode.getNodeName().equals("band")) {
// Read the band...
NamedNodeMap bandAttributes = bandNode.getAttributes();
Band b = this.getBandByName("summary");
if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
if ( bandAttributes.getNamedItem("isSplitAllowed") != null) b.setSplitAllowed( bandAttributes.getNamedItem("isSplitAllowed").getNodeValue().equals("true") );
readBandElements(bandNode,b);
}
}
}
NodeList children = node.getChildNodes();
if (children != null) {
for (int i=0; i< children.getLength(); i++)
traverse(children.item(i));
}
}
private void readBandElements(Node bandNode, Band band) {
NodeList list_child = bandNode.getChildNodes();
for (int ck=0; ck< list_child.getLength(); ck++) {
Node child = (Node)list_child.item(ck);
if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("printWhenExpression")) {
// Read the band...
//NamedNodeMap bandAttributes = bandNode.getAttributes();
//if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
// Take subelements and lloking for the expression...
NodeList childsOfChild = child.getChildNodes();
for (int c_count=0; c_count< childsOfChild.getLength(); c_count++) {
Node child_child = (Node)childsOfChild.item(c_count);
if (child_child.getNodeType() == Node.CDATA_SECTION_NODE ||
child_child.getNodeType() == Node.TEXT_NODE) {
band.setPrintWhenExpression(child_child.getNodeValue());
}
}
}
else if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("staticText")) {
StaticTextReportElement re = new StaticTextReportElement(0,0,0,0);
re.setIReportFont(defaultFont);
re.setBand(band);
NodeList childsOfChild = child.getChildNodes();
for (int c_count=0; c_count< childsOfChild.getLength(); c_count++) {
Node child_child = (Node)childsOfChild.item(c_count);
if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("reportElement")) {
readXMLReportElement(child_child,re);
}
else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("textElement")) {
readXMLTextElement(child_child,re);
}
else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("text")) {
re.setText( readPCDATA(child_child, false) );
}
else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("box")) {
readBoxElement(child_child,re);
}
}
re.setPosition(re.position);
re.trasform(new java.awt.Point(0,0),TransformationType.TRANSFORMATION_RESIZE_SE);
elements.addElement(re);
}
else if (child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals("image")) {
ImageReportElement re = new ImageReportElement(0,0,0,0);
re.setBand(band);
NamedNodeMap nodeAttributes = child.getAttributes();
if (nodeAttributes.getNamedItem("isUsingCache") != null)
re.setIsUsingCache( (""+nodeAttributes.getNamedItem("isUsingCache").getNodeValue()).equals("true") );
if (nodeAttributes.getNamedItem("scaleImage") != null)
re.setScaleImage(""+nodeAttributes.getNamedItem("scaleImage").getNodeValue());
if (nodeAttributes.getNamedItem("vAlign") != null)
re.setVerticalAlignment( ""+nodeAttributes.getNamedItem("vAlign").getNodeValue());
if (nodeAttributes.getNamedItem("hAlign") != null)
re.setHorizontalAlignment(""+nodeAttributes.getNamedItem("hAlign").getNodeValue());
if (nodeAttributes.getNamedItem("evaluationTime") != null)
re.setEvaluationTime( ""+nodeAttributes.getNamedItem("evaluationTime").getNodeValue());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -