Package com.ponysdk.sample.client.datamodel

Examples of com.ponysdk.sample.client.datamodel.Pony


        add.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                final Integer i = Integer.parseInt(line.getText());
                final Pony father = dataGrid.getVisibleItem(i);
                final List<Pony> copy = new ArrayList<Pony>();
                for (int j = 0; j < 3; j++) {
                    final Pony p = new Pony(father.getId(), "Copy-" + father.getName(), father.getAge(), father.getRace());
                    copy.add(p);
                }
                dataGrid.insertSubList(father, copy);
            }
        });

        final PButton remove = new PButton("Remove");
        remove.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                final Integer i = Integer.parseInt(line.getText());
                final Pony father = dataGrid.getVisibleItem(i);
                dataGrid.removeSubList(father);
            }
        });

        layout.add(line);
View Full Code Here


            public void onCancel() {}

            @Override
            public boolean onOK(final PDialogBox p) {
                if (createPony.isValid()) {
                    final Pony pony = new Pony(null, nameFormField.getValue(), ageFormField.getValue(), raceFormField.getValue());
                    final CreatePonyCommand command = new CreatePonyCommand(pony);
                    final Pony newPony = command.execute();
                    if (command.isSuccessfull()) {
                        final PonyCreatedEvent event = new PonyCreatedEvent(this, newPony);
                        event.setBusinessMessage("Pony '" + newPony.getName() + "' has been added");
                        fireEvent(event);
                    }
                    return true;
                }
                return false;
View Full Code Here

            public void onCancel() {}

            @Override
            public boolean onOK(final PDialogBox p) {
                if (createPonyActivity.isValid()) {
                    final Pony pony = new Pony(null, nameFormField.getStringValue(), ageFormField.getIntegerValue(), raceFormField.getStringValue());
                    final CreatePonyCommand command = new CreatePonyCommand(pony);
                    final Pony newPony = command.execute();
                    if (command.isSuccessfull()) {
                        final PonyCreatedEvent event = new PonyCreatedEvent(this, newPony);
                        event.setBusinessMessage("Pony '" + newPony.getName() + "' has been added");
                        fireEvent(event);
                    }
                    return true;
                }
                return false;
View Full Code Here

    private final List<PonyStock> stocks = new ArrayList<PonyStock>();

    public PonyServiceImpl() {
        final Random rdm = new Random();
        for (int i = 0; i < 11; i++) {
            addPony(new Pony(id.incrementAndGet(), "Altai horseBengin", rdm.nextInt(10), "Equus ferus caballus"));
            addPony(new Pony(id.incrementAndGet(), "American Warmblood", rdm.nextInt(10), "Equus ferus caballus"));
            addPony(new Pony(id.incrementAndGet(), "Falabella", rdm.nextInt(10), "Equus ferus caballus"));
            addPony(new Pony(id.incrementAndGet(), "Friesian horse", rdm.nextInt(10), "Equus ferus caballus"));
            addPony(new Pony(id.incrementAndGet(), "Mustang", rdm.nextInt(10), "Equus ferus caballus"));
            addPony(new Pony(id.incrementAndGet(), "Altai horse", rdm.nextInt(10), "Equus ferus caballus"));
        }

        initAndPushStock();
    }
View Full Code Here

        return null;
    }

    @Override
    public Result<List<Pony>> findPonyChilds(final Long fatherID) throws Exception {
        final Pony father = ponyByID.get(fatherID);
        final List<Pony> subPonyList = new ArrayList<Pony>();
        subPonyList.add(new Pony(id.incrementAndGet(), father.getName() + " child 1", 1, father.getRace()));
        subPonyList.add(new Pony(id.incrementAndGet(), father.getName() + " child 2", 2, father.getRace()));
        subPonyList.add(new Pony(id.incrementAndGet(), father.getName() + " child 3", 3, father.getRace()));
        return new Result<List<Pony>>(subPonyList);
    }
View Full Code Here

TOP

Related Classes of com.ponysdk.sample.client.datamodel.Pony

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.