• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScriptFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.openbravo.pos.scripting.ScriptFactory的典型用法代码示例。如果您正苦于以下问题:Java ScriptFactory类的具体用法?Java ScriptFactory怎么用?Java ScriptFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScriptFactory类属于com.openbravo.pos.scripting包,在下文中一共展示了ScriptFactory类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: evalScript

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
public Object evalScript(String code, ScriptArg... args) throws ScriptException {
    
    ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
    script.put("ticket", ticket);
    script.put("place", ticketext);
    script.put("taxes", taxcollection);
    script.put("taxeslogic", taxeslogic);             
    script.put("user", m_App.getAppUserView().getUser());
    script.put("sales", this);

    // more arguments
    for(ScriptArg arg : args) {
        script.put(arg.getKey(), arg.getValue());
    }             

    return script.eval(code);
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:18,代码来源:JPanelTicket.java


示例2: insertRow

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
public void insertRow(int index, TicketLineInfo oLine) {
    
    String[] row = new String[m_acolumns.length];
    for (int i = 0; i < m_acolumns.length; i++) {
        try {
            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
            script.put("ticketline", oLine);
            row[i] = script.eval(m_acolumns[i].value).toString();
        } catch (ScriptException e) {
            row[i] = null;
        }  
    } 
    
    m_rows.add(index, row);
    fireTableRowsInserted(index, index);
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:17,代码来源:JTicketLines.java


示例3: JPaymentCashPos

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
/** Creates new form JPaymentCash */
public JPaymentCashPos(JPaymentNotifier notifier, DataLogicSystem dlSystem) {
    
    m_notifier = notifier;
    
    initComponents();  
    
    m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
    m_jTendered.addEditorKeys(m_jKeys);
    
    String code = dlSystem.getResourceAsXML("payment.cash");
    if (code != null) {
        try {
            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
            script.put("payment", new ScriptPaymentCash(dlSystem));    
            script.eval(code);
        } catch (ScriptException e) {
            MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotexecute"), e);
            msg.show(this);
        }
    }
    
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:24,代码来源:JPaymentCashPos.java


示例4: init

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
/**
     *
     * @param app
     * @throws BeanFactoryException
     */
    @Override
    public void init(AppView app) throws BeanFactoryException {
        
        // Resource
        try {
            ScriptEngine eng = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
            eng.put("app", app);
            
            bean = (BeanFactory) eng.eval(StringUtils.readResource(script));
            if (bean == null) {
                // old definition
                bean = (BeanFactory) eng.get("bean");
            }
            
            // todo // llamar al init del bean
            if (bean instanceof BeanFactoryApp) {
                ((BeanFactoryApp) bean).init(app);
            }
// JG 16 May use multicatch
        } catch (ScriptException | IOException e) {
            throw new BeanFactoryException(e);
        }     
    }
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:29,代码来源:BeanFactoryScript.java


示例5: m_jPrintActionPerformed

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void m_jPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jPrintActionPerformed

        InputStream schema = getClass().getResourceAsStream(PRINTER_SHEMA);
        InputStream template = getClass().getResourceAsStream(PRINT_TICKET_PREVIEW);

        if (m_ticket != null) {
            m_TTP2 = new TicketParser(schema, m_App.getDeviceTicket());
            try {
                ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
                script.put("ticket", m_ticket);
                script.put("local", new AppLocal());
                m_TTP2.printTicket(template, script);
            } catch (ScriptException | TicketPrinterException e) {
                JMessageDialog.showMessage(this, new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotprint"), e));
            }
        }

    }
 
开发者ID:nordpos,项目名称:nordpos,代码行数:19,代码来源:JTicketsBagTicket.java


示例6: visorTicketLine

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void visorTicketLine(TicketLineInfo oLine) {
    if (oLine == null) {
        m_App.getDeviceTicket().getDeviceDisplay().clearVisor();
    } else {
        m_TTP = new TicketParser(getClass().getResourceAsStream(PRINTER_SHEMA), m_App.getDeviceTicket());
        try {
            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
            script.put("ticketline", oLine);
            script.put("local", new AppLocal());
            m_TTP.printTicket(getClass().getResourceAsStream(PRINT_TICKET_LINE), script);
        } catch (ScriptException | TicketPrinterException e) {
            MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintline"), e);
            msg.show(JPanelTicket.this);
        }
    }
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:17,代码来源:JPanelTicket.java


示例7: evalScript

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
public Object evalScript(String code, ScriptArg... args) throws ScriptException {

            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);

            script.put("hostname", m_App.getProperties().getProperty("machine.hostname"));
            script.put("ticket", ticket);
            script.put("place", ticketext);
            script.put("taxes", taxcollection);
            script.put("taxeslogic", taxeslogic);
            script.put("user", m_App.getAppUserView().getUser());
            script.put("sales", this);
            script.put("logicsales", dlSales);
            script.put("logicsystem", dlSystem);

            // more arguments
            for (ScriptArg arg : args) {
                script.put(arg.getKey(), arg.getValue());
            }

            return script.eval(code);
        }
 
开发者ID:nordpos,项目名称:nordpos,代码行数:22,代码来源:JPanelTicket.java


示例8: printerStart

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void printerStart() {

        InputStream schema = getClass().getResourceAsStream(PRINTER_SHEMA);
        InputStream template = getClass().getResourceAsStream(PRINT_START);

        if (schema == null || template == null) {
            m_TP.getDeviceDisplay().writeVisor(AppLocal.APP_NAME, AppLocal.APP_VERSION);
        } else {
            m_TTP = new TicketParser(schema, getDeviceTicket());
            try {
                ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
                script.put("local", new AppLocal());
                m_TTP.printTicket(template, script);
            } catch (ScriptException | TicketPrinterException eTP) {
                m_TP.getDeviceDisplay().writeVisor(AppLocal.APP_NAME, AppLocal.APP_VERSION);
            }
        }
    }
 
开发者ID:nordpos,项目名称:nordpos,代码行数:19,代码来源:JRootApp.java


示例9: evalScript

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
public Object evalScript(String code, ScriptArg... args) throws ScriptException {

            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
            script.put("ticket", ticket);
            script.put("place", ticketext);
            script.put("taxes", taxcollection);
            script.put("taxeslogic", taxeslogic);
            script.put("user", m_App.getAppUserView().getUser());
            script.put("sales", this);

            // more arguments
            for (ScriptArg arg : args) {
                script.put(arg.getKey(), arg.getValue());
            }

            return script.eval(code);
        }
 
开发者ID:ZarGate,项目名称:OpenbravoPOS,代码行数:18,代码来源:JPanelTicket.java


示例10: setRow

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
public void setRow(int index, TicketLineInfo oLine){
    
    String[] row = (String []) m_rows.get(index);
    for (int i = 0; i < m_acolumns.length; i++) {
        try {
            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
            script.put("ticketline", oLine);
            row[i] = script.eval(m_acolumns[i].value).toString();
        } catch (ScriptException e) {
            row[i] = null;
        } 
        fireTableCellUpdated(index, i);
    }             
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:15,代码来源:JTicketLines.java


示例11: getScriptMenu

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private Component getScriptMenu(String menutext) throws ScriptException {

        ScriptMenu menu = new ScriptMenu();

        ScriptEngine eng = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
        eng.put("menu", menu);
        eng.eval(menutext);
        return menu.getTaskPane();
    }
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:10,代码来源:JPrincipalApp.java


示例12: visorTicketLine

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void visorTicketLine(TicketLineInfo oLine){
        if (oLine == null) { 
             m_App.getDeviceTicket().getDeviceDisplay().clearVisor();
        } else {                 
            try {
                ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
                script.put("ticketline", oLine);
                m_TTP.printTicket(script.eval(dlSystem.getResourceAsXML("Printer.TicketLine")).toString());
// JG May 2013 replaced with Multicatch
            } catch (    ScriptException | TicketPrinterException e) {
                MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintline"), e);
                msg.show(JPanelTicket.this);
            }
        } 
    }
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:16,代码来源:JPanelTicket.java


示例13: evalScript

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
/**
         *
         * @param code
         * @param args
         * @return Script object and value
         * @throws ScriptException
         */
        public Object evalScript(String code, ScriptArg... args) throws ScriptException {
            
        ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);            

// Mod JG Sept 2011 - Used inside scripts i.e.: Stock Checking
        String sDBUser = m_App.getProperties().getProperty("db.user");
        String sDBPassword = m_App.getProperties().getProperty("db.password");
        
        if (sDBUser != null && sDBPassword != null && sDBPassword.startsWith("crypt:")) {
            AltEncrypter cypher = new AltEncrypter("cypherkey" + sDBUser);
            sDBPassword = cypher.decrypt(sDBPassword.substring(6));
        } 
            script.put("hostname", m_App.getProperties().getProperty("machine.hostname"));
            script.put("dbURL", m_App.getProperties().getProperty("db.URL")); 
            script.put("dbUser", sDBUser);
            script.put("dbPassword", sDBPassword);
// End mod
            
            script.put("ticket", ticket);
            script.put("place", ticketext);
            script.put("taxes", taxcollection);
            script.put("taxeslogic", taxeslogic);             
            script.put("user", m_App.getAppUserView().getUser());
            script.put("sales", this);
            script.put("taxesinc",m_jaddtax.isSelected());
            script.put("warranty",warrantyPrint);
            script.put("pickupid",getPickupString(ticket));
       

            // more arguments
            for(ScriptArg arg : args) {
                script.put(arg.getKey(), arg.getValue());
//                System.out.println(arg.getKey());
//                System.out.println(arg.getValue());
            }             

            return script.eval(code);
        }
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:46,代码来源:JPanelTicket.java


示例14: printTicket

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void printTicket(String sresourcename, TicketInfo ticket, String table) {
           if (ticket != null) {
           try {
               ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
               script.put("ticket", ticket);              
               script.put("place",m_restaurant.getTableName());
               m_TTP2.printTicket(script.eval(m_dlSystem.getResourceAsXML(sresourcename)).toString());                
           } catch ( ScriptException | TicketPrinterException e) {
               JMessageDialog.showMessage(this, new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotprint"), e));
           }
       } 
}
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:13,代码来源:JTicketsBagRestaurant.java


示例15: JPaymentCashPos

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
/** Creates new form JPaymentCash
     * @param notifier
     * @param dlSystem */
    public JPaymentCashPos(JPaymentNotifier notifier, DataLogicSystem dlSystem) {
        
        m_notifier = notifier;
        
        initComponents();  
        
        m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
        m_jTendered.addEditorKeys(m_jKeys);
        
// added JDL 11.05.13        
        AppConfig m_config =  new AppConfig(new File((System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));        
        m_config.load();        
        priceWith00 =("true".equals(m_config.getProperty("till.pricewith00")));
        if (priceWith00) {
            // use '00' instead of '.'
            m_jKeys.dotIs00(true);
        }
//        m_config=null;
       
        String code = dlSystem.getResourceAsXML("payment.cash");
        if (code != null) {
            try {
                ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
                script.put("payment", new ScriptPaymentCash(dlSystem));    
                script.eval(code);
            } catch (ScriptException e) {
                MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotexecute"), e);
                msg.show(this);
            }
        }
        
    }
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:36,代码来源:JPaymentCashPos.java


示例16: printTicket

import com.openbravo.pos.scripting.ScriptFactory; //导入依赖的package包/类
private void printTicket() {
    
    // imprimo m_ticket
    
    /* DISABLE TICKET EDITING ---------------------
    try {
        m_jEdit.setEnabled(
                m_ticket != null
                && (m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL || m_ticket.getTicketType() == TicketInfo.RECEIPT_REFUND)
                && m_dlSales.isCashActive(m_ticket.getActiveCash()));
    } catch (BasicException e) {
        m_jEdit.setEnabled(false);
    } ----------------------------------------------*/
    m_jRefund.setEnabled(m_ticket != null && m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL);
    m_jPrint.setEnabled(m_ticket != null);
    
    // Este deviceticket solo tiene una impresora, la de pantalla
    m_TP.getDevicePrinter("1").reset();
    
    if (m_ticket == null) {
        m_jTicketId.setText(null);            
    } else {
        m_jTicketId.setText(m_ticket.getName());
        
        try {
            ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
            script.put("ticket", m_ticket);
            script.put("taxes", m_ticket.getTaxLines());                
            m_TTP.printTicket(script.eval(m_dlSystem.getResourceAsXML("Printer.TicketPreview")).toString());
        } catch (    ScriptException | TicketPrinterException e) {
            MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"), e);
            msg.show(this);
        }
    }
}
 
开发者ID:sbandur84,项目名称:micro-Blagajna,代码行数:36,代码来源:JTicketsBagTicket.java



注:本文中的com.openbravo.pos.scripting.ScriptFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Config类代码示例发布时间:2022-05-23
下一篇:
Java UnionTypeTree类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap