Package jpos

Examples of jpos.JposException


        return keyData;
    }

    public int getPOSKeyEventType() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return this.keyEvent;
    }
View Full Code Here


            if (keyDef.startsWith("0x")) {
                try {
                    this.keyCode = Integer.parseInt(keyDef.substring(2), 16);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal hex code key definition [" + keyName + "]");
                }
            } else if (keyDef.startsWith("VK_")) {
                try {
                    Field kef = KeyEvent.class.getField(keyDef);
                    this.keyCode = kef.getInt(kef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal virtual key definition [" + keyName + "]");
                }
            } else {
                try {
                    this.keyCode = Integer.parseInt(keyDef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code definition [" + keyName + "]");
                }
            }

            // set the key modifiers
            String[] modifiers = null;
            if (UtilValidate.isNotEmpty(keyMod)) {
                if (keyMod.indexOf("+") != -1) {
                    modifiers = keyMod.split("\\+");
                } else {
                    modifiers = new String[1];
                    modifiers[0] = keyMod;
                }
                for (int i = 0; i < modifiers.length; i++) {
                    if ("SHIFT".equalsIgnoreCase(modifiers[i])) {
                        this.shift = true;
                    } else {
                        this.shift = false;
                    }
                    if ("CTRL".equalsIgnoreCase(modifiers[i])) {
                        this.ctrl = true;
                    } else {
                        this.ctrl = false;
                    }
                    if ("ALT".equalsIgnoreCase(modifiers[i])) {
                        this.alt = true;
                        this.alt = false;
                    }
                }
            }

            // set the mapped value
            if (UtilValidate.isNotEmpty(mappedValue)) {
                try {
                    this.mappedCode = Integer.parseInt(mappedValue);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code mapping [" + mappedValue + "]");
                }
            } else {
                this.mappedCode = keyCode;
            }
        }
View Full Code Here

            this.eventTypes = i;
    }

    public int getPOSKeyData() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return keyData;
    }
View Full Code Here

        return keyData;
    }

    public int getPOSKeyEventType() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return this.keyEvent;
    }
View Full Code Here

            if (keyDef.startsWith("0x")) {
                try {
                    this.keyCode = Integer.parseInt(keyDef.substring(2), 16);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal hex code key definition [" + keyName + "]");
                }
            } else if (keyDef.startsWith("VK_")) {
                try {
                    Field kef = KeyEvent.class.getField(keyDef);
                    this.keyCode = kef.getInt(kef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal virtual key definition [" + keyName + "]");
                }
            } else {
                try {
                    this.keyCode = Integer.parseInt(keyDef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code definition [" + keyName + "]");
                }
            }

            // set the key modifiers
            String[] modifiers = null;
            if (UtilValidate.isNotEmpty(keyMod)) {
                if (keyMod.indexOf("+") != -1) {
                    modifiers = keyMod.split("\\+");
                } else {
                    modifiers = new String[1];
                    modifiers[0] = keyMod;
                }
                for (int i = 0; i < modifiers.length; i++) {
                    if ("SHIFT".equalsIgnoreCase(modifiers[i])) {
                        this.shift = true;
                    } else {
                        this.shift = false;
                    }
                    if ("CTRL".equalsIgnoreCase(modifiers[i])) {
                        this.ctrl = true;
                    } else {
                        this.ctrl = false;
                    }
                    if ("ALT".equalsIgnoreCase(modifiers[i])) {
                        this.alt = true;
                        this.alt = false;
                    }
                }
            }

            // set the mapped value
            if (UtilValidate.isNotEmpty(mappedValue)) {
                try {
                    this.mappedCode = Integer.parseInt(mappedValue);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code mapping [" + mappedValue + "]");
                }
            } else {
                this.mappedCode = keyCode;
            }
        }
View Full Code Here

        this.control = new jpos.POSPrinter();
    }

    @Override
    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        this.control = new jpos.PINPad();
    }

    @Override
    public void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        this.control = new jpos.SignatureCapture();
    }

    @Override
    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        this.control = new jpos.LineDisplay();
    }

    @Override
    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        this.control = new jpos.CheckScanner();
    }

    @Override
    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

TOP

Related Classes of jpos.JposException

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.