Package net.helipilot50.stocktrade.framework

Examples of net.helipilot50.stocktrade.framework.EventHandle


                UIutils.requestFinalize((JFrame)win);
                break;
            case Constants.SC_ENABLEDSHUTDOWN:
        default:
            Thread th = getOwningThread(e.getWindow());
            FocusHelper.windowClosing(win, new EventHandle[] {new EventHandle(th, "Shutdown")});
            break;
        }
            /*
             * 25/01/06 Commented out below call.
             * If user has made changes and then cancels the close operation, we
View Full Code Here


            // TF:12/10/07:Made sure to disable the event manager posting new events as we rollback the old ones
            boolean isEnabled = EventManager.isPostingEnabled();
            EventManager.disableEventPosting();
            try {
              for (Iterator<EventHandle> it1 = pEventsToPurge.iterator(); it1.hasNext();) {
                EventHandle handle = (EventHandle)it1.next();
                for (ConditionalRunnable r : items) {
                  if (r.getEvent() != null &&
                      r.getEvent().equals(handle.getName()) &&
                      r.getObject().equals(handle.getSourceObject())) {
                    _log.debug("   Purging chain " + pChainId + ":" + r.getRunnable());
                    r.getRunnable().run();
                  }
                }
              }
View Full Code Here

            EventRegistration PushButton_Click_getqq_ExitBtn = ClientEventManager.register( this.getqq_ExitBtn(), "Click" );

            while (true) {

                UIutils.processGUIActions();
                EventHandle qq_currentEvent = EventManager.waitForEvent();
                if (qq_currentEvent == null)
                    break;

                // -------------
                // task.Shutdown
                // -------------
                if (qq_currentEvent.isEvent(TaskHandle_Shutdown_langThreadcurrentThread)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ----------------------
                // TradeSO.OrderProcessed
                // ----------------------
                else if (qq_currentEvent.isEvent(TradeMgr_OrderProcessed_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        Order theProcessedOrder = qq_currentEvent.getParam("pOrder");
                        if (this.getOrderList() != null) {
                            for (Order row : this.getOrderList()) {
                                if (row.getOrderID() == theProcessedOrder.getOrderID()) {
                                    // TODO [1037,Major]: If you are deleting a row inside a loop, use the Iterator in place of the array
                                    this.getOrderList().remove(row);
                                }
                            }
                        }

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------
                // TradeSO.NewOrderAdded
                // ---------------------
                else if (qq_currentEvent.isEvent(TradeMgr_NewOrderAdded_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        Order theNewOrder = qq_currentEvent.getParam("pNewOrder");
                        this.getOrderList().add(theNewOrder);

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ----------------------------
                // <ViewHoldingsBtn>.ObjectDrop
                // ----------------------------
                else if (qq_currentEvent.isEvent(PushButton_ObjectDrop_getqq_ViewHoldingsBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        JComponent theDroppedWidget = qq_currentEvent.getParam("sourceField");
                        int rownum = 0;
                        rownum = TableRow.get(this.getqq_OrderList());
                        CustomerWindow customerWin = new CustomerWindow();
                        customerWin.setUsage(Constants.WU_VIEW);
                        customerWin.display(this.getOrderList().get(rownum-1).getCustomerName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -----------------------
                // <ViewHoldingsBtn>.Click
                // -----------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_ViewHoldingsBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        //self.Window.MessageDialog(MessageText='View Holdings not yet implemented',
                        //              MessageType=MT_INFO);

                        CustomerWindow customerWin = new CustomerWindow();
                        customerWin.display(this.getTraderName());


                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // --------------------
                // <MakeTradeBtn>.Click
                // --------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_MakeTradeBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        //self.Window.MessageDialog(MessageText='Make Trade not yet implemented',
                        //              MessageType=MT_INFO);
                        try {
                            Order buyOrder = null, sellOrder = null;
                            int tradeQuantity = 0;
                            float tradePrice = 0;

                            // ------------------------------------
                            // Parameters for call to ValidateMatch
                            // ------------------------------------
                            ParameterHolder_Order qq_pBuyOrder = new ParameterHolder_Order();
                            ParameterHolder_Order qq_pSellOrder = new ParameterHolder_Order();
                            this.validateMatch(qq_pBuyOrder, qq_pSellOrder);
                            buyOrder = qq_pBuyOrder.get();
                            sellOrder = qq_pSellOrder.get();
                            //self.OrderList.DeleteRow(object=buyOrder);
                            //self.OrderList.DeleteRow(object=sellOrder);
                            new TradeMgr.AsyncRunner(true).makeTrade(TradeSO_proxy.getInstance(), buyOrder, sellOrder, new ParameterHolder_integer(), new ParameterHolder_float());

                            //self.Window.MessageDialog(messagetext='Trade completed successfully',
                            //              messagetype = MT_INFO);

                        }
                        catch (InvalidTradeException badOrder) {
                                WindowManager.messageDialog(this, GenericException.getMessageText(badOrder), GenericException.severity(badOrder), 50);
                        }

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ------------------------
                // TradeSO.MakeTrade_return
                // ------------------------
                else if (qq_currentEvent.isEvent(TradeMgr_MakeTrade_return_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        int outputQuantity = (Integer)qq_currentEvent.getParam("pMTQuantity");
                        float outputPrice = (Float)qq_currentEvent.getParam("pMTPrice");
                        String returnSecName = qq_currentEvent.getParam("return");
                        TextData tempMsg = new TextData();
                        TextData objSecName = new TextData(returnSecName);
                        DecimalData objPrice = new DecimalData(outputPrice);
                        IntegerData objQuantity = new IntegerData(outputQuantity);
                        tempMsg.replaceParameters("Trade for %1 at price $%2 for %3 shares completed successfully", objSecName, objPrice, objQuantity);
                        WindowManager.messageDialog(this, tempMsg, Constants.MT_INFO, 50);

                        //   when TradeSO.MakeTrade_exception do
                        //       self.Window.MessageDialog(
                        //       messagetext = 'Error in trading. The trade was not performed',
                        //       messageType = MT_ERROR);

                        //  badTrade returned as type OBJECT, need to cast to GenericException or
                        // ErroDesc to access message attribute
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------------
                // TradeSO.MakeTrade_exception
                // ---------------------------
                else if (qq_currentEvent.isEvent(TradeMgr_MakeTrade_exception_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        RuntimeException badTrade = qq_currentEvent.getParam("exception");
                        // TODO [1094,Minor]: Exception message has been wrapped in a TextData, ensure this doesn't cause any issues.
                        WindowManager.messageDialog(this, GenericException.getMessageText(((GenericException)badTrade)).getValue(), Constants.MT_ERROR, 50);

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------
                // <ExitBtn>.Click
                // ---------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_ExitBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;
View Full Code Here

    private static void setFocus(final Component onComponent, final Focus event) {
      if (SwingUtilities.isEventDispatchThread()) {
          ActionMgr.addAction(event);
      }
      else {
          EventHandle handle = new EventHandle(onComponent, "dummy, cannot be caught");
          JFrame topLevel = UIutils.getWindowForComponent(onComponent);
          if (topLevel != null) {
            Thread windowThread = WindowManager.getOwningThread(topLevel);
            if (windowThread == null) {
              windowThread = Thread.currentThread();
            }
            handle.setForceReceiptOfEvent(windowThread);
            handle.setPriority(EventHandle.PRIORITY_EDT);
            handle.setReceiptForcedOnTopLevel(true);
            handle.setCommencementNotifier(new Runnable() {
                public void run() {
                  UIutils.waitForEDTToBeIdle();
                  ActionMgr.addAction(event);
                  UIutils.processGUIActions();
                }
View Full Code Here

                EventRegistration PushButton_Click_getqq_ExitBtn = ClientEventManager.register( this.getqq_ExitBtn(), "Click" );
   
                while (true) {
   
                    UIutils.processGUIActions();
                    EventHandle qq_currentEvent = EventManager.waitForEvent();
                    if (qq_currentEvent == null)
                        break;
   
                    // -------------
                    // task.Shutdown
                    // -------------
                    if (qq_currentEvent.isEvent(TaskHandle_Shutdown_langThreadcurrentThread)) {
                        try {
                            CursorMgr.startEvent();
                            // ================ Begin Forte Event Handler Translation ================
                            break;
   
                            // ================ End Forte Event Handler Translation ================
                        }
                        finally {
                            CursorMgr.endEvent();
                        }
                    }
   
                    // ----------------------
                    // TradeSO.OrderProcessed
                    // ----------------------
                    else if (qq_currentEvent.isEvent(TradeMgr_OrderProcessed_getInstance)) {
                        try {
                            CursorMgr.startEvent();
                            // ================ Begin Forte Event Handler Translation ================
                            Order orderOK = qq_currentEvent.getParam("pOrder");
                            if ((this.getCustomerGrid().getCustomerName().isEqual(orderOK.getCustomerName())).getValue()) {
                                this.setCustomerGrid(CustomerSO_proxy.getInstance().getCustomer(orderOK.getCustomerName()));
                            }
   
                            // ================ End Forte Event Handler Translation ================
                        }
                        finally {
                            CursorMgr.endEvent();
                        }
                    }
   
                    // --------------
                    // <BuyBtn>.Click
                    // --------------
                    else if (qq_currentEvent.isEvent(PushButton_Click_getqq_BuyBtn)) {
                        try {
                            CursorMgr.startEvent();
                            // ================ Begin Forte Event Handler Translation ================
                            //self.Quantity = self.Quantity + 100;
                            //self.Window.MessageDialog(MessageText='You bought 100 shares',
                            //              MessageType=MT_INFO);
                            OrderWindow orderWin = new OrderWindow();
                            orderWin.display(this.getCustomerGrid().getCustomerName(), "Buy", (Array_Of_Holding<Holding>)null);

   
                            // ================ End Forte Event Handler Translation ================
                        }
                        finally {
                            CursorMgr.endEvent();
                        }
                    }
   
                    // ---------------
                    // <SellBtn>.Click
                    // ---------------
                    else if (qq_currentEvent.isEvent(PushButton_Click_getqq_SellBtn)) {
                        try {
                            CursorMgr.startEvent();
                            // ================ Begin Forte Event Handler Translation ================
                            //self.Quantity = self.Quantity - 100;
                            //self.Window.MessageDialog(MessageText='You sold 100 shares',
                            //              MessageType=MT_INFO);
                            OrderWindow orderWin = new OrderWindow();
                            orderWin.display(this.getCustomerGrid().getCustomerName(), "Sell", this.getCustomerGrid().getHoldingList());

   
                            // ================ End Forte Event Handler Translation ================
                        }
                        finally {
                            CursorMgr.endEvent();
                        }
                    }
   
                    // ---------------
                    // <ExitBtn>.Click
                    // ---------------
                    else if (qq_currentEvent.isEvent(PushButton_Click_getqq_ExitBtn)) {
                        try {
                            CursorMgr.startEvent();
                            // ================ Begin Forte Event Handler Translation ================
                            break;
   
View Full Code Here

            EventRegistration MenuCommand_Activate_getqq_fileExit = ClientEventManager.register( this.getqq_fileExit(), "Activate" );

            while (true) {

                UIutils.processGUIActions();
                EventHandle qq_currentEvent = EventManager.waitForEvent();
                if (qq_currentEvent == null)
                    break;

                // -------------
                // task.Shutdown
                // -------------
                if (qq_currentEvent.isEvent(TaskHandle_Shutdown_langThreadcurrentThread)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------
                // <AsCustomerBtn>.Click
                // ---------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_AsCustomerBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        CustomerWindow customerWin = new CustomerWindow();
                        new CustomerWindow.AsyncRunner().display(customerWin, this.getLoginName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -------------------
                // <AsTraderBtn>.Click
                // -------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_AsTraderBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        TraderWindow traderWin = new TraderWindow();
                        new TraderWindow.AsyncRunner().display(traderWin, this.getLoginName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -----------------------
                // <AsCustomerMC>.Activate
                // -----------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_AsCustomerMC)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        CustomerWindow customerWin = new CustomerWindow();
                        new CustomerWindow.AsyncRunner().display(customerWin, this.getLoginName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------
                // <AsTraderMC>.Activate
                // ---------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_AsTraderMC)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        TraderWindow traderWin = new TraderWindow();
                        new TraderWindow.AsyncRunner().display(traderWin, this.getLoginName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -------------------
                // <fileExit>.Activate
                // -------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_fileExit)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;
View Full Code Here

   */
    private static int lastCID;

    public SystemAgent() {
        String logLocation = PropertiesMgr.getProperty(PropertiesMgr.cLOGS_LOCATION);
        this.logFile = new File();
        this.logFile.setLocalName(logLocation + "/" + this.getClass().getName() + ".log");
        this.logFile.open(net.helipilot50.stocktrade.framework.Constants.SP_AM_READ_WRITE);

        this.initCmdProcessor();

View Full Code Here

          try {
            if (pValue instanceof TextData) {
              TextData textValue = (TextData) pValue;
              cachedRowSet.updateString(pColOrdinal, textValue.toString());
            } else if (pValue instanceof IntegerData) {
              IntegerData integerValue = (IntegerData) pValue;
              cachedRowSet.updateInt(pColOrdinal, integerValue.getIntegerValue());
            } else if (pValue instanceof DoubleData) {
              DoubleData doubleValue = (DoubleData) pValue;
              cachedRowSet.updateDouble(pColOrdinal, doubleValue.getDoubleValue());
            } else if (pValue instanceof DecimalData) {
              DecimalData value = (DecimalData) pValue;
View Full Code Here

    public void setAttribute (Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
        Instrument instrument = this.findInstrument(attribute.getName());
        if (instrument instanceof ConfigValueInst) {
            DataValue theAttribute = null;
            if (attribute.getValue() instanceof java.lang.Integer) {
                theAttribute = new IntegerData((Integer)attribute.getValue());
            }
            if (attribute.getValue() instanceof java.lang.Double) {
                theAttribute = new DoubleData((Double)attribute.getValue());
            }
            if (attribute.getValue() instanceof java.lang.String) {
View Full Code Here

    public void setIntegerValue(int value) {
        if (scrollList != null) {
            int limit = this.list.getSize();
            for (int i = 0; i < limit; i++) {
                ListElement el = (ListElement)this.list.getElementAt(i);
                if (el.getIntegerValue() == value) {
                    this.list.setSelection(el);
                    return;
                }
            }
        }
View Full Code Here

TOP

Related Classes of net.helipilot50.stocktrade.framework.EventHandle

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.