本文整理汇总了Java中com.openbravo.pos.scripting.ScriptException类的典型用法代码示例。如果您正苦于以下问题:Java ScriptException类的具体用法?Java ScriptException怎么用?Java ScriptException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptException类属于com.openbravo.pos.scripting包,在下文中一共展示了ScriptException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evalScript
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
示例2: insertRow
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
示例3: JPaymentCashPos
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
}
示例4: init
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
示例5: m_jPrintActionPerformed
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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));
}
}
}
示例6: visorTicketLine
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
}
示例7: evalScript
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
示例8: printerStart
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
}
示例9: m_jPrintLabelActionPerformed
import com.openbravo.pos.scripting.ScriptException; //导入依赖的package包/类
private void m_jPrintLabelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jPrintLabelActionPerformed
m_oCurrentProductEdit.setID(m_id.toString());
m_oCurrentProductEdit.setReference(m_jRef.getText());
m_oCurrentProductEdit.setName(m_jName.getText());
m_oCurrentProductEdit.setCode(m_jCode.getText());
Double dPriceBuy = readCurrency(m_jPriceBuy.getText());
if (dPriceBuy != null) {
m_oCurrentProductEdit.setPriceBuy(dPriceBuy);
}
Double dPriceSell = readCurrency(m_jPriceSell.getText());
if (dPriceSell != null) {
m_oCurrentProductEdit.setPriceSell(dPriceSell);
}
m_oCurrentProductEdit.setCategoryID(m_CategoryModel.getSelectedKey().toString());
m_oCurrentProductEdit.setTaxID(taxcatmodel.getSelectedKey().toString());
m_oCurrentProductEdit.setAttributeUseID((attmodel.getSelectedKey() != null) ? attmodel.getSelectedKey().toString() : null);
try {
printProductLabel(m_oCurrentProductEdit);
} catch (TicketPrinterException | ScriptException ex) {
Logger.getLogger(ProductsEditor.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例10: evalScript
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
示例11: setRow
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
示例12: getScriptMenu
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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();
}
示例13: visorTicketLine
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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);
}
}
}
示例14: evalScript
import com.openbravo.pos.scripting.ScriptException; //导入依赖的package包/类
private Object evalScript(ScriptObject scr, String resource, ScriptArg... args) {
// resource here is guaranteed to be not null
try {
scr.setSelectedIndex(m_ticketlines.getSelectedIndex());
return scr.evalScript(dlSystem.getResourceAsXML(resource), args);
} catch (ScriptException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotexecute"), e);
msg.show(this);
return msg;
}
}
示例15: printTicket
import com.openbravo.pos.scripting.ScriptException; //导入依赖的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));
}
}
}