Package org.apache.openjpa.trader.domain

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


        refreshTimer = new Timer() {
            @Override
            public void run() {
                int n = getRowCount();
                for (int i = 0; i < n; i++) {
                    Tradable t = get(i);
                    if (t != null) {
                        session.getService().refresh(t, new RefreshTradableCallback());
                    }
                }
            }
View Full Code Here


    @Override
    public void onStockUpdated(ServiceEvent.StockUpdated event) {
        int n = getRowCount();
        Stock updatedStock = event.getPayload();
        for (int i = 0; i < n; i++) {
            Tradable t = get(i);
            if (updatedStock.equals(t.getStock())) {
                t.updateStock(updatedStock);
                update(t, new Integer[]{1,4});
            }
        }
    }
View Full Code Here

        FlexTable body = new FlexTable();
        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);
            act.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    for (int i = 0; i < buttons.length; i++) {
                        if (buttons[i].getValue()) {
                            Match match = matches.get(i);
                            Tradable t = ask ? match.getAsk() : match.getBid();
                            session.getService().trade(match, new TradeCallback(t));
                            hide(true);
                        }
                    }
                }
View Full Code Here

TOP

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

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.