Package com.ponysdk.sample.command.pony

Examples of com.ponysdk.sample.command.pony.FindPonysCommand


                UIContext.getRootEventBus().fireEvent(new DemoBusinessEvent(msg));
            }
        });

        final Query query = new Query();
        final FindPonysCommand command = new FindPonysCommand(query);
        final Result<List<Pony>> ponys = command.execute();

        final List<String> datas = new ArrayList<String>();
        for (final Pony pony : ponys.getData()) {
            datas.add(pony.getName());
        }
        suggestOracle.addAll(datas);
        suggestOracle.setDefaultSuggestions(datas.subList(0, 5));

        panel.add(suggestBox);

        panel.add(new PHTML("<br><br>"));

        panel.add(new PLabel("Manipulate the suggest box:"));
        final PListBox operation = new PListBox(true);
        operation.addItem("Select \"Friesian horse\"", 0);
        operation.addItem("Get textbox value", 1);
        operation.addItem("Enable/Disable textbox", 2);
        operation.addItem("Clear", 3);
        operation.addItem("Add items", 4);
        operation.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final Integer item = (Integer) operation.getSelectedValue();
                if (item == null) return;

                if (item.equals(0)) {
                    suggestBox.setText("Friesian horse");
                } else if (item.equals(1)) {
                    UIContext.getRootEventBus().fireEvent(new DemoBusinessEvent("Text content: " + suggestBox.getText()));
                } else if (item.equals(2)) {
                    suggestBox.getTextBox().setEnabled(!suggestBox.getTextBox().isEnabled());
                } else if (item.equals(3)) {
                    final PMultiWordSuggestOracle oracle = (PMultiWordSuggestOracle) suggestBox.getSuggestOracle();
                    oracle.clear();
                } else if (item.equals(4)) {
                    current++;
                    final Result<List<Pony>> ponys = command.execute();
                    for (final Pony pony : ponys.getData()) {
                        suggestOracle.add(pony.getName() + " " + current);
                    }
                }
            }
View Full Code Here


        final RemoteDataProvider<Pony> dataProvider = new RemoteDataProvider<Pony>(pager, dataGrid) {

            @Override
            protected List<Pony> getData(final Query query) {
                final Result<List<Pony>> result = new FindPonysCommand(query).execute();
                final List<Pony> data = result.getData();
                final int fullSize = result.getFullSize();
                pager.process(fullSize);
                selector.reset();
                selector.setPageSize(data.size());
                selector.setFullSize(fullSize);
                return data;
            }

            @Override
            protected List<Pony> getFullData(final Query query) {
                return new FindPonysCommand(query).execute().getData();
            }

        };

        final DataGridColumnDescriptor<Pony, Pony> selectColumnDescriptor = new DataGridColumnDescriptor<Pony, Pony>();
View Full Code Here

        complexListActivity.setCommandFactory(new ComplexListCommandFactory<Pony>() {

            @Override
            public Command<Result<List<Pony>>> newFindCommand(final ComplexListActivity<Pony> complexListActivity, final Query query) {
                return new FindPonysCommand(query) {

                    @Override
                    protected void doAfterSuccess(final Result<List<Pony>> result) {
                        for (final Pony pony : result.getData()) {
                            if (!raceSearchFormFieldRenderer.hasItem(pony.getRace())) raceSearchFormFieldRenderer.addItem(pony.getRace());
View Full Code Here

        tree.addItem(firstItem);
        tree.addItem(secondItem);
        tree.addItem(thirdItem);

        final Query query = new Query();
        final FindPonysCommand command = new FindPonysCommand(query);
        final Result<List<Pony>> ponys = command.execute();

        for (final Pony pony : ponys.getData()) {
            firstItem.addItem(pony.getName());
            secondItem.addItem(pony.getName());
            thirdItem.addItem(pony.getName());
View Full Code Here

    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PFlowPanel flowPanel = new PFlowPanel();

        FindPonysCommand command = new FindPonysCommand(new Query());
        List<Pony> ponyList = command.execute().getData();

        for (Pony pony : ponyList) {
            flowPanel.add(new PCheckBox(pony.getName()));
        }
View Full Code Here

TOP

Related Classes of com.ponysdk.sample.command.pony.FindPonysCommand

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.