Package com.atolsystems.atolutilities

Examples of com.atolsystems.atolutilities.StopRequestFromUserException


                if (JOptionPane.NO_OPTION == choice) {
                    checkOperation = false;
                }
                if (JOptionPane.CANCEL_OPTION == choice) {
                    userCancelled=true;
                    throw new StopRequestFromUserException("Operation cancelled by user.");
                }
            }
        }finally{
            if(-1==end)
                end=System.nanoTime();
View Full Code Here


            sb.append(runCnt+1);
            statusDiplayer.setText(sb.toString());
            for (int i = 0; i < cmds.size(); i++) {

                if(Thread.interrupted())
                    throw new StopRequestFromUserException("Operation cancelled by user.");

                if (cmds.get(i).getClass().equals(Apdu.class)) {
                    lastApdu=playApdu((Apdu) cmds.get(i));
                    lastAtr=null;
                }else if (cmds.get(i).getClass().equals(Integer.class)) {
                    Integer bufferId = (Integer) cmds.get(i);
                    if(null!=lastApdu)
                        buffers.put(bufferId, lastApdu);
                    else if(null!=lastAtr)
                        buffers.put(bufferId, lastAtr);
                    else
                        throw new ScardException("'Save to buffer' invoked but no ATR nor APDU to save");
                } else if (cmds.get(i).getClass().equals(BufferOperation.class)) {
                    BufferOperation bufferOperation = (BufferOperation) cmds.get(i);
                    bufferOperation.perform(this);
                } else if (cmds.get(i).getClass().equals(Frequency.class)) {
                    Frequency frequency = (Frequency) cmds.get(i);
                    if(playTerminal instanceof FrequencySetter){
                        FrequencySetter fs=(FrequencySetter) playTerminal;
                        fs.setFrequency(frequency.frequency);
                    }else
                        terminal.logLine(ScardLogHandler.LOG_WARNING,"Frequency specified in script but frequency setting is not supported with this terminal");
                } else if (cmds.get(i).getClass().equals(PowerSupplyVoltage.class)) {
                    PowerSupplyVoltage power = (PowerSupplyVoltage) cmds.get(i);
                    if(playTerminal instanceof PowerSupplyVoltageSetter){
                        PowerSupplyVoltageSetter pss=(PowerSupplyVoltageSetter) playTerminal;
                        pss.setVoltage(power.voltage);
                    }else
                        terminal.logLine(ScardLogHandler.LOG_WARNING,"Voltage specified in script but voltage setting is not supported with this terminal");
                } else if (cmds.get(i).getClass().equals(PcscPowerOn.class)) {
                    PcscPowerOn pcscPowerOn = (PcscPowerOn) cmds.get(i);
                    terminal.setNegociateComSpeed(true);
                    terminal.connect(pcscPowerOn.protocol, pcscPowerOn.activation);
                    lastAtr=terminal.getAtr();
                    lastApdu=null;
                } else if (cmds.get(i).getClass().equals(PowerOn.class)) {
                    PowerOn powerOn = (PowerOn) cmds.get(i);
                    terminal.setNegociateComSpeed(false);
                    terminal.connect(powerOn.activation);
                    lastAtr=terminal.getAtr();
                    lastApdu=null;
                } else if (cmds.get(i).getClass().equals(PowerOff.class)) {
                    terminal.disconnect();
                } else if (cmds.get(i) instanceof CallBack) {
                    CallBack callBack = (CallBack) cmds.get(i);
                    callBack.execute(terminal);
                    lastAtr=terminal.getAtr();
                    lastApdu=null;
                } else if (cmds.get(i).getClass().equals(DelayNs.class)) {
                    DelayNs delayNs=(DelayNs)cmds.get(i);
                    terminal.delay(delayNs.delayNs);
                } else if (cmds.get(i).getClass().equals(ApduTimeoutPush.class)) {
                    ApduTimeoutPush timeout=(ApduTimeoutPush)cmds.get(i);
                    terminalTimeoutStack.push(terminal.getApduTimeout());
                    terminal.setApduTimeout(timeout.timeoutMs);
                } else if (cmds.get(i).getClass().equals(ApduTimeout.class)) {
                    ApduTimeout timeout=(ApduTimeout)cmds.get(i);
                    terminal.setApduTimeout(timeout.timeoutMs);
                } else if (cmds.get(i).getClass().equals(ApduTimeoutPop.class)) {
                    terminal.setApduTimeout(terminalTimeoutStack.pop());
                } else if (cmds.get(i).getClass().equals(String.class)) {
                    String comment = (String) cmds.get(i);
                    terminal.logLine(ScardLogHandler.LOG_COMMENT,comment);
                } else if (cmds.get(i).getClass().equals(ExpectedApduResponse.class)) {
                    ExpectedApduResponse expectedApduResponse = (ExpectedApduResponse) cmds.get(i);
                    buffers.put(expectedApduResponse.id, expectedApduResponse);
                } else {
                    if (reportUnsupportedError) {
                        errorOccured=true;
                        String msg = "Runtime error: object ";
                        msg += cmds.get(i).getClass().getCanonicalName();
                        msg += " not supported. Action not performed."+nl+nl;
                        msg += "Ignore that kind of error ? (press Cancel to stop sequence)";
                        long start=System.nanoTime();
                        int choice = JOptionPane.showConfirmDialog(null, msg, "Runtime error", JOptionPane.YES_NO_CANCEL_OPTION);
                        deadTime+=System.nanoTime()-start;
                        if (JOptionPane.YES_OPTION == choice) {
                            reportUnsupportedError = false;
                        }
                        if (JOptionPane.CANCEL_OPTION == choice) {
                            userCancelled=false;
                            throw new StopRequestFromUserException("Operation cancelled by user.");
                        }
                    }
                }
            }
            runCnt++;
View Full Code Here

                        if (JOptionPane.NO_OPTION == choice) {
                            player.checkOperation = false;
                        }
                        if (JOptionPane.CANCEL_OPTION == choice) {
                            player.userCancelled = true;
                            throw new StopRequestFromUserException("Operation cancelled by user.");
                        }
                    }
                    break;
                }
                default:
