Source Code Cross Referenced for ReportObjectSheetPanel.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » sheet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport.gui.sheet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
0003:         * http://www.jaspersoft.com.
0004:         *
0005:         * Unless you have purchased a commercial license agreement from JasperSoft,
0006:         * the following license terms apply:
0007:         *
0008:         * This program is free software; you can redistribute it and/or modify
0009:         * it under the terms of the GNU General Public License version 2 as published by
0010:         * the Free Software Foundation.
0011:         *
0012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
0013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014:         * See the 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, see http://www.gnu.org/licenses/gpl.txt
0018:         * or write to:
0019:         *
0020:         * Free Software Foundation, Inc.,
0021:         * 59 Temple Place - Suite 330,
0022:         * Boston, MA  USA  02111-1307
0023:         *
0024:         *
0025:         *
0026:         *
0027:         * ReportElementSheetPanel.java
0028:         * 
0029:         * Created on 16 febbraio 2005, 6.57
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport.gui.sheet;
0034:
0035:        import it.businesslogic.ireport.*;
0036:        import it.businesslogic.ireport.gui.*;
0037:        import it.businesslogic.ireport.gui.JNumberField;
0038:        import it.businesslogic.ireport.gui.event.*;
0039:        import it.businesslogic.ireport.refactoring.ReportRefactor;
0040:        import it.businesslogic.ireport.util.*;
0041:        import it.businesslogic.ireport.util.LanguageChangedEvent;
0042:        import it.businesslogic.ireport.util.LanguageChangedListener;
0043:        import java.awt.Color;
0044:        import java.util.*;
0045:        import javax.swing.JCheckBox;
0046:        import javax.swing.JComboBox;
0047:        import javax.swing.JComponent;
0048:
0049:        /**
0050:         *
0051:         * @author  Administrator
0052:         */
0053:        public class ReportObjectSheetPanel extends CategorySheetPanel
0054:                implements  ReportListener, LanguageChangedListener,
0055:                ReportFrameActivatedListener {
0056:
0057:            private SheetProperty spParameterName;
0058:            private SheetProperty spParameterDescription;
0059:            private ExpressionSheetProperty spParameterDefaultValueExpression;
0060:            private PropertiesSheetProperty spParameterProperties;
0061:            private SheetProperty spParameterClassType;
0062:            private SheetProperty spParameterIsForPrompting;
0063:
0064:            private SheetProperty spFieldName;
0065:            private SheetProperty spFieldDescription;
0066:            private PropertiesSheetProperty spFieldProperties;
0067:            private SheetProperty spFieldClassType;
0068:
0069:            private SheetProperty spVariableName;
0070:            private SheetProperty spVariableClassType;
0071:            private SheetProperty spVariableCalculationType;
0072:            private SheetProperty spVariableResetType;
0073:            private ComboBoxSheetProperty spVariableResetGroup;
0074:            private SheetProperty spVariableIncrementType;
0075:            private ComboBoxSheetProperty spVariableIncrementGroup;
0076:            private SheetProperty spVariableIncrementerClass;
0077:            private ExpressionSheetProperty spVariableExpression;
0078:            private ExpressionSheetProperty spVariableInitialValueExpression;
0079:
0080:            public static java.awt.Color sharedDifferentValueLabelColor = java.awt.Color.red
0081:                    .darker().darker();
0082:            public static java.awt.Color mandatoryPropertiesLabelColor = java.awt.Color.black;
0083:            //public  static java.awt.Color notMandatoryPropertiesLabelColor = java.awt.Color.black;
0084:
0085:            private JReportFrame jrf = null;
0086:
0087:            private boolean init = false;
0088:
0089:            private Vector objectSelection = new Vector();
0090:
0091:            /** Creates a new instance of ReportElementSheetPanel */
0092:            public ReportObjectSheetPanel() {
0093:                super ();
0094:                this .setBackground(Color.BLUE);
0095:                initSheetProperties();
0096:                // We have to register for element changes...
0097:                MainFrame mf = MainFrame.getMainInstance();
0098:                mf.addReportListener(this );
0099:                mf.addReportFrameActivatedListener(this );
0100:                I18n.addOnLanguageChangedListener(this );
0101:            }
0102:
0103:            public void reportFrameActivated(ReportFrameActivatedEvent evt) {
0104:
0105:                if (MainFrame.getMainInstance().getActiveReportFrame() == this 
0106:                        .getJrf())
0107:                    return;
0108:                updateSelection(MainFrame.getMainInstance()
0109:                        .getActiveReportFrame());
0110:
0111:            }
0112:
0113:            public void languageChanged(LanguageChangedEvent evt) {
0114:                this .removeAllProperties();
0115:                initSheetProperties();
0116:                updateSelection();
0117:            }
0118:
0119:            public void updateSelection() {
0120:                JReportFrame newJrf = MainFrame.getMainInstance()
0121:                        .getActiveReportFrame();
0122:                updateSelection(newJrf);
0123:            }
0124:
0125:            /**
0126:             * Update all the element properties...
0127:             * 
0128:             */
0129:            public void updateSelection(JReportFrame newJrf) {
0130:
0131:                // Improving speed...
0132:                // Do nothing if there are elements selected...
0133:                if (newJrf != null && newJrf.getSelectedElements().size() > 0)
0134:                    return;
0135:
0136:                // Fix for numbers focus losing...
0137:                if (newJrf == null) {
0138:                    this .setSelection(new Vector());
0139:                } else {
0140:                    this .setSelection(newJrf.getSelectedObjects());
0141:                }
0142:
0143:                setInit(true);
0144:
0145:                this .removeAllProperties();
0146:
0147:                this .jrf = newJrf;
0148:
0149:                if (jrf == null || getSelection().size() == 0) {
0150:                    this .recreateSheet();
0151:                    return;
0152:                }
0153:
0154:                try {
0155:                    Vector selectedElements = getSelection();
0156:
0157:                    boolean sameParameterDescription = true;
0158:                    boolean sameParameterDefaultValueExpression = true;
0159:                    boolean sameParameterClassType = true;
0160:                    boolean sameParameterIsForPrompting = true;
0161:
0162:                    boolean sameFieldDescription = true;
0163:                    boolean sameFieldClassType = true;
0164:
0165:                    boolean sameVariableResetType = true;
0166:                    boolean sameVariableResetGroup = true;
0167:                    boolean sameVariableCalculationType = true;
0168:                    boolean sameVariableClassType = true;
0169:                    boolean sameVariableExpression = true;
0170:                    boolean sameVariableInitialValueExpression = true;
0171:                    boolean sameVariableIncrementGroup = true;
0172:                    boolean sameVariableIncrementType = true;
0173:                    boolean sameVariableIncrementerClass = true;
0174:
0175:                    boolean areAllparameters = true;
0176:                    boolean areAllfields = true;
0177:                    boolean areAllvariables = true;
0178:                    boolean isTheFirstElement = true;
0179:
0180:                    boolean areBuiltInParameters = false; // True if one ore more parameter is builtin...
0181:                    boolean areBuiltInVariables = false; // True if one ore more parameter is builtin...
0182:
0183:                    SubDataset subdataset = null;
0184:
0185:                    for (int i = 0; i < selectedElements.size(); ++i) {
0186:                        Object obj = selectedElements.elementAt(i);
0187:
0188:                        if (!(obj instanceof  JRParameter)) {
0189:                            areAllparameters = false;
0190:                        }
0191:
0192:                        if (!(obj instanceof  JRField)) {
0193:                            areAllfields = false;
0194:                        }
0195:
0196:                        if (!(obj instanceof  JRVariable)) {
0197:                            areAllvariables = false;
0198:                        }
0199:
0200:                        if (isTheFirstElement) {
0201:                            subdataset = Misc.getObjectSubDataset(jrf
0202:                                    .getReport(), obj);
0203:                            updateAllComboBoxes(subdataset);
0204:                        } else if (subdataset != null) {
0205:                            SubDataset s2 = Misc.getObjectSubDataset(
0206:                                    subdataset, obj);
0207:                            if (s2 != subdataset) {
0208:                                subdataset = null;
0209:                            }
0210:                        }
0211:
0212:                        if (areAllparameters) {
0213:                            JRParameter param = (JRParameter) selectedElements
0214:                                    .elementAt(i);
0215:
0216:                            if (!areBuiltInParameters) {
0217:                                areBuiltInParameters = param.isBuiltin();
0218:                            }
0219:
0220:                            if (selectedElements.size() == 1) {
0221:                                // Single parameter selectes...
0222:                                setTextArea(isTheFirstElement, param.getName(),
0223:                                        spParameterName);
0224:                                spParameterProperties.setValue(param
0225:                                        .getProperties());
0226:                            }
0227:                            if (sameParameterDescription)
0228:                                sameParameterDescription = setTextArea(
0229:                                        isTheFirstElement, param
0230:                                                .getDescription(),
0231:                                        spParameterDescription);
0232:                            if (sameParameterDefaultValueExpression)
0233:                                sameParameterDefaultValueExpression = setTextArea(
0234:                                        isTheFirstElement, param
0235:                                                .getDefaultValueExpression(),
0236:                                        spParameterDefaultValueExpression);
0237:                            if (sameParameterClassType)
0238:                                sameParameterClassType = setGenericSheetProperty(
0239:                                        isTheFirstElement,
0240:                                        param.getClassType(),
0241:                                        spParameterClassType);
0242:                            if (sameParameterIsForPrompting)
0243:                                sameParameterIsForPrompting = this .setCheckBox(
0244:                                        isTheFirstElement, param
0245:                                                .isIsForPrompting(), false,
0246:                                        spParameterIsForPrompting);
0247:
0248:                        }
0249:
0250:                        if (areAllfields) {
0251:                            JRField field = (JRField) selectedElements
0252:                                    .elementAt(i);
0253:
0254:                            if (selectedElements.size() == 1) {
0255:                                // Single parameter selectes...
0256:                                setTextArea(isTheFirstElement, field.getName(),
0257:                                        spFieldName);
0258:                                spFieldProperties.setValue(field
0259:                                        .getProperties());
0260:                            }
0261:                            if (sameFieldDescription)
0262:                                sameFieldDescription = setTextArea(
0263:                                        isTheFirstElement, field
0264:                                                .getDescription(),
0265:                                        spFieldDescription);
0266:                            if (sameFieldClassType)
0267:                                sameFieldClassType = setGenericSheetProperty(
0268:                                        isTheFirstElement,
0269:                                        field.getClassType(), spFieldClassType);
0270:                        }
0271:
0272:                        if (areAllvariables) {
0273:                            JRVariable variable = (JRVariable) selectedElements
0274:                                    .elementAt(i);
0275:
0276:                            if (!areBuiltInVariables) {
0277:                                areBuiltInVariables = variable.isBuiltin();
0278:                            }
0279:
0280:                            if (selectedElements.size() == 1) {
0281:                                // Single parameter selectes...
0282:                                setTextArea(isTheFirstElement, variable
0283:                                        .getName(), spVariableName);
0284:                            }
0285:
0286:                            if (subdataset != null) {
0287:                                if (sameVariableResetType)
0288:                                    sameVariableResetType = setTagComboBox(
0289:                                            isTheFirstElement, variable
0290:                                                    .getResetType(),
0291:                                            spVariableResetType);
0292:                                if (sameVariableResetGroup)
0293:                                    sameVariableResetGroup = setTagComboBox(
0294:                                            isTheFirstElement, variable
0295:                                                    .getResetGroup(),
0296:                                            spVariableResetGroup);
0297:                                if (sameVariableIncrementType)
0298:                                    sameVariableIncrementType = setTagComboBox(
0299:                                            isTheFirstElement, variable
0300:                                                    .getIncrementType(),
0301:                                            spVariableIncrementType);
0302:                                if (sameVariableIncrementGroup)
0303:                                    sameVariableIncrementGroup = setTagComboBox(
0304:                                            isTheFirstElement, variable
0305:                                                    .getIncrementGroup(),
0306:                                            spVariableIncrementGroup);
0307:                            }
0308:
0309:                            if (sameVariableCalculationType)
0310:                                sameVariableCalculationType = setTagComboBox(
0311:                                        isTheFirstElement, variable
0312:                                                .getCalculation(),
0313:                                        spVariableCalculationType);
0314:                            if (sameVariableIncrementerClass)
0315:                                sameVariableIncrementerClass = setTextArea(
0316:                                        isTheFirstElement, variable
0317:                                                .getIncrementerFactoryClass(),
0318:                                        spVariableIncrementerClass);
0319:                            if (sameVariableClassType)
0320:                                sameVariableClassType = setGenericSheetProperty(
0321:                                        isTheFirstElement, variable
0322:                                                .getClassType(),
0323:                                        spVariableClassType);
0324:                            if (sameVariableExpression)
0325:                                sameVariableExpression = setTextArea(
0326:                                        isTheFirstElement, variable
0327:                                                .getExpression(),
0328:                                        spVariableExpression);
0329:                            if (sameVariableInitialValueExpression)
0330:                                sameVariableInitialValueExpression = setTextArea(
0331:                                        isTheFirstElement, variable
0332:                                                .getInitialValueExpression(),
0333:                                        spVariableInitialValueExpression);
0334:                        }
0335:
0336:                        isTheFirstElement = false;
0337:                    }
0338:
0339:                    // TO DO: change this!
0340:
0341:                    // get the common subdataset...
0342:                    if (subdataset != null) {
0343:                        ExpressionContext ec = new ExpressionContext();
0344:                        ec.setSubDataset(subdataset);
0345:                        spParameterDefaultValueExpression
0346:                                .setExpressionContext(ec);
0347:                        spVariableExpression.setExpressionContext(ec);
0348:                        spVariableInitialValueExpression
0349:                                .setExpressionContext(ec);
0350:                    }
0351:
0352:                    spParameterDefaultValueExpression.setLabelError(null);
0353:                    spParameterDefaultValueExpression.updateLabel();
0354:
0355:                    spVariableExpression.setLabelError(null);
0356:                    spVariableExpression.updateLabel();
0357:
0358:                    spVariableInitialValueExpression.setLabelError(null);
0359:                    spVariableInitialValueExpression.updateLabel();
0360:
0361:                    if (areAllparameters) {
0362:
0363:                        String commonStr = it.businesslogic.ireport.util.I18n
0364:                                .getString("parameterProperties",
0365:                                        "Parameter Properties");
0366:                        if (getSelection().size() == 1)
0367:                            this .addSheetProperty(commonStr, spParameterName);
0368:                        spParameterIsForPrompting.setDefaultValue(new Boolean(
0369:                                true));
0370:                        this .addSheetProperty(commonStr, spParameterClassType);
0371:                        spParameterClassType
0372:                                .setLabelColor((sameParameterClassType) ? mandatoryPropertiesLabelColor
0373:                                        : sharedDifferentValueLabelColor);
0374:
0375:                        if (!areBuiltInParameters) {
0376:                            spParameterName.setReadOnly(false);
0377:                            spParameterClassType.setReadOnly(false);
0378:                            spParameterIsForPrompting
0379:                                    .setLabelColor((sameParameterIsForPrompting) ? mandatoryPropertiesLabelColor
0380:                                            : sharedDifferentValueLabelColor);
0381:                            this .addSheetProperty(commonStr,
0382:                                    spParameterIsForPrompting);
0383:                            spParameterDefaultValueExpression
0384:                                    .setLabelColor((sameParameterDefaultValueExpression) ? mandatoryPropertiesLabelColor
0385:                                            : sharedDifferentValueLabelColor);
0386:                            this .addSheetProperty(commonStr,
0387:                                    spParameterDefaultValueExpression);
0388:                            if (getSelection().size() == 1)
0389:                                this .addSheetProperty(commonStr,
0390:                                        spParameterProperties);
0391:                        } else {
0392:                            spParameterName.setReadOnly(true);
0393:                            spParameterClassType.setReadOnly(true);
0394:                        }
0395:
0396:                    } else if (areAllfields) {
0397:                        String commonStr = it.businesslogic.ireport.util.I18n
0398:                                .getString("fieldProperties",
0399:                                        "Field Properties");
0400:                        if (getSelection().size() == 1)
0401:                            this .addSheetProperty(commonStr, spFieldName);
0402:                        spFieldClassType
0403:                                .setLabelColor((sameFieldClassType) ? mandatoryPropertiesLabelColor
0404:                                        : sharedDifferentValueLabelColor);
0405:                        this .addSheetProperty(commonStr, spFieldClassType);
0406:                        spFieldDescription
0407:                                .setLabelColor((sameFieldDescription) ? mandatoryPropertiesLabelColor
0408:                                        : sharedDifferentValueLabelColor);
0409:                        this .addSheetProperty(commonStr, spFieldDescription);
0410:                        if (getSelection().size() == 1)
0411:                            this .addSheetProperty(commonStr, spFieldProperties);
0412:
0413:                    } else if (areAllvariables) {
0414:                        String commonStr = it.businesslogic.ireport.util.I18n
0415:                                .getString("variableProperties",
0416:                                        "Variable Properties");
0417:                        if (getSelection().size() == 1)
0418:                            this .addSheetProperty(commonStr, spVariableName);
0419:
0420:                        spVariableClassType
0421:                                .setLabelColor((sameVariableClassType) ? mandatoryPropertiesLabelColor
0422:                                        : sharedDifferentValueLabelColor);
0423:                        this .addSheetProperty(commonStr, spVariableClassType);
0424:
0425:                        if (!areBuiltInVariables) {
0426:                            spVariableName.setReadOnly(false);
0427:                            spVariableClassType.setReadOnly(false);
0428:
0429:                            spVariableCalculationType
0430:                                    .setLabelColor((sameVariableCalculationType) ? mandatoryPropertiesLabelColor
0431:                                            : sharedDifferentValueLabelColor);
0432:                            this .addSheetProperty(commonStr,
0433:                                    spVariableCalculationType);
0434:
0435:                            if (subdataset != null) {
0436:                                spVariableResetType
0437:                                        .setLabelColor((sameVariableResetType) ? mandatoryPropertiesLabelColor
0438:                                                : sharedDifferentValueLabelColor);
0439:                                this .addSheetProperty(commonStr,
0440:                                        spVariableResetType);
0441:                                spVariableResetGroup
0442:                                        .setLabelColor((sameVariableResetGroup) ? mandatoryPropertiesLabelColor
0443:                                                : sharedDifferentValueLabelColor);
0444:                                this .addSheetProperty(commonStr,
0445:                                        spVariableResetGroup);
0446:                                spVariableIncrementType
0447:                                        .setLabelColor((sameVariableIncrementType) ? mandatoryPropertiesLabelColor
0448:                                                : sharedDifferentValueLabelColor);
0449:                                this .addSheetProperty(commonStr,
0450:                                        spVariableIncrementType);
0451:                                spVariableIncrementGroup
0452:                                        .setLabelColor((sameVariableIncrementGroup) ? mandatoryPropertiesLabelColor
0453:                                                : sharedDifferentValueLabelColor);
0454:                                this .addSheetProperty(commonStr,
0455:                                        spVariableIncrementGroup);
0456:
0457:                                if (!sameVariableResetType
0458:                                        || !spVariableResetType.getValue()
0459:                                                .equals("Group")) {
0460:                                    spVariableResetGroup.setReadOnly(true);
0461:                                } else {
0462:                                    spVariableResetGroup.setReadOnly(false);
0463:                                }
0464:
0465:                                if (!sameVariableIncrementType
0466:                                        || !spVariableIncrementType.getValue()
0467:                                                .equals("Group")) {
0468:                                    spVariableIncrementGroup.setReadOnly(true);
0469:                                } else {
0470:                                    spVariableIncrementGroup.setReadOnly(false);
0471:                                }
0472:                            }
0473:                            spVariableIncrementerClass
0474:                                    .setLabelColor((sameVariableIncrementerClass) ? mandatoryPropertiesLabelColor
0475:                                            : sharedDifferentValueLabelColor);
0476:                            this .addSheetProperty(commonStr,
0477:                                    spVariableIncrementerClass);
0478:                            spVariableExpression
0479:                                    .setLabelColor((sameVariableExpression) ? mandatoryPropertiesLabelColor
0480:                                            : sharedDifferentValueLabelColor);
0481:                            this .addSheetProperty(commonStr,
0482:                                    spVariableExpression);
0483:                            spVariableInitialValueExpression
0484:                                    .setLabelColor((sameVariableInitialValueExpression) ? mandatoryPropertiesLabelColor
0485:                                            : sharedDifferentValueLabelColor);
0486:                            this .addSheetProperty(commonStr,
0487:                                    spVariableInitialValueExpression);
0488:
0489:                        } else {
0490:                            spVariableName.setReadOnly(true);
0491:                            spVariableClassType.setReadOnly(true);
0492:                        }
0493:                    }
0494:
0495:                    this .recreateSheet();
0496:
0497:                } catch (Exception ex) {
0498:                    ex.printStackTrace();
0499:                }
0500:
0501:                finally {
0502:
0503:                }
0504:
0505:                setInit(false);
0506:            }
0507:
0508:            /**
0509:             * This methos is called when a property changes...
0510:             */
0511:            public void sheetPropertyValueChanged(
0512:                    SheetPropertyValueChangedEvent evt) {
0513:                if (isInit())
0514:                    return;
0515:
0516:                try {
0517:                    setInit(true);
0518:                    //System.out.println("Changed: " + evt.getPropertyName());
0519:                    //if (isNullItem((SheetProperty)evt.getSource())) return;
0520:
0521:                    //removeNullItem( (SheetProperty)evt.getSource() );
0522:
0523:                    Vector selectedElements = getSelection();
0524:
0525:                    Vector modified_parameters = new Vector();
0526:                    Vector original_parameters = new Vector();
0527:
0528:                    Vector modified_fields = new Vector();
0529:                    Vector original_fields = new Vector();
0530:
0531:                    Vector modified_variables = new Vector();
0532:                    Vector original_variables = new Vector();
0533:
0534:                    for (int i = 0; i < selectedElements.size(); ++i) {
0535:
0536:                        Object object = selectedElements.elementAt(i);
0537:
0538:                        if (object instanceof  JRParameter) {
0539:                            JRParameter param = (JRParameter) object;
0540:                            if (param.isBuiltin())
0541:                                continue;
0542:                            JRParameter originalParam = param.cloneMe();
0543:                            if (applyNewParameterProperty(param, evt
0544:                                    .getPropertyName(), evt.getOldValue(), evt
0545:                                    .getNewValue())) {
0546:                                modified_parameters.add(object);
0547:                                original_parameters.add(originalParam);
0548:                            }
0549:                        } else if (object instanceof  JRField) {
0550:                            JRField field = (JRField) object;
0551:                            JRField originalField = field.cloneMe();
0552:                            if (applyNewFieldProperty(field, evt
0553:                                    .getPropertyName(), evt.getOldValue(), evt
0554:                                    .getNewValue())) {
0555:                                modified_fields.add(object);
0556:                                original_fields.add(originalField);
0557:                            }
0558:                        } else if (object instanceof  JRVariable) {
0559:                            JRVariable variable = (JRVariable) object;
0560:                            JRVariable originalVariable = variable.cloneMe();
0561:                            if (applyNewVariableProperty(variable, evt
0562:                                    .getPropertyName(), evt.getOldValue(), evt
0563:                                    .getNewValue())) {
0564:                                modified_variables.add(object);
0565:                                original_variables.add(originalVariable);
0566:                            }
0567:                        }
0568:
0569:                        // don't listen to these events...
0570:
0571:                        for (int k = 0; k < modified_parameters.size(); ++k) {
0572:                            JRParameter param = (JRParameter) modified_parameters
0573:                                    .get(k);
0574:                            JRParameter oldParam = (JRParameter) original_parameters
0575:                                    .get(k);
0576:                            SubDataset sd = Misc.getObjectSubDataset(getJrf()
0577:                                    .getReport(), param);
0578:                            sd
0579:                                    .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
0580:                                            sd,
0581:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.PARAMETER,
0582:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
0583:                                            oldParam, param));
0584:                        }
0585:
0586:                        for (int k = 0; k < modified_fields.size(); ++k) {
0587:                            JRField field = (JRField) modified_fields.get(k);
0588:                            JRField oldField = (JRField) original_fields.get(k);
0589:                            SubDataset sd = Misc.getObjectSubDataset(getJrf()
0590:                                    .getReport(), field);
0591:                            sd
0592:                                    .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
0593:                                            sd,
0594:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.FIELD,
0595:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
0596:                                            oldField, field));
0597:                        }
0598:
0599:                        for (int k = 0; k < modified_variables.size(); ++k) {
0600:                            JRVariable variable = (JRVariable) modified_variables
0601:                                    .get(k);
0602:                            JRVariable oldVariable = (JRVariable) original_variables
0603:                                    .get(k);
0604:                            SubDataset sd = Misc.getObjectSubDataset(getJrf()
0605:                                    .getReport(), variable);
0606:                            sd
0607:                                    .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
0608:                                            sd,
0609:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.VARIABLE,
0610:                                            it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
0611:                                            oldVariable, variable));
0612:                        }
0613:
0614:                    }
0615:
0616:                    getJrf().getReport().incrementReportChanges();
0617:
0618:                } finally {
0619:                    setInit(false);
0620:
0621:                }
0622:
0623:            }
0624:
0625:            /*
0626:             * This method apply the new value for the specified property
0627:             * The oldValue can be wrong or null if a multiselection was performed
0628:             * return true if the object is modified...
0629:             */
0630:            private boolean applyNewParameterProperty(JRParameter param,
0631:                    String propertyName, Object oldValue, Object newValue) {
0632:                if (propertyName == null)
0633:                    return false;
0634:
0635:                boolean objectModified = true;
0636:
0637:                if (propertyName.equals("parameterName")) {
0638:                    SubDataset paramSubdataset = Misc.getObjectSubDataset(
0639:                            getJrf().getReport(), param);
0640:                    if (paramSubdataset != null && newValue != null) {
0641:                        for (int i = 0; i < paramSubdataset.getParameters()
0642:                                .size(); ++i) {
0643:                            JRParameter f = (JRParameter) paramSubdataset
0644:                                    .getParameters().get(i);
0645:                            if (f.getName().equals(newValue)) {
0646:                                ((SheetProperty) this 
0647:                                        .getSheetProperty(propertyName))
0648:                                        .setLabelError(I18n
0649:                                                .getString(
0650:                                                        "messages.jRParameterDialog.DuplicatedParameterName",
0651:                                                        "A parameter with this name already exists!"));
0652:                                ((SheetProperty) this 
0653:                                        .getSheetProperty(propertyName))
0654:                                        .updateLabel();
0655:                                return false;
0656:                            }
0657:                        }
0658:
0659:                        param.setName("" + newValue);
0660:                        ((SheetProperty) this .getSheetProperty(propertyName))
0661:                                .setLabelError(null);
0662:                        ((SheetProperty) this .getSheetProperty(propertyName))
0663:                                .updateLabel();
0664:                    }
0665:                } else if (propertyName.equals("parameterIsForPrompting")) {
0666:                    param
0667:                            .setIsForPrompting(((Boolean) newValue)
0668:                                    .booleanValue());
0669:                } else if (propertyName.equals("parameterDescription")) {
0670:                    if (newValue != null) {
0671:                        param.setDescription("" + newValue);
0672:                    }
0673:                } else if (propertyName.equals("parameterProperties")) {
0674:                    if (newValue != null && newValue instanceof  List) {
0675:                        param.setProperties((List) newValue);
0676:                    }
0677:                } else if (propertyName.equals("parameterClassType")) {
0678:                    if (newValue != null) {
0679:                        param.setClassType("" + newValue);
0680:                    }
0681:                } else if (propertyName
0682:                        .equals("parameterDefaultValueExpression")) {
0683:                    if (newValue != null) {
0684:                        param.setDefaultValueExpression("" + newValue);
0685:                    }
0686:                    ((SheetProperty) this .getSheetProperty(propertyName))
0687:                            .setLabelError(null);
0688:                    ((SheetProperty) this .getSheetProperty(propertyName))
0689:                            .updateLabel();
0690:                }
0691:
0692:                return objectModified;
0693:            }
0694:
0695:            /*
0696:             * This method apply the new value for the specified property
0697:             * The oldValue can be wrong or null if a multiselection was performed
0698:             * return true if the object is modified...
0699:             */
0700:            private boolean applyNewFieldProperty(JRField field,
0701:                    String propertyName, Object oldValue, Object newValue) {
0702:                if (propertyName == null)
0703:                    return false;
0704:
0705:                boolean objectModified = true;
0706:
0707:                if (propertyName.equals("fieldName")) {
0708:                    SubDataset paramSubdataset = Misc.getObjectSubDataset(
0709:                            getJrf().getReport(), field);
0710:                    if (paramSubdataset != null && newValue != null) {
0711:                        for (int i = 0; i < paramSubdataset.getFields().size(); ++i) {
0712:                            JRField f = (JRField) paramSubdataset.getFields()
0713:                                    .get(i);
0714:                            if (f.getName().equals(newValue)) {
0715:                                ((SheetProperty) this 
0716:                                        .getSheetProperty(propertyName))
0717:                                        .setLabelError(I18n
0718:                                                .getString(
0719:                                                        "messages.JRFieldDialog.DuplicatedFieldName",
0720:                                                        "A field with this name already exists!"));
0721:                                ((SheetProperty) this 
0722:                                        .getSheetProperty(propertyName))
0723:                                        .updateLabel();
0724:                                return false;
0725:                            }
0726:                        }
0727:
0728:                        field.setName("" + newValue);
0729:                        ((SheetProperty) this .getSheetProperty(propertyName))
0730:                                .setLabelError(null);
0731:                        ((SheetProperty) this .getSheetProperty(propertyName))
0732:                                .updateLabel();
0733:                    }
0734:                } else if (propertyName.equals("fieldDescription")) {
0735:                    if (newValue != null) {
0736:                        field.setDescription("" + newValue);
0737:                    }
0738:                } else if (propertyName.equals("fieldProperties")) {
0739:                    if (newValue != null && newValue instanceof  List) {
0740:                        field.setProperties((List) newValue);
0741:                    }
0742:                } else if (propertyName.equals("fieldClassType")) {
0743:                    if (newValue != null) {
0744:                        field.setClassType("" + newValue);
0745:                    }
0746:                }
0747:
0748:                return objectModified;
0749:            }
0750:
0751:            /*
0752:             * This method apply the new value for the specified property
0753:             * The oldValue can be wrong or null if a multiselection was performed
0754:             * return true if the object is modified...
0755:             */
0756:            private boolean applyNewVariableProperty(JRVariable variable,
0757:                    String propertyName, Object oldValue, Object newValue) {
0758:                if (propertyName == null)
0759:                    return false;
0760:
0761:                boolean objectModified = true;
0762:
0763:                if (propertyName.equals("variableName")) {
0764:                    SubDataset paramSubdataset = Misc.getObjectSubDataset(
0765:                            getJrf().getReport(), variable);
0766:                    if (paramSubdataset != null && newValue != null) {
0767:                        for (int i = 0; i < paramSubdataset.getVariables()
0768:                                .size(); ++i) {
0769:                            JRVariable f = (JRVariable) paramSubdataset
0770:                                    .getVariables().get(i);
0771:                            if (f.getName().equals(newValue)) {
0772:                                ((SheetProperty) this 
0773:                                        .getSheetProperty(propertyName))
0774:                                        .setLabelError(I18n
0775:                                                .getString(
0776:                                                        "messages.JRVariableDialog.DuplicatedVariableName",
0777:                                                        "A variable with this name already exists!"));
0778:                                ((SheetProperty) this 
0779:                                        .getSheetProperty(propertyName))
0780:                                        .updateLabel();
0781:                                return false;
0782:                            }
0783:                        }
0784:
0785:                        variable.setName("" + newValue);
0786:                        ((SheetProperty) this .getSheetProperty(propertyName))
0787:                                .setLabelError(null);
0788:                        ((SheetProperty) this .getSheetProperty(propertyName))
0789:                                .updateLabel();
0790:                    }
0791:                } else if (propertyName.equals("variableClassType")) {
0792:                    if (newValue != null) {
0793:                        variable.setClassType("" + newValue);
0794:                    }
0795:                } else if (propertyName.equals("variableCalculationType")) {
0796:                    if (newValue != null) {
0797:                        variable.setCalculation("" + newValue);
0798:                    }
0799:                } else if (propertyName.equals("variableResetType")) {
0800:                    if (newValue != null) {
0801:                        variable.setResetType("" + newValue);
0802:                    }
0803:                    if (newValue != null && newValue.equals("Group")) {
0804:                        spVariableResetGroup.setReadOnly(false);
0805:                        variable.setResetGroup(spVariableResetGroup.getValue()
0806:                                + "");
0807:                    } else {
0808:                        spVariableResetGroup.setReadOnly(true);
0809:                        variable.setResetGroup("");
0810:                    }
0811:                    spVariableResetGroup.updateLabel();
0812:                } else if (propertyName.equals("variableResetGroup")) {
0813:                    variable.setResetGroup((newValue == null) ? "" : ""
0814:                            + newValue);
0815:                } else if (propertyName.equals("variableIncrementType")) {
0816:                    if (newValue != null) {
0817:                        variable.setIncrementType("" + newValue);
0818:                    }
0819:                    if (newValue != null && newValue.equals("Group")) {
0820:                        spVariableIncrementGroup.setReadOnly(false);
0821:                        variable.setResetGroup(spVariableIncrementGroup
0822:                                .getValue()
0823:                                + "");
0824:                    } else {
0825:                        spVariableIncrementGroup.setReadOnly(true);
0826:                        variable.setIncrementGroup("");
0827:                    }
0828:                    spVariableIncrementGroup.updateLabel();
0829:                } else if (propertyName.equals("variableIncrementGroup")) {
0830:                    variable.setIncrementGroup((newValue == null) ? "" : ""
0831:                            + newValue);
0832:                } else if (propertyName.equals("variableIncrementerClass")) {
0833:                    variable.setIncrementerFactoryClass((newValue == null) ? ""
0834:                            : "" + newValue);
0835:                } else if (propertyName.equals("variableExpression")) {
0836:                    if (newValue != null) {
0837:                        variable.setExpression("" + newValue);
0838:                    }
0839:                    ((SheetProperty) this .getSheetProperty(propertyName))
0840:                            .setLabelError(null);
0841:                    ((SheetProperty) this .getSheetProperty(propertyName))
0842:                            .updateLabel();
0843:                } else if (propertyName
0844:                        .equals("variableInitialValueExpression")) {
0845:                    if (newValue != null) {
0846:                        variable.setInitialValueExpression("" + newValue);
0847:                    }
0848:                    ((SheetProperty) this .getSheetProperty(propertyName))
0849:                            .setLabelError(null);
0850:                    ((SheetProperty) this .getSheetProperty(propertyName))
0851:                            .updateLabel();
0852:                }
0853:
0854:                return objectModified;
0855:            }
0856:
0857:            /*
0858:             *     This method is called when a band is removed, changed or added.
0859:             */
0860:            public void reportBandChanged(ReportBandChangedEvent evt) {
0861:            }
0862:
0863:            protected void initSheetProperties() {
0864:                spParameterName = new SheetProperty("parameterName", I18n
0865:                        .getString("crosstabParameterDialog.label1",
0866:                                "Parameter name"), SheetProperty.TEXT);
0867:                spParameterName.setShowResetButton(false);
0868:
0869:                spParameterDescription = new SheetProperty(
0870:                        "parameterDescription", I18n.getString(
0871:                                "jRParameterDialog.label4",
0872:                                "Parameter Description"), SheetProperty.TEXT);
0873:                spParameterDescription.setShowResetButton(false);
0874:
0875:                spParameterDefaultValueExpression = new ExpressionSheetProperty(
0876:                        "parameterDefaultValueExpression",
0877:                        it.businesslogic.ireport.util.I18n.getString(
0878:                                "jRParameterDialog.label3",
0879:                                "Default Value Expression"));
0880:                spParameterDefaultValueExpression.setShowResetButton(false);
0881:
0882:                spParameterProperties = new PropertiesSheetProperty(
0883:                        "parameterProperties",
0884:                        it.businesslogic.ireport.util.I18n.getString(
0885:                                "parameterProperties", "Parameter Properties"));
0886:                spParameterProperties.setShowResetButton(false);
0887:
0888:                spParameterClassType = new ComboBoxSheetProperty(
0889:                        "parameterClassType",
0890:                        it.businesslogic.ireport.util.I18n.getString(
0891:                                "jRParameterDialog.label2",
0892:                                "Parameter Class Type"));
0893:                spParameterClassType.setShowResetButton(false);
0894:                JComboBox classTypeCombo = (JComboBox) spParameterClassType
0895:                        .getEditor();
0896:
0897:                classTypeCombo.setEditable(true);
0898:
0899:                classTypeCombo.addItem("java.lang.Boolean");
0900:                classTypeCombo.addItem("java.lang.Byte");
0901:                classTypeCombo.addItem("java.util.Date");
0902:                classTypeCombo.addItem("java.sql.Timestamp");
0903:                classTypeCombo.addItem("java.sql.Time");
0904:                classTypeCombo.addItem("java.lang.Double");
0905:                classTypeCombo.addItem("java.lang.Float");
0906:                classTypeCombo.addItem("java.lang.Integer");
0907:                classTypeCombo.addItem("java.lang.Long");
0908:                classTypeCombo.addItem("java.lang.Short");
0909:                classTypeCombo.addItem("java.math.BigDecimal");
0910:                classTypeCombo.addItem("java.lang.Number");
0911:                classTypeCombo.addItem("java.lang.String");
0912:                classTypeCombo.addItem("java.util.Collection");
0913:                classTypeCombo.addItem("java.util.List");
0914:                classTypeCombo.addItem("java.lang.Object");
0915:                classTypeCombo.addItem("java.io.InputStream");
0916:                classTypeCombo
0917:                        .addItem("net.sf.jasperreports.engine.JREmptyDataSource");
0918:
0919:                spParameterIsForPrompting = new SheetProperty(
0920:                        "parameterIsForPrompting",
0921:                        it.businesslogic.ireport.util.I18n.getString(
0922:                                "jRParameterDialog.checkBoxIsForPrompting",
0923:                                "Use as a Prompt"), SheetProperty.BOOLEAN);
0924:                spParameterIsForPrompting.setShowResetButton(false);
0925:
0926:                spFieldName = new SheetProperty("fieldName", I18n.getString(
0927:                        "jRFieldDialog.label1", "Field name"),
0928:                        SheetProperty.TEXT);
0929:                spFieldName.setShowResetButton(false);
0930:
0931:                spFieldDescription = new SheetProperty("fieldDescription",
0932:                        I18n.getString("jRFieldDialog.label4",
0933:                                "Field Description"), SheetProperty.TEXT);
0934:                spFieldDescription.setShowResetButton(false);
0935:
0936:                spFieldClassType = new ComboBoxSheetProperty("fieldClassType",
0937:                        it.businesslogic.ireport.util.I18n.getString(
0938:                                "jRFieldDialog.label2", "Field Class Type"));
0939:                spFieldClassType.setShowResetButton(false);
0940:                classTypeCombo = (JComboBox) spFieldClassType.getEditor();
0941:
0942:                classTypeCombo.setEditable(true);
0943:                classTypeCombo.addItem("java.lang.Boolean");
0944:                classTypeCombo.addItem("java.lang.Byte");
0945:                classTypeCombo.addItem("java.util.Date");
0946:                classTypeCombo.addItem("java.sql.Timestamp");
0947:                classTypeCombo.addItem("java.sql.Time");
0948:                classTypeCombo.addItem("java.lang.Double");
0949:                classTypeCombo.addItem("java.lang.Float");
0950:                classTypeCombo.addItem("java.lang.Integer");
0951:                classTypeCombo.addItem("java.lang.Long");
0952:                classTypeCombo.addItem("java.lang.Short");
0953:                classTypeCombo.addItem("java.math.BigDecimal");
0954:                classTypeCombo.addItem("java.lang.Number");
0955:                classTypeCombo.addItem("java.lang.String");
0956:                classTypeCombo.addItem("java.util.Collection");
0957:                classTypeCombo.addItem("java.util.List");
0958:
0959:                spFieldProperties = new PropertiesSheetProperty(
0960:                        "fieldProperties", it.businesslogic.ireport.util.I18n
0961:                                .getString("fieldProperties",
0962:                                        "Field Properties"));
0963:                spFieldProperties.setShowResetButton(false);
0964:
0965:                spVariableName = new SheetProperty("variableName", I18n
0966:                        .getString("jRVariableDialog.label1", "Variable name"),
0967:                        SheetProperty.TEXT);
0968:                spVariableName.setShowResetButton(false);
0969:
0970:                spVariableClassType = new ComboBoxSheetProperty(
0971:                        "variableClassType", it.businesslogic.ireport.util.I18n
0972:                                .getString("jRVariableDialog.label5",
0973:                                        "Variable Class Type"));
0974:                spVariableClassType.setShowResetButton(false);
0975:                classTypeCombo = (JComboBox) spVariableClassType.getEditor();
0976:                classTypeCombo.setEditable(true);
0977:                classTypeCombo.addItem("java.lang.Boolean");
0978:                classTypeCombo.addItem("java.lang.Byte");
0979:                classTypeCombo.addItem("java.util.Date");
0980:                classTypeCombo.addItem("java.sql.Timestamp");
0981:                classTypeCombo.addItem("java.sql.Time");
0982:                classTypeCombo.addItem("java.lang.Double");
0983:                classTypeCombo.addItem("java.lang.Float");
0984:                classTypeCombo.addItem("java.lang.Integer");
0985:                classTypeCombo.addItem("java.lang.Long");
0986:                classTypeCombo.addItem("java.lang.Short");
0987:                classTypeCombo.addItem("java.math.BigDecimal");
0988:                classTypeCombo.addItem("java.lang.Number");
0989:                classTypeCombo.addItem("java.lang.String");
0990:                classTypeCombo.addItem("java.util.Collection");
0991:                classTypeCombo.addItem("java.util.List");
0992:                classTypeCombo.addItem("java.lang.Object");
0993:                classTypeCombo.addItem("java.io.InputStream");
0994:                classTypeCombo
0995:                        .addItem("net.sf.jasperreports.engine.JREmptyDataSource");
0996:
0997:                spVariableCalculationType = new SheetProperty(
0998:                        "variableCalculationType",
0999:                        it.businesslogic.ireport.util.I18n.getString(
1000:                                "jRVariableDialog.label2", "Calculation Type"),
1001:                        SheetProperty.COMBOBOX);
1002:                Vector tags = new Vector();
1003:                tags.add(new Tag("Nothing", I18n.getString(
1004:                        "variable.calculationType.Nothing", "Nothing")));
1005:                tags.add(new Tag("Count", I18n.getString(
1006:                        "variable.calculationType.Count", "Count")));
1007:                tags.add(new Tag("DistinctCount", I18n.getString(
1008:                        "variable.calculationType.DistinctCount",
1009:                        "Distinct count")));
1010:                tags.add(new Tag("Sum", I18n.getString(
1011:                        "variable.calculationType.Sum", "Sum")));
1012:                tags.add(new Tag("Average", I18n.getString(
1013:                        "variable.calculationType.Average", "Average")));
1014:                tags.add(new Tag("Lowest", I18n.getString(
1015:                        "variable.calculationType.Lowest", "Lowest")));
1016:                tags.add(new Tag("Highest", I18n.getString(
1017:                        "variable.calculationType.Highest", "Highest")));
1018:                tags.add(new Tag("StandardDeviation", I18n.getString(
1019:                        "variable.calculationType.StandardDeviation",
1020:                        "Standard deviation")));
1021:                tags.add(new Tag("Variance", I18n.getString(
1022:                        "variable.calculationType.Variance", "Variance")));
1023:                tags.add(new Tag("System", I18n.getString(
1024:                        "variable.calculationType.System", "System")));
1025:                tags.add(new Tag("First", I18n.getString(
1026:                        "variable.calculationType.First", "First")));
1027:                spVariableCalculationType.setTags(tags);
1028:                spVariableCalculationType.setDefaultValue("Now");
1029:                spVariableCalculationType.setShowResetButton(false);
1030:                spVariableResetType = new it.businesslogic.ireport.gui.sheet.SheetProperty(
1031:                        "variableResetType",
1032:                        it.businesslogic.ireport.util.I18n.getString(
1033:                                "jRVariableDialog.label7", "Reset Type"),
1034:                        it.businesslogic.ireport.gui.sheet.SheetProperty.COMBOBOX);
1035:                spVariableResetType.setShowResetButton(false);
1036:                tags = new Vector();
1037:                tags.add(new Tag("None", it.businesslogic.ireport.util.I18n
1038:                        .getString("resetType.None", "None")));
1039:                tags.add(new Tag("Report", it.businesslogic.ireport.util.I18n
1040:                        .getString("resetType.Report", "Report")));
1041:                tags.add(new Tag("Page", it.businesslogic.ireport.util.I18n
1042:                        .getString("resetType.Page", "Page")));
1043:                tags.add(new Tag("Column", it.businesslogic.ireport.util.I18n
1044:                        .getString("resetType.Column", "Column")));
1045:                tags.add(new Tag("Group", it.businesslogic.ireport.util.I18n
1046:                        .getString("resetType.Group", "Group")));
1047:                spVariableResetType.setTags(tags);
1048:                spVariableResetType.setDefaultValue("Report");
1049:
1050:                spVariableResetGroup = new ComboBoxSheetProperty(
1051:                        "variableResetGroup",
1052:                        it.businesslogic.ireport.util.I18n.getString(
1053:                                "jRVariableDialog.label6", "Reset Group"));
1054:                spVariableResetGroup.setShowResetButton(false);
1055:
1056:                spVariableIncrementType = new SheetProperty(
1057:                        "variableIncrementType",
1058:                        it.businesslogic.ireport.util.I18n
1059:                                .getString(
1060:                                        "gui.elementpropertiessheet.textfieldEvaluationTime",
1061:                                        "Eval. time"), SheetProperty.COMBOBOX);
1062:                tags = new Vector();
1063:                tags.add(new Tag("None", it.businesslogic.ireport.util.I18n
1064:                        .getString("incrementType.None", "None")));
1065:                tags.add(new Tag("Report", it.businesslogic.ireport.util.I18n
1066:                        .getString("incrementType.Report", "Report")));
1067:                tags.add(new Tag("Page", it.businesslogic.ireport.util.I18n
1068:                        .getString("incrementType.Page", "Page")));
1069:                tags.add(new Tag("Column", it.businesslogic.ireport.util.I18n
1070:                        .getString("incrementType.Column", "Column")));
1071:                tags.add(new Tag("Group", it.businesslogic.ireport.util.I18n
1072:                        .getString("incrementType.Group", "Group")));
1073:                spVariableIncrementType.setShowResetButton(false);
1074:                spVariableIncrementType.setTags(tags);
1075:                spVariableIncrementType.setDefaultValue("None");
1076:
1077:                spVariableIncrementGroup = new ComboBoxSheetProperty(
1078:                        "variableIncrementGroup",
1079:                        it.businesslogic.ireport.util.I18n.getString(
1080:                                "jRVariableDialog.label10", "Increment Group"));
1081:                spVariableIncrementGroup.setShowResetButton(false);
1082:
1083:                spVariableIncrementerClass = new SheetProperty(
1084:                        "variableIncrementerClass", I18n.getString(
1085:                                "jRVariableDialog.label8",
1086:                                "Custom Incrementer Factory Class"),
1087:                        SheetProperty.TEXT);
1088:                spVariableIncrementerClass.setShowResetButton(false);
1089:
1090:                spVariableExpression = new ExpressionSheetProperty(
1091:                        "variableExpression",
1092:                        it.businesslogic.ireport.util.I18n.getString(
1093:                                "jRVariableDialog.label3",
1094:                                "Variable Expression"));
1095:                spVariableExpression.setShowResetButton(false);
1096:
1097:                spVariableInitialValueExpression = new ExpressionSheetProperty(
1098:                        "variableInitialValueExpression",
1099:                        it.businesslogic.ireport.util.I18n.getString(
1100:                                "jRVariableDialog.label4",
1101:                                "Initial Value Expression"));
1102:                spVariableInitialValueExpression.setShowResetButton(false);
1103:
1104:            }
1105:
1106:            /**
1107:             * Update groups
1108:             */
1109:            protected void updateAllComboBoxes(SubDataset subDataset) {
1110:                if (jrf == null)
1111:                    return;
1112:                // Use the name of the group and not the group object....
1113:                Vector group_names = new Vector();
1114:
1115:                if (subDataset != null) {
1116:                    Enumeration e = subDataset.getGroups().elements();
1117:                    while (e.hasMoreElements()) {
1118:                        group_names.addElement("" + e.nextElement());
1119:                    }
1120:                }
1121:                spVariableIncrementGroup.updateValues(group_names, false);
1122:                spVariableResetGroup.updateValues(group_names, false);
1123:            }
1124:
1125:            public boolean isInit() {
1126:                return init;
1127:            }
1128:
1129:            public void setInit(boolean init) {
1130:                this .init = init;
1131:            }
1132:
1133:            public JReportFrame getJrf() {
1134:                return jrf;
1135:            }
1136:
1137:            public void setJrf(JReportFrame jrf) {
1138:                this .jrf = jrf;
1139:            }
1140:
1141:            /**
1142:             * Redraw the correct editor panel (JReportPanel or the active CrosstabPanel)
1143:             *
1144:             */
1145:            public void repaintEditor() {
1146:                if (jrf == null)
1147:                    return;
1148:                jrf.getJPanelReport().repaint();
1149:            }
1150:
1151:            public Vector getSelection() {
1152:                return objectSelection;
1153:            }
1154:
1155:            public void setSelection(Vector newSelection) {
1156:                this .objectSelection.removeAllElements();
1157:                if (newSelection == null)
1158:                    return;
1159:                this .objectSelection.addAll(newSelection);
1160:            }
1161:
1162:            public void reportElementsSelectionChanged(
1163:                    ReportElementsSelectionEvent evt) {
1164:            }
1165:
1166:            public void reportElementsChanged(ReportElementChangedEvent evt) {
1167:            }
1168:
1169:            public void reportBandsSelectionChanged(
1170:                    ReportBandsSelectionEvent evt) {
1171:            }
1172:
1173:            public void reportObjectsSelectionChanged(
1174:                    ReportObjectsSelectionEvent evt) {
1175:                updateSelection();
1176:            }
1177:
1178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.