Package org.apache.openjpa.trader.domain

Examples of org.apache.openjpa.trader.domain.Trader


    public Trader login(String trader) {
        for (Trader t : _traders) {
            if (t.getName().equals(trader))
                return t;
        }
        Trader t = new Trader(trader);
        _traders.add(t);
        return t;
    }
View Full Code Here


        });
       
        // Counter Party
        setRenderer(3, new GridCellRenderer<Trade>() {
            public Widget render(Trade t) {
                Trader cpty = session.getTrader().equals(t.getBuyer()) ? t.getSeller() : t.getBuyer();
                return new Label(cpty.getName());
           }
        });
    }
View Full Code Here

     * On receipt of the event determines if it is relevant for this instance.
     * Because an instance display either the Trades sold or bought.
     * If relevant then updates the display.
     */
    public void onTradeCommitted(ServiceEvent.TradeCommitted event) {
        Trader trader = session.getTrader();
        Trade trade = event.getPayload();
        if ((trader.equals(trade.getSeller()) && _type == Ask.class)
         || (trader.equals(trade.getBuyer())  && _type == Bid.class)) {  
            insert(trade);
        }
    }
View Full Code Here

        final RadioButton[] buttons = new RadioButton[matches.size()];
        if (!matches.isEmpty()) {
            for (int i = 0;  i < matches.size(); i++) {
                Match match = matches.get(i);
                Tradable t2 = ask ? match.getBid() : match.getAsk();
                Trader cpty = ask ? match.getBid().getBuyer() : match.getAsk().getSeller();
                buttons[i] = new RadioButton("matches");
                buttons[i].setValue(i == 0);
                body.setWidget(i, 0, buttons[i]);
                body.setWidget(i, 1, FormatUtil.formatPrice(t2.getPrice()));
                body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume()));
                body.setText(i, 3, " by " + cpty.getName());
            }
           
            Button act = new Button(ask ? "Sell" : "Buy");
            act.setFocus(true);
            body.setWidget(matches.size()+1, 1, act);
View Full Code Here

    }

    public Trader login(String traderName) {
        EntityManager em = getEntityManager();
        begin();
        Trader trader = em.find(Trader.class, traderName);
        if (trader == null) {
            trader = new Trader(traderName);
            em.persist(trader);
        }
        commit();
        return trader;
    }
View Full Code Here

                Stock stock = new Stock((String)d[0], (String)d[0], (Sector)d[1], (Double)d[2]);
                em.persist(stock);
            }
       
            for (int i = 0; i < 4; i++) {
                Trader trader = new Trader("Trader-"+i);
                em.persist(trader);
            }
            stocks = em.createQuery(GET_ALL_STOCKS, Stock.class).getResultList();
        }
        commit();
View Full Code Here

TOP

Related Classes of org.apache.openjpa.trader.domain.Trader

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.