Author: jleroux
Date: Fri Apr 2 20:31:12 2010 New Revision: 930373 URL: http://svn.apache.org/viewvc?rev=930373&view=rev Log: A patch from Bob Morley "Resolve java warnings exposed in Eclipse (POS part of OFBIZ-3100)" https://issues.apache.org/jira/browse/OFBIZ-3600 - OFBIZ-3600 Changes across quite a few classes in the Pos area. Also minor changes to the CheckoutHelper - validatePaymentMethods and processPayment methods which were returning non-generic Maps. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/SyncCallbackAdaptor.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PosButton.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/container/JposDeviceContainer.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/DeviceLoader.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/factory/OfbizJposServiceFactory.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/BaseService.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/ScannerKybService.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SelectProduct.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/XFocusDialog.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Fri Apr 2 20:31:12 2010 @@ -558,12 +558,12 @@ public class CheckOutHelper { return result; } - public Map createOrder(GenericValue userLogin) { + public Map<String, Object> createOrder(GenericValue userLogin) { return createOrder(userLogin, null, null, null, false, null, null); } // Create order event - uses createOrder service for processing - public Map createOrder(GenericValue userLogin, String distributorId, String affiliateId, + public Map<String, Object> createOrder(GenericValue userLogin, String distributorId, String affiliateId, List trackingCodeOrders, boolean areOrderItemsExploded, String visitId, String webSiteId) { if (this.cart == null) { return null; @@ -873,19 +873,19 @@ public class CheckOutHelper { return UtilMisc.toList(orderAdj, itemAdj); } - public Map processPayment(GenericValue productStore, GenericValue userLogin) throws GeneralException { + public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin) throws GeneralException { return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, false, false, dispatcher, delegator); } - public Map processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace) throws GeneralException { + public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace) throws GeneralException { return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, faceToFace, false, dispatcher, delegator); } - public Map processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold) throws GeneralException { + public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold) throws GeneralException { return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, faceToFace, manualHold, dispatcher, delegator); } - public static Map processPayment(String orderId, BigDecimal orderTotal, String currencyUomId, GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator) throws GeneralException { + public static Map<String, Object> processPayment(String orderId, BigDecimal orderTotal, String currencyUomId, GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator) throws GeneralException { // Get some payment related strings String DECLINE_MESSAGE = productStore.getString("authDeclinedMessage"); String ERROR_MESSAGE = productStore.getString("authErrorMessage"); @@ -1453,7 +1453,7 @@ public class CheckOutHelper { return accountMap; } - public Map validatePaymentMethods() { + public Map<String, Object> validatePaymentMethods() { String errMsg = null; String billingAccountId = cart.getBillingAccountId(); BigDecimal billingAccountAmt = cart.getBillingAccountAmount(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Fri Apr 2 20:31:12 2010 @@ -39,6 +39,7 @@ import org.ofbiz.base.util.GeneralExcept import org.ofbiz.base.util.Log4jLoggerWriter; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilNumber; import org.ofbiz.base.util.UtilProperties; @@ -403,13 +404,14 @@ public class PosTransaction implements S payInfo.put("cardNumber", cardStr); // masked cardNumber } else if ("GIFT_CARD".equals(paymentMethodTypeId)) { - @SuppressWarnings("unused") + /* GenericValue gc = null; try { gc = infValue.getRelatedOne("GiftCard"); //FIXME is this really useful ? (Maybe later...) } catch (GenericEntityException e) { Debug.logError(e, module); } + */ } } @@ -865,7 +867,7 @@ public class PosTransaction implements S output.print(UtilProperties.getMessage(resource, "PosProcessing", locale)); Map<String, Object> payRes = null; try { - payRes = (Map<String, Object>) ch.processPayment(ProductStoreWorker.getProductStore(productStoreId, session.getDelegator()), session.getUserLogin(), true); + payRes = ch.processPayment(ProductStoreWorker.getProductStore(productStoreId, session.getDelegator()), session.getUserLogin(), true); } catch (GeneralException e) { Debug.logError(e, module); throw e; @@ -1237,7 +1239,7 @@ public class PosTransaction implements S } else{ Integer orderListSize = (Integer) svcRes.get("orderListSize"); if (orderListSize > 0) { - List<GenericValue> orderList = (List<GenericValue>) svcRes.get("orderList"); + List<GenericValue> orderList = UtilGenerics.checkList(svcRes.get("orderList"), GenericValue.class); return orderList; } } @@ -1330,7 +1332,7 @@ public class PosTransaction implements S public boolean restoreOrder(String orderId, PosScreen pos, boolean append) { trace("Restore an order"); - Delegator delegator = session.getDelegator(); + LocalDispatcher dispatcher = session.getDispatcher(); Map<String, Object> svcCtx = FastMap.newInstance(); @@ -1402,11 +1404,6 @@ public class PosTransaction implements S pos.showDialog("dialog/error/exception", UtilProperties.getMessage("OrderErrorUiLabels", "OrderUnableToCreateNewShoppingList", locale)); return; } - Delegator delegator = this.session.getDelegator(); - LocalDispatcher dispatcher = session.getDispatcher(); - GenericValue userLogin = session.getUserLogin(); - String shoppingListId = null; - if (!UtilValidate.isEmpty(shoppingListName)) { // attach the party ID to the cart cart.setOrderPartyId(partyId); @@ -1492,7 +1489,6 @@ public class PosTransaction implements S return result; } - // TODO, I really wonder if there is not a better way to do this (DynamicView excluded because of the contactMechId collisions between phone and email)! private List<Map<String, String>> searchContactMechs(Delegator delegator, PosScreen pos, List<Map<String, String>> partyList, String valueToCompare, String contactMechType) { ListIterator<Map<String, String>> partyListIt = partyList.listIterator(); while(partyListIt.hasNext()) { @@ -1511,7 +1507,7 @@ public class PosTransaction implements S keyType = "contactMech"; key = "infoString"; } - Map<String, Object> keyTypeMap = (Map<String, Object>) partyContactMechValueMap.get(keyType); + Map<String, Object> keyTypeMap = UtilGenerics.checkMap(partyContactMechValueMap.get(keyType)); String keyTypeValue = ((String) keyTypeMap.get(key)).trim(); if (valueToCompare.equals(keyTypeValue) || UtilValidate.isEmpty(valueToCompare)) { if (nb == 1) { Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java Fri Apr 2 20:31:12 2010 @@ -22,7 +22,6 @@ import java.awt.Component; import java.awt.Container; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -49,8 +48,8 @@ public class KeyboardAdaptor { public static final int MSR_DATA = 102; public static final int ALL_DATA = 999; - protected static List loadedComponents = new LinkedList(); - protected static Map receivers = new LinkedHashMap(); + protected static List<Component> loadedComponents = new LinkedList<Component>(); + protected static Map<KeyboardReceiver, Integer> receivers = new LinkedHashMap<KeyboardReceiver, Integer>(); protected static KeyboardAdaptor adaptor = null; protected static boolean running = true; @@ -122,8 +121,8 @@ public class KeyboardAdaptor { // By default keyboard entry (login & password 1st) public Long MAX_WAIT = MAX_WAIT_KEYBOARD; - private List keyCodeData = new LinkedList(); - private List keyCharData = new LinkedList(); + private List<Integer> keyCodeData = new LinkedList<Integer>(); + private List<Character> keyCharData = new LinkedList<Character>(); private long lastKey = -1; private KeyReader reader = null; @@ -174,9 +173,7 @@ public class KeyboardAdaptor { chars[i] = ch.charValue(); } - Iterator ri = KeyboardAdaptor.receivers.keySet().iterator(); - while (ri.hasNext()) { - KeyboardReceiver receiver = (KeyboardReceiver) ri.next(); + for (KeyboardReceiver receiver : receivers.keySet()) { int receiverType = ((Integer) receivers.get(receiver)).intValue(); int thisDataType = this.checkDataType(chars); if (receiverType == ALL_DATA || receiverType == thisDataType) { @@ -184,8 +181,8 @@ public class KeyboardAdaptor { } } - keyCharData = new LinkedList(); - keyCodeData = new LinkedList(); + keyCharData = new LinkedList<Character>(); + keyCodeData = new LinkedList<Integer>(); lastKey = -1; MAX_WAIT = MAX_WAIT_KEYBOARD; } @@ -197,9 +194,7 @@ public class KeyboardAdaptor { protected synchronized void sendEvent(int eventType, KeyEvent event) { lastKey = System.currentTimeMillis(); if (KeyboardAdaptor.receivers.size() > 0) { - Iterator ri = KeyboardAdaptor.receivers.keySet().iterator(); - while (ri.hasNext()) { - KeyboardReceiver receiver = (KeyboardReceiver) ri.next(); + for (KeyboardReceiver receiver : KeyboardAdaptor.receivers.keySet()) { if (receiver instanceof KeyListener) { switch (eventType) { case 1: Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/SyncCallbackAdaptor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/SyncCallbackAdaptor.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/SyncCallbackAdaptor.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/SyncCallbackAdaptor.java Fri Apr 2 20:31:12 2010 @@ -48,7 +48,7 @@ public class SyncCallbackAdaptor impleme this.enabled = enabled; } - protected void internalReceiveEvent(Map context, Object obj) { + protected void internalReceiveEvent(Map<String, Object> context, Object obj) { String ctxSyncId = (String) context.get("entitySyncId"); if (ctxSyncId != null && entitySyncId.equals(ctxSyncId)) { GenericValue entitySync = null; @@ -69,15 +69,15 @@ public class SyncCallbackAdaptor impleme } } - public void receiveEvent(Map context) { + public void receiveEvent(Map<String, Object> context) { this.internalReceiveEvent(context, null); } - public void receiveEvent(Map context, Map result) { + public void receiveEvent(Map<String, Object> context, Map<String, Object> result) { this.internalReceiveEvent(context, result); } - public void receiveEvent(Map context, Throwable error) { + public void receiveEvent(Map<String, Object> context, Throwable error) { this.internalReceiveEvent(context, error); } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java Fri Apr 2 20:31:12 2010 @@ -41,7 +41,7 @@ public class Input implements KeyboardRe "CREDITEXP", "POSTALCODE"}; - protected Stack functionStack = new Stack(); + protected Stack<String[]> functionStack = new Stack<String[]>(); protected Component[] pageComs = null; protected Color lastColor = null; protected javax.swing.JTextField input = null; @@ -112,9 +112,7 @@ public class Input implements KeyboardRe } public String[] getFunction(String function) { - Iterator i = functionStack.iterator(); - while (i.hasNext()) { - String[] func = (String[]) i.next(); + for (String[] func : functionStack) { if (func[0].equals(function)) { return func; } @@ -123,7 +121,7 @@ public class Input implements KeyboardRe } public String[] clearFunction(String function) { - Iterator i = functionStack.iterator(); + Iterator<String[]> i = functionStack.iterator(); while (i.hasNext()) { String[] func = (String[]) i.next(); if (func[0].equals(function)) { @@ -135,9 +133,7 @@ public class Input implements KeyboardRe } public boolean isFunctionSet(String function) { - Iterator i = functionStack.iterator(); - while (i.hasNext()) { - String func[] = (String[]) i.next(); + for (String[] func : functionStack) { if (func[0].equals(function)) { return true; } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java Fri Apr 2 20:31:12 2010 @@ -19,12 +19,10 @@ package org.ofbiz.pos.component; import java.awt.Color; -import java.io.StringWriter; import java.util.Locale; import javax.swing.ListSelectionModel; -import net.xoetrope.data.XDataSource; import net.xoetrope.swing.XScrollPane; import net.xoetrope.swing.XTable; import net.xoetrope.xui.XProject; @@ -196,11 +194,4 @@ public class Journal { } return newNode; } - - private String getModelText(XModel model) - { - StringWriter sw = new StringWriter(); - XDataSource.outputModel(sw, model); - return "<Datasets>" + sw.toString() + "</Datasets>"; - } } \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PosButton.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PosButton.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PosButton.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PosButton.java Fri Apr 2 20:31:12 2010 @@ -18,16 +18,15 @@ *******************************************************************************/ package org.ofbiz.pos.component; +import java.awt.AWTEvent; import java.awt.Component; import java.awt.Container; -import java.awt.AWTEvent; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import net.xoetrope.swing.XButton; -import net.xoetrope.xui.helper.SwingWorker; import net.xoetrope.xui.events.XEventHelper; +import net.xoetrope.xui.helper.SwingWorker; import org.ofbiz.base.config.GenericConfigException; import org.ofbiz.base.util.Debug; @@ -39,7 +38,7 @@ public class PosButton { public static final String module = PosButton.class.getName(); - protected Map loadedXButtons = new HashMap(); + protected Map<String, PosButtonWrapper> loadedXButtons = new HashMap<String, PosButtonWrapper>(); protected PosScreen pos = null; public PosButton(PosScreen pos) { @@ -83,9 +82,7 @@ public class PosButton { } public void setLock(boolean lock) { - Iterator i = loadedXButtons.keySet().iterator(); - while (i.hasNext()) { - String buttonName = (String) i.next(); + for (String buttonName : loadedXButtons.keySet()) { if (this.isLockable(buttonName) && lock) { this.setLock(buttonName, lock); } else { Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/config/ButtonEventConfig.java Fri Apr 2 20:31:12 2010 @@ -170,8 +170,8 @@ public class ButtonEventConfig implement } // two variations are available - Class[] paramTypes1 = new Class[] { PosScreen.class, AWTEvent.class }; - Class[] paramTypes2 = new Class[] { PosScreen.class }; + Class<?>[] paramTypes1 = new Class[] { PosScreen.class, AWTEvent.class }; + Class<?>[] paramTypes2 = new Class[] { PosScreen.class }; Object[] params1 = new Object[] { pos, event }; Object[] params2 = new Object[] { pos }; Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/container/JposDeviceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/container/JposDeviceContainer.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/container/JposDeviceContainer.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/container/JposDeviceContainer.java Fri Apr 2 20:31:12 2010 @@ -18,16 +18,13 @@ *******************************************************************************/ package org.ofbiz.pos.container; -import java.util.Map; - import org.ofbiz.base.container.Container; -import org.ofbiz.base.container.ContainerException; import org.ofbiz.base.container.ContainerConfig; -import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.container.ContainerException; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; import org.ofbiz.pos.device.DeviceLoader; - public class JposDeviceContainer implements Container { public static final String module = JposDeviceContainer.class.getName(); @@ -45,9 +42,8 @@ public class JposDeviceContainer impleme } // load the devices - Map devices = cc.properties; try { - DeviceLoader.load(devices); + DeviceLoader.load(cc.properties); } catch (GeneralException e) { Debug.logInfo("******************************************************", module); Debug.logInfo("Please verify that your receipt printer is connected !", module); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/DeviceLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/DeviceLoader.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/DeviceLoader.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/DeviceLoader.java Fri Apr 2 20:31:12 2010 @@ -50,7 +50,7 @@ public class DeviceLoader { public static Receipt receipt = null; public static Scanner scanner = null; - public static void load(Map devices) throws GeneralException { + public static void load(Map<String, ContainerConfig.Container.Property> devices) throws GeneralException { // load the keyboard if (devices.get("Keyboard") != null) { String keyboardDevice = ((ContainerConfig.Container.Property) devices.get("Keyboard")).value; Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java Fri Apr 2 20:31:12 2010 @@ -70,7 +70,7 @@ public class Keyboard extends GenericDev return; } - List buttonEvents = ButtonEventConfig.findButtonKeyAssign(keyCode); + List<String> buttonEvents = ButtonEventConfig.findButtonKeyAssign(keyCode); if (UtilValidate.isNotEmpty(buttonEvents)) { Debug.log("Key -> Button Mapping(s) Found [" + keyCode + "]", module); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/TestEvents.java Fri Apr 2 20:31:12 2010 @@ -52,7 +52,7 @@ public class TestEvents { NumericKeypad numericKeypad = new NumericKeypad(pos); numericKeypad.setMinus(true); numericKeypad.setPercent(false); - String results = numericKeypad.openDlg(); + numericKeypad.openDlg(); } catch (Exception e) { Debug.logError(e, module); } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/factory/OfbizJposServiceFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/factory/OfbizJposServiceFactory.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/factory/OfbizJposServiceFactory.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/factory/OfbizJposServiceFactory.java Fri Apr 2 20:31:12 2010 @@ -34,7 +34,7 @@ import org.ofbiz.pos.jpos.service.BaseSe public class OfbizJposServiceFactory extends Object implements JposServiceInstanceFactory { public static final String module = OfbizJposServiceFactory.class.getName(); - private static Map serviceMap = new HashMap(); + private static Map<String, Object> serviceMap = new HashMap<String, Object>(); public JposServiceInstance createInstance(String logicalName, JposEntry entry) throws JposException { // check to see if we have a service class property Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/BaseService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/BaseService.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/BaseService.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/BaseService.java Fri Apr 2 20:31:12 2010 @@ -18,9 +18,9 @@ *******************************************************************************/ package org.ofbiz.pos.jpos.service; -import java.util.ArrayList; import java.util.List; -import java.util.Iterator; + +import javolution.util.FastList; import jpos.services.EventCallbacks; import jpos.JposException; @@ -37,7 +37,7 @@ public class BaseService implements jpos public static final String module = BaseService.class.getName(); protected static boolean claimed = false; - protected List eventQueue = new ArrayList(); + protected List<Object> eventQueue = FastList.newInstance(); protected JposEntry entry = null; protected boolean freezeEvents = false; @@ -184,13 +184,9 @@ public class BaseService implements jpos } private void fireQueuedEvents() { - List queuedList = new ArrayList(eventQueue); - this.eventQueue = new ArrayList(); - Iterator i = queuedList.iterator(); - - while (i.hasNext()) { - Object obj = i.next(); - i.remove(); + List<Object> queuedList = new FastList<Object>(eventQueue); + this.eventQueue = FastList.newInstance(); + for (Object obj : queuedList) { this.fireEvent(obj); } } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java Fri Apr 2 20:31:12 2010 @@ -34,6 +34,7 @@ import jpos.services.EventCallbacks; import org.ofbiz.pos.adaptor.KeyboardReceiver; import org.ofbiz.pos.adaptor.KeyboardAdaptor; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; public class KeyboardService extends BaseService implements jpos.services.POSKeyboardService17, KeyboardReceiver, KeyListener { @@ -48,7 +49,7 @@ public class KeyboardService extends Bas protected int keyData = -1; protected KeyEvent lastEvent = null; - protected Map keyMapping = null; + protected Map<Integer, PosKey> keyMapping = null; public KeyboardService() { KeyboardAdaptor.getInstance(this, KeyboardAdaptor.KEYBOARD_DATA); @@ -59,10 +60,10 @@ public class KeyboardService extends Bas super.open(deviceName, ecb); // setup the key mapping - this.keyMapping = new HashMap(); - Enumeration props = entry.getPropertyNames(); + this.keyMapping = new HashMap<Integer, PosKey>(); + Enumeration<String> props = UtilGenerics.cast(entry.getPropertyNames()); while (props.hasMoreElements()) { - String propName = (String) props.nextElement(); + String propName = props.nextElement(); if (propName.startsWith("key.")) { String propValue = (String) entry.getPropertyValue(propName); propName = propName.substring(4); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/ScannerKybService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/ScannerKybService.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/ScannerKybService.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/ScannerKybService.java Fri Apr 2 20:31:12 2010 @@ -27,6 +27,7 @@ import jpos.ScannerConst; import jpos.services.EventCallbacks; import jpos.events.DataEvent; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.pos.adaptor.KeyboardAdaptor; import org.ofbiz.pos.adaptor.KeyboardReceiver; @@ -46,7 +47,7 @@ public class ScannerKybService extends B private static final int TYPELOC_SUFFIX = 60; private static final int TYPELOC_NONE = 99; - protected Map barcodeIdMap = new HashMap(); + protected Map<String, Integer> barcodeIdMap = new HashMap<String, Integer>(); protected byte[] scannedDataLabel = new byte[0]; protected byte[] scannedData = new byte[0]; @@ -171,16 +172,16 @@ public class ScannerKybService extends B private void readCodeMap() { if (barcodeIdMap == null) { - barcodeIdMap = new HashMap(); + barcodeIdMap = new HashMap<String, Integer>(); } if (barcodeIdMap.size() > 0) { return; } - Enumeration names = entry.getPropertyNames(); + Enumeration<String> names = UtilGenerics.cast(entry.getPropertyNames()); if (names != null) { while (names.hasMoreElements()) { - String codeType = (String) names.nextElement(); + String codeType = names.nextElement(); if (codeType.startsWith("CodeType:")) { String codeValue = entry.getProp(codeType).getValueAsString(); if ("CodeType:CODE11".equals(codeType)) { Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java Fri Apr 2 20:31:12 2010 @@ -345,7 +345,6 @@ public class ConfigureItem extends XPage } protected class ListButtonQuestion implements Question, ListQuestion{ - @SuppressWarnings("unused") private XButton button = null; // FIXME a bit weird, but I have no time to clean it up... private XScrollPane scrollpane = null; private ConfigItem question = null; @@ -355,6 +354,10 @@ public class ConfigureItem extends XPage return; } + public XButton getButton() { + return this.button; + } + public void setupButton(XButton button) { this.button = button; button.setText(question.getQuestion()); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/Keyboard.java Fri Apr 2 20:31:12 2010 @@ -19,10 +19,7 @@ package org.ofbiz.pos.screen; import java.awt.Color; - -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.pos.PosTransaction; +import java.util.Locale; import net.xoetrope.swing.XButton; import net.xoetrope.swing.XDialog; @@ -30,9 +27,11 @@ import net.xoetrope.swing.XEdit; import net.xoetrope.xui.PageSupport; import net.xoetrope.xui.XPage; import net.xoetrope.xui.events.XEventHelper; -import java.awt.Panel; -import java.util.Locale; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.pos.PosTransaction; + +@SuppressWarnings("serial") public class Keyboard extends XPage { public static final String module = Keyboard.class.getName(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java Fri Apr 2 20:31:12 2010 @@ -30,6 +30,7 @@ import net.xoetrope.xui.PageSupport; import net.xoetrope.xui.XPage; import net.xoetrope.xui.events.XEventHelper; +@SuppressWarnings("serial") public class NumericKeypad extends XPage { public static final String module = NumericKeypad.class.getName(); @@ -99,11 +100,6 @@ public class NumericKeypad extends XPage xbutton.setVisible(false); } - private void enableButton(String button) { - XButton xbutton = (XButton) m_dialog.findComponent(button); - xbutton.setVisible(true); - } - private void setupEvents() { XButton button = (XButton) m_dialog.findComponent("numOne"); XEventHelper.addMouseHandler(this, button, "triggerOne"); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosDialog.java Fri Apr 2 20:31:12 2010 @@ -48,7 +48,7 @@ import org.ofbiz.base.util.cache.UtilCac public class PosDialog { public static final String module = PosDialog.class.getName(); - protected static UtilCache instances = UtilCache.createUtilCache("pos.Dialogs", 0, 0); + protected static UtilCache<Object, Object> instances = UtilCache.createUtilCache("pos.Dialogs", 0, 0); protected final Frame clientFrame = XProjectManager.getCurrentProject().getAppFrame(); protected final Window appWindow = XProjectManager.getCurrentProject().getAppWindow(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SelectProduct.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SelectProduct.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SelectProduct.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SelectProduct.java Fri Apr 2 20:31:12 2010 @@ -19,7 +19,6 @@ package org.ofbiz.pos.screen; import java.util.Hashtable; -import java.util.Iterator; import java.util.Locale; import java.util.Map; @@ -36,16 +35,17 @@ import org.ofbiz.base.util.UtilPropertie import org.ofbiz.pos.PosTransaction; +@SuppressWarnings("serial") public class SelectProduct extends XPage { /** - * To choose a product in a list of products whith the same bar code + * To choose a product in a list of products with the same bar code */ public static final String module = SelectProduct.class.getName(); protected static PosScreen m_pos = null; protected XDialog m_dialog = null; - static protected Hashtable m_productsMap = new Hashtable(); + static protected Hashtable<String, Object> m_productsMap = new Hashtable<String, Object>(); protected XList m_productsList = null; protected XButton m_cancel = null; protected XButton m_select = null; @@ -55,7 +55,7 @@ public class SelectProduct extends XPage //TODO : make getter and setter for members (ie m_*) if needed (extern calls). For that in Eclipse use Source/Generate Getters and setters - public SelectProduct(Hashtable saleMap, PosTransaction trans, PosScreen page) { + public SelectProduct(Hashtable<String, Object> saleMap, PosTransaction trans, PosScreen page) { m_productsMap.putAll(saleMap); m_trans = trans; m_pos = page; @@ -76,9 +76,7 @@ public class SelectProduct extends XPage XEventHelper.addMouseHandler(this, m_select, "selectProduct"); m_listModel = new DefaultListModel(); - for (Iterator i = m_productsMap.entrySet().iterator(); i.hasNext();) { - Object o = i.next(); - Map.Entry entry = (Map.Entry)o; + for (Map.Entry<String, Object> entry : m_productsMap.entrySet()) { String val = entry.getValue().toString(); m_listModel.addElement(val); } @@ -114,10 +112,7 @@ public class SelectProduct extends XPage private void selectProductId() { if (null != m_productsList.getSelectedValue()) { String product = (String) m_productsList.getSelectedValue(); - Iterator i = m_productsMap.entrySet().iterator(); - while (i.hasNext()) { - Object o = i.next(); - Map.Entry entry = (Map.Entry)o; + for (Map.Entry<String, Object> entry : m_productsMap.entrySet()) { String val = entry.getValue().toString(); if (val.equals(product)) { m_productIdSelected = entry.getKey().toString(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/XFocusDialog.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/XFocusDialog.java?rev=930373&r1=930372&r2=930373&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/XFocusDialog.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/XFocusDialog.java Fri Apr 2 20:31:12 2010 @@ -26,6 +26,7 @@ import net.xoetrope.swing.XDialog; // //import org.ofbiz.base.util.Debug; // +@SuppressWarnings("serial") public class XFocusDialog extends XDialog { // // protected XEdit m_focused = null; |
Free forum by Nabble | Edit this page |