From: Anneli <an...@us...> - 2005-01-11 17:14:31
|
Update of /cvsroot/redpos/RedPOS/src/org/redpos/client/ui/plugin/function In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12515/src/org/redpos/client/ui/plugin/function Added Files: CustomerService.java Log Message: New plugin for displaying information about support --- NEW FILE: CustomerService.java --- /* * RedPOS, the OpenSource Point of Sale * * Copyright (C) 2004-2007 Redpill AB * * This application is free software; you can redistribute * it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This application is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this application; if not, it can be downloaded * from http://www.gnu.org/licenses/lgpl.html. * * For more information and contacts, please visit http://www.redpos.org * */ package org.redpos.client.ui.plugin.function; import javax.management.JMException; import org.eclipse.swt.widgets.Composite; import org.redpos.client.contract.POSEngineUtility; import org.redpos.client.ui.plugin.PluginFunctionMBeanSupport; import org.redpos.client.ui.plugin.contract.PluginFunctionConstants; /** * Information to customer service for RedPOS * * @version <tt>$Revision: 1.1 $</tt> * @author <a href="mailto:an...@us...">anba</a> * @jmx.mbean name = "RedPOS.client.ui.plugin.function:service=CustomerService" * description = "RedPOS client plug-in function" * extends = "org.redpos.client.ui.plugin.PluginFunctionMBean" */ public class CustomerService extends PluginFunctionMBeanSupport implements CustomerServiceMBean { private POSEngineUtility posEngineUtility = null; /** * @see org.redpos.client.ui.plugin.PluginFunctionMBean#invoke(org.eclipse.swt.widgets.Composite) */ public boolean invokeFunction(Composite parent) { ConfirmActionUI.ConfirmListener listener = new ConfirmActionUI.ConfirmListener() { public void selectionMade(int selection) { // send notification fireNotification( PluginFunctionConstants.NOTIFICATION_FUNCTION_FINISHED, null); try { if (posEngineUtility.getLoginPerReceipt()) { fireNotification(PluginFunctionConstants.NOTIFICATION_LOGIN_PER_RECEIPT, null); } } catch(JMException e) { log.error(e.getMessage(), e); } } }; String yesText = ""; String noText = ""; String okText = getLanguageString("ui.main.dashboard.message.ok.text", "OK"); String cancelText = ""; String message = getLanguageString( "ui.plugin.support.customerservice.message.text", "Customer service su...@re..."); ConfirmActionUI confirm = new ConfirmActionUI(parent, message, ConfirmActionUI.OK_SELECTION, listener, yesText, noText, okText, cancelText); parent.layout(); return true; } /** * Invoked when service is started * * @see org.jboss.system.ServiceMBeanSupport#startService() */ protected void startService() throws Exception { super.startService(); setText(getLanguageString("ui.plugin.support.customerservice.text", "Customer Service")); posEngineUtility = new POSEngineUtility(getServer()); } } |