0001: /*
0002: * Copyright (C) 2004 Giuseppe MANNA
0003: *
0004: * This file is part of FreeReportBuilder
0005: *
0006: * FreeReportBuilder is free software; you can redistribute it and/or
0007: * modify it under the terms of the GNU General Public License
0008: * as published by the Free Software Foundation; either version 2
0009: * of the License, or (at your option) any later version.
0010: *
0011: * This program is distributed in the hope that it will be useful,
0012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0014: * GNU General Public License for more details.
0015: *
0016: * You should have received a copy of the GNU General Public License
0017: * along with this program; if not, write to the Free Software
0018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0019: *
0020: */
0021:
0022: package it.frb;
0023:
0024: import java.awt.Component;
0025: import java.awt.Dimension;
0026: import java.sql.ResultSet;
0027: import java.sql.SQLException;
0028: import java.sql.Types;
0029: import java.util.Vector;
0030: import javax.swing.*;
0031:
0032: public class JPreviewPanel extends JPanel implements
0033: java.awt.print.Printable {
0034: private int cursorPosition;
0035: private int rowsForPage;
0036: private int numRows;
0037: private int rowsCount;
0038: private int counterColumnPos = 0;
0039: private int cCPosForFinalTrailer = 0;
0040: private int pagIndexPrint;
0041: private int subIndexPage;
0042: private int yTotalPosition;
0043: private int headerColumnPos = 0;
0044: private int yTotalHeight;
0045: private int yMaxWidth;
0046: private int indexStartColumnTrailerValue;
0047: private int[] arrayColumnType;
0048: private Vector vSnapshotCursorPosition = null;
0049: private ResultSet rsDati;
0050: private DataPanel dataPanel;
0051: private String sOutputGruppo = "";
0052: private Vector vecDati;
0053: private String sqlExecuted;
0054: private String sUltimiValoriGruppi[] = null;
0055: private java.awt.Dimension dScSize;
0056: private java.util.Hashtable hashArgumentNested = null;
0057: private java.awt.print.PrinterJob printerJob;
0058: private java.sql.Connection connection;
0059: private javax.swing.JProgressBar bar;
0060: private java.awt.print.PageFormat pageFormat = null;
0061:
0062: public JPreviewPanel(DataPanel dtp) {
0063: super (null);
0064: java.awt.Toolkit objToolkit = java.awt.Toolkit
0065: .getDefaultToolkit();
0066: dScSize = objToolkit.getScreenSize();
0067:
0068: this .dataPanel = dtp;
0069: }
0070:
0071: public java.sql.Connection getConnection() {
0072: return connection;
0073: }
0074:
0075: public void setPrintJob(java.awt.print.PrinterJob prj) {
0076: this .printerJob = prj;
0077: }
0078:
0079: public void setRowsCount(int rows) {
0080: this .rowsCount = rows;
0081: }
0082:
0083: public int getRowsCount() {
0084: return rowsCount;
0085: }
0086:
0087: public void setResultSetVect(Vector vec, int[] arrayColumnType) {
0088: this .arrayColumnType = arrayColumnType;
0089: vecDati = vec;
0090: }
0091:
0092: public Vector getVectorDati() {
0093: return vecDati;
0094: }
0095:
0096: public void setResultSet(ResultSet rst) throws SQLException {
0097: java.sql.Statement stm = rst.getStatement();
0098: connection = stm.getConnection();
0099:
0100: rst.close();
0101: stm.close();
0102:
0103: //Se il database supporta i cursori che scorrono in
0104: //entrambi i sensi, me ne accorgo dal fatto che
0105: // l' Engine non ha caricato il vettore
0106: if (vecDati == null) {
0107: Object arguments[] = dataPanel.getArgsObject();
0108:
0109: if (arguments == null) {
0110: stm = connection.createStatement(
0111: ResultSet.TYPE_SCROLL_INSENSITIVE,
0112: ResultSet.CONCUR_READ_ONLY);
0113:
0114: try {
0115: if (stm.execute(sqlExecuted)) {
0116: rsDati = stm.getResultSet();
0117: rsDati.first();
0118:
0119: if (cursorPosition != -1) {
0120: rsDati.relative(cursorPosition);
0121: }
0122: }
0123: } catch (StringIndexOutOfBoundsException p) {
0124:
0125: }
0126: } else {
0127: java.sql.PreparedStatement prdStat = connection
0128: .prepareStatement(sqlExecuted,
0129: ResultSet.TYPE_SCROLL_INSENSITIVE,
0130: ResultSet.CONCUR_READ_ONLY);
0131:
0132: for (int i = 0; i < arguments.length; i++) {
0133: prdStat.setObject(i + 1, arguments[i]);
0134: }
0135:
0136: if (prdStat.execute()) {
0137: try {
0138: rsDati = prdStat.getResultSet();
0139:
0140: if (rsDati != null) {
0141: rsDati.first();
0142:
0143: if (cursorPosition != -1) {
0144: rsDati.relative(cursorPosition);
0145: }
0146: }
0147: } catch (StringIndexOutOfBoundsException e) {
0148: dataPanel.resetSqlForArgs();
0149:
0150: java.sql.Connection connection = prdStat
0151: .getConnection();
0152:
0153: prdStat.close();
0154:
0155: boolean bMltStm = ConfigurationProperties
0156: .properties().getUseMultiTransaction(
0157: false);
0158:
0159: if (!bMltStm) {
0160: connection.close();
0161: }
0162: }
0163: }
0164:
0165: dataPanel.resetSqlForArgs();
0166: }
0167: }
0168: }
0169:
0170: public ResultSet getResultSet() {
0171: return rsDati;
0172: }
0173:
0174: public void setRowsForPage(int pos) {
0175: rowsForPage = pos;
0176: }
0177:
0178: public int getRowsForPage() {
0179: return rowsForPage;
0180: }
0181:
0182: public void initVectorShapshotCP() {
0183: vSnapshotCursorPosition = new Vector();
0184: vSnapshotCursorPosition.add(new Integer("0"));
0185: }
0186:
0187: public void setCursorPosition(int pos) throws SQLException {
0188: setCursorPosition(pos, true);
0189: }
0190:
0191: public void setCursorPosition(int pos, boolean scrollRS)
0192: throws SQLException {
0193: if (scrollRS) {
0194: if (vecDati == null) {
0195: while (cursorPosition != pos && cursorPosition != 0) {
0196: if (cursorPosition > pos) {
0197: rsDati.previous();
0198: cursorPosition = cursorPosition - 1;
0199: } else {
0200: rsDati.next();
0201: cursorPosition = cursorPosition + 1;
0202: }
0203: }
0204: if (cursorPosition == 0) {
0205: cursorPosition = pos;
0206: }
0207: } else {
0208: cursorPosition = pos;
0209: }
0210: } else {
0211: cursorPosition = pos;
0212: }
0213: }
0214:
0215: public int getCursorPosition() {
0216: return cursorPosition;
0217: }
0218:
0219: public void setStartIndexTrailerValue(int index) {
0220: this .indexStartColumnTrailerValue = index;
0221: }
0222:
0223: public int getStartIndexTrailerValue() {
0224: return indexStartColumnTrailerValue;
0225: }
0226:
0227: public void setWidthDataPanel(int width) {
0228: yMaxWidth = width;
0229: }
0230:
0231: public int getWidthDataPanel() {
0232: return yMaxWidth;
0233: }
0234:
0235: public void setHeightDataPanel(int height) {
0236: yTotalHeight = height;
0237: }
0238:
0239: public int getHeightDataPanel() {
0240: return yTotalHeight;
0241: }
0242:
0243: public void setSQLExecuted(String s) {
0244: sqlExecuted = s;
0245: }
0246:
0247: public String getSQLExecuted() {
0248: return sqlExecuted;
0249: }
0250:
0251: public void setJProgressBar(javax.swing.JProgressBar bar) {
0252: this .bar = bar;
0253: }
0254:
0255: private int runNestedDataPanel(JPanel newComp, String useObj,
0256: int position) throws SQLException {
0257: int yHeightHeader = dataPanel
0258: .getHeaderDividerRelativeLocation();
0259:
0260: DataPanel nestedReport = new DataPanel();
0261: nestedReport.loadXmlToDataPanel(newComp.getName());
0262: nestedReport.setAutoResize(true);
0263:
0264: Connessione c = null;
0265: java.sql.Connection cnn = null;
0266: DataEngine pml = null;
0267:
0268: if (useObj.equalsIgnoreCase("NEW")) {
0269: cnn = Connessione.getConnessione();
0270: pml = new DataEngine(cnn, nestedReport);
0271: } else {
0272: pml = new DataEngine(connection, nestedReport);
0273: }
0274:
0275: pml.setVisibleRowsCountFrame(false);
0276:
0277: String nestedColumn = newComp.getToolTipText();
0278: JPreviewPanel jprewPan = null;
0279:
0280: if (!nestedColumn.equals("null") && !nestedColumn.equals("")) {
0281: Vector argsNested = new Vector();
0282: int indexStart = 0;
0283: int indexEnd = -1;
0284:
0285: while (!nestedColumn.equals("")) {
0286: indexEnd = nestedColumn.indexOf(";");
0287: String column = nestedColumn.substring(0, indexEnd);
0288: indexStart = indexEnd;
0289: nestedColumn = nestedColumn.substring(indexStart + 1,
0290: nestedColumn.length());
0291: argsNested.add(hashArgumentNested.get(column));
0292: }
0293:
0294: jprewPan = pml.retrieve(argsNested.toArray());
0295: } else {
0296: jprewPan = pml.retrieve();
0297: }
0298:
0299: if (jprewPan.getComponentCount() == 0) {
0300: jprewPan.setHeightDataPanel(0);
0301: }
0302:
0303: jprewPan.setSize(newComp.getWidth(), jprewPan
0304: .getHeightDataPanel());
0305: jprewPan.setLocation(newComp.getX(), newComp.getY() + position);
0306: this .add(jprewPan);
0307:
0308: if (useObj.equalsIgnoreCase("NEW")) {
0309: boolean bMltStm = ConfigurationProperties.properties()
0310: .getUseMultiTransaction(false);
0311: if (!bMltStm) {
0312: cnn.close();
0313: }
0314: }
0315:
0316: return jprewPan.getHeightDataPanel();
0317: }
0318:
0319: private void loadComponentsOnPanel(Component[] arrayCompPanel,
0320: int bandHeight, int incrementY) throws SQLException {
0321: for (int j = 0; j < arrayCompPanel.length; j++) {
0322: JComponent newComp = (JComponent) arrayCompPanel[j];
0323:
0324: if ((newComp.getClass() == JTextField.class)) {
0325: if (((JTextField) newComp).getName() == null
0326: || ((JTextField) newComp).getName().equals("")) {
0327: String sValore;
0328:
0329: if (vecDati == null) {
0330: headerColumnPos = headerColumnPos + 1;
0331: sValore = rsDati.getString(headerColumnPos);
0332: } else {
0333: sValore = ((String[]) vecDati
0334: .elementAt(cursorPosition))[headerColumnPos];
0335: headerColumnPos = headerColumnPos + 1;
0336: }
0337:
0338: /*if (sValore == null)
0339: {
0340: sValore = "null";
0341: }*/
0342:
0343: JComponent jLabelColumnResult;
0344:
0345: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
0346: .getSize().height) {
0347: jLabelColumnResult = new JLabel();
0348: ((JLabel) jLabelColumnResult).setText(sValore);
0349: } else {
0350: jLabelColumnResult = new JTextArea();
0351: ((JTextArea) jLabelColumnResult)
0352: .setLineWrap(true);
0353: ((JTextArea) jLabelColumnResult)
0354: .setWrapStyleWord(true);
0355: ((JTextArea) jLabelColumnResult)
0356: .setEditable(false);
0357: ((JTextArea) jLabelColumnResult)
0358: .setText(sValore);
0359: }
0360:
0361: if (sValore != null) {
0362: hashArgumentNested.put(((JTextField) newComp)
0363: .getText(), sValore);
0364: }
0365:
0366: jLabelColumnResult.setBounds(newComp.getX(),
0367: newComp.getY(), newComp.getSize().width,
0368: newComp.getSize().height);
0369: jLabelColumnResult
0370: .setForeground(((JTextField) newComp)
0371: .getForeground());
0372: jLabelColumnResult.setFont(((JTextField) newComp)
0373: .getFont());
0374:
0375: // if (bandHeight < newComp.getY())
0376: // {
0377: // jLabelColumnResult.setVisible(false);
0378: // }
0379: // this.add(jLabelColumnResult);
0380:
0381: if (bandHeight < newComp.getY()) {
0382: jLabelColumnResult = null;
0383: } else
0384: this .add(jLabelColumnResult);
0385:
0386: } else {
0387: String fromString = dataPanel.getFromString();
0388: ComputeField cmpField = new ComputeField(newComp,
0389: fromString, dataPanel.getWhereString(), "",
0390: dataPanel.getArgsObject());
0391: String valore = cmpField.getValue();
0392:
0393: JComponent jLabelColumnResult;
0394:
0395: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
0396: .getSize().height) {
0397: jLabelColumnResult = new JLabel();
0398: ((JLabel) jLabelColumnResult).setText(valore);
0399: } else {
0400: jLabelColumnResult = new JTextArea();
0401: ((JTextArea) jLabelColumnResult)
0402: .setLineWrap(true);
0403: ((JTextArea) jLabelColumnResult)
0404: .setEditable(false);
0405: ((JTextArea) jLabelColumnResult)
0406: .setWrapStyleWord(true);
0407: ((JTextArea) jLabelColumnResult)
0408: .setText(valore);
0409: }
0410:
0411: jLabelColumnResult.setBounds(newComp.getX(),
0412: newComp.getY(), newComp.getSize().width,
0413: newComp.getSize().height);
0414: jLabelColumnResult
0415: .setForeground(((JTextField) newComp)
0416: .getForeground());
0417: jLabelColumnResult.setFont(((JTextField) newComp)
0418: .getFont());
0419:
0420: // if (bandHeight < newComp.getY())
0421: // {
0422: // jLabelColumnResult.setVisible(false);
0423: // }
0424: // this.add(jLabelColumnResult);
0425:
0426: if (bandHeight < newComp.getY()) {
0427: jLabelColumnResult = null;
0428: } else
0429: this .add(jLabelColumnResult);
0430:
0431: }
0432: } else if ((newComp.getClass() == JLabel.class)) {
0433: if (((JLabel) newComp).getIcon() != null) {
0434: if (!((JLabel) newComp).getText().equals("")
0435: && ((JLabel) newComp).getText() != null) {
0436: String sValore;
0437:
0438: if (vecDati == null) {
0439: headerColumnPos = headerColumnPos + 1;
0440: sValore = rsDati.getString(headerColumnPos);
0441: } else {
0442: sValore = ((String[]) vecDati
0443: .elementAt(cursorPosition))[headerColumnPos];
0444: headerColumnPos = headerColumnPos + 1;
0445: }
0446:
0447: if ((sValore == null)
0448: || (sValore.equalsIgnoreCase("true"))) {
0449: this .loadComponentOnPanel(newComp,
0450: bandHeight, incrementY);
0451: }
0452: } else {
0453: this .loadComponentOnPanel(newComp, bandHeight,
0454: incrementY);
0455: }
0456: } else {
0457: this .loadComponentOnPanel(newComp, bandHeight,
0458: incrementY);
0459: }
0460: } else if (newComp.getClass() == JPanel.class) {
0461: if (bandHeight > newComp.getY()) {
0462: this .runNestedDataPanel((JPanel) newComp, "NEW",
0463: incrementY);
0464: }
0465: } else {
0466: this .loadComponentOnPanel(newComp, bandHeight,
0467: incrementY);
0468: }
0469: }
0470: }
0471:
0472: private void loadComponentOnPanel(JComponent comp, int bandHeight,
0473: int incrementY) throws SQLException {
0474: if (bandHeight > comp.getY()) {
0475: JComponent jcopyComp = this .elementaryCopyJComponent(comp);
0476: jcopyComp.setSize(comp.getWidth(), comp.getHeight());
0477: jcopyComp
0478: .setLocation(comp.getX(), comp.getY() + incrementY);
0479: this .add(jcopyComp);
0480: }
0481: }
0482:
0483: private void loadComponentOnVector(JComponent comp, Vector vec,
0484: int bandHeight) throws SQLException {
0485: if (bandHeight > comp.getY()) {
0486: JComponent jcopyComp = this .elementaryCopyJComponent(comp);
0487: jcopyComp.setSize(comp.getWidth(), comp.getHeight());
0488: jcopyComp.setLocation(comp.getX(), comp.getY());
0489: /*Nel nome ci salvo che altezza si trova l' oggetto */
0490: jcopyComp.setName(String.valueOf(comp.getY()));
0491: vec.add(jcopyComp);
0492: }
0493: }
0494:
0495: public void prevPage() throws SQLException {
0496: if (vecDati == null) {
0497: this .prevPageWithResultSet();
0498:
0499: } else {
0500: this .prevPageWithVector();
0501: }
0502: this .setPreferredSize(new Dimension(this .getWidthDataPanel(),
0503: this .getHeightDataPanel()));
0504: }
0505:
0506: private void prevPageWithResultSet() throws SQLException {
0507: if (vSnapshotCursorPosition.size() == 1) {
0508: rsDati.beforeFirst();
0509: cursorPosition = rowsForPage + 1;
0510: } else {
0511: rsDati.first();
0512: cursorPosition = ((Integer) vSnapshotCursorPosition
0513: .get(vSnapshotCursorPosition.size() - 2))
0514: .intValue();
0515: if (cursorPosition == 0) {
0516: rsDati.beforeFirst();
0517: cursorPosition = -1;
0518: } else {
0519: rsDati.relative(cursorPosition);
0520: }
0521: vSnapshotCursorPosition.remove(vSnapshotCursorPosition
0522: .size() - 1);
0523: vSnapshotCursorPosition.remove(vSnapshotCursorPosition
0524: .size() - 1);
0525: }
0526:
0527: this .nextPage();
0528: }
0529:
0530: private void prevPageWithVector() throws SQLException {
0531: if (vSnapshotCursorPosition.size() == 1) {
0532: this .setCursorPosition(-1);
0533: } else {
0534: cursorPosition = ((Integer) vSnapshotCursorPosition
0535: .get(vSnapshotCursorPosition.size() - 2))
0536: .intValue();
0537: if (cursorPosition == 0) {
0538: this .setCursorPosition(-1);
0539: } else {
0540: this .setCursorPosition(cursorPosition);
0541: }
0542: vSnapshotCursorPosition.remove(vSnapshotCursorPosition
0543: .size() - 1);
0544: vSnapshotCursorPosition.remove(vSnapshotCursorPosition
0545: .size() - 1);
0546: }
0547:
0548: this .nextPage();
0549: }
0550:
0551: public void nextPage() throws SQLException {
0552: if (vecDati == null) {
0553: this .nextPageWithResultSet();
0554: } else {
0555: this .nextPageWithVector();
0556: }
0557:
0558: this .setPreferredSize(new Dimension(this .getWidthDataPanel(),
0559: this .getHeightDataPanel()));
0560: }
0561:
0562: public void setFormatPage(java.awt.print.PageFormat pageFormat) {
0563: this .pageFormat = pageFormat;
0564: }
0565:
0566: public int getSubRightPage() {
0567: return (int) (this .getWidthDataPanel() / pageFormat
0568: .getImageableWidth());
0569: }
0570:
0571: public void setPageIndex(int index) {
0572: pagIndexPrint = index;
0573: subIndexPage = index;
0574: }
0575:
0576: public double getHeightFormatPage() {
0577: if (this .pageFormat != null)
0578: return this .pageFormat.getHeight();
0579:
0580: return dataPanel.FORMAT_A4;
0581: //return DataPanel.FORMAT_A4;
0582: }
0583:
0584: private void nextPageWithResultSet() throws SQLException {
0585: int yHeightHeader;
0586:
0587: this .removeAll();
0588:
0589: int count = dataPanel.getGroupCount();
0590:
0591: yHeightHeader = dataPanel.getHeaderDividerRelativeLocation();
0592:
0593: String sUltimiValoriGruppi[] = new String[count];
0594:
0595: for (int i = 0; i < count; i++) {
0596: sUltimiValoriGruppi[i] = "";
0597: }
0598:
0599: /* Header */
0600: yTotalPosition = 0;
0601:
0602: Vector vWhereCompField = new Vector();
0603: Vector vSummaryValues = new Vector();
0604: Vector vFooterValues = new Vector();
0605:
0606: boolean printHeader = true;
0607: vSnapshotCursorPosition.add(new Integer(cursorPosition));
0608:
0609: while (yTotalPosition < dataPanel.FORMAT_A4 && rsDati.next()
0610: && (rsDati.getRow() != 0))
0611: //while (yTotalPosition < this.getHeightFormatPage() && rsDati.next() && (rsDati.getRow() != 0))
0612: {
0613: hashArgumentNested = new java.util.Hashtable();
0614:
0615: if (printHeader) {
0616: headerColumnPos = 0;
0617: JPanel jpHeader = dataPanel.getHeaderPanel();
0618: int BandHeightHeader = dataPanel
0619: .getHeaderDividerRelativeLocation();
0620: Component[] arrayHeaderCompPanel = jpHeader
0621: .getComponents();
0622:
0623: this .loadComponentsOnPanel(arrayHeaderCompPanel,
0624: BandHeightHeader, 0);
0625: printHeader = false;
0626: }
0627:
0628: cursorPosition = cursorPosition + 1;
0629: counterColumnPos = headerColumnPos;
0630:
0631: int counterPos = 0;
0632:
0633: vSummaryValues.clear();
0634: vFooterValues.clear();
0635:
0636: for (int i = 1; i <= count; i++) {
0637: int yNestedH = 0;
0638: int yHeightNested = 0;
0639: sOutputGruppo = "";
0640: String sWhereComputefield = "";
0641: Vector vecResult = new Vector();
0642:
0643: int BandHeightComputedField = dataPanel
0644: .getHeaderGroupDividerRelativeLocation(i);
0645: JPanel jpanelHeaderGroup = dataPanel
0646: .getHeaderGroupPanel(i);
0647: Component[] arrayCompPanel = jpanelHeaderGroup
0648: .getComponents();
0649:
0650: /* Gestione Componenti negli Header*/
0651: for (int j = 0; j < arrayCompPanel.length; j++) {
0652: int BandHeight = dataPanel
0653: .getHeaderGroupDividerRelativeLocation(i);
0654: JComponent newComp = (JComponent) arrayCompPanel[j];
0655:
0656: if ((newComp.getClass() == JTextField.class)) {
0657: if (((JTextField) newComp).getName() == null
0658: || ((JTextField) newComp).getName()
0659: .equals("")) {
0660: counterColumnPos = counterColumnPos + 1;
0661:
0662: java.sql.ResultSetMetaData rsmd = rsDati
0663: .getMetaData();
0664: int typeColumn = rsmd
0665: .getColumnType(counterColumnPos);
0666:
0667: String sValoreForWhere = "";
0668: String sValore = "";
0669:
0670: if (typeColumn == Types.DATE
0671: || typeColumn == Types.TIME
0672: || typeColumn == Types.TIMESTAMP) {
0673: java.sql.Timestamp date = rsDati
0674: .getTimestamp(counterColumnPos);
0675:
0676: if (date != null) {
0677: sValore = date.toString();
0678:
0679: String days = sValore.substring(8,
0680: 10);
0681: String mounth = sValore.substring(
0682: 5, 7);
0683: String year = sValore.substring(0,
0684: 4);
0685:
0686: sValoreForWhere = days + "/"
0687: + mounth + "/" + year;
0688: } else {
0689: sValoreForWhere = "IS NULL";
0690: }
0691: } else {
0692: sValore = rsDati
0693: .getString(counterColumnPos);
0694: sValoreForWhere = sValore;
0695: }
0696:
0697: /*if (sValore == null)
0698: {
0699: sValore = "null";
0700: }*/
0701:
0702: String columnName = ((JTextField) newComp)
0703: .getText();
0704:
0705: if (typeColumn == Types.VARCHAR
0706: || typeColumn == Types.LONGVARCHAR
0707: || typeColumn == Types.CHAR
0708: || typeColumn == Types.DATE
0709: || typeColumn == Types.TIME
0710: || typeColumn == Types.TIMESTAMP
0711: || typeColumn == Types.OTHER) {
0712: if (sValore != null
0713: && !sValore.equals("")) {
0714: if (sValore.indexOf("'") != -1) {
0715: //sValoreForWhere = DataEngine.replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
0716: sValoreForWhere = DataEngine
0717: .replaceString(
0718: sValore,
0719: new String("'"),
0720: new String("''"));
0721: }
0722: sWhereComputefield = sWhereComputefield
0723: + columnName
0724: + " = '"
0725: + sValoreForWhere
0726: + "' and ";
0727: }
0728: } else {
0729: if (typeColumn == Types.BIGINT
0730: || typeColumn == Types.DECIMAL
0731: || typeColumn == Types.DOUBLE
0732: || typeColumn == Types.FLOAT
0733: || typeColumn == Types.INTEGER
0734: || typeColumn == Types.NUMERIC) {
0735: sWhereComputefield = sWhereComputefield
0736: + columnName
0737: + " = "
0738: + sValoreForWhere + " and ";
0739: } else {
0740: if (sValore != null
0741: && !sValore.equals("")) {
0742: if (sValore.indexOf("'") != -1) {
0743: //sValoreForWhere = DataEngine.replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
0744: sValoreForWhere = DataEngine
0745: .replaceString(
0746: sValore,
0747: new String(
0748: "'"),
0749: new String(
0750: "''"));
0751: }
0752: sWhereComputefield = sWhereComputefield
0753: + columnName
0754: + " = '"
0755: + sValoreForWhere
0756: + "' and ";
0757: }
0758: }
0759: }
0760:
0761: counterPos = counterPos + 1;
0762:
0763: JComponent jLabelColumnResult;
0764:
0765: if (((JTextField) newComp).getFont()
0766: .getSize() + 10 >= ((JTextField) newComp)
0767: .getSize().height) {
0768: jLabelColumnResult = new JLabel();
0769: ((JLabel) jLabelColumnResult)
0770: .setText(sValore);
0771: } else {
0772: jLabelColumnResult = new JTextArea();
0773: ((JTextArea) jLabelColumnResult)
0774: .setLineWrap(true);
0775: ((JTextArea) jLabelColumnResult)
0776: .setWrapStyleWord(true);
0777: ((JTextArea) jLabelColumnResult)
0778: .setEditable(false);
0779: ((JTextArea) jLabelColumnResult)
0780: .setText(sValore);
0781: }
0782:
0783: if (sValore != null) {
0784: hashArgumentNested.put(
0785: ((JTextField) newComp)
0786: .getText(), sValore);
0787: }
0788:
0789: jLabelColumnResult.setBounds(
0790: newComp.getX(), newComp.getY(),
0791: newComp.getSize().width, newComp
0792: .getSize().height);
0793: jLabelColumnResult
0794: .setForeground(((JTextField) newComp)
0795: .getForeground());
0796: jLabelColumnResult
0797: .setFont(((JTextField) newComp)
0798: .getFont());
0799: /* Linea che serve per salvare il posizionamento dell' oggetto sul datareport
0800: all' interno del gruppo per eventuale spostamento successivo per la presenza
0801: di un nested*/
0802: jLabelColumnResult.setName(String
0803: .valueOf(newComp.getY()));
0804:
0805: // if (BandHeight < newComp.getY())
0806: // {
0807: // jLabelColumnResult.setVisible(false);
0808: // }
0809: //
0810: // vecResult.add(jLabelColumnResult);
0811:
0812: if (BandHeight < newComp.getY()) {
0813: jLabelColumnResult = null;
0814: } else
0815: vecResult.add(jLabelColumnResult);
0816:
0817: if (sValore != null) {
0818: sValore = sValore.trim();
0819: sOutputGruppo = sOutputGruppo + sValore;
0820: }
0821: } else {
0822: vecResult.add(newComp);
0823: }
0824: } else if (newComp.getClass() == JLabel.class) {
0825: if (((JLabel) newComp).getIcon() != null) {
0826: if (!((JLabel) newComp).getText()
0827: .equals("")
0828: && ((JLabel) newComp).getText() != null) {
0829: counterColumnPos = counterColumnPos + 1;
0830: String sValore = rsDati
0831: .getString(counterColumnPos);
0832:
0833: if ((sValore == null)
0834: || (sValore
0835: .equalsIgnoreCase("true"))) {
0836: this .loadComponentOnVector(newComp,
0837: vecResult, BandHeight);
0838: }
0839: } else {
0840: this .loadComponentOnVector(newComp,
0841: vecResult, BandHeight);
0842: }
0843: } else {
0844: this .loadComponentOnVector(newComp,
0845: vecResult, BandHeight);
0846: }
0847: } else if (newComp.getClass() == JPanel.class) {
0848: if (BandHeight > newComp.getY()) {
0849: yNestedH = newComp.getY();
0850: yHeightNested = this .runNestedDataPanel(
0851: (JPanel) newComp, "NEW",
0852: yHeightHeader + yTotalPosition);
0853: /* Questa linea fa in modo che gli oggetti si posizionino
0854: da adesso in poi ad un livello che comprende anche l' altezza
0855: (che non si sa' a priori del nested)*/
0856: yTotalPosition = yTotalPosition
0857: + yHeightNested;
0858: }
0859: } else {
0860: this .loadComponentOnVector(newComp, vecResult,
0861: BandHeight);
0862: }
0863: }
0864:
0865: /* Blocco che gestisce il posizionamento degli oggetti se nel header Group
0866: è presente un Nested Report */
0867: if (yHeightNested > 0) {
0868: for (int j = 0; j < vecResult.size(); j++) {
0869: JComponent newComp = (JComponent) vecResult
0870: .get(j);
0871: if (newComp.getName() != null) {
0872: if (Integer.valueOf(newComp.getName())
0873: .intValue() <= yNestedH) {
0874: newComp.setLocation(newComp.getX(),
0875: newComp.getY() - yHeightNested);
0876: }
0877: }
0878: }
0879: }
0880: /*************************************************************************/
0881:
0882: if (!sOutputGruppo.equals(sUltimiValoriGruppi[i - 1])) {
0883: /* Gestione trailer*/
0884: if (sUltimiValoriGruppi[i - 1] != "") {
0885: int indexColumnTrailerValue = indexStartColumnTrailerValue;
0886:
0887: for (int f = count; f >= i; f--) {
0888: JPanel panelTrailer = dataPanel
0889: .getTrailerGroupPanel(f);
0890: int BandHeight = dataPanel
0891: .getTrailerGroupDividerRelativeLocation(f);
0892:
0893: Component[] arrayTrailerCompPanel = panelTrailer
0894: .getComponents();
0895: for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
0896: JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
0897:
0898: if ((jCompMove.getClass() != JTextField.class)) {
0899: if ((jCompMove.getClass() == JLabel.class)) {
0900: if (((JLabel) jCompMove)
0901: .getIcon() != null) {
0902: if (!((JLabel) jCompMove)
0903: .getText().equals(
0904: "")
0905: && ((JLabel) jCompMove)
0906: .getText() != null) {
0907: rsDati.previous();
0908: indexColumnTrailerValue = indexColumnTrailerValue + 1;
0909: String sValore = rsDati
0910: .getString(indexColumnTrailerValue);
0911: rsDati.next();
0912:
0913: if ((sValore == null)
0914: || (sValore
0915: .equalsIgnoreCase("true"))) {
0916: this
0917: .loadComponentOnPanel(
0918: jCompMove,
0919: BandHeight,
0920: yHeightHeader
0921: + yTotalPosition);
0922: }
0923: } else {
0924: this
0925: .loadComponentOnPanel(
0926: jCompMove,
0927: BandHeight,
0928: yHeightHeader
0929: + yTotalPosition);
0930: }
0931: } else {
0932: this
0933: .loadComponentOnPanel(
0934: jCompMove,
0935: BandHeight,
0936: yHeightHeader
0937: + yTotalPosition);
0938: }
0939: } else if (jCompMove.getClass() == JPanel.class) {
0940: if (BandHeight > jCompMove
0941: .getY()) {
0942: int height = this
0943: .runNestedDataPanel(
0944: (JPanel) jCompMove,
0945: "NEW",
0946: yHeightHeader
0947: + yTotalPosition);
0948: yTotalPosition = yTotalPosition
0949: + height;
0950: }
0951: } else {
0952: this
0953: .loadComponentOnPanel(
0954: jCompMove,
0955: BandHeight,
0956: yHeightHeader
0957: + yTotalPosition);
0958: }
0959: } else if (jCompMove.getClass() == JTextField.class) {
0960: if (((JTextField) jCompMove)
0961: .getName() == null
0962: || ((JTextField) jCompMove)
0963: .getName().equals(
0964: "")) {
0965: rsDati.previous();
0966: indexColumnTrailerValue = indexColumnTrailerValue + 1;
0967: String sValore = rsDati
0968: .getString(indexColumnTrailerValue);
0969: rsDati.next();
0970:
0971: /*if (sValore == null)
0972: {
0973: sValore = "null";
0974: }*/
0975:
0976: JComponent jLabelColumnResult;
0977:
0978: if (((JTextField) jCompMove)
0979: .getFont().getSize() + 10 >= ((JTextField) jCompMove)
0980: .getSize().height) {
0981: jLabelColumnResult = new JLabel();
0982: ((JLabel) jLabelColumnResult)
0983: .setText(sValore);
0984: } else {
0985: jLabelColumnResult = new JTextArea();
0986: ((JTextArea) jLabelColumnResult)
0987: .setLineWrap(true);
0988: ((JTextArea) jLabelColumnResult)
0989: .setWrapStyleWord(true);
0990: ((JTextArea) jLabelColumnResult)
0991: .setEditable(false);
0992: ((JTextArea) jLabelColumnResult)
0993: .setText(sValore);
0994: }
0995:
0996: jLabelColumnResult
0997: .setBounds(
0998: jCompMove
0999: .getX(),
1000: jCompMove
1001: .getY()
1002: + yTotalPosition
1003: + yHeightHeader,
1004: jCompMove
1005: .getSize().width,
1006: jCompMove
1007: .getSize().height);
1008: jLabelColumnResult
1009: .setForeground(((JTextField) jCompMove)
1010: .getForeground());
1011: jLabelColumnResult
1012: .setFont(((JTextField) jCompMove)
1013: .getFont());
1014:
1015: // if (BandHeight < jCompMove.getY())
1016: // {
1017: // jLabelColumnResult.setVisible(false);
1018: // }
1019: //
1020: // this.add(jLabelColumnResult);
1021:
1022: if (BandHeight < jCompMove
1023: .getY()) {
1024: jLabelColumnResult = null;
1025: } else
1026: this
1027: .add(jLabelColumnResult);
1028:
1029: } else {
1030: String sWhere = "";
1031: int countCompute = f;
1032:
1033: while (countCompute != 0) {
1034: if (sWhere.equals("")) {
1035: sWhere = (String) vWhereCompField
1036: .get(countCompute - 1);
1037: } else {
1038: sWhere = sWhere
1039: + " and "
1040: + (String) vWhereCompField
1041: .get(countCompute - 1);
1042: }
1043:
1044: countCompute = countCompute - 1;
1045: }
1046:
1047: String sOrderBy = "";
1048:
1049: if (f != 1) {
1050: sOrderBy = dataPanel
1051: .getOrderByString(f);
1052: }
1053:
1054: String fromString = dataPanel
1055: .getFromString();
1056:
1057: ComputeField cmpField = null;
1058:
1059: if (!dataPanel.getWhereString()
1060: .equals("")) {
1061: cmpField = new ComputeField(
1062: jCompMove,
1063: fromString,
1064: sWhere
1065: + " and "
1066: + dataPanel
1067: .getWhereString(),
1068: sOrderBy,
1069: dataPanel
1070: .getArgsObject());
1071: } else {
1072: cmpField = new ComputeField(
1073: jCompMove,
1074: fromString,
1075: sWhere,
1076: sOrderBy,
1077: dataPanel
1078: .getArgsObject());
1079: }
1080:
1081: String valore = cmpField
1082: .getValue();
1083:
1084: /*if (valore == null)
1085: {
1086: valore = "null";
1087: }*/
1088:
1089: JComponent jLabelColumnResult;
1090:
1091: if (((JTextField) jCompMove)
1092: .getFont().getSize() + 10 >= ((JTextField) jCompMove)
1093: .getSize().height) {
1094: jLabelColumnResult = new JLabel();
1095: ((JLabel) jLabelColumnResult)
1096: .setText(valore);
1097: } else {
1098: jLabelColumnResult = new JTextArea();
1099: ((JTextArea) jLabelColumnResult)
1100: .setLineWrap(true);
1101: ((JTextArea) jLabelColumnResult)
1102: .setEditable(false);
1103: ((JTextArea) jLabelColumnResult)
1104: .setWrapStyleWord(true);
1105: ((JTextArea) jLabelColumnResult)
1106: .setText(valore);
1107: }
1108:
1109: jLabelColumnResult
1110: .setBounds(
1111: jCompMove
1112: .getX(),
1113: jCompMove
1114: .getY()
1115: + yHeightHeader
1116: + yTotalPosition,
1117: jCompMove
1118: .getSize().width,
1119: jCompMove
1120: .getSize().height);
1121: jLabelColumnResult
1122: .setForeground(((JTextField) jCompMove)
1123: .getForeground());
1124: jLabelColumnResult
1125: .setFont(((JTextField) jCompMove)
1126: .getFont());
1127:
1128: // if (BandHeight < jCompMove.getY())
1129: // {
1130: // jLabelColumnResult.setVisible(false);
1131: // }
1132: //
1133: // this.add(jLabelColumnResult);
1134:
1135: if (BandHeight < jCompMove
1136: .getY()) {
1137: jLabelColumnResult = null;
1138: } else
1139: this
1140: .add(jLabelColumnResult);
1141: }
1142: /******************************/
1143: }
1144: }
1145: yTotalPosition = yTotalPosition
1146: + dataPanel
1147: .getTrailerGroupDividerRelativeLocation(f);
1148: }
1149: }
1150:
1151: if (!sWhereComputefield.equalsIgnoreCase("")) {
1152: vWhereCompField.add(i - 1, sWhereComputefield
1153: .substring(0, sWhereComputefield
1154: .length() - 4));
1155: }
1156:
1157: for (int z = 0; z < vecResult.size(); z++) {
1158: JComponent insertComp = (JComponent) vecResult
1159: .get(z);
1160:
1161: if (insertComp.getClass() == JTextField.class) {
1162: if (((JTextField) insertComp).getName() != null
1163: && !((JTextField) insertComp)
1164: .getName().equals("")) {
1165: String sWhere = "";
1166: int countCompute = i;
1167:
1168: while (countCompute != 0) {
1169: if (sWhere.equals("")) {
1170: sWhere = (String) vWhereCompField
1171: .get(countCompute - 1);
1172: } else {
1173: sWhere = sWhere
1174: + " and "
1175: + (String) vWhereCompField
1176: .get(countCompute - 1);
1177: }
1178:
1179: countCompute = countCompute - 1;
1180: }
1181:
1182: String sOrderBy = "";
1183:
1184: if (i != 1) {
1185: sOrderBy = dataPanel
1186: .getOrderByString(i);
1187: }
1188:
1189: String fromString = dataPanel
1190: .getFromString();
1191:
1192: ComputeField cmpField = null;
1193:
1194: if (!dataPanel.getWhereString().equals(
1195: "")) {
1196: cmpField = new ComputeField(
1197: insertComp,
1198: fromString,
1199: sWhere
1200: + " and "
1201: + dataPanel
1202: .getWhereString(),
1203: sOrderBy, dataPanel
1204: .getArgsObject());
1205: } else {
1206: cmpField = new ComputeField(
1207: insertComp, fromString,
1208: sWhere, sOrderBy, dataPanel
1209: .getArgsObject());
1210: }
1211:
1212: String valore = cmpField.getValue();
1213:
1214: JComponent jLabelColumnResult;
1215:
1216: if (((JTextField) insertComp).getFont()
1217: .getSize() + 10 >= ((JTextField) insertComp)
1218: .getSize().height) {
1219: jLabelColumnResult = new JLabel();
1220: ((JLabel) jLabelColumnResult)
1221: .setText(valore);
1222: } else {
1223: jLabelColumnResult = new JTextArea();
1224: ((JTextArea) jLabelColumnResult)
1225: .setLineWrap(true);
1226: ((JTextArea) jLabelColumnResult)
1227: .setEditable(false);
1228: ((JTextArea) jLabelColumnResult)
1229: .setWrapStyleWord(true);
1230: ((JTextArea) jLabelColumnResult)
1231: .setText(valore);
1232: }
1233:
1234: jLabelColumnResult.setBounds(insertComp
1235: .getX(), insertComp.getY()
1236: + yHeightHeader
1237: + yTotalPosition, insertComp
1238: .getSize().width, insertComp
1239: .getSize().height);
1240: jLabelColumnResult
1241: .setForeground(((JTextField) insertComp)
1242: .getForeground());
1243: jLabelColumnResult
1244: .setFont(((JTextField) insertComp)
1245: .getFont());
1246:
1247: // if (BandHeightComputedField < insertComp.getY())
1248: // {
1249: // jLabelColumnResult.setVisible(false);
1250: // }
1251: //
1252: // this.add(jLabelColumnResult);
1253:
1254: if (BandHeightComputedField < insertComp
1255: .getY()) {
1256: jLabelColumnResult = null;
1257: } else
1258: this .add(jLabelColumnResult);
1259: }
1260: } else {
1261: insertComp.setLocation(insertComp.getX(),
1262: insertComp.getY() + yTotalPosition
1263: + yHeightHeader);
1264: this .add(insertComp);
1265: }
1266: }
1267:
1268: yTotalPosition = yTotalPosition
1269: + dataPanel
1270: .getHeaderGroupDividerRelativeLocation(i);
1271:
1272: sUltimiValoriGruppi[i - 1] = sOutputGruppo;
1273:
1274: for (int w = i; w < count; w++) {
1275: sUltimiValoriGruppi[w] = "";
1276: }
1277: }
1278: }
1279:
1280: /* Inizio Dettaglio */
1281: JPanel jpanelDetail = dataPanel.getDetailPanel();
1282: Component[] arrayDetailCompPanel = jpanelDetail
1283: .getComponents();
1284:
1285: for (int j = 0; j < arrayDetailCompPanel.length; j++) {
1286: int BandHeight = dataPanel
1287: .getDetailDividerRelativeLocation();
1288: JComponent newComp = ((JComponent) arrayDetailCompPanel[j]);
1289:
1290: if ((newComp.getClass() == JTextField.class)) {
1291: if (((JTextField) newComp).getName() == null
1292: || ((JTextField) newComp).getName().equals(
1293: "")) {
1294: counterColumnPos = counterColumnPos + 1;
1295: String sValore = rsDati
1296: .getString(counterColumnPos);
1297: counterPos = counterPos + 1;
1298:
1299: /*if (sValore == null)
1300: {
1301: sValore = "null";
1302: }*/
1303:
1304: JComponent jLabelColumnResult;
1305:
1306: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
1307: .getSize().height) {
1308: jLabelColumnResult = new JLabel();
1309: ((JLabel) jLabelColumnResult)
1310: .setText(sValore);
1311: } else {
1312: jLabelColumnResult = new JTextArea();
1313: ((JTextArea) jLabelColumnResult)
1314: .setLineWrap(true);
1315: ((JTextArea) jLabelColumnResult)
1316: .setWrapStyleWord(true);
1317: ((JTextArea) jLabelColumnResult)
1318: .setEditable(false);
1319: ((JTextArea) jLabelColumnResult)
1320: .setText(sValore);
1321: }
1322:
1323: if (sValore != null) {
1324: hashArgumentNested.put(
1325: ((JTextField) newComp).getText(),
1326: sValore);
1327: }
1328:
1329: jLabelColumnResult.setBounds(newComp.getX(),
1330: newComp.getY() + yHeightHeader
1331: + yTotalPosition, newComp
1332: .getSize().width, newComp
1333: .getSize().height);
1334: jLabelColumnResult
1335: .setForeground(((JTextField) newComp)
1336: .getForeground());
1337: jLabelColumnResult
1338: .setFont(((JTextField) newComp)
1339: .getFont());
1340:
1341: // if (BandHeight < newComp.getY())
1342: // {
1343: // jLabelColumnResult.setVisible(false);
1344: // }
1345: //
1346: // this.add(jLabelColumnResult);
1347:
1348: if (BandHeight < newComp.getY()) {
1349: jLabelColumnResult = null;
1350: } else
1351: this .add(jLabelColumnResult);
1352:
1353: } else {
1354: String sWhere = "";
1355: int countCompute = count;
1356:
1357: while (countCompute != 0) {
1358: if (sWhere.equals("")) {
1359: sWhere = (String) vWhereCompField
1360: .get(countCompute - 1);
1361: } else {
1362: sWhere = sWhere
1363: + " and "
1364: + (String) vWhereCompField
1365: .get(countCompute - 1);
1366: }
1367:
1368: countCompute = countCompute - 1;
1369: }
1370:
1371: String sOrderBy = "";
1372:
1373: if (count != 1) {
1374: sOrderBy = dataPanel
1375: .getOrderByString(count);
1376: }
1377:
1378: String fromString = dataPanel.getFromString();
1379:
1380: ComputeField cmpField = null;
1381:
1382: if (!dataPanel.getWhereString().equals("")) {
1383: cmpField = new ComputeField(newComp,
1384: fromString, sWhere
1385: + " and "
1386: + dataPanel
1387: .getWhereString(),
1388: sOrderBy, dataPanel.getArgsObject());
1389: } else {
1390: cmpField = new ComputeField(newComp,
1391: fromString, sWhere, sOrderBy,
1392: dataPanel.getArgsObject());
1393: }
1394:
1395: String valore = cmpField.getValue();
1396:
1397: JComponent jLabelColumnResult;
1398:
1399: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
1400: .getSize().height) {
1401: jLabelColumnResult = new JLabel();
1402: ((JLabel) jLabelColumnResult)
1403: .setText(valore);
1404: } else {
1405: jLabelColumnResult = new JTextArea();
1406: ((JTextArea) jLabelColumnResult)
1407: .setLineWrap(true);
1408: ((JTextArea) jLabelColumnResult)
1409: .setEditable(false);
1410: ((JTextArea) jLabelColumnResult)
1411: .setWrapStyleWord(true);
1412: ((JTextArea) jLabelColumnResult)
1413: .setText(valore);
1414: }
1415:
1416: jLabelColumnResult.setBounds(newComp.getX(),
1417: newComp.getY() + yHeightHeader
1418: + yTotalPosition, newComp
1419: .getSize().width, newComp
1420: .getSize().height);
1421: jLabelColumnResult
1422: .setForeground(((JTextField) newComp)
1423: .getForeground());
1424: jLabelColumnResult
1425: .setFont(((JTextField) newComp)
1426: .getFont());
1427:
1428: // if (BandHeight < newComp.getY())
1429: // {
1430: // jLabelColumnResult.setVisible(false);
1431: // }
1432: //
1433: // this.add(jLabelColumnResult);
1434:
1435: if (BandHeight < newComp.getY()) {
1436: jLabelColumnResult = null;
1437: } else
1438: this .add(jLabelColumnResult);
1439:
1440: }
1441: } else if ((newComp.getClass() == JLabel.class)) {
1442: if (((JLabel) newComp).getIcon() != null) {
1443: if (!((JLabel) newComp).getText().equals("")
1444: && ((JLabel) newComp).getText() != null) {
1445: counterColumnPos = counterColumnPos + 1;
1446: String sValore = rsDati
1447: .getString(counterColumnPos);
1448:
1449: if ((sValore == null)
1450: || (sValore
1451: .equalsIgnoreCase("true"))) {
1452: this .loadComponentOnPanel(newComp,
1453: BandHeight, yHeightHeader
1454: + yTotalPosition);
1455: }
1456: } else {
1457: this .loadComponentOnPanel(newComp,
1458: BandHeight, yHeightHeader
1459: + yTotalPosition);
1460: }
1461: } else {
1462: this .loadComponentOnPanel(newComp, BandHeight,
1463: yHeightHeader + yTotalPosition);
1464: }
1465: } else if (newComp.getClass() == JPanel.class) {
1466: if (BandHeight > newComp.getY()) {
1467: int yNested = this .runNestedDataPanel(
1468: (JPanel) newComp, "NEW", yHeightHeader
1469: + yTotalPosition);
1470: yTotalPosition = yTotalPosition + yNested;
1471: }
1472: } else {
1473: this .loadComponentOnPanel(newComp, BandHeight,
1474: yHeightHeader + yTotalPosition);
1475: }
1476: }
1477:
1478: if (arrayDetailCompPanel.length > 0) {
1479: yTotalPosition = yTotalPosition
1480: + dataPanel.getDetailDividerRelativeLocation();
1481: }
1482:
1483: JPanel jpanelSummary = dataPanel.getSummaryPanel();
1484: Component[] arraySummaryCompPanel = jpanelSummary
1485: .getComponents();
1486:
1487: for (int j = 0; j < arraySummaryCompPanel.length; j++) {
1488: JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
1489:
1490: if ((newComp.getClass() == JTextField.class)) {
1491: if (((JTextField) newComp).getName() == null
1492: || ((JTextField) newComp).getName().equals(
1493: "")) {
1494: counterColumnPos = counterColumnPos + 1;
1495: String sValore = rsDati
1496: .getString(counterColumnPos);
1497:
1498: vSummaryValues.add(sValore);
1499: }
1500: } else if ((newComp.getClass() == JLabel.class)) {
1501: if (((JLabel) newComp).getIcon() != null) {
1502: if (!((JLabel) newComp).getText().equals("")
1503: && ((JLabel) newComp).getText() != null) {
1504: counterColumnPos = counterColumnPos + 1;
1505: String sValore = rsDati
1506: .getString(counterColumnPos);
1507:
1508: vSummaryValues.add(sValore);
1509: }
1510: }
1511: }
1512: }
1513:
1514: JPanel jpanelFooter = dataPanel.getFooterPanel();
1515: Component[] arrayFooterCompPanel = jpanelFooter
1516: .getComponents();
1517:
1518: for (int j = 0; j < arrayFooterCompPanel.length; j++) {
1519: JComponent newComp = ((JComponent) arrayFooterCompPanel[j]);
1520:
1521: if ((newComp.getClass() == JTextField.class)) {
1522: if (((JTextField) newComp).getName() == null
1523: || ((JTextField) newComp).getName().equals(
1524: "")) {
1525: counterColumnPos = counterColumnPos + 1;
1526: String sValore = rsDati
1527: .getString(counterColumnPos);
1528:
1529: vFooterValues.add(sValore);
1530: }
1531: } else if ((newComp.getClass() == JLabel.class)) {
1532: if (((JLabel) newComp).getIcon() != null) {
1533: if (!((JLabel) newComp).getText().equals("")
1534: && ((JLabel) newComp).getText() != null) {
1535: counterColumnPos = counterColumnPos + 1;
1536: String sValore = rsDati
1537: .getString(counterColumnPos);
1538:
1539: vFooterValues.add(sValore);
1540: }
1541: }
1542: }
1543: }
1544: }
1545:
1546: Vector vEndPageGroup = new Vector();
1547:
1548: if (rsDati.next() && !rsDati.isAfterLast()) {
1549: counterColumnPos = 0;
1550: // //TEST
1551: for (int i = 1; i <= count; i++) {
1552: sOutputGruppo = "";
1553:
1554: JPanel jpanelHeaderGroup = dataPanel
1555: .getHeaderGroupPanel(i);
1556: Component[] arrayCompPanel = jpanelHeaderGroup
1557: .getComponents();
1558:
1559: for (int k = 0; k < arrayCompPanel.length; k++) {
1560: JComponent newComp = (JComponent) arrayCompPanel[k];
1561:
1562: if ((newComp.getClass() == JTextField.class)) {
1563: if (((JTextField) newComp).getName() == null
1564: || ((JTextField) newComp).getName()
1565: .equals("")) {
1566: counterColumnPos = counterColumnPos + 1;
1567:
1568: java.sql.ResultSetMetaData rsmd = rsDati
1569: .getMetaData();
1570: int typeColumn = rsmd
1571: .getColumnType(counterColumnPos);
1572:
1573: String sValore = "";
1574:
1575: if (typeColumn == Types.DATE
1576: || typeColumn == Types.TIME
1577: || typeColumn == Types.TIMESTAMP) {
1578: java.sql.Timestamp date = rsDati
1579: .getTimestamp(counterColumnPos);
1580:
1581: if (date != null) {
1582: sValore = date.toString();
1583: }
1584: } else {
1585: sValore = rsDati
1586: .getString(counterColumnPos);
1587: }
1588:
1589: if (sValore != null) {
1590: sValore = sValore.trim();
1591: sOutputGruppo = sOutputGruppo + sValore;
1592: }
1593: }
1594: }
1595: }
1596: vEndPageGroup.add(sOutputGruppo);
1597: }
1598: rsDati.previous();
1599: }
1600:
1601: int indexColumnTrailerValue = indexStartColumnTrailerValue;
1602:
1603: //fine resulset next
1604: for (int f = count; f >= 1; f--) {
1605: //if ((!sOutputGruppo.equals(sUltimiValoriGruppi[count - 1]) || (cursorPosition == (rowsCount - 1))))
1606: //{
1607: if ((vEndPageGroup.size() == 0
1608: || !((String) vEndPageGroup.get(f - 1))
1609: .equals(sUltimiValoriGruppi[f - 1]) || (cursorPosition == (rowsCount - 1)))) {
1610: /** gestione trailer finali **/
1611: JPanel panelTrailer = dataPanel.getTrailerGroupPanel(f);
1612:
1613: int BandHeight = dataPanel
1614: .getTrailerGroupDividerRelativeLocation(f);
1615: Component[] arrayTrailerCompPanel = panelTrailer
1616: .getComponents();
1617:
1618: for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
1619: JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
1620:
1621: if ((jCompMove.getClass() != JTextField.class)) {
1622: if ((jCompMove.getClass() == JLabel.class)) {
1623: if (((JLabel) jCompMove).getIcon() != null) {
1624: if (!((JLabel) jCompMove).getText()
1625: .equals("")
1626: && ((JLabel) jCompMove)
1627: .getText() != null) {
1628: rsDati.previous();
1629: indexColumnTrailerValue = indexColumnTrailerValue + 1;
1630: String sValore = rsDati
1631: .getString(indexColumnTrailerValue);
1632: rsDati.next();
1633:
1634: if ((sValore == null)
1635: || (sValore
1636: .equalsIgnoreCase("true"))) {
1637: this
1638: .loadComponentOnPanel(
1639: jCompMove,
1640: BandHeight,
1641: yHeightHeader
1642: + yTotalPosition);
1643: }
1644: } else {
1645: this .loadComponentOnPanel(
1646: jCompMove, BandHeight,
1647: yHeightHeader
1648: + yTotalPosition);
1649: }
1650: } else {
1651: this .loadComponentOnPanel(jCompMove,
1652: BandHeight, yHeightHeader
1653: + yTotalPosition);
1654: }
1655: } else if (jCompMove.getClass() == JPanel.class) {
1656: if (BandHeight > jCompMove.getY()) {
1657: int height = this .runNestedDataPanel(
1658: (JPanel) jCompMove, "NEW",
1659: yHeightHeader + yTotalPosition);
1660: yTotalPosition = yTotalPosition
1661: + height;
1662: }
1663: } else {
1664: this .loadComponentOnPanel(jCompMove,
1665: BandHeight, yHeightHeader
1666: + yTotalPosition);
1667: }
1668: } else if (jCompMove.getClass() == JTextField.class) {
1669: if (((JTextField) jCompMove).getName() == null
1670: || ((JTextField) jCompMove).getName()
1671: .equals("")) {
1672: rsDati.previous();
1673: indexColumnTrailerValue = indexColumnTrailerValue + 1;
1674: String sValore = rsDati
1675: .getString(indexColumnTrailerValue);
1676: rsDati.next();
1677:
1678: /*if (sValore == null)
1679: {
1680: sValore = "null";
1681: }*/
1682:
1683: JComponent jLabelColumnResult;
1684:
1685: if (((JTextField) jCompMove).getFont()
1686: .getSize() + 10 >= ((JTextField) jCompMove)
1687: .getSize().height) {
1688: jLabelColumnResult = new JLabel();
1689: ((JLabel) jLabelColumnResult)
1690: .setText(sValore);
1691: } else {
1692: jLabelColumnResult = new JTextArea();
1693: ((JTextArea) jLabelColumnResult)
1694: .setLineWrap(true);
1695: ((JTextArea) jLabelColumnResult)
1696: .setWrapStyleWord(true);
1697: ((JTextArea) jLabelColumnResult)
1698: .setEditable(false);
1699: ((JTextArea) jLabelColumnResult)
1700: .setText(sValore);
1701: }
1702:
1703: jLabelColumnResult.setBounds(jCompMove
1704: .getX(), jCompMove.getY()
1705: + yTotalPosition + yHeightHeader,
1706: jCompMove.getSize().width,
1707: jCompMove.getSize().height);
1708: jLabelColumnResult
1709: .setForeground(((JTextField) jCompMove)
1710: .getForeground());
1711: jLabelColumnResult
1712: .setFont(((JTextField) jCompMove)
1713: .getFont());
1714:
1715: // if (BandHeight < jCompMove.getY())
1716: // {
1717: // jLabelColumnResult.setVisible(false);
1718: // }
1719: //
1720: // this.add(jLabelColumnResult);
1721:
1722: if (BandHeight < jCompMove.getY()) {
1723: jLabelColumnResult = null;
1724: } else
1725: this .add(jLabelColumnResult);
1726:
1727: } else {
1728: String sWhere = "";
1729: int countCompute = f;
1730:
1731: while (countCompute != 0) {
1732: if (sWhere.equals("")) {
1733: if (vWhereCompField.size() > 0) {
1734: sWhere = (String) vWhereCompField
1735: .get(countCompute - 1);
1736: }
1737: } else {
1738: if (vWhereCompField.size() > 0) {
1739: sWhere = sWhere
1740: + " and "
1741: + (String) vWhereCompField
1742: .get(countCompute - 1);
1743: }
1744: }
1745:
1746: countCompute = countCompute - 1;
1747: }
1748:
1749: String sOrderBy = "";
1750:
1751: if (f != 1) {
1752: sOrderBy = dataPanel
1753: .getOrderByString(f);
1754: }
1755:
1756: String fromString = dataPanel
1757: .getFromString();
1758:
1759: ComputeField cmpField = null;
1760:
1761: if (!dataPanel.getWhereString().equals("")) {
1762: cmpField = new ComputeField(
1763: jCompMove,
1764: fromString,
1765: sWhere
1766: + " and "
1767: + dataPanel
1768: .getWhereString(),
1769: sOrderBy, dataPanel
1770: .getArgsObject());
1771: } else {
1772: cmpField = new ComputeField(jCompMove,
1773: fromString, sWhere, sOrderBy,
1774: dataPanel.getArgsObject());
1775: }
1776:
1777: String valore = cmpField.getValue();
1778:
1779: JComponent jLabelColumnResult;
1780:
1781: if (((JTextField) jCompMove).getFont()
1782: .getSize() + 10 >= ((JTextField) jCompMove)
1783: .getSize().height) {
1784: jLabelColumnResult = new JLabel();
1785: ((JLabel) jLabelColumnResult)
1786: .setText(valore);
1787: } else {
1788: jLabelColumnResult = new JTextArea();
1789: ((JTextArea) jLabelColumnResult)
1790: .setLineWrap(true);
1791: ((JTextArea) jLabelColumnResult)
1792: .setEditable(false);
1793: ((JTextArea) jLabelColumnResult)
1794: .setWrapStyleWord(true);
1795: ((JTextArea) jLabelColumnResult)
1796: .setText(valore);
1797: }
1798:
1799: jLabelColumnResult.setBounds(jCompMove
1800: .getX(), jCompMove.getY()
1801: + yHeightHeader + yTotalPosition,
1802: jCompMove.getSize().width,
1803: jCompMove.getSize().height);
1804: jLabelColumnResult
1805: .setForeground(((JTextField) jCompMove)
1806: .getForeground());
1807: jLabelColumnResult
1808: .setFont(((JTextField) jCompMove)
1809: .getFont());
1810:
1811: // if (BandHeight < jCompMove.getY())
1812: // {
1813: // jLabelColumnResult.setVisible(false);
1814: // }
1815: //
1816: // this.add(jLabelColumnResult);
1817:
1818: if (BandHeight < jCompMove.getY()) {
1819: jLabelColumnResult = null;
1820: } else
1821: this .add(jLabelColumnResult);
1822: }
1823: /******************************/
1824: }
1825: }
1826:
1827: yTotalPosition = yTotalPosition
1828: + dataPanel
1829: .getTrailerGroupDividerRelativeLocation(f);
1830: }
1831: }
1832:
1833: //if (rsDati.getRow() != 0)
1834: //{
1835: //Gestione Summary solo se siamo alla fine del documento
1836: if (rowsCount == (cursorPosition + 1)) {
1837: JPanel jpanelSummary = dataPanel.getSummaryPanel();
1838: Component[] arraySummaryCompPanel = jpanelSummary
1839: .getComponents();
1840:
1841: int index = 0;
1842:
1843: for (int j = 0; j < arraySummaryCompPanel.length; j++) {
1844: int BandHeight = dataPanel
1845: .getSummaryDividerRelativeLocation();
1846: JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
1847:
1848: if (newComp.getClass() == JTextField.class) {
1849: if (((JTextField) newComp).getName() == null
1850: || ((JTextField) newComp).getName().equals(
1851: "")) {
1852: if (vSummaryValues.size() != 0) {
1853: String valore = (String) vSummaryValues
1854: .get(index);
1855: JComponent jLabelColumnResult;
1856:
1857: /*if (valore == null)
1858: {
1859: valore = "null";
1860: }*/
1861:
1862: if (((JTextField) newComp).getFont()
1863: .getSize() + 10 >= ((JTextField) newComp)
1864: .getSize().height) {
1865: jLabelColumnResult = new JLabel();
1866: ((JLabel) jLabelColumnResult)
1867: .setText(valore);
1868: } else {
1869: jLabelColumnResult = new JTextArea();
1870: ((JTextArea) jLabelColumnResult)
1871: .setLineWrap(true);
1872: ((JTextArea) jLabelColumnResult)
1873: .setWrapStyleWord(true);
1874: ((JTextArea) jLabelColumnResult)
1875: .setEditable(false);
1876: ((JTextArea) jLabelColumnResult)
1877: .setText(valore);
1878: }
1879:
1880: jLabelColumnResult.setBounds(
1881: newComp.getX(), newComp.getY()
1882: + yHeightHeader
1883: + yTotalPosition, newComp
1884: .getSize().width, newComp
1885: .getSize().height);
1886: jLabelColumnResult
1887: .setForeground(((JTextField) newComp)
1888: .getForeground());
1889: jLabelColumnResult
1890: .setFont(((JTextField) newComp)
1891: .getFont());
1892:
1893: // if (BandHeight < newComp.getY())
1894: // {
1895: // jLabelColumnResult.setVisible(false);
1896: // }
1897: //
1898: // this.add(jLabelColumnResult);
1899:
1900: if (BandHeight < newComp.getY()) {
1901: jLabelColumnResult = null;
1902: } else
1903: this .add(jLabelColumnResult);
1904:
1905: index = index + 1;
1906: }
1907: /******************************/
1908: } else {
1909: String fromString = dataPanel.getFromString();
1910: ComputeField cmpField = new ComputeField(
1911: newComp, fromString, dataPanel
1912: .getWhereString(), "",
1913: dataPanel.getArgsObject());
1914: String valore = cmpField.getValue();
1915:
1916: /*if (valore == null)
1917: {
1918: valore = "null";
1919: }*/
1920:
1921: JComponent jLabelColumnResult;
1922:
1923: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
1924: .getSize().height) {
1925: jLabelColumnResult = new JLabel();
1926: ((JLabel) jLabelColumnResult)
1927: .setText(valore);
1928: } else {
1929: jLabelColumnResult = new JTextArea();
1930: ((JTextArea) jLabelColumnResult)
1931: .setLineWrap(true);
1932: ((JTextArea) jLabelColumnResult)
1933: .setEditable(false);
1934: ((JTextArea) jLabelColumnResult)
1935: .setWrapStyleWord(true);
1936: ((JTextArea) jLabelColumnResult)
1937: .setText(valore);
1938: }
1939:
1940: jLabelColumnResult.setBounds(newComp.getX(),
1941: newComp.getY() + yHeightHeader
1942: + yTotalPosition, newComp
1943: .getSize().width, newComp
1944: .getSize().height);
1945: jLabelColumnResult
1946: .setForeground(((JTextField) newComp)
1947: .getForeground());
1948: jLabelColumnResult
1949: .setFont(((JTextField) newComp)
1950: .getFont());
1951:
1952: // if (BandHeight < newComp.getY())
1953: // {
1954: // jLabelColumnResult.setVisible(false);
1955: // }
1956: //
1957: // this.add(jLabelColumnResult);
1958:
1959: if (BandHeight < newComp.getY()) {
1960: jLabelColumnResult = null;
1961: } else
1962: this .add(jLabelColumnResult);
1963: }
1964: /******************************/
1965: } else if ((newComp.getClass() == JLabel.class)) {
1966: if (((JLabel) newComp).getIcon() != null) {
1967: if (!((JLabel) newComp).getText().equals("")
1968: && ((JLabel) newComp).getText() != null) {
1969: String sValore = (String) vSummaryValues
1970: .get(index);
1971:
1972: if ((sValore == null)
1973: || (sValore
1974: .equalsIgnoreCase("true"))) {
1975: this .loadComponentOnPanel(newComp,
1976: BandHeight, yHeightHeader
1977: + yTotalPosition);
1978: }
1979:
1980: index = index + 1;
1981: } else {
1982: this .loadComponentOnPanel(newComp,
1983: BandHeight, yHeightHeader
1984: + yTotalPosition);
1985: }
1986: } else {
1987: this .loadComponentOnPanel(newComp, BandHeight,
1988: yHeightHeader + yTotalPosition);
1989: }
1990: } else if (newComp.getClass() == JPanel.class) {
1991: if (BandHeight > newComp.getY()) {
1992: this .runNestedDataPanel((JPanel) newComp,
1993: "OLD", yHeightHeader + yTotalPosition);
1994: }
1995: } else {
1996: this .loadComponentOnPanel(newComp, BandHeight,
1997: yHeightHeader + yTotalPosition);
1998: }
1999: }
2000:
2001: if (arraySummaryCompPanel.length > 0) {
2002: yTotalPosition = yTotalPosition
2003: + dataPanel.getSummaryDividerRelativeLocation();
2004: }
2005: }
2006:
2007: cCPosForFinalTrailer = 0;
2008:
2009: JPanel panelFooter = dataPanel.getFooterPanel();
2010: int BandHeight = dataPanel.getFooterDividerRelativeLocation();
2011:
2012: Component[] arrayFooterCompPanel = panelFooter.getComponents();
2013: int index = 0;
2014:
2015: for (int j = 0; j < arrayFooterCompPanel.length; j++) {
2016: JComponent jCompMove = (JComponent) arrayFooterCompPanel[j];
2017:
2018: if (jCompMove.getClass() == JTextField.class) {
2019: if (((JTextField) jCompMove).getName() == null
2020: || ((JTextField) jCompMove).getName()
2021: .equals("")) {
2022: String valore = (String) vFooterValues.get(index);
2023:
2024: /*if (valore == null)
2025: {
2026: valore = "null";
2027: }*/
2028:
2029: JLabel jLabelColumnResult = new JLabel();
2030: jLabelColumnResult.setText(valore);
2031: jLabelColumnResult.setBounds(jCompMove.getX(),
2032: jCompMove.getY() + yHeightHeader
2033: + yTotalPosition, jCompMove
2034: .getSize().width, jCompMove
2035: .getSize().height);
2036: jLabelColumnResult
2037: .setForeground(((JTextField) jCompMove)
2038: .getForeground());
2039: jLabelColumnResult.setFont(((JTextField) jCompMove)
2040: .getFont());
2041:
2042: // if (BandHeight < jCompMove.getY())
2043: // {
2044: // jLabelColumnResult.setVisible(false);
2045: // }
2046: //
2047: // this.add(jLabelColumnResult);
2048:
2049: if (BandHeight < jCompMove.getY()) {
2050: jLabelColumnResult = null;
2051: } else
2052: this .add(jLabelColumnResult);
2053:
2054: index = index + 1;
2055: /******************************/
2056: } else {
2057: String fromString = dataPanel.getFromString();
2058: ComputeField cmpField = new ComputeField(jCompMove,
2059: fromString, dataPanel.getWhereString(), "",
2060: dataPanel.getArgsObject());
2061: String valore = cmpField.getValue();
2062:
2063: JComponent jLabelColumnResult;
2064:
2065: if (((JTextField) jCompMove).getFont().getSize() + 10 >= ((JTextField) jCompMove)
2066: .getSize().height) {
2067: jLabelColumnResult = new JLabel();
2068: ((JLabel) jLabelColumnResult).setText(valore);
2069: } else {
2070: jLabelColumnResult = new JTextArea();
2071: ((JTextArea) jLabelColumnResult)
2072: .setLineWrap(true);
2073: ((JTextArea) jLabelColumnResult)
2074: .setEditable(false);
2075: ((JTextArea) jLabelColumnResult)
2076: .setWrapStyleWord(true);
2077: ((JTextArea) jLabelColumnResult)
2078: .setText(valore);
2079: }
2080:
2081: jLabelColumnResult.setBounds(jCompMove.getX(),
2082: jCompMove.getY() + yHeightHeader
2083: + yTotalPosition, jCompMove
2084: .getSize().width, jCompMove
2085: .getSize().height);
2086: jLabelColumnResult
2087: .setForeground(((JTextField) jCompMove)
2088: .getForeground());
2089: jLabelColumnResult.setFont(((JTextField) jCompMove)
2090: .getFont());
2091:
2092: // if (BandHeight < jCompMove.getY())
2093: // {
2094: // jLabelColumnResult.setVisible(false);
2095: // }
2096: //
2097: // this.add(jLabelColumnResult);
2098:
2099: if (BandHeight < jCompMove.getY()) {
2100: jLabelColumnResult = null;
2101: } else
2102: this .add(jLabelColumnResult);
2103: }
2104: /******************************/
2105: } else if ((jCompMove.getClass() == JLabel.class)) {
2106: if (((JLabel) jCompMove).getIcon() != null) {
2107: if (!((JLabel) jCompMove).getText().equals("")
2108: && ((JLabel) jCompMove).getText() != null) {
2109: String sValore = (String) vFooterValues
2110: .get(index);
2111:
2112: if ((sValore == null)
2113: || (sValore.equalsIgnoreCase("true"))) {
2114: this .loadComponentOnPanel(jCompMove,
2115: BandHeight, yHeightHeader
2116: + yTotalPosition);
2117: }
2118:
2119: index = index + 1;
2120: } else {
2121: this .loadComponentOnPanel(jCompMove,
2122: BandHeight, yHeightHeader
2123: + yTotalPosition);
2124: }
2125: } else {
2126: this .loadComponentOnPanel(jCompMove, BandHeight,
2127: yHeightHeader + yTotalPosition);
2128: }
2129: } else if (jCompMove.getClass() == JPanel.class) {
2130: if (BandHeight > jCompMove.getY()) {
2131: this .runNestedDataPanel((JPanel) jCompMove, "OLD",
2132: yHeightHeader + yTotalPosition);
2133: }
2134: } else {
2135: this .loadComponentOnPanel(jCompMove, BandHeight,
2136: yHeightHeader + yTotalPosition);
2137: }
2138: }
2139: if (arrayFooterCompPanel.length > 0) {
2140: yTotalPosition = yTotalPosition
2141: + dataPanel.getFooterDividerRelativeLocation();
2142: }
2143:
2144: this .setHeightDataPanel(yTotalPosition + yHeightHeader);
2145: }
2146:
2147: private void nextPageWithVector() throws SQLException {
2148: int yHeightHeader;
2149:
2150: this .removeAll();
2151:
2152: int count = dataPanel.getGroupCount();
2153:
2154: yHeightHeader = dataPanel.getHeaderDividerRelativeLocation();
2155:
2156: String sUltimiValoriGruppi[] = new String[count];
2157:
2158: for (int i = 0; i < count; i++) {
2159: sUltimiValoriGruppi[i] = "";
2160: }
2161:
2162: /* Header */
2163: int yTotalPosition = 0;
2164: boolean printHeader = true;
2165: vSnapshotCursorPosition.add(new Integer(cursorPosition));
2166:
2167: Vector vWhereCompField = new Vector();
2168: Vector vSummaryValues = new Vector();
2169: Vector vFooterValues = new Vector();
2170:
2171: while (yTotalPosition < dataPanel.FORMAT_A4
2172: && (cursorPosition + 1) < rowsCount)
2173: //while (yTotalPosition < this.getHeightFormatPage() && (cursorPosition + 1) < rowsCount)
2174: {
2175: hashArgumentNested = new java.util.Hashtable();
2176:
2177: cursorPosition = cursorPosition + 1;
2178:
2179: if (printHeader) {
2180: headerColumnPos = 0;
2181: JPanel jpHeader = dataPanel.getHeaderPanel();
2182: int BandHeightHeader = dataPanel
2183: .getHeaderDividerRelativeLocation();
2184: Component[] arrayHeaderCompPanel = jpHeader
2185: .getComponents();
2186:
2187: this .loadComponentsOnPanel(arrayHeaderCompPanel,
2188: BandHeightHeader, 0);
2189: printHeader = false;
2190: }
2191:
2192: int counterPos = headerColumnPos;
2193:
2194: vSummaryValues.clear();
2195: vFooterValues.clear();
2196:
2197: for (int i = 1; i <= count; i++) {
2198: int yNestedH = 0;
2199: int yHeightNested = 0;
2200: sOutputGruppo = "";
2201: String sWhereComputefield = "";
2202: Vector vecResult = new Vector();
2203:
2204: int BandHeightComputedField = dataPanel
2205: .getHeaderGroupDividerRelativeLocation(i);
2206: JPanel jpanelHeaderGroup = dataPanel
2207: .getHeaderGroupPanel(i);
2208: Component[] arrayCompPanel = jpanelHeaderGroup
2209: .getComponents();
2210:
2211: /* Gestione Componenti negli Header*/
2212: for (int j = 0; j < arrayCompPanel.length; j++) {
2213: int BandHeight = dataPanel
2214: .getHeaderGroupDividerRelativeLocation(i);
2215: JComponent newComp = (JComponent) arrayCompPanel[j];
2216:
2217: if ((newComp.getClass() == JTextField.class)) {
2218: if (((JTextField) newComp).getName() == null
2219: || ((JTextField) newComp).getName()
2220: .equals("")) {
2221: counterColumnPos = counterColumnPos + 1;
2222:
2223: int typeColumn = arrayColumnType[counterPos];
2224:
2225: String sValoreForWhere = "";
2226: String sValore = "";
2227:
2228: if (typeColumn == Types.DATE
2229: || typeColumn == Types.TIME
2230: || typeColumn == Types.TIMESTAMP) {
2231: sValore = ((String[]) vecDati
2232: .elementAt(cursorPosition))[counterPos];
2233:
2234: java.text.SimpleDateFormat tms = new java.text.SimpleDateFormat();
2235:
2236: try {
2237: java.util.Date d = tms
2238: .parse(sValore);
2239:
2240: sValoreForWhere = d.toString();
2241:
2242: String days = sValoreForWhere
2243: .substring(8, 10);
2244: String mounth = String.valueOf(d
2245: .getMonth() + 1);
2246: String year = sValoreForWhere
2247: .substring(sValoreForWhere
2248: .length() - 4,
2249: sValoreForWhere
2250: .length());
2251:
2252: sValoreForWhere = days + "/"
2253: + mounth + "/" + year;
2254:
2255: } catch (java.text.ParseException e) {
2256: String days = sValore.substring(8,
2257: 10);
2258: String mounth = sValore.substring(
2259: 5, 7);
2260: String year = sValore.substring(0,
2261: 4);
2262:
2263: sValoreForWhere = days + "/"
2264: + mounth + "/" + year;
2265: }
2266:
2267: } else {
2268: sValore = ((String[]) vecDati
2269: .elementAt(cursorPosition))[counterPos];
2270: sValoreForWhere = sValore;
2271: }
2272:
2273: /*if (sValore == null)
2274: {
2275: sValore = "null";
2276: }*/
2277:
2278: counterPos = counterPos + 1;
2279: String columnName = ((JTextField) newComp)
2280: .getText();
2281:
2282: if (typeColumn == Types.VARCHAR
2283: || typeColumn == Types.LONGVARCHAR
2284: || typeColumn == Types.CHAR
2285: || typeColumn == Types.DATE
2286: || typeColumn == Types.TIME
2287: || typeColumn == Types.TIMESTAMP
2288: || typeColumn == Types.OTHER) {
2289: if (sValore != null
2290: && !sValore.equals("")) {
2291: if (sValore.indexOf("'") != -1) {
2292: //sValoreForWhere = DataEngine.replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
2293: sValoreForWhere = DataEngine
2294: .replaceString(
2295: sValore,
2296: new String("'"),
2297: new String("''"));
2298: }
2299: sWhereComputefield = sWhereComputefield
2300: + columnName
2301: + " = '"
2302: + sValoreForWhere
2303: + "' and ";
2304: }
2305: } else {
2306: if (typeColumn == Types.BIGINT
2307: || typeColumn == Types.DECIMAL
2308: || typeColumn == Types.DOUBLE
2309: || typeColumn == Types.FLOAT
2310: || typeColumn == Types.INTEGER
2311: || typeColumn == Types.NUMERIC) {
2312: sWhereComputefield = sWhereComputefield
2313: + columnName
2314: + " = "
2315: + sValoreForWhere + " and ";
2316: } else {
2317: if (sValore != null
2318: && !sValore.equals("")) {
2319: if (sValore.indexOf("'") != -1) {
2320: //sValoreForWhere = DataEngine.replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
2321: sValoreForWhere = DataEngine
2322: .replaceString(
2323: sValore,
2324: new String(
2325: "'"),
2326: new String(
2327: "''"));
2328: }
2329: sWhereComputefield = sWhereComputefield
2330: + columnName
2331: + " = '"
2332: + sValoreForWhere
2333: + "' and ";
2334: }
2335: }
2336: }
2337:
2338: JComponent jLabelColumnResult;
2339:
2340: if (((JTextField) newComp).getFont()
2341: .getSize() + 10 >= ((JTextField) newComp)
2342: .getSize().height) {
2343: jLabelColumnResult = new JLabel();
2344: ((JLabel) jLabelColumnResult)
2345: .setText(sValore);
2346: } else {
2347: jLabelColumnResult = new JTextArea();
2348: ((JTextArea) jLabelColumnResult)
2349: .setLineWrap(true);
2350: ((JTextArea) jLabelColumnResult)
2351: .setWrapStyleWord(true);
2352: ((JTextArea) jLabelColumnResult)
2353: .setEditable(false);
2354: ((JTextArea) jLabelColumnResult)
2355: .setText(sValore);
2356: }
2357:
2358: if (sValore != null) {
2359: hashArgumentNested.put(
2360: ((JTextField) newComp)
2361: .getText(), sValore);
2362: }
2363:
2364: jLabelColumnResult.setBounds(
2365: newComp.getX(), newComp.getY(),
2366: newComp.getSize().width, newComp
2367: .getSize().height);
2368: jLabelColumnResult
2369: .setForeground(((JTextField) newComp)
2370: .getForeground());
2371: jLabelColumnResult
2372: .setFont(((JTextField) newComp)
2373: .getFont());
2374: /* Linea che serve per salvare il posizionamento dell' oggetto sul datareport
2375: all' interno del gruppo per eventuale spostamento successivo per la presenza
2376: di un nested*/
2377: jLabelColumnResult.setName(String
2378: .valueOf(newComp.getY()));
2379:
2380: // if (BandHeight < newComp.getY())
2381: // {
2382: // jLabelColumnResult.setVisible(false);
2383: // }
2384: //
2385: // vecResult.add(jLabelColumnResult);
2386:
2387: if (BandHeight < newComp.getY()) {
2388: jLabelColumnResult = null;
2389: } else
2390: vecResult.add(jLabelColumnResult);
2391:
2392: if (sValore != null) {
2393: sValore = sValore.trim();
2394: sOutputGruppo = sOutputGruppo + sValore;
2395: }
2396: } else {
2397: vecResult.add(newComp);
2398: }
2399: } else if (newComp.getClass() == JLabel.class) {
2400: if (((JLabel) newComp).getIcon() != null) {
2401: if (!((JLabel) newComp).getText()
2402: .equals("")
2403: && ((JLabel) newComp).getText() != null) {
2404: counterColumnPos = counterColumnPos + 1;
2405: String sValore = ((String[]) vecDati
2406: .elementAt(cursorPosition))[counterPos];
2407: counterPos = counterPos + 1;
2408:
2409: if ((sValore == null)
2410: || (sValore
2411: .equalsIgnoreCase("true"))) {
2412: this .loadComponentOnVector(newComp,
2413: vecResult, BandHeight);
2414: }
2415: } else {
2416: this .loadComponentOnVector(newComp,
2417: vecResult, BandHeight);
2418: }
2419: } else {
2420: this .loadComponentOnVector(newComp,
2421: vecResult, BandHeight);
2422: }
2423: } else if (newComp.getClass() == JPanel.class) {
2424: if (BandHeight > newComp.getY()) {
2425: yNestedH = newComp.getY();
2426: yHeightNested = this .runNestedDataPanel(
2427: (JPanel) newComp, "NEW",
2428: yHeightHeader + yTotalPosition);
2429: /* Questa linea fa in modo che gli oggetti si posizionino
2430: da adesso in poi ad un livello che comprende anche l' altezza
2431: (che non si sa' a priori del nested)*/
2432: yTotalPosition = yTotalPosition
2433: + yHeightNested;
2434: }
2435: } else {
2436: this .loadComponentOnVector(newComp, vecResult,
2437: BandHeight);
2438: }
2439: }
2440:
2441: /* Blocco che gestisce il posizionamento degli oggetti se nel header Group
2442: è presente un Nested Report */
2443: if (yHeightNested > 0) {
2444: for (int j = 0; j < vecResult.size(); j++) {
2445: JComponent newComp = (JComponent) vecResult
2446: .get(j);
2447: if (newComp.getName() != null) {
2448: if (Integer.valueOf(newComp.getName())
2449: .intValue() <= yNestedH) {
2450: newComp.setLocation(newComp.getX(),
2451: newComp.getY() - yHeightNested);
2452: }
2453: }
2454: }
2455: }
2456: /*************************************************************************/
2457:
2458: if (!sOutputGruppo.equals(sUltimiValoriGruppi[i - 1])) {
2459: /* Gestione trailer*/
2460: if (sUltimiValoriGruppi[i - 1] != "") {
2461: int indexColumnTrailerValue = indexStartColumnTrailerValue;
2462:
2463: for (int f = count; f >= i; f--) {
2464: JPanel panelTrailer = dataPanel
2465: .getTrailerGroupPanel(f);
2466: int BandHeight = dataPanel
2467: .getTrailerGroupDividerRelativeLocation(f);
2468:
2469: Component[] arrayTrailerCompPanel = panelTrailer
2470: .getComponents();
2471: for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
2472: JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
2473:
2474: if ((jCompMove.getClass() != JTextField.class)) {
2475: if ((jCompMove.getClass() == JLabel.class)) {
2476: if (((JLabel) jCompMove)
2477: .getIcon() != null) {
2478: if (!((JLabel) jCompMove)
2479: .getText().equals(
2480: "")
2481: && ((JLabel) jCompMove)
2482: .getText() != null) {
2483: String sValore = ((String[]) vecDati
2484: .elementAt(cursorPosition - 1))[indexColumnTrailerValue];
2485: indexColumnTrailerValue = indexColumnTrailerValue + 1;
2486:
2487: if ((sValore == null)
2488: || (sValore
2489: .equalsIgnoreCase("true"))) {
2490: this
2491: .loadComponentOnPanel(
2492: jCompMove,
2493: BandHeight,
2494: yHeightHeader
2495: + yTotalPosition);
2496: }
2497: } else {
2498: this
2499: .loadComponentOnPanel(
2500: jCompMove,
2501: BandHeight,
2502: yHeightHeader
2503: + yTotalPosition);
2504: }
2505: } else {
2506: this
2507: .loadComponentOnPanel(
2508: jCompMove,
2509: BandHeight,
2510: yHeightHeader
2511: + yTotalPosition);
2512: }
2513: } else if (jCompMove.getClass() == JPanel.class) {
2514: if (BandHeight > jCompMove
2515: .getY()) {
2516: int height = this
2517: .runNestedDataPanel(
2518: (JPanel) jCompMove,
2519: "NEW",
2520: yHeightHeader
2521: + yTotalPosition);
2522: yTotalPosition = yTotalPosition
2523: + height;
2524: }
2525: } else {
2526: this
2527: .loadComponentOnPanel(
2528: jCompMove,
2529: BandHeight,
2530: yHeightHeader
2531: + yTotalPosition);
2532: }
2533: } else if (jCompMove.getClass() == JTextField.class) {
2534: if (((JTextField) jCompMove)
2535: .getName() == null
2536: || ((JTextField) jCompMove)
2537: .getName().equals(
2538: "")) {
2539: String sValore = ((String[]) vecDati
2540: .elementAt(cursorPosition - 1))[indexColumnTrailerValue];
2541:
2542: /*if (sValore == null)
2543: {
2544: sValore = "null";
2545: }*/
2546:
2547: indexColumnTrailerValue = indexColumnTrailerValue + 1;
2548:
2549: JComponent jLabelColumnResult;
2550:
2551: if (((JTextField) jCompMove)
2552: .getFont().getSize() + 10 >= ((JTextField) jCompMove)
2553: .getSize().height) {
2554: jLabelColumnResult = new JLabel();
2555: ((JLabel) jLabelColumnResult)
2556: .setText(sValore);
2557: } else {
2558: jLabelColumnResult = new JTextArea();
2559: ((JTextArea) jLabelColumnResult)
2560: .setLineWrap(true);
2561: ((JTextArea) jLabelColumnResult)
2562: .setWrapStyleWord(true);
2563: ((JTextArea) jLabelColumnResult)
2564: .setEditable(false);
2565: ((JTextArea) jLabelColumnResult)
2566: .setText(sValore);
2567: }
2568:
2569: jLabelColumnResult
2570: .setBounds(
2571: jCompMove
2572: .getX(),
2573: jCompMove
2574: .getY()
2575: + yTotalPosition
2576: + yHeightHeader,
2577: jCompMove
2578: .getSize().width,
2579: jCompMove
2580: .getSize().height);
2581: jLabelColumnResult
2582: .setForeground(((JTextField) jCompMove)
2583: .getForeground());
2584: jLabelColumnResult
2585: .setFont(((JTextField) jCompMove)
2586: .getFont());
2587:
2588: // if (BandHeight < jCompMove.getY())
2589: // {
2590: // jLabelColumnResult.setVisible(false);
2591: // }
2592: //
2593: // this.add(jLabelColumnResult);
2594:
2595: if (BandHeight < jCompMove
2596: .getY()) {
2597: jLabelColumnResult = null;
2598: } else
2599: this
2600: .add(jLabelColumnResult);
2601:
2602: } else {
2603: String sWhere = "";
2604: int countCompute = f;
2605:
2606: while (countCompute != 0) {
2607: if (sWhere.equals("")) {
2608: sWhere = (String) vWhereCompField
2609: .get(countCompute - 1);
2610: } else {
2611: sWhere = sWhere
2612: + " and "
2613: + (String) vWhereCompField
2614: .get(countCompute - 1);
2615: }
2616: countCompute = countCompute - 1;
2617: }
2618:
2619: String sOrderBy = "";
2620:
2621: if (f != 1) {
2622: sOrderBy = dataPanel
2623: .getOrderByString(f);
2624: }
2625:
2626: String fromString = dataPanel
2627: .getFromString();
2628:
2629: ComputeField cmpField = null;
2630:
2631: if (!dataPanel.getWhereString()
2632: .equals("")) {
2633: cmpField = new ComputeField(
2634: jCompMove,
2635: fromString,
2636: sWhere
2637: + " and "
2638: + dataPanel
2639: .getWhereString(),
2640: sOrderBy,
2641: dataPanel
2642: .getArgsObject());
2643: } else {
2644: cmpField = new ComputeField(
2645: jCompMove,
2646: fromString,
2647: sWhere,
2648: sOrderBy,
2649: dataPanel
2650: .getArgsObject());
2651: }
2652:
2653: String valore = cmpField
2654: .getValue();
2655:
2656: /*if (valore == null)
2657: {
2658: valore = "null";
2659: }*/
2660:
2661: JComponent jLabelColumnResult;
2662:
2663: if (((JTextField) jCompMove)
2664: .getFont().getSize() + 10 >= ((JTextField) jCompMove)
2665: .getSize().height) {
2666: jLabelColumnResult = new JLabel();
2667: ((JLabel) jLabelColumnResult)
2668: .setText(valore);
2669: } else {
2670: jLabelColumnResult = new JTextArea();
2671: ((JTextArea) jLabelColumnResult)
2672: .setLineWrap(true);
2673: ((JTextArea) jLabelColumnResult)
2674: .setEditable(false);
2675: ((JTextArea) jLabelColumnResult)
2676: .setWrapStyleWord(true);
2677: ((JTextArea) jLabelColumnResult)
2678: .setText(valore);
2679: }
2680:
2681: jLabelColumnResult
2682: .setBounds(
2683: jCompMove
2684: .getX(),
2685: jCompMove
2686: .getY()
2687: + yHeightHeader
2688: + yTotalPosition,
2689: jCompMove
2690: .getSize().width,
2691: jCompMove
2692: .getSize().height);
2693: jLabelColumnResult
2694: .setForeground(((JTextField) jCompMove)
2695: .getForeground());
2696: jLabelColumnResult
2697: .setFont(((JTextField) jCompMove)
2698: .getFont());
2699:
2700: // if (BandHeight < jCompMove.getY())
2701: // {
2702: // jLabelColumnResult.setVisible(false);
2703: // }
2704: //
2705: // this.add(jLabelColumnResult);
2706:
2707: if (BandHeight < jCompMove
2708: .getY()) {
2709: jLabelColumnResult = null;
2710: } else
2711: this
2712: .add(jLabelColumnResult);
2713: }
2714: /******************************/
2715: }
2716: }
2717:
2718: yTotalPosition = yTotalPosition
2719: + dataPanel
2720: .getTrailerGroupDividerRelativeLocation(f);
2721: }
2722: }
2723:
2724: if (!sWhereComputefield.equals("")) {
2725: vWhereCompField.add(i - 1, sWhereComputefield
2726: .substring(0, sWhereComputefield
2727: .length() - 4));
2728: }
2729:
2730: for (int z = 0; z < vecResult.size(); z++) {
2731: JComponent insertComp = (JComponent) vecResult
2732: .get(z);
2733:
2734: if (insertComp.getClass() == JTextField.class) {
2735: if (((JTextField) insertComp).getName() != null
2736: && !((JTextField) insertComp)
2737: .getName().equals("")) {
2738: String sWhere = "";
2739: int countCompute = i;
2740:
2741: while (countCompute != 0) {
2742: if (sWhere.equals("")) {
2743: sWhere = (String) vWhereCompField
2744: .get(countCompute - 1);
2745: } else {
2746: sWhere = sWhere
2747: + " and "
2748: + (String) vWhereCompField
2749: .get(countCompute - 1);
2750: }
2751:
2752: countCompute = countCompute - 1;
2753: }
2754:
2755: String sOrderBy = "";
2756:
2757: if (i != 1) {
2758: sOrderBy = dataPanel
2759: .getOrderByString(i);
2760: }
2761:
2762: String fromString = dataPanel
2763: .getFromString();
2764:
2765: ComputeField cmpField = null;
2766:
2767: if (!dataPanel.getWhereString().equals(
2768: "")) {
2769: cmpField = new ComputeField(
2770: insertComp,
2771: fromString,
2772: sWhere
2773: + " and "
2774: + dataPanel
2775: .getWhereString(),
2776: sOrderBy, dataPanel
2777: .getArgsObject());
2778: } else {
2779: cmpField = new ComputeField(
2780: insertComp, fromString,
2781: sWhere, sOrderBy, dataPanel
2782: .getArgsObject());
2783: }
2784:
2785: String valore = cmpField.getValue();
2786:
2787: JComponent jLabelColumnResult;
2788:
2789: if (((JTextField) insertComp).getFont()
2790: .getSize() + 10 >= ((JTextField) insertComp)
2791: .getSize().height) {
2792: jLabelColumnResult = new JLabel();
2793: ((JLabel) jLabelColumnResult)
2794: .setText(valore);
2795: } else {
2796: jLabelColumnResult = new JTextArea();
2797: ((JTextArea) jLabelColumnResult)
2798: .setLineWrap(true);
2799: ((JTextArea) jLabelColumnResult)
2800: .setEditable(false);
2801: ((JTextArea) jLabelColumnResult)
2802: .setWrapStyleWord(true);
2803: ((JTextArea) jLabelColumnResult)
2804: .setText(valore);
2805: }
2806:
2807: jLabelColumnResult.setBounds(insertComp
2808: .getX(), insertComp.getY()
2809: + yHeightHeader
2810: + yTotalPosition, insertComp
2811: .getSize().width, insertComp
2812: .getSize().height);
2813: jLabelColumnResult
2814: .setForeground(((JTextField) insertComp)
2815: .getForeground());
2816: jLabelColumnResult
2817: .setFont(((JTextField) insertComp)
2818: .getFont());
2819:
2820: // if (BandHeightComputedField < insertComp.getY())
2821: // {
2822: // jLabelColumnResult.setVisible(false);
2823: // }
2824: //
2825: // this.add(jLabelColumnResult);
2826:
2827: if (BandHeightComputedField < insertComp
2828: .getY()) {
2829: jLabelColumnResult = null;
2830: } else
2831: this .add(jLabelColumnResult);
2832: }
2833: } else {
2834: insertComp.setLocation(insertComp.getX(),
2835: insertComp.getY() + yTotalPosition
2836: + yHeightHeader);
2837: this .add(insertComp);
2838: }
2839: }
2840:
2841: yTotalPosition = yTotalPosition
2842: + dataPanel
2843: .getHeaderGroupDividerRelativeLocation(i);
2844:
2845: sUltimiValoriGruppi[i - 1] = sOutputGruppo;
2846:
2847: for (int w = i; w < count; w++) {
2848: sUltimiValoriGruppi[w] = "";
2849: }
2850: }
2851: }
2852:
2853: /* Inizio Dettaglio */
2854: JPanel jpanelDetail = dataPanel.getDetailPanel();
2855: Component[] arrayDetailCompPanel = jpanelDetail
2856: .getComponents();
2857:
2858: for (int j = 0; j < arrayDetailCompPanel.length; j++) {
2859: int BandHeight = dataPanel
2860: .getDetailDividerRelativeLocation();
2861: JComponent newComp = ((JComponent) arrayDetailCompPanel[j]);
2862:
2863: if ((newComp.getClass() == JTextField.class)) {
2864: if (((JTextField) newComp).getName() == null
2865: || ((JTextField) newComp).getName().equals(
2866: "")) {
2867: counterColumnPos = counterColumnPos + 1;
2868: String sValore = ((String[]) vecDati
2869: .elementAt(cursorPosition))[counterPos];
2870: counterPos = counterPos + 1;
2871:
2872: /*if (sValore == null)
2873: {
2874: sValore = "null";
2875: }*/
2876:
2877: JComponent jLabelColumnResult;
2878:
2879: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
2880: .getSize().height) {
2881: jLabelColumnResult = new JLabel();
2882: ((JLabel) jLabelColumnResult)
2883: .setText(sValore);
2884: } else {
2885: jLabelColumnResult = new JTextArea();
2886: ((JTextArea) jLabelColumnResult)
2887: .setLineWrap(true);
2888: ((JTextArea) jLabelColumnResult)
2889: .setWrapStyleWord(true);
2890: ((JTextArea) jLabelColumnResult)
2891: .setEditable(false);
2892: ((JTextArea) jLabelColumnResult)
2893: .setText(sValore);
2894: }
2895:
2896: if (sValore != null) {
2897: hashArgumentNested.put(
2898: ((JTextField) newComp).getText(),
2899: sValore);
2900: }
2901:
2902: jLabelColumnResult.setBounds(newComp.getX(),
2903: newComp.getY() + yHeightHeader
2904: + yTotalPosition, newComp
2905: .getSize().width, newComp
2906: .getSize().height);
2907: jLabelColumnResult
2908: .setForeground(((JTextField) newComp)
2909: .getForeground());
2910: jLabelColumnResult
2911: .setFont(((JTextField) newComp)
2912: .getFont());
2913:
2914: // if (BandHeight < newComp.getY())
2915: // {
2916: // jLabelColumnResult.setVisible(false);
2917: // }
2918: //
2919: // this.add(jLabelColumnResult);
2920:
2921: if (BandHeight < newComp.getY()) {
2922: jLabelColumnResult = null;
2923: } else
2924: this .add(jLabelColumnResult);
2925:
2926: } else {
2927: String sWhere = "";
2928: int countCompute = count;
2929:
2930: while (countCompute != 0) {
2931: if (sWhere.equals("")) {
2932: sWhere = (String) vWhereCompField
2933: .get(countCompute - 1);
2934: } else {
2935: sWhere = sWhere
2936: + " and "
2937: + (String) vWhereCompField
2938: .get(countCompute - 1);
2939: }
2940:
2941: countCompute = countCompute - 1;
2942: }
2943:
2944: String sOrderBy = "";
2945:
2946: if (count != 1) {
2947: sOrderBy = dataPanel
2948: .getOrderByString(count);
2949: }
2950:
2951: String fromString = dataPanel.getFromString();
2952:
2953: ComputeField cmpField = null;
2954:
2955: if (!dataPanel.getWhereString().equals("")) {
2956: cmpField = new ComputeField(newComp,
2957: fromString, sWhere
2958: + " and "
2959: + dataPanel
2960: .getWhereString(),
2961: sOrderBy, dataPanel.getArgsObject());
2962: } else {
2963: cmpField = new ComputeField(newComp,
2964: fromString, sWhere, sOrderBy,
2965: dataPanel.getArgsObject());
2966: }
2967:
2968: String valore = cmpField.getValue();
2969:
2970: JComponent jLabelColumnResult;
2971:
2972: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
2973: .getSize().height) {
2974: jLabelColumnResult = new JLabel();
2975: ((JLabel) jLabelColumnResult)
2976: .setText(valore);
2977: } else {
2978: jLabelColumnResult = new JTextArea();
2979: ((JTextArea) jLabelColumnResult)
2980: .setLineWrap(true);
2981: ((JTextArea) jLabelColumnResult)
2982: .setEditable(false);
2983: ((JTextArea) jLabelColumnResult)
2984: .setWrapStyleWord(true);
2985: ((JTextArea) jLabelColumnResult)
2986: .setText(valore);
2987: }
2988:
2989: jLabelColumnResult.setBounds(newComp.getX(),
2990: newComp.getY() + yHeightHeader
2991: + yTotalPosition, newComp
2992: .getSize().width, newComp
2993: .getSize().height);
2994: jLabelColumnResult
2995: .setForeground(((JTextField) newComp)
2996: .getForeground());
2997: jLabelColumnResult
2998: .setFont(((JTextField) newComp)
2999: .getFont());
3000:
3001: // if (BandHeight < newComp.getY())
3002: // {
3003: // jLabelColumnResult.setVisible(false);
3004: // }
3005: //
3006: // this.add(jLabelColumnResult);
3007:
3008: if (BandHeight < newComp.getY()) {
3009: jLabelColumnResult = null;
3010: } else
3011: this .add(jLabelColumnResult);
3012:
3013: }
3014: } else if ((newComp.getClass() == JLabel.class)) {
3015: if (((JLabel) newComp).getIcon() != null) {
3016: if (!((JLabel) newComp).getText().equals("")
3017: && ((JLabel) newComp).getText() != null) {
3018: counterColumnPos = counterColumnPos + 1;
3019: String sValore = ((String[]) vecDati
3020: .elementAt(cursorPosition))[counterPos];
3021: counterPos = counterPos + 1;
3022:
3023: if ((sValore == null)
3024: || (sValore
3025: .equalsIgnoreCase("true"))) {
3026: this .loadComponentOnPanel(newComp,
3027: BandHeight, yHeightHeader
3028: + yTotalPosition);
3029: }
3030: } else {
3031: this .loadComponentOnPanel(newComp,
3032: BandHeight, yHeightHeader
3033: + yTotalPosition);
3034: }
3035: } else {
3036: this .loadComponentOnPanel(newComp, BandHeight,
3037: yHeightHeader + yTotalPosition);
3038: }
3039: } else if (newComp.getClass() == JPanel.class) {
3040: if (BandHeight > newComp.getY()) {
3041: int yNested = this .runNestedDataPanel(
3042: (JPanel) newComp, "NEW", yHeightHeader
3043: + yTotalPosition);
3044: yTotalPosition = yTotalPosition + yNested;
3045: }
3046: } else {
3047: this .loadComponentOnPanel(newComp, BandHeight,
3048: yHeightHeader + yTotalPosition);
3049: }
3050: }
3051:
3052: if (arrayDetailCompPanel.length > 0) {
3053: yTotalPosition = yTotalPosition
3054: + dataPanel.getDetailDividerRelativeLocation();
3055: }
3056:
3057: JPanel jpanelSummary = dataPanel.getSummaryPanel();
3058: Component[] arraySummaryCompPanel = jpanelSummary
3059: .getComponents();
3060:
3061: for (int j = 0; j < arraySummaryCompPanel.length; j++) {
3062: JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
3063:
3064: if ((newComp.getClass() == JTextField.class)) {
3065: if (((JTextField) newComp).getName() == null
3066: || ((JTextField) newComp).getName().equals(
3067: "")) {
3068: counterColumnPos = counterColumnPos + 1;
3069: String sValore = ((String[]) vecDati
3070: .elementAt(cursorPosition))[counterPos];
3071: counterPos = counterPos + 1;
3072:
3073: vSummaryValues.add(sValore);
3074: }
3075: } else if ((newComp.getClass() == JLabel.class)) {
3076: if (((JLabel) newComp).getIcon() != null) {
3077: if (!((JLabel) newComp).getText().equals("")
3078: && ((JLabel) newComp).getText() != null) {
3079: counterColumnPos = counterColumnPos + 1;
3080: String sValore = ((String[]) vecDati
3081: .elementAt(cursorPosition))[counterPos];
3082: counterPos = counterPos + 1;
3083:
3084: vSummaryValues.add(sValore);
3085: }
3086: }
3087: }
3088: }
3089:
3090: JPanel jpanelFooter = dataPanel.getFooterPanel();
3091: Component[] arrayFooterCompPanel = jpanelFooter
3092: .getComponents();
3093:
3094: for (int j = 0; j < arrayFooterCompPanel.length; j++) {
3095: JComponent newComp = ((JComponent) arrayFooterCompPanel[j]);
3096:
3097: if ((newComp.getClass() == JTextField.class)) {
3098: if (((JTextField) newComp).getName() == null
3099: || ((JTextField) newComp).getName().equals(
3100: "")) {
3101: counterColumnPos = counterColumnPos + 1;
3102: String sValore = ((String[]) vecDati
3103: .elementAt(cursorPosition))[counterPos];
3104: counterPos = counterPos + 1;
3105:
3106: vFooterValues.add(sValore);
3107: }
3108: } else if ((newComp.getClass() == JLabel.class)) {
3109: if (((JLabel) newComp).getIcon() != null) {
3110: if (!((JLabel) newComp).getText().equals("")
3111: && ((JLabel) newComp).getText() != null) {
3112: counterColumnPos = counterColumnPos + 1;
3113: String sValore = ((String[]) vecDati
3114: .elementAt(cursorPosition))[counterPos];
3115: counterPos = counterPos + 1;
3116:
3117: vFooterValues.add(sValore);
3118: }
3119: }
3120: }
3121: }
3122: }
3123:
3124: Vector vEndPageGroup = new Vector();
3125:
3126: if (cursorPosition + 1 < rowsCount) {
3127: cursorPosition = cursorPosition + 1;
3128: int counterPos = headerColumnPos;
3129: //counterColumnPos = 0;
3130: // //TEST
3131: for (int i = 1; i <= count; i++) {
3132: sOutputGruppo = "";
3133:
3134: JPanel jpanelHeaderGroup = dataPanel
3135: .getHeaderGroupPanel(i);
3136: Component[] arrayCompPanel = jpanelHeaderGroup
3137: .getComponents();
3138:
3139: for (int k = 0; k < arrayCompPanel.length; k++) {
3140: JComponent newComp = (JComponent) arrayCompPanel[k];
3141:
3142: if ((newComp.getClass() == JTextField.class)) {
3143: if (((JTextField) newComp).getName() == null
3144: || ((JTextField) newComp).getName()
3145: .equals("")) {
3146: String sValore = "";
3147:
3148: sValore = ((String[]) vecDati
3149: .elementAt(cursorPosition))[counterPos];
3150:
3151: if (sValore != null) {
3152: sValore = sValore.trim();
3153: sOutputGruppo = sOutputGruppo + sValore;
3154: }
3155:
3156: counterPos = counterPos + 1;
3157: }
3158: }
3159: }
3160: vEndPageGroup.add(sOutputGruppo);
3161: }
3162: cursorPosition = cursorPosition - 1;
3163: }
3164:
3165: int indexColumnTrailerValue = indexStartColumnTrailerValue;
3166:
3167: //fine resulset next
3168: for (int f = count; f >= 1; f--) {
3169: //if ((!sOutputGruppo.equals(sUltimiValoriGruppi[count - 1]) || (cursorPosition == (rowsCount - 1))))
3170: //{
3171: if ((vEndPageGroup.size() == 0
3172: || !((String) vEndPageGroup.get(f - 1))
3173: .equals(sUltimiValoriGruppi[f - 1]) || (cursorPosition == (rowsCount - 1)))) {
3174: /** gestione trailer finali **/
3175: JPanel panelTrailer = dataPanel.getTrailerGroupPanel(f);
3176:
3177: int BandHeight = dataPanel
3178: .getTrailerGroupDividerRelativeLocation(f);
3179: Component[] arrayTrailerCompPanel = panelTrailer
3180: .getComponents();
3181:
3182: for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
3183: JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
3184:
3185: if ((jCompMove.getClass() != JTextField.class)) {
3186: if ((jCompMove.getClass() == JLabel.class)) {
3187: if (((JLabel) jCompMove).getIcon() != null) {
3188: if (!((JLabel) jCompMove).getText()
3189: .equals("")
3190: && ((JLabel) jCompMove)
3191: .getText() != null) {
3192: String sValore = ((String[]) vecDati
3193: .elementAt(cursorPosition))[indexColumnTrailerValue];
3194: indexColumnTrailerValue = indexColumnTrailerValue + 1;
3195:
3196: if ((sValore == null)
3197: || (sValore
3198: .equalsIgnoreCase("true"))) {
3199: this
3200: .loadComponentOnPanel(
3201: jCompMove,
3202: BandHeight,
3203: yHeightHeader
3204: + yTotalPosition);
3205: }
3206: } else {
3207: this .loadComponentOnPanel(
3208: jCompMove, BandHeight,
3209: yHeightHeader
3210: + yTotalPosition);
3211: }
3212: } else {
3213: this .loadComponentOnPanel(jCompMove,
3214: BandHeight, yHeightHeader
3215: + yTotalPosition);
3216: }
3217: } else if (jCompMove.getClass() == JPanel.class) {
3218: if (BandHeight > jCompMove.getY()) {
3219: int height = this .runNestedDataPanel(
3220: (JPanel) jCompMove, "NEW",
3221: yHeightHeader + yTotalPosition);
3222: yTotalPosition = yTotalPosition
3223: + height;
3224: }
3225: } else {
3226: if (BandHeight > jCompMove.getY()) {
3227: JComponent jcopyComp = this
3228: .elementaryCopyJComponent(jCompMove);
3229: jcopyComp.setSize(jCompMove.getWidth(),
3230: jCompMove.getHeight());
3231: jcopyComp.setLocation(jCompMove.getX(),
3232: jCompMove.getY()
3233: + yTotalPosition
3234: + yHeightHeader);
3235: this .add(jcopyComp);
3236: }
3237: }
3238: } else if (jCompMove.getClass() == JTextField.class) {
3239: if (((JTextField) jCompMove).getName() == null
3240: || ((JTextField) jCompMove).getName()
3241: .equals("")) {
3242: String sValore = ((String[]) vecDati
3243: .elementAt(cursorPosition))[indexColumnTrailerValue];
3244: indexColumnTrailerValue = indexColumnTrailerValue + 1;
3245:
3246: /*if (sValore == null)
3247: {
3248: sValore = "null";
3249: }*/
3250:
3251: JComponent jLabelColumnResult;
3252:
3253: if (((JTextField) jCompMove).getFont()
3254: .getSize() + 10 >= ((JTextField) jCompMove)
3255: .getSize().height) {
3256: jLabelColumnResult = new JLabel();
3257: ((JLabel) jLabelColumnResult)
3258: .setText(sValore);
3259: } else {
3260: jLabelColumnResult = new JTextArea();
3261: ((JTextArea) jLabelColumnResult)
3262: .setLineWrap(true);
3263: ((JTextArea) jLabelColumnResult)
3264: .setWrapStyleWord(true);
3265: ((JTextArea) jLabelColumnResult)
3266: .setEditable(false);
3267: ((JTextArea) jLabelColumnResult)
3268: .setText(sValore);
3269: }
3270:
3271: jLabelColumnResult.setBounds(jCompMove
3272: .getX(), jCompMove.getY()
3273: + yTotalPosition + yHeightHeader,
3274: jCompMove.getSize().width,
3275: jCompMove.getSize().height);
3276: jLabelColumnResult
3277: .setForeground(((JTextField) jCompMove)
3278: .getForeground());
3279: jLabelColumnResult
3280: .setFont(((JTextField) jCompMove)
3281: .getFont());
3282:
3283: // if (BandHeight < jCompMove.getY())
3284: // {
3285: // jLabelColumnResult.setVisible(false);
3286: // }
3287: //
3288: // this.add(jLabelColumnResult);
3289:
3290: if (BandHeight < jCompMove.getY()) {
3291: jLabelColumnResult = null;
3292: } else
3293: this .add(jLabelColumnResult);
3294:
3295: } else {
3296: String sWhere = "";
3297: int countCompute = f;
3298:
3299: while (countCompute != 0) {
3300: if (sWhere.equals("")) {
3301: if (vWhereCompField.size() > 0) {
3302: sWhere = (String) vWhereCompField
3303: .get(countCompute - 1);
3304: }
3305: } else {
3306: if (vWhereCompField.size() > 0) {
3307: sWhere = sWhere
3308: + " and "
3309: + (String) vWhereCompField
3310: .get(countCompute - 1);
3311: }
3312: }
3313: countCompute = countCompute - 1;
3314: }
3315:
3316: String sOrderBy = "";
3317:
3318: if (f != 1) {
3319: sOrderBy = dataPanel
3320: .getOrderByString(f);
3321: }
3322:
3323: String fromString = dataPanel
3324: .getFromString();
3325:
3326: ComputeField cmpField = null;
3327:
3328: if (!dataPanel.getWhereString().equals("")) {
3329: cmpField = new ComputeField(
3330: jCompMove,
3331: fromString,
3332: sWhere
3333: + " and "
3334: + dataPanel
3335: .getWhereString(),
3336: sOrderBy, dataPanel
3337: .getArgsObject());
3338: } else {
3339: cmpField = new ComputeField(jCompMove,
3340: fromString, sWhere, sOrderBy,
3341: dataPanel.getArgsObject());
3342: }
3343:
3344: String valore = cmpField.getValue();
3345:
3346: JComponent jLabelColumnResult;
3347:
3348: if (((JTextField) jCompMove).getFont()
3349: .getSize() + 10 >= ((JTextField) jCompMove)
3350: .getSize().height) {
3351: jLabelColumnResult = new JLabel();
3352: ((JLabel) jLabelColumnResult)
3353: .setText(valore);
3354: } else {
3355: jLabelColumnResult = new JTextArea();
3356: ((JTextArea) jLabelColumnResult)
3357: .setLineWrap(true);
3358: ((JTextArea) jLabelColumnResult)
3359: .setEditable(false);
3360: ((JTextArea) jLabelColumnResult)
3361: .setWrapStyleWord(true);
3362: ((JTextArea) jLabelColumnResult)
3363: .setText(valore);
3364: }
3365:
3366: jLabelColumnResult.setBounds(jCompMove
3367: .getX(), jCompMove.getY()
3368: + yHeightHeader + yTotalPosition,
3369: jCompMove.getSize().width,
3370: jCompMove.getSize().height);
3371: jLabelColumnResult
3372: .setForeground(((JTextField) jCompMove)
3373: .getForeground());
3374: jLabelColumnResult
3375: .setFont(((JTextField) jCompMove)
3376: .getFont());
3377:
3378: // if (BandHeight < jCompMove.getY())
3379: // {
3380: // jLabelColumnResult.setVisible(false);
3381: // }
3382: //
3383: // this.add(jLabelColumnResult);
3384:
3385: if (BandHeight < jCompMove.getY()) {
3386: jLabelColumnResult = null;
3387: } else
3388: this .add(jLabelColumnResult);
3389: }
3390: /******************************/
3391: }
3392: }
3393:
3394: yTotalPosition = yTotalPosition
3395: + dataPanel
3396: .getTrailerGroupDividerRelativeLocation(f);
3397: }
3398: }
3399:
3400: //if ((cursorPosition + 1 < rowsCount))
3401: //{
3402: //Gestione Summary solo se siamo alla fine del documento
3403: if (rowsCount == (cursorPosition + 1)) {
3404: JPanel jpanelSummary = dataPanel.getSummaryPanel();
3405: Component[] arraySummaryCompPanel = jpanelSummary
3406: .getComponents();
3407:
3408: int index = 0;
3409:
3410: for (int j = 0; j < arraySummaryCompPanel.length; j++) {
3411: int BandHeight = dataPanel
3412: .getSummaryDividerRelativeLocation();
3413: JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
3414:
3415: if (newComp.getClass() == JTextField.class) {
3416: if (((JTextField) newComp).getName() == null
3417: || ((JTextField) newComp).getName().equals(
3418: "")) {
3419: if (vSummaryValues.size() != 0) {
3420: String valore = (String) vSummaryValues
3421: .get(index);
3422:
3423: /*if (valore == null)
3424: {
3425: valore = "null";
3426: }*/
3427:
3428: JComponent jLabelColumnResult;
3429:
3430: if (((JTextField) newComp).getFont()
3431: .getSize() + 10 >= ((JTextField) newComp)
3432: .getSize().height) {
3433: jLabelColumnResult = new JLabel();
3434: ((JLabel) jLabelColumnResult)
3435: .setText(valore);
3436: } else {
3437: jLabelColumnResult = new JTextArea();
3438: ((JTextArea) jLabelColumnResult)
3439: .setLineWrap(true);
3440: ((JTextArea) jLabelColumnResult)
3441: .setWrapStyleWord(true);
3442: ((JTextArea) jLabelColumnResult)
3443: .setEditable(false);
3444: ((JTextArea) jLabelColumnResult)
3445: .setText(valore);
3446: }
3447:
3448: jLabelColumnResult.setBounds(
3449: newComp.getX(), newComp.getY()
3450: + yHeightHeader
3451: + yTotalPosition, newComp
3452: .getSize().width, newComp
3453: .getSize().height);
3454: jLabelColumnResult
3455: .setForeground(((JTextField) newComp)
3456: .getForeground());
3457: jLabelColumnResult
3458: .setFont(((JTextField) newComp)
3459: .getFont());
3460:
3461: // if (BandHeight < newComp.getY())
3462: // {
3463: // jLabelColumnResult.setVisible(false);
3464: // }
3465: //
3466: // this.add(jLabelColumnResult);
3467:
3468: if (BandHeight < newComp.getY()) {
3469: jLabelColumnResult = null;
3470: } else
3471: this .add(jLabelColumnResult);
3472:
3473: index = index + 1;
3474: }
3475: /******************************/
3476: } else {
3477: String fromString = dataPanel.getFromString();
3478: ComputeField cmpField = new ComputeField(
3479: newComp, fromString, dataPanel
3480: .getWhereString(), "",
3481: dataPanel.getArgsObject());
3482: String valore = cmpField.getValue();
3483:
3484: JComponent jLabelColumnResult;
3485:
3486: if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
3487: .getSize().height) {
3488: jLabelColumnResult = new JLabel();
3489: ((JLabel) jLabelColumnResult)
3490: .setText(valore);
3491: } else {
3492: jLabelColumnResult = new JTextArea();
3493: ((JTextArea) jLabelColumnResult)
3494: .setLineWrap(true);
3495: ((JTextArea) jLabelColumnResult)
3496: .setEditable(false);
3497: ((JTextArea) jLabelColumnResult)
3498: .setWrapStyleWord(true);
3499: ((JTextArea) jLabelColumnResult)
3500: .setText(valore);
3501: }
3502:
3503: jLabelColumnResult.setBounds(newComp.getX(),
3504: newComp.getY() + yHeightHeader
3505: + yTotalPosition, newComp
3506: .getSize().width, newComp
3507: .getSize().height);
3508: jLabelColumnResult
3509: .setForeground(((JTextField) newComp)
3510: .getForeground());
3511: jLabelColumnResult
3512: .setFont(((JTextField) newComp)
3513: .getFont());
3514:
3515: // if (BandHeight < newComp.getY())
3516: // {
3517: // jLabelColumnResult.setVisible(false);
3518: // }
3519: // this.add(jLabelColumnResult);
3520:
3521: if (BandHeight < newComp.getY()) {
3522: jLabelColumnResult = null;
3523: } else
3524: this .add(jLabelColumnResult);
3525: }
3526: /******************************/
3527: } else if ((newComp.getClass() == JLabel.class)) {
3528: if (((JLabel) newComp).getIcon() != null) {
3529: if (!((JLabel) newComp).getText().equals("")
3530: && ((JLabel) newComp).getText() != null) {
3531: String sValore = (String) vSummaryValues
3532: .get(index);
3533:
3534: if ((sValore == null)
3535: || (sValore
3536: .equalsIgnoreCase("true"))) {
3537: this .loadComponentOnPanel(newComp,
3538: BandHeight, yHeightHeader
3539: + yTotalPosition);
3540: }
3541:
3542: index = index + 1;
3543: } else {
3544: this .loadComponentOnPanel(newComp,
3545: BandHeight, yHeightHeader
3546: + yTotalPosition);
3547: }
3548: } else {
3549: this .loadComponentOnPanel(newComp, BandHeight,
3550: yHeightHeader + yTotalPosition);
3551: }
3552: } else if (newComp.getClass() == JPanel.class) {
3553: if (BandHeight > newComp.getY()) {
3554: this .runNestedDataPanel((JPanel) newComp,
3555: "NEW", yHeightHeader + yTotalPosition);
3556: }
3557: } else {
3558: this .loadComponentOnPanel(newComp, BandHeight,
3559: yHeightHeader + yTotalPosition);
3560: }
3561: }
3562:
3563: if (arraySummaryCompPanel.length > 0) {
3564: yTotalPosition = yTotalPosition
3565: + dataPanel.getSummaryDividerRelativeLocation();
3566: }
3567: }
3568:
3569: JPanel panelFooter = dataPanel.getFooterPanel();
3570: int BandHeight = dataPanel.getFooterDividerRelativeLocation();
3571:
3572: Component[] arrayFooterCompPanel = panelFooter.getComponents();
3573: int index = 0;
3574:
3575: for (int j = 0; j < arrayFooterCompPanel.length; j++) {
3576: JComponent jCompMove = (JComponent) arrayFooterCompPanel[j];
3577:
3578: if (jCompMove.getClass() == JTextField.class) {
3579: if (((JTextField) jCompMove).getName() == null
3580: || ((JTextField) jCompMove).getName()
3581: .equals("")) {
3582: String valore = (String) vFooterValues.get(index);
3583: JLabel jLabelColumnResult = new JLabel();
3584:
3585: /*if (valore == null)
3586: {
3587: valore = "null";
3588: }*/
3589:
3590: jLabelColumnResult.setText(valore);
3591: jLabelColumnResult.setBounds(jCompMove.getX(),
3592: jCompMove.getY() + yHeightHeader
3593: + yTotalPosition, jCompMove
3594: .getSize().width, jCompMove
3595: .getSize().height);
3596: jLabelColumnResult
3597: .setForeground(((JTextField) jCompMove)
3598: .getForeground());
3599: jLabelColumnResult.setFont(((JTextField) jCompMove)
3600: .getFont());
3601:
3602: if (BandHeight < jCompMove.getY()) {
3603: jLabelColumnResult.setVisible(false);
3604: }
3605:
3606: this .add(jLabelColumnResult);
3607:
3608: index = index + 1;
3609: /******************************/
3610: } else {
3611: String fromString = dataPanel.getFromString();
3612: ComputeField cmpField = new ComputeField(jCompMove,
3613: fromString, dataPanel.getWhereString(), "",
3614: dataPanel.getArgsObject());
3615: String valore = cmpField.getValue();
3616:
3617: JComponent jLabelColumnResult;
3618:
3619: if (((JTextField) jCompMove).getFont().getSize() + 10 >= ((JTextField) jCompMove)
3620: .getSize().height) {
3621: jLabelColumnResult = new JLabel();
3622: ((JLabel) jLabelColumnResult).setText(valore);
3623: } else {
3624: jLabelColumnResult = new JTextArea();
3625: ((JTextArea) jLabelColumnResult)
3626: .setLineWrap(true);
3627: ((JTextArea) jLabelColumnResult)
3628: .setEditable(false);
3629: ((JTextArea) jLabelColumnResult)
3630: .setWrapStyleWord(true);
3631: ((JTextArea) jLabelColumnResult)
3632: .setText(valore);
3633: }
3634:
3635: jLabelColumnResult.setBounds(jCompMove.getX(),
3636: jCompMove.getY() + yHeightHeader
3637: + yTotalPosition, jCompMove
3638: .getSize().width, jCompMove
3639: .getSize().height);
3640: jLabelColumnResult
3641: .setForeground(((JTextField) jCompMove)
3642: .getForeground());
3643: jLabelColumnResult.setFont(((JTextField) jCompMove)
3644: .getFont());
3645:
3646: // if (BandHeight < jCompMove.getY())
3647: // {
3648: // jLabelColumnResult.setVisible(false);
3649: // }
3650: //
3651: // this.add(jLabelColumnResult);
3652:
3653: if (BandHeight < jCompMove.getY()) {
3654: jLabelColumnResult = null;
3655: } else
3656: this .add(jLabelColumnResult);
3657: }
3658: /******************************/
3659: } else if ((jCompMove.getClass() == JLabel.class)) {
3660: if (((JLabel) jCompMove).getIcon() != null) {
3661: //if(((JLabel)jCompMove).getText() != "" && ((JLabel)jCompMove).getText() !=null)
3662: if (!((JLabel) jCompMove).getText().equals("")
3663: && ((JLabel) jCompMove).getText() != null) {
3664: String sValore = (String) vFooterValues
3665: .get(index);
3666:
3667: if ((sValore == null)
3668: || (sValore.equalsIgnoreCase("true"))) {
3669: this .loadComponentOnPanel(jCompMove,
3670: BandHeight, yHeightHeader
3671: + yTotalPosition);
3672: }
3673:
3674: index = index + 1;
3675: } else {
3676: this .loadComponentOnPanel(jCompMove,
3677: BandHeight, yHeightHeader
3678: + yTotalPosition);
3679: }
3680: } else {
3681: this .loadComponentOnPanel(jCompMove, BandHeight,
3682: yHeightHeader + yTotalPosition);
3683: }
3684: } else if (jCompMove.getClass() == JPanel.class) {
3685: if (BandHeight > jCompMove.getY()) {
3686: this .runNestedDataPanel((JPanel) jCompMove, "NEW",
3687: yHeightHeader + yTotalPosition);
3688: }
3689: } else {
3690: this .loadComponentOnPanel(jCompMove, BandHeight,
3691: yHeightHeader + yTotalPosition);
3692: }
3693: }
3694: if (arrayFooterCompPanel.length > 0) {
3695: yTotalPosition = yTotalPosition
3696: + dataPanel.getFooterDividerRelativeLocation();
3697: }
3698:
3699: this .setHeightDataPanel(yTotalPosition + yHeightHeader);
3700: //}
3701: }
3702:
3703: private JComponent elementaryCopyJComponent(JComponent comp) {
3704: JComponent obj = null;
3705:
3706: try {
3707: obj = (JComponent) Class.forName(comp.getClass().getName())
3708: .newInstance();
3709: } catch (ClassNotFoundException e) {
3710: System.out.println(e);
3711: } catch (InstantiationException a) {
3712: System.out.println(a);
3713: } catch (IllegalAccessException b) {
3714: System.out.println(b);
3715: }
3716:
3717: if (comp.getClass().getName() == "javax.swing.JSeparator") {
3718: ((javax.swing.JSeparator) obj)
3719: .setOrientation(((javax.swing.JSeparator) comp)
3720: .getOrientation());
3721: ((javax.swing.JSeparator) obj)
3722: .setForeground(((javax.swing.JSeparator) comp)
3723: .getForeground());
3724: }
3725:
3726: if (comp.getClass().getName() == "javax.swing.JLabel") {
3727: if (((JLabel) comp).getName() != null) {
3728: ((JLabel) obj).setName(((JLabel) comp).getName());
3729: ((JLabel) obj).setIcon(((JLabel) comp).getIcon());
3730: } else {
3731: ((JLabel) obj).setText(((JLabel) comp).getText());
3732: ((JLabel) obj).setFont(((JLabel) comp).getFont());
3733: }
3734:
3735: ((JLabel) obj).setForeground(((JLabel) comp)
3736: .getForeground());
3737: }
3738:
3739: if (comp.getClass().getName() == "javax.swing.JTextArea") {
3740: ((JTextArea) obj).setEditable(false);
3741: ((JTextArea) obj).setFont(((JTextArea) comp).getFont());
3742: ((JTextArea) obj).setForeground(((JTextArea) comp)
3743: .getForeground());
3744: ((JTextArea) obj).setBackground(((JTextArea) comp)
3745: .getBackground());
3746: ((JTextArea) obj).setLineWrap(((JTextArea) comp)
3747: .getLineWrap());
3748: ((JTextArea) obj).setText(((JTextArea) comp).getText());
3749: }
3750:
3751: return obj;
3752: }
3753:
3754: public int print(java.awt.Graphics g, java.awt.print.PageFormat pf,
3755: int pageIndex) throws java.awt.print.PrinterException {
3756: if (pageIndex != 0) {
3757: if (pagIndexPrint != pageIndex) {
3758: try {
3759: if (cursorPosition != (rowsCount - 1)) {
3760: this .nextPage();
3761: } else {
3762: this .setFormatPage(null);
3763: initVectorShapshotCP();
3764:
3765: if (this .getVectorDati() == null) {
3766: this .getResultSet().beforeFirst();
3767: }
3768:
3769: this .setCursorPosition(-1, false);
3770:
3771: this .nextPage();
3772:
3773: return java.awt.print.Printable.NO_SUCH_PAGE;
3774: }
3775:
3776: bar.setString("Page " + (pageIndex));
3777: bar.setValue(pageIndex);
3778:
3779: } catch (SQLException SQLe) {
3780: javax.swing.JOptionPane
3781: .showMessageDialog(null,
3782: "Error in the advancement of the page in phase of print!");
3783: }
3784: }
3785: }
3786:
3787: pagIndexPrint = pageIndex;
3788:
3789: java.awt.Graphics2D g2 = (java.awt.Graphics2D) g;
3790:
3791: disableDoubleBuffering(this );
3792: g2.translate(pf.getImageableX(), pf.getImageableY());
3793:
3794: double scaleX = pageFormat.getImageableWidth()
3795: / this .getWidthDataPanel();
3796: double scaleY = pageFormat.getImageableHeight()
3797: / this .getHeightDataPanel();
3798:
3799: if (scaleX < 1 || scaleY < 1) {
3800: if (true) {
3801: if (scaleX < scaleY) {
3802: scaleY = scaleX;
3803: } else {
3804: scaleX = scaleY;
3805: }
3806: }
3807:
3808: g2.scale(scaleX, scaleY);
3809: }
3810:
3811: paint(g2);
3812: enableDoubleBuffering(this );
3813:
3814: return java.awt.print.Printable.PAGE_EXISTS;
3815: }
3816:
3817: // public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex) throws java.awt.print.PrinterException
3818: // {
3819: // java.awt.Graphics2D g2 = (java.awt.Graphics2D) g;
3820: //
3821: // disableDoubleBuffering(this);
3822: // g2.translate(pf.getImageableX( ), pf.getImageableY( ));
3823: //
3824: // try
3825: // {
3826: // if (pagIndexPrint!=pageIndex)
3827: // {
3828: // subIndexPage++;
3829: // if (subIndexPage == this.getSubRightPage()-1)
3830: // {
3831: // this.nextPage();
3832: // subIndexPage = 0;
3833: // }
3834: // }else
3835: // {
3836: // if(subIndexPage!=0)
3837: // {
3838: // subIndexPage++;
3839: // }
3840: // }
3841: //
3842: // bar.setString("Page " + (pageIndex));
3843: // bar.setValue(pageIndex);
3844: //
3845: // }catch(SQLException SQLe )
3846: // {
3847: // javax.swing.JOptionPane.showMessageDialog(null,"Error in the advancement of the page in phase of print!");
3848: // }
3849: //
3850: // pagIndexPrint= pageIndex;
3851: //
3852: // //Cosi' stampa una pagina successiva di lato
3853: // if (subIndexPage != 0)
3854: // {
3855: // g2.translate(-(int)pf.getImageableWidth()*subIndexPage, 0);
3856: // g2.setClip((int)pf.getImageableWidth()*subIndexPage,0,(int)pf.getImageableWidth()*(subIndexPage+1),(int)pf.getImageableHeight());
3857: // }else
3858: // {
3859: // g2.setClip(0,0, (int)pf.getImageableWidth(),(int)pf.getImageableHeight());
3860: // subIndexPage = 0;
3861: // }
3862: //
3863: //
3864: // paint(g2);
3865: // enableDoubleBuffering(this);
3866: //
3867: // return java.awt.print.Printable.PAGE_EXISTS;
3868: // }
3869:
3870: public static void disableDoubleBuffering(Component c) {
3871: javax.swing.RepaintManager currentManager = javax.swing.RepaintManager
3872: .currentManager(c);
3873: currentManager.setDoubleBufferingEnabled(false);
3874: }
3875:
3876: public static void enableDoubleBuffering(Component c) {
3877: javax.swing.RepaintManager currentManager = javax.swing.RepaintManager
3878: .currentManager(c);
3879: currentManager.setDoubleBufferingEnabled(true);
3880: }
3881: }
|