001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * MeasureDialog.java
028: *
029: * Created on 9 maggio 2003, 17.25
030: *
031: */
032:
033: package it.businesslogic.ireport.crosstab.gui;
034:
035: import it.businesslogic.ireport.*;
036: import it.businesslogic.ireport.crosstab.Measure;
037: import it.businesslogic.ireport.gui.JRParameterDialog;
038: import it.businesslogic.ireport.gui.MainFrame;
039: import it.businesslogic.ireport.gui.sheet.Tag;
040: import it.businesslogic.ireport.util.Misc;
041: import it.businesslogic.ireport.util.I18n;
042:
043: /**
044: * @author Administrator
045: */
046: public class MeasureDialog extends javax.swing.JDialog {
047:
048: /** Creates new form JRParameterDialog */
049: Measure tmpVariable = null;
050: private SubDataset subDataset = null;
051:
052: /**
053: * Creates a new JRVariableDialog object.
054: *
055: * @param subDataset DOCUMENT ME!
056: * @param parent DOCUMENT ME!
057: * @param modal DOCUMENT ME!
058: */
059: public MeasureDialog(SubDataset report, java.awt.Frame parent,
060: boolean modal) {
061: super (parent, modal);
062: initAll(report);
063: }
064:
065: public MeasureDialog(SubDataset report, java.awt.Dialog parent,
066: boolean modal) {
067: super (parent, modal);
068: initAll(report);
069: }
070:
071: public void initAll(SubDataset report) {
072: initComponents();
073:
074: this .setSubDataset(report);
075: setTypes();
076: this .jComboBoxClassType.setSelectedItem("java.lang.String");
077: this .jComboBoxCalculationType.setSelectedItem("Nothing");
078: this .jComboBoxPercentageOf.setSelectedIndex(0); // "None"
079: pack();
080:
081: Misc.centerFrame(this );
082:
083: javax.swing.KeyStroke escape = javax.swing.KeyStroke
084: .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
085: false);
086: javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
087: public void actionPerformed(java.awt.event.ActionEvent e) {
088: jButtonCancelActionPerformed(e);
089: }
090: };
091:
092: getRootPane().getInputMap(
093: javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
094: escape, "ESCAPE");
095: getRootPane().getActionMap().put("ESCAPE", escapeAction);
096:
097: applyI18n();
098: //to make the default button ...
099: this .getRootPane().setDefaultButton(this .jButtonOK);
100: }
101:
102: /**
103: * DOCUMENT ME!
104: */
105: public void setTypes() {
106: this .jComboBoxClassType.addItem("java.lang.String");
107: this .jComboBoxClassType.addItem("java.lang.Object");
108: this .jComboBoxClassType.addItem("java.lang.Boolean");
109: this .jComboBoxClassType.addItem("java.lang.Byte");
110: this .jComboBoxClassType.addItem("java.util.Date");
111: this .jComboBoxClassType.addItem("java.sql.Timestamp");
112: this .jComboBoxClassType.addItem("java.sql.Time");
113: this .jComboBoxClassType.addItem("java.lang.Double");
114: this .jComboBoxClassType.addItem("java.lang.Float");
115: this .jComboBoxClassType.addItem("java.lang.Integer");
116: this .jComboBoxClassType.addItem("java.io.InputStream");
117: this .jComboBoxClassType.addItem("java.lang.Long");
118: this .jComboBoxClassType.addItem("java.lang.Short");
119: this .jComboBoxClassType.addItem("java.math.BigDecimal");
120: this .jComboBoxClassType
121: .addItem("net.sf.jasperreports.engine.JREmptyDataSource");
122:
123: this .jComboBoxPercentageOf.addItem(new Tag("None", I18n
124: .getString("measure.percentageOf.None", "None")));
125: this .jComboBoxPercentageOf.addItem(new Tag("GrandTotal", I18n
126: .getString("measure.percentageOf.GrandTotal",
127: "Grand total")));
128:
129: this .jComboBoxCalculationType.addItem(new Tag("Nothing",
130: I18n.getString("measure.calculationType.Nothing",
131: "Nothing")));
132: this .jComboBoxCalculationType.addItem(new Tag("Count", I18n
133: .getString("measure.calculationType.Count", "Count")));
134: this .jComboBoxCalculationType.addItem(new Tag("DistinctCount",
135: I18n.getString("measure.calculationType.DistinctCount",
136: "Distinct count")));
137: this .jComboBoxCalculationType.addItem(new Tag("Sum", I18n
138: .getString("measure.calculationType.Sum", "Sum")));
139: this .jComboBoxCalculationType.addItem(new Tag("Average",
140: I18n.getString("measure.calculationType.Average",
141: "Average")));
142: this .jComboBoxCalculationType
143: .addItem(new Tag("Lowest", I18n.getString(
144: "measure.calculationType.Lowest", "Lowest")));
145: this .jComboBoxCalculationType.addItem(new Tag("Highest",
146: I18n.getString("measure.calculationType.Highest",
147: "Highest")));
148: this .jComboBoxCalculationType.addItem(new Tag(
149: "StandardDeviation", I18n.getString(
150: "measure.calculationType.StandardDeviation",
151: "Standard deviation")));
152: this .jComboBoxCalculationType.addItem(new Tag("Variance", I18n
153: .getString("measure.calculationType.Variance",
154: "Variance")));
155: this .jComboBoxCalculationType.addItem(new Tag("First", I18n
156: .getString("measure.calculationType.First", "First")));
157: }
158:
159: /**
160: * This method is called from within the constructor to initialize the
161: * form. WARNING: Do NOT modify this code. The content of this method is
162: * always regenerated by the Form Editor.
163: */
164:
165: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
166: private void initComponents() {
167: java.awt.GridBagConstraints gridBagConstraints;
168:
169: jLabel1 = new javax.swing.JLabel();
170: jTextFieldName = new javax.swing.JTextField();
171: jLabel2 = new javax.swing.JLabel();
172: jLabel3 = new javax.swing.JLabel();
173: jLabel5 = new javax.swing.JLabel();
174: jComboBoxCalculationType = new javax.swing.JComboBox();
175: jComboBoxClassType = new javax.swing.JComboBox();
176: jRTextExpressionAreaExpression = new it.businesslogic.ireport.gui.JRTextExpressionArea();
177: jLabel8 = new javax.swing.JLabel();
178: jTextFieldNameIncrementerFactoryClass = new javax.swing.JTextField();
179: jPanel1 = new javax.swing.JPanel();
180: jButtonOK = new javax.swing.JButton();
181: jButtonCancel = new javax.swing.JButton();
182: jLabel9 = new javax.swing.JLabel();
183: jComboBoxPercentageOf = new javax.swing.JComboBox();
184: jLabel10 = new javax.swing.JLabel();
185: jTextFieldNamePercentageCalculatorClass = new javax.swing.JTextField();
186:
187: getContentPane().setLayout(new java.awt.GridBagLayout());
188:
189: setTitle("Add/modify measure");
190: setModal(true);
191: addWindowListener(new java.awt.event.WindowAdapter() {
192: public void windowClosing(java.awt.event.WindowEvent evt) {
193: closeDialog(evt);
194: }
195: });
196:
197: jLabel1.setText("Measure name");
198: gridBagConstraints = new java.awt.GridBagConstraints();
199: gridBagConstraints.gridx = 0;
200: gridBagConstraints.gridy = 0;
201: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
202: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
203: getContentPane().add(jLabel1, gridBagConstraints);
204:
205: gridBagConstraints = new java.awt.GridBagConstraints();
206: gridBagConstraints.gridx = 0;
207: gridBagConstraints.gridy = 1;
208: gridBagConstraints.gridwidth = 3;
209: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
210: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
211: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
212: getContentPane().add(jTextFieldName, gridBagConstraints);
213:
214: jLabel2.setText("Calculation type");
215: gridBagConstraints = new java.awt.GridBagConstraints();
216: gridBagConstraints.gridx = 1;
217: gridBagConstraints.gridy = 2;
218: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
219: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
220: getContentPane().add(jLabel2, gridBagConstraints);
221:
222: jLabel3.setText("Measure expression");
223: gridBagConstraints = new java.awt.GridBagConstraints();
224: gridBagConstraints.gridx = 0;
225: gridBagConstraints.gridy = 14;
226: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
227: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
228: getContentPane().add(jLabel3, gridBagConstraints);
229:
230: jLabel5.setText("Measure class type");
231: gridBagConstraints = new java.awt.GridBagConstraints();
232: gridBagConstraints.gridx = 0;
233: gridBagConstraints.gridy = 2;
234: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
235: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
236: getContentPane().add(jLabel5, gridBagConstraints);
237:
238: gridBagConstraints = new java.awt.GridBagConstraints();
239: gridBagConstraints.gridx = 1;
240: gridBagConstraints.gridy = 3;
241: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
242: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
243: gridBagConstraints.weightx = 1.0;
244: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
245: getContentPane().add(jComboBoxCalculationType,
246: gridBagConstraints);
247:
248: jComboBoxClassType.setEditable(true);
249: gridBagConstraints = new java.awt.GridBagConstraints();
250: gridBagConstraints.gridx = 0;
251: gridBagConstraints.gridy = 3;
252: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
253: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
254: gridBagConstraints.weightx = 1.0;
255: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
256: getContentPane().add(jComboBoxClassType, gridBagConstraints);
257:
258: jRTextExpressionAreaExpression
259: .setBorder(javax.swing.BorderFactory
260: .createEtchedBorder());
261: jRTextExpressionAreaExpression.setCaretVisible(false);
262: jRTextExpressionAreaExpression.setElectricScroll(0);
263: jRTextExpressionAreaExpression
264: .setMinimumSize(new java.awt.Dimension(657, 100));
265: jRTextExpressionAreaExpression
266: .setPreferredSize(new java.awt.Dimension(325, 70));
267: gridBagConstraints = new java.awt.GridBagConstraints();
268: gridBagConstraints.gridx = 0;
269: gridBagConstraints.gridy = 15;
270: gridBagConstraints.gridwidth = 2;
271: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
272: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
273: gridBagConstraints.weightx = 1.0;
274: gridBagConstraints.weighty = 1.0;
275: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
276: getContentPane().add(jRTextExpressionAreaExpression,
277: gridBagConstraints);
278:
279: jLabel8.setText("Custom Incrementer Factory Class");
280: gridBagConstraints = new java.awt.GridBagConstraints();
281: gridBagConstraints.gridx = 0;
282: gridBagConstraints.gridy = 5;
283: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
284: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
285: getContentPane().add(jLabel8, gridBagConstraints);
286:
287: jTextFieldNameIncrementerFactoryClass
288: .setNextFocusableComponent(jRTextExpressionAreaExpression);
289: gridBagConstraints = new java.awt.GridBagConstraints();
290: gridBagConstraints.gridx = 0;
291: gridBagConstraints.gridy = 6;
292: gridBagConstraints.gridwidth = 2;
293: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
294: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
295: gridBagConstraints.weightx = 1.0;
296: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
297: getContentPane().add(jTextFieldNameIncrementerFactoryClass,
298: gridBagConstraints);
299:
300: jPanel1.setLayout(new java.awt.FlowLayout(
301: java.awt.FlowLayout.RIGHT));
302:
303: jButtonOK.setMnemonic('o');
304: jButtonOK.setText("OK");
305: jButtonOK
306: .addActionListener(new java.awt.event.ActionListener() {
307: public void actionPerformed(
308: java.awt.event.ActionEvent evt) {
309: jButtonOKActionPerformed(evt);
310: }
311: });
312:
313: jPanel1.add(jButtonOK);
314:
315: jButtonCancel.setText("Cancel");
316: jButtonCancel.setMnemonic('c');
317: jButtonCancel
318: .addActionListener(new java.awt.event.ActionListener() {
319: public void actionPerformed(
320: java.awt.event.ActionEvent evt) {
321: jButtonCancelActionPerformed(evt);
322: }
323: });
324:
325: jPanel1.add(jButtonCancel);
326:
327: gridBagConstraints = new java.awt.GridBagConstraints();
328: gridBagConstraints.gridx = 0;
329: gridBagConstraints.gridy = 99;
330: gridBagConstraints.gridwidth = 3;
331: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
332: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
333: gridBagConstraints.weightx = 1.0;
334: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
335: getContentPane().add(jPanel1, gridBagConstraints);
336:
337: jLabel9.setText("Percentage of");
338: gridBagConstraints = new java.awt.GridBagConstraints();
339: gridBagConstraints.gridx = 0;
340: gridBagConstraints.gridy = 7;
341: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
342: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
343: getContentPane().add(jLabel9, gridBagConstraints);
344:
345: gridBagConstraints = new java.awt.GridBagConstraints();
346: gridBagConstraints.gridx = 0;
347: gridBagConstraints.gridy = 8;
348: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
349: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
350: gridBagConstraints.weightx = 1.0;
351: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
352: getContentPane().add(jComboBoxPercentageOf, gridBagConstraints);
353:
354: jLabel10.setText("Custom Percentage Calculator Class");
355: gridBagConstraints = new java.awt.GridBagConstraints();
356: gridBagConstraints.gridx = 0;
357: gridBagConstraints.gridy = 10;
358: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
359: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
360: getContentPane().add(jLabel10, gridBagConstraints);
361:
362: jTextFieldNamePercentageCalculatorClass
363: .setNextFocusableComponent(jRTextExpressionAreaExpression);
364: gridBagConstraints = new java.awt.GridBagConstraints();
365: gridBagConstraints.gridx = 0;
366: gridBagConstraints.gridy = 11;
367: gridBagConstraints.gridwidth = 2;
368: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
369: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
370: gridBagConstraints.weightx = 1.0;
371: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
372: getContentPane().add(jTextFieldNamePercentageCalculatorClass,
373: gridBagConstraints);
374:
375: pack();
376: java.awt.Dimension screenSize = java.awt.Toolkit
377: .getDefaultToolkit().getScreenSize();
378: java.awt.Dimension dialogSize = getSize();
379: setLocation((screenSize.width - dialogSize.width) / 2,
380: (screenSize.height - dialogSize.height) / 2);
381: }// </editor-fold>//GEN-END:initComponents
382:
383: private void jButtonCancelActionPerformed(
384: java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonCancelActionPerformed
385: {
386: setVisible(false);
387: this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
388: dispose();
389: }//GEN-LAST:event_jButtonCancelActionPerformed
390:
391: private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonOKActionPerformed
392: {
393:
394: if (this .jTextFieldName.getText().trim().length() <= 0) {
395: javax.swing.JOptionPane
396: .showMessageDialog(
397: this ,
398: I18n
399: .getString(
400: "messages.measureDialog.invalidMeasureName",
401: "Please insert a valid measure name!"),
402: I18n
403: .getString(
404: "messages.measureDialog.invalidMeasureNameCaption",
405: "Invalid measure!"),
406: javax.swing.JOptionPane.WARNING_MESSAGE);
407:
408: return;
409: }
410:
411: if (this .jComboBoxClassType.getSelectedIndex() < 0
412: || ("" + this .jComboBoxClassType.getSelectedItem())
413: .trim().length() <= 0) {
414: javax.swing.JOptionPane
415: .showMessageDialog(
416: this ,
417: I18n
418: .getString(
419: "messages.measureDialog.invalidClassName",
420: "Please insert a valid class name!"),
421: I18n
422: .getString(
423: "messages.measureDialog.invalidClassNameCaption",
424: "Invalid class!"),
425: javax.swing.JOptionPane.WARNING_MESSAGE);
426:
427: return;
428: }
429:
430: tmpVariable = new Measure(this .jTextFieldName.getText());
431:
432: tmpVariable.setClassType(this .jComboBoxClassType
433: .getSelectedItem()
434: + "");
435:
436: tmpVariable.setCalculation(((Tag) this .jComboBoxCalculationType
437: .getSelectedItem()).getValue()
438: + "");
439:
440: tmpVariable.setPercentageOf(((Tag) this .jComboBoxPercentageOf
441: .getSelectedItem()).getValue()
442: + "");
443:
444: //System.out.println(this.jComboBoxIncrementType.getSelectedItem()+" "+ tmpVariable.getIncrementType());
445: tmpVariable
446: .setIncrementerFactoryClass(this .jTextFieldNameIncrementerFactoryClass
447: .getText());
448: tmpVariable
449: .setPercentageCalculatorClass(this .jTextFieldNamePercentageCalculatorClass
450: .getText());
451:
452: tmpVariable.setExpression(jRTextExpressionAreaExpression
453: .getText());
454:
455: setVisible(false);
456: this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
457: dispose();
458: }//GEN-LAST:event_jButtonOKActionPerformed
459:
460: /**
461: * Closes the dialog
462: * @param evt DOCUMENT ME!
463: */
464: private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog
465: {
466: setVisible(false);
467: this .setDialogResult(javax.swing.JOptionPane.CLOSED_OPTION);
468: dispose();
469: }//GEN-LAST:event_closeDialog
470:
471: /**
472: * @param args the command line arguments
473: */
474: public static void main(String[] args) {
475: new JRParameterDialog(new javax.swing.JFrame(), true)
476: .setVisible(true);
477: }
478:
479: /**
480: * Getter for property tmpParameter.
481: *
482: * @return Value of property tmpParameter.
483: */
484: public it.businesslogic.ireport.crosstab.Measure getMeasure() {
485:
486: return tmpVariable;
487: }
488:
489: /**
490: * Setter for property tmpParameter.
491: *
492: * @param tmpVariable New value of property tmpParameter.
493: */
494: public void setMeasure(
495: it.businesslogic.ireport.crosstab.Measure tmpVariable) {
496: this .jTextFieldName.setText(new String(tmpVariable.getName()));
497:
498: this .jComboBoxClassType.setSelectedItem(new String(tmpVariable
499: .getClassType()));
500:
501: this .jRTextExpressionAreaExpression.setText(new String(
502: tmpVariable.getExpression()));
503: this .jTextFieldNameIncrementerFactoryClass.setText(new String(
504: tmpVariable.getIncrementerFactoryClass()));
505:
506: Misc.setComboboxSelectedTagValue(jComboBoxCalculationType,
507: tmpVariable.getCalculation());
508: Misc.setComboboxSelectedTagValue(jComboBoxPercentageOf,
509: tmpVariable.getPercentageOf());
510:
511: this .jTextFieldNamePercentageCalculatorClass
512: .setText(new String(tmpVariable
513: .getPercentageCalculatorClass()));
514: }
515:
516: /**
517: * Getter for property dialogResult.
518: *
519: * @return Value of property dialogResult.
520: */
521: public int getDialogResult() {
522:
523: return dialogResult;
524: }
525:
526: /**
527: * Setter for property dialogResult.
528: *
529: * @param dialogResult New value of property dialogResult.
530: */
531: public void setDialogResult(int dialogResult) {
532: this .dialogResult = dialogResult;
533: }
534:
535: public void setExpressionContext(SubDataset sds) {
536: if (sds == null) {
537: sds = MainFrame.getMainInstance().getActiveReportFrame()
538: .getReport();
539: }
540:
541: this .jRTextExpressionAreaExpression.setSubDataset(sds);
542: this .jRTextExpressionAreaExpression.getCrosstabElements()
543: .removeAllElements();
544: }
545:
546: // Variables declaration - do not modify//GEN-BEGIN:variables
547: private javax.swing.JButton jButtonCancel;
548: private javax.swing.JButton jButtonOK;
549: private javax.swing.JComboBox jComboBoxCalculationType;
550: private javax.swing.JComboBox jComboBoxClassType;
551: private javax.swing.JComboBox jComboBoxPercentageOf;
552: private javax.swing.JLabel jLabel1;
553: private javax.swing.JLabel jLabel10;
554: private javax.swing.JLabel jLabel2;
555: private javax.swing.JLabel jLabel3;
556: private javax.swing.JLabel jLabel5;
557: private javax.swing.JLabel jLabel8;
558: private javax.swing.JLabel jLabel9;
559: private javax.swing.JPanel jPanel1;
560: private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaExpression;
561: private javax.swing.JTextField jTextFieldName;
562: private javax.swing.JTextField jTextFieldNameIncrementerFactoryClass;
563: private javax.swing.JTextField jTextFieldNamePercentageCalculatorClass;
564: // End of variables declaration//GEN-END:variables
565: private int dialogResult;
566:
567: public SubDataset getSubDataset() {
568: return subDataset;
569: }
570:
571: public void setSubDataset(SubDataset subDataset) {
572: this .subDataset = subDataset;
573: if (subDataset == null)
574: return;
575: jRTextExpressionAreaExpression.setSubDataset(subDataset);
576: jRTextExpressionAreaExpression.getTokenMarker()
577: .setKeywordLookup(subDataset.getKeywordLookup());
578: }
579:
580: public void applyI18n() {
581: // Start autogenerated code ----------------------
582: jButtonCancel.setText(I18n.getString(
583: "measureDialog.buttonCancel", "Cancel"));
584: jButtonOK.setText(I18n
585: .getString("measureDialog.buttonOK", "OK"));
586: jLabel1.setText(I18n.getString("measureDialog.label1",
587: "Measure name"));
588: jLabel10.setText(I18n.getString("measureDialog.label10",
589: "Custom Percentage Calculator Class"));
590: jLabel2.setText(I18n.getString("measureDialog.label2",
591: "Calculation type"));
592: jLabel3.setText(I18n.getString("measureDialog.label3",
593: "Measure expression"));
594: jLabel5.setText(I18n.getString("measureDialog.label5",
595: "Measure class type"));
596: jLabel8.setText(I18n.getString("measureDialog.label8",
597: "Custom Incrementer Factory Class"));
598: jLabel9.setText(I18n.getString("measureDialog.label9",
599: "Percentage of"));
600: // End autogenerated code ----------------------
601:
602: this .setTitle(I18n.getString("measureDialog.title",
603: "Add/modify measure"));
604: jButtonCancel.setMnemonic(I18n.getString(
605: "measureDialog.buttonCancelMnemonic", "c").charAt(0));
606: jButtonOK.setMnemonic(I18n.getString(
607: "measureDialog.buttonOKMnemonic", "o").charAt(0));
608: }
609:
610: public static final int COMPONENT_NONE = 0;
611: public static final int COMPONENT_MEASURE_EXPRESSION = 1;
612:
613: /**
614: * This method set the focus on a specific component.
615: * Valid constants are:<br>
616: * COMPONENT_MEASURE_EXPRESSION
617: */
618: public void setFocusedExpression(int expID) {
619: switch (expID) {
620: case COMPONENT_MEASURE_EXPRESSION:
621: Misc.selectTextAndFocusArea(jRTextExpressionAreaExpression);
622: break;
623: }
624:
625: }
626: }
|