private void jButtonOkActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonOkActionPerformed String exp = ""; if (jList1.getSelectedIndex() < 0) { JOptionPane.showMessageDialog( this, I18n.getString( "ArithmeticOperationHelper.msg1", "Please select an object in the first list")); return; } else if (jList2.getSelectedIndex() < 0) { JOptionPane.showMessageDialog( this, I18n.getString( "ArithmeticOperationHelper.msg2", "Please select an object from the second list")); return; } ExpObject expObj1 = (ExpObject) jList1.getSelectedValue(); ExpObject expObj2 = (ExpObject) jList2.getSelectedValue(); if (getLanguage().equals("groovy")) { this.setExpression( expObj1.getExpression() + " " + jComboBoxOperation.getSelectedItem() + " " + expObj2.getExpression()); } else { exp = expObj1.getExpression(); if (jComboBoxType1.getSelectedIndex() == 0) { String type = expObj1.getClassType(); if (type.equals("java.lang.Number")) exp += ".doubleValue()"; if (type.equals("java.lang.BigDecimal")) exp += ".doubleValue()"; if (type.equals("java.lang.BigInteger")) exp += ".longValue()"; if (type.equals("java.lang.Byte")) exp += ".byteValue()"; if (type.equals("java.lang.Double")) exp += ".doubleValue()"; if (type.equals("java.lang.Float")) exp += ".floatValue()"; if (type.equals("java.lang.Integer")) exp += ".intValue()"; if (type.equals("java.lang.Long")) exp += ".longValue()"; if (type.equals("java.lang.Short")) exp += ".shortValue()"; } else if (jComboBoxType1.getSelectedIndex() == 1) { exp += ".intValue()"; } else if (jComboBoxType1.getSelectedIndex() == 2) { exp += ".doubleValue()"; } exp = " (" + exp + ") " + jComboBoxOperation.getSelectedItem(); exp += "(" + expObj2.getExpression(); if (jComboBoxType2.getSelectedIndex() == 0) { String type = expObj2.getClassType(); if (type.equals("java.lang.Number")) exp += ".doubleValue()"; if (type.equals("java.lang.BigDecimal")) exp += ".doubleValue()"; if (type.equals("java.lang.BigInteger")) exp += ".longValue()"; if (type.equals("java.lang.Byte")) exp += ".byteValue()"; if (type.equals("java.lang.Double")) exp += ".doubleValue()"; if (type.equals("java.lang.Float")) exp += ".floatValue()"; if (type.equals("java.lang.Integer")) exp += ".intValue()"; if (type.equals("java.lang.Long")) exp += ".longValue()"; if (type.equals("java.lang.Short")) exp += ".shortValue()"; } else if (jComboBoxType2.getSelectedIndex() == 1) { exp += ".intValue()"; } else if (jComboBoxType2.getSelectedIndex() == 2) { exp += ".doubleValue()"; } exp += ")"; if (jComboBoxReturnType.getSelectedIndex() != 0) { exp = "new " + jComboBoxReturnType.getSelectedItem() + "( " + exp + " )"; } else if (expObj2.getClassType().equals(expObj1.getClassType()) && !expObj2.getClassType().equals("java.lang.Number")) { exp = "new " + expObj2.getClassType() + "( " + exp + " )"; } else { if (isInteger(expObj2.getClassType()) && isInteger(expObj1.getClassType())) { exp = "new Integer( " + exp + " )"; } else { exp = "new Double( " + exp + " )"; } } this.setExpression(exp); } this.setDialogResult(JOptionPane.OK_OPTION); this.dialog.setVisible(false); this.dialog.dispose(); } // GEN-LAST:event_jButtonOkActionPerformed