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: * ArithmeticOperationHelper.java
028: *
029: * Created on September 26, 2006, 9:46 AM
030: *
031: */
032:
033: package it.businesslogic.ireport.gui.expbuilder;
034:
035: import it.businesslogic.ireport.gui.sheet.Tag;
036: import it.businesslogic.ireport.util.I18n;
037: import it.businesslogic.ireport.util.Misc;
038: import java.awt.Component;
039: import java.awt.Dialog;
040: import java.awt.Frame;
041: import java.awt.Window;
042: import javax.swing.DefaultListModel;
043: import javax.swing.JDialog;
044: import javax.swing.JOptionPane;
045: import javax.swing.SwingUtilities;
046:
047: /**
048: *
049: * @author gtoffoli
050: */
051: public class ArithmeticOperationHelper extends javax.swing.JPanel {
052:
053: JDialog dialog = null;
054: private String expression = null;
055: private String language = "java";
056: private int dialogResult = JOptionPane.CANCEL_OPTION;
057:
058: /** Creates new form BasicOperationWizard */
059: public ArithmeticOperationHelper() {
060: initComponents();
061: applyI18n();
062: jList1.setModel(new DefaultListModel());
063: jList2.setModel(new DefaultListModel());
064:
065: jList1.setCellRenderer(new ExpObjectCellRenderer(jList1));
066: jList2.setCellRenderer(new ExpObjectCellRenderer(jList2));
067:
068: jComboBoxType1.addItem(new Tag("auto", I18n.getString(
069: "autoType", "Automatic")));
070: jComboBoxType1.addItem(new Tag("int", I18n.getString("intType",
071: "Integer number (i.e. 123)")));
072: jComboBoxType1.addItem(new Tag("double", I18n.getString(
073: "realType", "Real number (i.e. 123.456)")));
074:
075: jComboBoxType2.addItem(new Tag("auto", I18n.getString(
076: "autoType", "Automatic")));
077: jComboBoxType2.addItem(new Tag("int", I18n.getString("intType",
078: "Integer number (i.e. 123)")));
079: jComboBoxType2.addItem(new Tag("double", I18n.getString(
080: "realType", "Real number (i.e. 123.456)")));
081:
082: jComboBoxReturnType.addItem(I18n.getString("autoType",
083: "Automatic"));
084: jComboBoxReturnType.addItem("BigDecimal");
085: jComboBoxReturnType.addItem("BigInteger");
086: jComboBoxReturnType.addItem("Byte");
087: jComboBoxReturnType.addItem("Double");
088: jComboBoxReturnType.addItem("Float");
089: jComboBoxReturnType.addItem("Integer");
090: jComboBoxReturnType.addItem("Long");
091: jComboBoxReturnType.addItem("Short");
092:
093: updateAdvancedOptionsStatus(false);
094: }
095:
096: public String getFinalReturnType() {
097: jComboBoxReturnType.removeAllItems();
098: if (jComboBoxType1.getSelectedIndex() == 0
099: && jComboBoxType1.getSelectedIndex() == 0) {
100: return "Integer";
101: } else {
102: return "Double";
103: }
104: }
105:
106: // Values can be a set of variables, parameters and fields
107: public void setValues(java.util.List values) {
108: if (values == null)
109: return;
110: int valids = 0;
111:
112: for (int i = 0; i < values.size(); ++i) {
113: ExpObject obj = (ExpObject) values.get(i);
114: String type = obj.getClassType();
115: if (type == null)
116: continue;
117:
118: if (type.equals("java.lang.Number")
119: || type.equals("java.lang.BigDecimal")
120: || type.equals("java.lang.BigInteger")
121: || type.equals("java.lang.Byte")
122: || type.equals("java.lang.Double")
123: || type.equals("java.lang.Float")
124: || type.equals("java.lang.Integer")
125: || type.equals("java.lang.Long")
126: || type.equals("java.lang.Short")) {
127: ((DefaultListModel) jList1.getModel()).addElement(obj);
128: ((DefaultListModel) jList2.getModel()).addElement(obj);
129: valids++;
130: }
131: }
132:
133: if (valids > 0) {
134: jList1.setSelectedIndex(0);
135: jList2.setSelectedIndex(0);
136: }
137: }
138:
139: public void setOperation(String op) {
140: jComboBoxOperation.setSelectedItem(op);
141: }
142:
143: /**
144: * Show the dialog.
145: * if c is null, the dialog will not have a parent.
146: */
147: public int showDialog(Component c) {
148: Window topLevel = null;
149: if (c != null) {
150: topLevel = SwingUtilities.getWindowAncestor(c);
151: }
152:
153: if (topLevel == null) {
154: dialog = new JDialog();
155: dialog.setModal(true);
156: } else if (topLevel instanceof Frame) {
157: dialog = new JDialog((Frame) topLevel, true);
158: } else if (topLevel instanceof Dialog) {
159: dialog = new JDialog((Dialog) topLevel, true);
160: }
161:
162: dialog.getContentPane().add(this );
163: dialog.setDefaultCloseOperation(dialog.DISPOSE_ON_CLOSE);
164:
165: dialog.setTitle("Arithmetic operation");
166: dialog.pack();
167: Misc.centerFrame(dialog);
168:
169: dialog.setVisible(true);
170:
171: return getDialogResult();
172: }
173:
174: /** This method is called from within the constructor to
175: * initialize the form.
176: * WARNING: Do NOT modify this code. The content of this method is
177: * always regenerated by the Form Editor.
178: */
179: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
180: private void initComponents() {
181: java.awt.GridBagConstraints gridBagConstraints;
182:
183: jPanelValue1 = new javax.swing.JPanel();
184: jLabel1 = new javax.swing.JLabel();
185: jScrollPane1 = new javax.swing.JScrollPane();
186: jList1 = new javax.swing.JList();
187: jLabelAdv1 = new javax.swing.JLabel();
188: jComboBoxType1 = new javax.swing.JComboBox();
189: jComboBoxOperation = new javax.swing.JComboBox();
190: jPanelValue2 = new javax.swing.JPanel();
191: jLabel2 = new javax.swing.JLabel();
192: jScrollPane2 = new javax.swing.JScrollPane();
193: jList2 = new javax.swing.JList();
194: jLabelAdv2 = new javax.swing.JLabel();
195: jComboBoxType2 = new javax.swing.JComboBox();
196: jPanelReturnType = new javax.swing.JPanel();
197: jSeparator2 = new javax.swing.JSeparator();
198: jLabelReturnType = new javax.swing.JLabel();
199: jComboBoxReturnType = new javax.swing.JComboBox();
200: jSeparator1 = new javax.swing.JSeparator();
201: jPanel1 = new javax.swing.JPanel();
202: jToggleButton1 = new javax.swing.JToggleButton();
203: jButtonOk = new javax.swing.JButton();
204: jButtonCancel = new javax.swing.JButton();
205:
206: setLayout(new java.awt.GridBagLayout());
207:
208: setMinimumSize(new java.awt.Dimension(500, 300));
209: setPreferredSize(new java.awt.Dimension(673, 300));
210: jPanelValue1.setLayout(new java.awt.GridBagLayout());
211:
212: jLabel1.setText("Value 1");
213: gridBagConstraints = new java.awt.GridBagConstraints();
214: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
215: gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
216: jPanelValue1.add(jLabel1, gridBagConstraints);
217:
218: jList1
219: .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
220: public void valueChanged(
221: javax.swing.event.ListSelectionEvent evt) {
222: jList1ValueChanged(evt);
223: }
224: });
225:
226: jScrollPane1.setViewportView(jList1);
227:
228: gridBagConstraints = new java.awt.GridBagConstraints();
229: gridBagConstraints.gridx = 0;
230: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
231: gridBagConstraints.weightx = 1.0;
232: gridBagConstraints.weighty = 1.0;
233: gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
234: jPanelValue1.add(jScrollPane1, gridBagConstraints);
235:
236: jLabelAdv1.setText("Consider this number as:");
237: gridBagConstraints = new java.awt.GridBagConstraints();
238: gridBagConstraints.gridx = 0;
239: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
240: gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
241: jPanelValue1.add(jLabelAdv1, gridBagConstraints);
242:
243: gridBagConstraints = new java.awt.GridBagConstraints();
244: gridBagConstraints.gridx = 0;
245: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
246: gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
247: jPanelValue1.add(jComboBoxType1, gridBagConstraints);
248:
249: gridBagConstraints = new java.awt.GridBagConstraints();
250: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
251: gridBagConstraints.weightx = 1.0;
252: gridBagConstraints.weighty = 1.0;
253: add(jPanelValue1, gridBagConstraints);
254:
255: jComboBoxOperation
256: .setModel(new javax.swing.DefaultComboBoxModel(
257: new String[] { "+", "-", "/", "*" }));
258: jComboBoxOperation
259: .setMinimumSize(new java.awt.Dimension(50, 18));
260: jComboBoxOperation.setPreferredSize(new java.awt.Dimension(50,
261: 22));
262: gridBagConstraints = new java.awt.GridBagConstraints();
263: gridBagConstraints.gridx = 1;
264: add(jComboBoxOperation, gridBagConstraints);
265:
266: jPanelValue2.setLayout(new java.awt.GridBagLayout());
267:
268: jLabel2.setText("Value 2");
269: gridBagConstraints = new java.awt.GridBagConstraints();
270: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
271: gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
272: jPanelValue2.add(jLabel2, gridBagConstraints);
273:
274: jList2
275: .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
276: public void valueChanged(
277: javax.swing.event.ListSelectionEvent evt) {
278: jList2ValueChanged(evt);
279: }
280: });
281:
282: jScrollPane2.setViewportView(jList2);
283:
284: gridBagConstraints = new java.awt.GridBagConstraints();
285: gridBagConstraints.gridx = 0;
286: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
287: gridBagConstraints.weightx = 1.0;
288: gridBagConstraints.weighty = 1.0;
289: gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
290: jPanelValue2.add(jScrollPane2, gridBagConstraints);
291:
292: jLabelAdv2.setText("Consider this number as:");
293: gridBagConstraints = new java.awt.GridBagConstraints();
294: gridBagConstraints.gridx = 0;
295: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
296: gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
297: jPanelValue2.add(jLabelAdv2, gridBagConstraints);
298:
299: gridBagConstraints = new java.awt.GridBagConstraints();
300: gridBagConstraints.gridx = 0;
301: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
302: gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
303: jPanelValue2.add(jComboBoxType2, gridBagConstraints);
304:
305: gridBagConstraints = new java.awt.GridBagConstraints();
306: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
307: gridBagConstraints.weightx = 1.0;
308: gridBagConstraints.weighty = 1.0;
309: add(jPanelValue2, gridBagConstraints);
310:
311: jPanelReturnType.setLayout(new java.awt.GridBagLayout());
312:
313: jSeparator2.setMinimumSize(new java.awt.Dimension(2, 2));
314: jSeparator2.setPreferredSize(new java.awt.Dimension(2, 2));
315: gridBagConstraints = new java.awt.GridBagConstraints();
316: gridBagConstraints.gridx = 0;
317: gridBagConstraints.gridwidth = 3;
318: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
319: jPanelReturnType.add(jSeparator2, gridBagConstraints);
320:
321: jLabelReturnType.setText("Return type:");
322: gridBagConstraints = new java.awt.GridBagConstraints();
323: gridBagConstraints.gridy = 1;
324: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
325: jPanelReturnType.add(jLabelReturnType, gridBagConstraints);
326:
327: jComboBoxReturnType.setMinimumSize(new java.awt.Dimension(200,
328: 18));
329: jComboBoxReturnType.setPreferredSize(new java.awt.Dimension(
330: 200, 22));
331: gridBagConstraints = new java.awt.GridBagConstraints();
332: gridBagConstraints.gridy = 1;
333: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
334: gridBagConstraints.weightx = 1.0;
335: gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
336: jPanelReturnType.add(jComboBoxReturnType, gridBagConstraints);
337:
338: gridBagConstraints = new java.awt.GridBagConstraints();
339: gridBagConstraints.gridx = 0;
340: gridBagConstraints.gridwidth = 3;
341: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
342: gridBagConstraints.weightx = 1.0;
343: add(jPanelReturnType, gridBagConstraints);
344:
345: jSeparator1.setMinimumSize(new java.awt.Dimension(2, 2));
346: jSeparator1.setPreferredSize(new java.awt.Dimension(2, 2));
347: gridBagConstraints = new java.awt.GridBagConstraints();
348: gridBagConstraints.gridx = 0;
349: gridBagConstraints.gridwidth = 3;
350: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
351: add(jSeparator1, gridBagConstraints);
352:
353: jPanel1.setLayout(new java.awt.GridBagLayout());
354:
355: jToggleButton1.setText("Advanced options");
356: jToggleButton1
357: .addActionListener(new java.awt.event.ActionListener() {
358: public void actionPerformed(
359: java.awt.event.ActionEvent evt) {
360: jToggleButton1ActionPerformed(evt);
361: }
362: });
363:
364: gridBagConstraints = new java.awt.GridBagConstraints();
365: gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
366: jPanel1.add(jToggleButton1, gridBagConstraints);
367:
368: jButtonOk.setText("Ok");
369: jButtonOk.setActionCommand("OK");
370: jButtonOk
371: .addActionListener(new java.awt.event.ActionListener() {
372: public void actionPerformed(
373: java.awt.event.ActionEvent evt) {
374: jButtonOkActionPerformed(evt);
375: }
376: });
377:
378: gridBagConstraints = new java.awt.GridBagConstraints();
379: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
380: gridBagConstraints.weightx = 1.0;
381: jPanel1.add(jButtonOk, gridBagConstraints);
382:
383: jButtonCancel.setText("Cancel");
384: jButtonCancel
385: .addActionListener(new java.awt.event.ActionListener() {
386: public void actionPerformed(
387: java.awt.event.ActionEvent evt) {
388: jButtonCancelActionPerformed(evt);
389: }
390: });
391:
392: gridBagConstraints = new java.awt.GridBagConstraints();
393: gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
394: jPanel1.add(jButtonCancel, gridBagConstraints);
395:
396: gridBagConstraints = new java.awt.GridBagConstraints();
397: gridBagConstraints.gridx = 0;
398: gridBagConstraints.gridwidth = 3;
399: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
400: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
401: add(jPanel1, gridBagConstraints);
402:
403: }// </editor-fold>//GEN-END:initComponents
404:
405: private void jList2ValueChanged(
406: javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList2ValueChanged
407:
408: }//GEN-LAST:event_jList2ValueChanged
409:
410: private void jButtonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOkActionPerformed
411:
412: String exp = "";
413: if (jList1.getSelectedIndex() < 0) {
414: JOptionPane.showMessageDialog(this , I18n.getString(
415: "ArithmeticOperationHelper.msg1",
416: "Please select an object in the first list"));
417: return;
418: } else if (jList2.getSelectedIndex() < 0) {
419: JOptionPane.showMessageDialog(this , I18n.getString(
420: "ArithmeticOperationHelper.msg2",
421: "Please select an object from the second list"));
422: return;
423: }
424:
425: ExpObject expObj1 = (ExpObject) jList1.getSelectedValue();
426: ExpObject expObj2 = (ExpObject) jList2.getSelectedValue();
427:
428: if (getLanguage().equals("groovy")) {
429: this .setExpression(expObj1.getExpression() + " "
430: + jComboBoxOperation.getSelectedItem() + " "
431: + expObj2.getExpression());
432: } else {
433: exp = expObj1.getExpression();
434:
435: if (jComboBoxType1.getSelectedIndex() == 0) {
436: String type = expObj1.getClassType();
437: if (type.equals("java.lang.Number"))
438: exp += ".doubleValue()";
439: if (type.equals("java.lang.BigDecimal"))
440: exp += ".doubleValue()";
441: if (type.equals("java.lang.BigInteger"))
442: exp += ".longValue()";
443: if (type.equals("java.lang.Byte"))
444: exp += ".byteValue()";
445: if (type.equals("java.lang.Double"))
446: exp += ".doubleValue()";
447: if (type.equals("java.lang.Float"))
448: exp += ".floatValue()";
449: if (type.equals("java.lang.Integer"))
450: exp += ".intValue()";
451: if (type.equals("java.lang.Long"))
452: exp += ".longValue()";
453: if (type.equals("java.lang.Short"))
454: exp += ".shortValue()";
455: } else if (jComboBoxType1.getSelectedIndex() == 1) {
456: exp += ".intValue()";
457: } else if (jComboBoxType1.getSelectedIndex() == 2) {
458: exp += ".doubleValue()";
459: }
460:
461: exp = " (" + exp + ") "
462: + jComboBoxOperation.getSelectedItem();
463:
464: exp += "(" + expObj2.getExpression();
465:
466: if (jComboBoxType2.getSelectedIndex() == 0) {
467: String type = expObj2.getClassType();
468: if (type.equals("java.lang.Number"))
469: exp += ".doubleValue()";
470: if (type.equals("java.lang.BigDecimal"))
471: exp += ".doubleValue()";
472: if (type.equals("java.lang.BigInteger"))
473: exp += ".longValue()";
474: if (type.equals("java.lang.Byte"))
475: exp += ".byteValue()";
476: if (type.equals("java.lang.Double"))
477: exp += ".doubleValue()";
478: if (type.equals("java.lang.Float"))
479: exp += ".floatValue()";
480: if (type.equals("java.lang.Integer"))
481: exp += ".intValue()";
482: if (type.equals("java.lang.Long"))
483: exp += ".longValue()";
484: if (type.equals("java.lang.Short"))
485: exp += ".shortValue()";
486: } else if (jComboBoxType2.getSelectedIndex() == 1) {
487: exp += ".intValue()";
488: } else if (jComboBoxType2.getSelectedIndex() == 2) {
489: exp += ".doubleValue()";
490: }
491:
492: exp += ")";
493:
494: if (jComboBoxReturnType.getSelectedIndex() != 0) {
495:
496: exp = "new " + jComboBoxReturnType.getSelectedItem()
497: + "( " + exp + " )";
498: } else if (expObj2.getClassType().equals(
499: expObj1.getClassType())
500: && !expObj2.getClassType().equals(
501: "java.lang.Number")) {
502: exp = "new " + expObj2.getClassType() + "( " + exp
503: + " )";
504: } else {
505: if (isInteger(expObj2.getClassType())
506: && isInteger(expObj1.getClassType())) {
507: exp = "new Integer( " + exp + " )";
508: } else {
509: exp = "new Double( " + exp + " )";
510: }
511: }
512:
513: this .setExpression(exp);
514: }
515:
516: this .setDialogResult(JOptionPane.OK_OPTION);
517: this .dialog.setVisible(false);
518: this .dialog.dispose();
519:
520: }//GEN-LAST:event_jButtonOkActionPerformed
521:
522: private boolean isInteger(String type) {
523: if (type.equals("java.lang.Number"))
524: return true;
525: if (type.equals("java.lang.BigInteger"))
526: return true;
527: if (type.equals("java.lang.Byte"))
528: return true;
529: if (type.equals("java.lang.Integer"))
530: return true;
531: if (type.equals("java.lang.Long"))
532: return true;
533: if (type.equals("java.lang.Short"))
534: return true;
535:
536: return false;
537: }
538:
539: private void jButtonCancelActionPerformed(
540: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
541:
542: if (dialog != null) {
543: dialog.setVisible(false);
544: dialog.dispose();
545: }
546:
547: }//GEN-LAST:event_jButtonCancelActionPerformed
548:
549: private void jList1ValueChanged(
550: javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
551:
552: }//GEN-LAST:event_jList1ValueChanged
553:
554: private void jToggleButton1ActionPerformed(
555: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
556:
557: updateAdvancedOptionsStatus(jToggleButton1.isSelected());
558:
559: }//GEN-LAST:event_jToggleButton1ActionPerformed
560:
561: // Variables declaration - do not modify//GEN-BEGIN:variables
562: private javax.swing.JButton jButtonCancel;
563: private javax.swing.JButton jButtonOk;
564: private javax.swing.JComboBox jComboBoxOperation;
565: private javax.swing.JComboBox jComboBoxReturnType;
566: private javax.swing.JComboBox jComboBoxType1;
567: private javax.swing.JComboBox jComboBoxType2;
568: private javax.swing.JLabel jLabel1;
569: private javax.swing.JLabel jLabel2;
570: private javax.swing.JLabel jLabelAdv1;
571: private javax.swing.JLabel jLabelAdv2;
572: private javax.swing.JLabel jLabelReturnType;
573: private javax.swing.JList jList1;
574: private javax.swing.JList jList2;
575: private javax.swing.JPanel jPanel1;
576: private javax.swing.JPanel jPanelReturnType;
577: private javax.swing.JPanel jPanelValue1;
578: private javax.swing.JPanel jPanelValue2;
579: private javax.swing.JScrollPane jScrollPane1;
580: private javax.swing.JScrollPane jScrollPane2;
581: private javax.swing.JSeparator jSeparator1;
582: private javax.swing.JSeparator jSeparator2;
583: private javax.swing.JToggleButton jToggleButton1;
584:
585: // End of variables declaration//GEN-END:variables
586:
587: public void updateAdvancedOptionsStatus(boolean b) {
588: jPanelReturnType.setVisible(b);
589: jLabelAdv1.setVisible(b);
590: jLabelAdv2.setVisible(b);
591: jComboBoxType1.setVisible(b);
592: jComboBoxType2.setVisible(b);
593:
594: if (b) {
595: jToggleButton1.setText(I18n.getString("FewerOptions",
596: "Fewer options"));
597: } else {
598: jToggleButton1.setText(I18n.getString("MoreOptions",
599: "More options"));
600: }
601: }
602:
603: public int getDialogResult() {
604: return dialogResult;
605: }
606:
607: public void setDialogResult(int dialogResult) {
608: this .dialogResult = dialogResult;
609: }
610:
611: public String getExpression() {
612: return expression;
613: }
614:
615: public void setExpression(String expression) {
616: this .expression = expression;
617: }
618:
619: public String getLanguage() {
620: return language;
621: }
622:
623: public void setLanguage(String language) {
624: this .language = language;
625: }
626:
627: public JDialog getDialog() {
628:
629: return dialog;
630: }
631:
632: public void setDialog(JDialog dialog) {
633: this .dialog = dialog;
634: if (dialog != null) {
635: dialog.setTitle(I18n.getString(
636: "arithmeticOperationHelper.title",
637: "Arithmetic operation"));
638: }
639: }
640:
641: public void applyI18n() {
642: // Start autogenerated code ----------------------
643: jButtonCancel.setText(I18n.getString(
644: "arithmeticOperationHelper.buttonCancel", "Cancel"));
645: jButtonOk.setText(I18n.getString(
646: "arithmeticOperationHelper.buttonOk", "Ok"));
647: jLabel1.setText(I18n.getString(
648: "arithmeticOperationHelper.label1", "Value 1"));
649: jLabel2.setText(I18n.getString(
650: "arithmeticOperationHelper.label2", "Value 2"));
651: jLabelAdv1.setText(I18n.getString(
652: "arithmeticOperationHelper.labelAdv1",
653: "Consider this number as:"));
654: jLabelAdv2.setText(I18n.getString(
655: "arithmeticOperationHelper.labelAdv2",
656: "Consider this number as:"));
657: jLabelReturnType.setText(I18n.getString(
658: "arithmeticOperationHelper.labelReturnType",
659: "Return type:"));
660: // End autogenerated code ----------------------
661: if (dialog != null) {
662: dialog.setTitle(I18n.getString(
663: "arithmeticOperationHelper.title",
664: "Arithmetic operation"));
665: }
666: jButtonCancel.setMnemonic(I18n.getString(
667: "arithmeticOperationHelper.buttonCancelMnemonic", "c")
668: .charAt(0));
669: jButtonOk.setMnemonic(I18n.getString(
670: "arithmeticOperationHelper.buttonOkMnemonic", "o")
671: .charAt(0));
672: }
673: }
|