368 lines
10 KiB
Java
368 lines
10 KiB
Java
package net.sf.jasperreports.engine.base;
|
|
|
|
import java.awt.Color;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import net.sf.jasperreports.engine.JRBox;
|
|
import net.sf.jasperreports.engine.JRBoxContainer;
|
|
import net.sf.jasperreports.engine.JRChild;
|
|
import net.sf.jasperreports.engine.JRCommonElement;
|
|
import net.sf.jasperreports.engine.JRElement;
|
|
import net.sf.jasperreports.engine.JRExpressionCollector;
|
|
import net.sf.jasperreports.engine.JRFrame;
|
|
import net.sf.jasperreports.engine.JRLineBox;
|
|
import net.sf.jasperreports.engine.JRVisitable;
|
|
import net.sf.jasperreports.engine.JRVisitor;
|
|
import net.sf.jasperreports.engine.util.JRBoxUtil;
|
|
import net.sf.jasperreports.engine.util.JRPenUtil;
|
|
import net.sf.jasperreports.engine.util.JRStyleResolver;
|
|
import net.sf.jasperreports.engine.util.LineBoxWrapper;
|
|
|
|
public class JRBaseFrame extends JRBaseElement implements JRFrame {
|
|
private static final long serialVersionUID = 10200L;
|
|
|
|
protected List children;
|
|
|
|
protected JRLineBox lineBox = null;
|
|
|
|
private Byte border;
|
|
|
|
private Byte topBorder;
|
|
|
|
private Byte leftBorder;
|
|
|
|
private Byte bottomBorder;
|
|
|
|
private Byte rightBorder;
|
|
|
|
private Color borderColor;
|
|
|
|
private Color topBorderColor;
|
|
|
|
private Color leftBorderColor;
|
|
|
|
private Color bottomBorderColor;
|
|
|
|
private Color rightBorderColor;
|
|
|
|
private Integer padding;
|
|
|
|
private Integer topPadding;
|
|
|
|
private Integer leftPadding;
|
|
|
|
private Integer bottomPadding;
|
|
|
|
private Integer rightPadding;
|
|
|
|
public JRBaseFrame(JRFrame frame, JRBaseObjectFactory factory) {
|
|
super((JRElement)frame, factory);
|
|
this.border = null;
|
|
this.topBorder = null;
|
|
this.leftBorder = null;
|
|
this.bottomBorder = null;
|
|
this.rightBorder = null;
|
|
this.borderColor = null;
|
|
this.topBorderColor = null;
|
|
this.leftBorderColor = null;
|
|
this.bottomBorderColor = null;
|
|
this.rightBorderColor = null;
|
|
this.padding = null;
|
|
this.topPadding = null;
|
|
this.leftPadding = null;
|
|
this.bottomPadding = null;
|
|
this.rightPadding = null;
|
|
List frameChildren = frame.getChildren();
|
|
if (frameChildren != null) {
|
|
this.children = new ArrayList(frameChildren.size());
|
|
for (Iterator it = frameChildren.iterator(); it.hasNext(); ) {
|
|
JRChild child = it.next();
|
|
this.children.add(factory.getVisitResult((JRVisitable)child));
|
|
}
|
|
}
|
|
this.lineBox = frame.getLineBox().clone((JRBoxContainer)this);
|
|
}
|
|
|
|
public JRElement[] getElements() {
|
|
return JRBaseElementGroup.getElements(this.children);
|
|
}
|
|
|
|
public void collectExpressions(JRExpressionCollector collector) {
|
|
collector.collect(this);
|
|
}
|
|
|
|
public void visit(JRVisitor visitor) {
|
|
visitor.visitFrame(this);
|
|
}
|
|
|
|
public List getChildren() {
|
|
return this.children;
|
|
}
|
|
|
|
public JRElement getElementByKey(String elementKey) {
|
|
return JRBaseElementGroup.getElementByKey(getElements(), elementKey);
|
|
}
|
|
|
|
public byte getMode() {
|
|
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
|
|
}
|
|
|
|
public JRBox getBox() {
|
|
return (JRBox)new LineBoxWrapper(getLineBox());
|
|
}
|
|
|
|
public JRLineBox getLineBox() {
|
|
return this.lineBox;
|
|
}
|
|
|
|
public byte getBorder() {
|
|
return JRPenUtil.getPenFromLinePen(this.lineBox.getPen());
|
|
}
|
|
|
|
public Byte getOwnBorder() {
|
|
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
|
|
}
|
|
|
|
public void setBorder(byte border) {
|
|
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
|
|
}
|
|
|
|
public void setBorder(Byte border) {
|
|
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
|
|
}
|
|
|
|
public Color getBorderColor() {
|
|
return this.lineBox.getPen().getLineColor();
|
|
}
|
|
|
|
public Color getOwnBorderColor() {
|
|
return this.lineBox.getPen().getOwnLineColor();
|
|
}
|
|
|
|
public void setBorderColor(Color borderColor) {
|
|
this.lineBox.getPen().setLineColor(borderColor);
|
|
}
|
|
|
|
public int getPadding() {
|
|
return this.lineBox.getPadding().intValue();
|
|
}
|
|
|
|
public Integer getOwnPadding() {
|
|
return this.lineBox.getOwnPadding();
|
|
}
|
|
|
|
public void setPadding(int padding) {
|
|
this.lineBox.setPadding(padding);
|
|
}
|
|
|
|
public void setPadding(Integer padding) {
|
|
this.lineBox.setPadding(padding);
|
|
}
|
|
|
|
public byte getTopBorder() {
|
|
return JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen());
|
|
}
|
|
|
|
public Byte getOwnTopBorder() {
|
|
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
|
|
}
|
|
|
|
public void setTopBorder(byte topBorder) {
|
|
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
|
|
}
|
|
|
|
public void setTopBorder(Byte topBorder) {
|
|
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
|
|
}
|
|
|
|
public Color getTopBorderColor() {
|
|
return this.lineBox.getTopPen().getLineColor();
|
|
}
|
|
|
|
public Color getOwnTopBorderColor() {
|
|
return this.lineBox.getTopPen().getOwnLineColor();
|
|
}
|
|
|
|
public void setTopBorderColor(Color topBorderColor) {
|
|
this.lineBox.getTopPen().setLineColor(topBorderColor);
|
|
}
|
|
|
|
public int getTopPadding() {
|
|
return this.lineBox.getTopPadding().intValue();
|
|
}
|
|
|
|
public Integer getOwnTopPadding() {
|
|
return this.lineBox.getOwnTopPadding();
|
|
}
|
|
|
|
public void setTopPadding(int topPadding) {
|
|
this.lineBox.setTopPadding(topPadding);
|
|
}
|
|
|
|
public void setTopPadding(Integer topPadding) {
|
|
this.lineBox.setTopPadding(topPadding);
|
|
}
|
|
|
|
public byte getLeftBorder() {
|
|
return JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen());
|
|
}
|
|
|
|
public Byte getOwnLeftBorder() {
|
|
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
|
|
}
|
|
|
|
public void setLeftBorder(byte leftBorder) {
|
|
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
|
|
}
|
|
|
|
public void setLeftBorder(Byte leftBorder) {
|
|
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
|
|
}
|
|
|
|
public Color getLeftBorderColor() {
|
|
return this.lineBox.getLeftPen().getLineColor();
|
|
}
|
|
|
|
public Color getOwnLeftBorderColor() {
|
|
return this.lineBox.getLeftPen().getOwnLineColor();
|
|
}
|
|
|
|
public void setLeftBorderColor(Color leftBorderColor) {
|
|
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
|
|
}
|
|
|
|
public int getLeftPadding() {
|
|
return this.lineBox.getLeftPadding().intValue();
|
|
}
|
|
|
|
public Integer getOwnLeftPadding() {
|
|
return this.lineBox.getOwnLeftPadding();
|
|
}
|
|
|
|
public void setLeftPadding(int leftPadding) {
|
|
this.lineBox.setLeftPadding(leftPadding);
|
|
}
|
|
|
|
public void setLeftPadding(Integer leftPadding) {
|
|
this.lineBox.setLeftPadding(leftPadding);
|
|
}
|
|
|
|
public byte getBottomBorder() {
|
|
return JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen());
|
|
}
|
|
|
|
public Byte getOwnBottomBorder() {
|
|
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
|
|
}
|
|
|
|
public void setBottomBorder(byte bottomBorder) {
|
|
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
|
|
}
|
|
|
|
public void setBottomBorder(Byte bottomBorder) {
|
|
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
|
|
}
|
|
|
|
public Color getBottomBorderColor() {
|
|
return this.lineBox.getBottomPen().getLineColor();
|
|
}
|
|
|
|
public Color getOwnBottomBorderColor() {
|
|
return this.lineBox.getBottomPen().getOwnLineColor();
|
|
}
|
|
|
|
public void setBottomBorderColor(Color bottomBorderColor) {
|
|
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
|
|
}
|
|
|
|
public int getBottomPadding() {
|
|
return this.lineBox.getBottomPadding().intValue();
|
|
}
|
|
|
|
public Integer getOwnBottomPadding() {
|
|
return this.lineBox.getOwnBottomPadding();
|
|
}
|
|
|
|
public void setBottomPadding(int bottomPadding) {
|
|
this.lineBox.setBottomPadding(bottomPadding);
|
|
}
|
|
|
|
public void setBottomPadding(Integer bottomPadding) {
|
|
this.lineBox.setBottomPadding(bottomPadding);
|
|
}
|
|
|
|
public byte getRightBorder() {
|
|
return JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen());
|
|
}
|
|
|
|
public Byte getOwnRightBorder() {
|
|
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
|
|
}
|
|
|
|
public void setRightBorder(byte rightBorder) {
|
|
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
|
|
}
|
|
|
|
public void setRightBorder(Byte rightBorder) {
|
|
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
|
|
}
|
|
|
|
public Color getRightBorderColor() {
|
|
return this.lineBox.getRightPen().getLineColor();
|
|
}
|
|
|
|
public Color getOwnRightBorderColor() {
|
|
return this.lineBox.getRightPen().getOwnLineColor();
|
|
}
|
|
|
|
public void setRightBorderColor(Color rightBorderColor) {
|
|
this.lineBox.getRightPen().setLineColor(rightBorderColor);
|
|
}
|
|
|
|
public int getRightPadding() {
|
|
return this.lineBox.getRightPadding().intValue();
|
|
}
|
|
|
|
public Integer getOwnRightPadding() {
|
|
return this.lineBox.getOwnRightPadding();
|
|
}
|
|
|
|
public void setRightPadding(int rightPadding) {
|
|
this.lineBox.setRightPadding(rightPadding);
|
|
}
|
|
|
|
public void setRightPadding(Integer rightPadding) {
|
|
this.lineBox.setRightPadding(rightPadding);
|
|
}
|
|
|
|
public Color getDefaultLineColor() {
|
|
return getForecolor();
|
|
}
|
|
|
|
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
|
in.defaultReadObject();
|
|
if (this.lineBox == null) {
|
|
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
|
|
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
|
|
this.border = null;
|
|
this.topBorder = null;
|
|
this.leftBorder = null;
|
|
this.bottomBorder = null;
|
|
this.rightBorder = null;
|
|
this.borderColor = null;
|
|
this.topBorderColor = null;
|
|
this.leftBorderColor = null;
|
|
this.bottomBorderColor = null;
|
|
this.rightBorderColor = null;
|
|
this.padding = null;
|
|
this.topPadding = null;
|
|
this.leftPadding = null;
|
|
this.bottomPadding = null;
|
|
this.rightPadding = null;
|
|
}
|
|
}
|
|
}
|