001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine.export.oasis;
029:
030: import java.io.IOException;
031: import java.io.Writer;
032:
033: import net.sf.jasperreports.engine.JRElement;
034: import net.sf.jasperreports.engine.JRPrintElement;
035: import net.sf.jasperreports.engine.util.JRColorUtil;
036:
037: /**
038: * @author Teodor Danciu (teodord@users.sourceforge.net)
039: * @version $Id: FrameStyle.java 1664 2007-03-26 09:48:03Z lucianc $
040: */
041: public class FrameStyle extends BorderStyle {
042: /**
043: *
044: */
045: private String fill = null;
046: private String backcolor = null;
047:
048: /**
049: *
050: */
051: public FrameStyle(Writer styleWriter, JRPrintElement element) {
052: super (styleWriter, element);
053:
054: if (element.getMode() == JRElement.MODE_OPAQUE) {
055: fill = "solid";
056: backcolor = JRColorUtil
057: .getColorHexa(element.getBackcolor());
058: } else {
059: fill = "none";
060: }
061: }
062:
063: /**
064: *
065: */
066: public String getId() {
067: return fill + "|" + backcolor + "|" + super .getId();
068: }
069:
070: /**
071: *
072: */
073: public void write(String frameStyleName) throws IOException {
074: styleWriter.write("<style:style style:name=\"");
075: styleWriter.write(frameStyleName);
076: styleWriter.write("\" style:family=\"graphic\"");
077: // styleWriter.write(" style:parent-style-name=\"Frame\"" +
078: styleWriter.write(">\n");
079: styleWriter.write(" <style:graphic-properties");
080: // styleWriter.write(" style:run-through=\"foreground\"");
081: // styleWriter.write(" style:wrap=\"run-through\"");
082: // styleWriter.write(" style:number-wrapped-paragraphs=\"no-limit\"");
083: // styleWriter.write(" style:wrap-contour=\"false\"");
084: styleWriter.write(" style:vertical-pos=\"from-top\"");
085: styleWriter.write(" style:vertical-rel=\"page\"");
086: styleWriter.write(" style:horizontal-pos=\"from-left\"");
087: styleWriter.write(" style:horizontal-rel=\"page\"");
088: styleWriter.write(" draw:fill=\"");
089: styleWriter.write(fill);
090: styleWriter.write("\" draw:fill-color=\"#");
091: styleWriter.write(backcolor);
092: styleWriter.write("\"");
093:
094: writeBorder(TOP_BORDER);
095: writeBorder(LEFT_BORDER);
096: writeBorder(BOTTOM_BORDER);
097: writeBorder(RIGHT_BORDER);
098:
099: styleWriter.write("/>\n");
100: styleWriter.write("</style:style>\n");
101: }
102:
103: }
|