View Full Code Here

        long start = System.nanoTime();
        int option = fileChooser.showOpenDialog(null);
        deadTime += System.nanoTime() - start;
        fileChooser.dispose();
        if (option != JFileChooser.APPROVE_OPTION) {
            throw new StopRequestFromUserException();//if user give up, we give up too...
        }
        fileChooser.saveCurrentPath();//tell the file chooser to remember this location
        outputFile = fileChooser.getSelectedFile();
        outputFileClonned = false;
        return outputFile;
View Full Code Here

                dataSize = Integer.decode(inputValue);
                message = "Number must be positive.";
            } catch (NumberFormatException e) {
                message = "Number not recognized.";
            } catch (NullPointerException e) {//this happens when the user click the cancel button
                throw new StopRequestFromUserException();//if user give up, we give up too...
            }
        } while (dataSize < 0);
        dataSize = dataSize * 1024;//compute the size in bytes
    }
View Full Code Here

            if (JOptionPane.YES_OPTION == choice) {
                this.coldConnect();
            }
        }
        if (JOptionPane.CANCEL_OPTION == choice) {
            throw new StopRequestFromUserException("Operation cancelled by user.");
        }
    }
View Full Code Here

                        int choice = JOptionPane.showConfirmDialog(null, sb.toString(), "Parallel mode", JOptionPane.OK_CANCEL_OPTION);
                        if (JOptionPane.OK_OPTION == choice) {
                            //nothing to do
                        }
                        if (JOptionPane.CANCEL_OPTION == choice) {
                            throw new StopRequestFromUserException("Operation cancelled by user.");
                        }
                    }
                    System.out.println("Launching parallel mode on " + selectedTerminals.size() + " terminals:");
                    System.out.println(terminalNames.toString());
                } else {
View Full Code Here

        out = fileChooser.getSelectedFile();
        long end = System.nanoTime();
        fileChooser.dispose();
        deadTime += end - start;
        if (option != JFileChooser.APPROVE_OPTION) {
            throw new StopRequestFromUserException();
        }
        return out;
    }
View Full Code Here

                    int choice = JOptionPane.showConfirmDialog(null, msg, "Waiting for card", JOptionPane.OK_CANCEL_OPTION);
                    if (JOptionPane.OK_OPTION == choice) {
                        //nothing to do
                    }
                    if (JOptionPane.CANCEL_OPTION == choice) {
                        throw new StopRequestFromUserException("Operation cancelled by user.");
                    }
                }
            }while(0 == selectedTerminals.size());
               
            if (PARALLEL_MODE_N_TERMINAL_NOT_FIXED > fixedParallelModeNTerminals) {
                if (selectedTerminals.size() != fixedParallelModeNTerminals) {
                    String msg = "Command line request " + fixedParallelModeNTerminals + " terminals with card but " + selectedTerminals.size() + " have been detected:";
                    msg += "\n" + terminalsWithCard;
                    throw new ExternalRuntimeException(msg);
                }
            } else if ((PARALLEL_MODE_SKIP_CONFIRMATION != fixedParallelModeNTerminals) &&
                    selectedTerminals.size()!=fixedParallelModeNTerminals) {//if number match, don't ask anything
                cardsDetected.append(terminalsWithCard);
                cardsDetected.append("\nContinue ?\n");
                int choice = JOptionPane.showConfirmDialog(null, cardsDetected.toString(), "Parallel mode", JOptionPane.OK_CANCEL_OPTION);
                if (JOptionPane.OK_OPTION == choice) {
                    //nothing to do
                }
                if (JOptionPane.CANCEL_OPTION == choice) {
                    throw new StopRequestFromUserException("Operation cancelled by user.");
                }
            } else {
                cardsDetected.append(terminalsWithCard);
                System.out.print(cardsDetected.toString());
            }
View Full Code Here

                        names[0]);
            if((null==o) || (-1==((Integer)o.getObject()))){
                String msg="The card could not be identified as one of the supported cards and manual selection has been cancelled. Supported cards:\n";
                for(int i=0;i<compatibleCards.size();i++)
                    msg+=compatibleCards.get(i).getIdentifiableCardDescription()+"\n";
                throw new StopRequestFromUserException(msg);
            }
            index=(Integer)o.getObject();
            lastWasSelectedByUser=true;
        }
        lastCard=compatibleCards.get(index);
View Full Code Here

TOP

Related Classes of com.atolsystems.atolutilities.StopRequestFromUserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.