Package cometedgwt.auction.entity

Examples of cometedgwt.auction.entity.AuctionItem


        table.setText(0, 2, "Price");
        table.setText(0, 3, "My bid");

        for (int i = 0; i < itens.size(); i++) {

            final AuctionItem item = (AuctionItem) itens.get(i);

            final int itemId = item.getId();
            final Label labelNumberOfBids = new Label(String.valueOf(item.getNumberOfBids()));
            final Label labelPrice = new Label("$ " + String.valueOf(item.getPrice()));
            final TextBox txtBoxMyBid = new TextBox();
            final Button bidButton = new Button("Bid!");
            final Label labelMessage = new Label("");

            bidButton.setStylePrimaryName("principal");

            //Save itemPrice Label to be used when new bids are processed.
            mapOfItemPrices.put(new Integer(itemId), labelPrice);
            //Save numberOfBids Label to be used when new bids are processed.
            mapOfNumberOfBids.put(new Integer(itemId), labelNumberOfBids);

            //Handle ENTER key
            txtBoxMyBid.addKeyboardListener(new KeyboardListener() {

                public void onKeyUp(Widget sender, char keyCode, int modifiers) {
                    if (keyCode == '\r') {
                        sendNewBid(item, txtBoxMyBid, labelMessage);
                    }
                }

                public void onKeyDown(Widget sender, char keyCode, int modifiers) {
                }

                public void onKeyPress(Widget sender, char keyCode, int modifiers) {
                }
            });

            //Handle button click
            bidButton.addClickListener(new ClickListener() {

                public void onClick(Widget sender) {
                    sendNewBid(item, txtBoxMyBid, labelMessage);
                }
            });

            table.setText(i + 1, 0, item.getName());
            table.setWidget(i + 1, 1, labelNumberOfBids);
            table.setWidget(i + 1, 2, labelPrice);
            table.setWidget(i + 1, 3, txtBoxMyBid);
            table.setWidget(i + 1, 4, bidButton);
            table.setWidget(i + 1, 5, labelMessage);
View Full Code Here


    private List getAuctionItens() {

        //TODO Get them from server side.

        AuctionItem item1 = new AuctionItem(0, "???? Nokia N80", 100.0f);
        AuctionItem item2 = new AuctionItem(1, "Laptop Apple PowerBook G4 17''", 1050.0f);
        AuctionItem item3 = new AuctionItem(2, "Canon Rebel XT", 800.0f);

        List itens = new ArrayList();
        itens.add(item1);
        itens.add(item2);
        itens.add(item3);
View Full Code Here

TOP

Related Classes of cometedgwt.auction.entity.AuctionItem

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.