Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PSimplePanel


        header1Child.setWidth("100%");
        header1Child.add(new PAnchor("Element 1.1"));
        header1Child.add(new PAnchor("Element 1.2"));
        header1Child.add(new PAnchor("Element 1.3"));
        header1Child.add(new PAnchor("Element 1.4"));
        final PSimplePanel container = new PSimplePanel();
        container.setWidget(header1Child);
        return container;
    }
View Full Code Here


    private PSimplePanel getHeader2Child() {
        header2Child.setWidth("100%");
        header2Child.add(new PCheckBox("checkbox 1"));
        header2Child.add(new PCheckBox("checkbox 2"));
        header2Child.add(new PCheckBox("checkbox 3"));
        final PSimplePanel container = new PSimplePanel();
        container.setWidget(header2Child);
        return container;
    }
View Full Code Here

        super.onFirstShowPage();

        scroll = new PScrollPanel();
        layout = new PFlowPanel();
        actions = new PFlexTable();
        listContainer = new PSimplePanel();

        scroll.setWidget(layout);
        layout.add(actions);
        layout.add(listContainer);
View Full Code Here

        super.onFirstShowPage();

        final PScrollPanel scroll = new PScrollPanel();
        final PFlowPanel layout = new PFlowPanel();
        final PFlexTable formContainer = new PFlexTable();
        final PSimplePanel listContainer = new PSimplePanel();
        layout.add(formContainer);

        final PButton add = new PButton("Add");
        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);
        layout.add(add);
        layout.add(remove);
        layout.add(listContainer);
        scroll.setWidget(layout);
        examplePanel.setWidget(scroll);

        // Register handler
        addHandler(SubmitFormEvent.TYPE, this);

        final Pager<Pony> pager = new Pager<Pony>(new DefaultPagerView());
        dataGrid = new DataGridActivity<Pony>(new DefaultSimpleListView());

        final DefaultActionSelectorView actionSelectorView = new DefaultActionSelectorView();
        final DefaultInfoSelectorView infoSelectorView = new DefaultInfoSelectorView();
        final CompositeSelectorView selectorView = new CompositeSelectorView(actionSelectorView, infoSelectorView);
        final Selector<Pony> selector = new Selector<Pony>(selectorView);

        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>();
        selectColumnDescriptor.setHeaderCellRenderer(new StringHeaderCellRenderer("Select"));
        selectColumnDescriptor.setValueProvider(new IdentityValueProvider<Pony>());
        final CellRenderer<Pony> selectCellRenderer = new CellRenderer<Pony>() {

            @Override
            public IsPWidget render(final int row, final Pony value) {
                final SelectorCheckBox<Pony> selectorCheckBox = new SelectorCheckBox<Pony>();
                selectorCheckBox.setData(value);
                selectorCheckBox.addSelectableListener(selector);
                selector.registerSelectable(selectorCheckBox);

                selectorCheckBox.addValueChangeHandler(new PValueChangeHandler<Boolean>() {

                    @Override
                    public void onValueChange(final PValueChangeEvent<Boolean> event) {
                        if (event.getValue()) {
                            selectorCheckBox.onCheck();
                            dataGrid.selectRow(value);

                        } else {
                            selectorCheckBox.onUncheck();
                            dataGrid.unSelectRow(value);

                        }
                    }
                });

                return selectorCheckBox;
            }
        };
        selectColumnDescriptor.setCellRenderer(selectCellRenderer);
        selectColumnDescriptor.setSubCellRenderer(selectCellRenderer);

        final DataGridColumnDescriptor<Pony, Pony> descriptor = new DataGridColumnDescriptor<Pony, Pony>();
        descriptor.setHeaderCellRenderer(new HeaderCellRenderer() {

            @Override
            public IsPWidget render() {
                return new PLabel();
            }
        });

        final DataGridColumnDescriptor<Pony, String> nameColumnDescriptor = new DataGridColumnDescriptor<Pony, String>();
        final ComplexHeaderCellRenderer nameHeaderCellRender = new FilterableHeaderCellRenderer("Name", new StringTextBoxFormField(), "name");
        nameHeaderCellRender.addFilterListener(dataProvider);
        nameColumnDescriptor.setHeaderCellRenderer(nameHeaderCellRender);
        nameColumnDescriptor.setValueProvider(new BeanValueProvider<Pony, String>("name"));
        nameColumnDescriptor.setCellRenderer(new LabelCellRenderer<String>());
        nameColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        nameColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        final PListBox ageListBox = new PListBox(true);
        for (int i = 0; i < 30; i++)
            ageListBox.addItem(i + " year", i);

        final DataGridColumnDescriptor<Pony, String> ageColumnDescriptor = new DataGridColumnDescriptor<Pony, String>();
        ageColumnDescriptor.setValueProvider(new BeanValueProvider<Pony, String>("age"));
        final ComplexHeaderCellRenderer ageHeaderCellRender = new ComplexHeaderCellRenderer("Age", new ListBoxFormField<Integer>(ageListBox), "age");
        ageHeaderCellRender.addFilterListener(dataProvider);
        ageColumnDescriptor.setHeaderCellRenderer(ageHeaderCellRender);
        ageColumnDescriptor.setCellRenderer(new LabelCellRenderer<String>());
        ageColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        final DataGridColumnDescriptor<Pony, String> raceColumnDescriptor = new DataGridColumnDescriptor<Pony, String>();
        raceColumnDescriptor.setValueProvider(new BeanValueProvider<Pony, String>("race"));
        final ComplexHeaderCellRenderer raceHeaderCellRender = new ComplexHeaderCellRenderer("Race", new StringTextBoxFormField(), "race");
        raceHeaderCellRender.addFilterListener(dataProvider);
        raceColumnDescriptor.setHeaderCellRenderer(raceHeaderCellRender);
        raceColumnDescriptor.setCellRenderer(new LabelCellRenderer<String>());
        raceColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        dataGrid.addDataGridColumnDescriptor(selectColumnDescriptor);
        dataGrid.addDataGridColumnDescriptor(nameColumnDescriptor);
        dataGrid.addDataGridColumnDescriptor(ageColumnDescriptor);
        dataGrid.addDataGridColumnDescriptor(raceColumnDescriptor);

        dataProvider.registerHasCriteria(ageHeaderCellRender);
        dataProvider.registerHasCriteria(nameHeaderCellRender);
        dataProvider.registerHasCriteria(raceHeaderCellRender);

        formContainer.setWidget(0, 0, actionSelectorView);

        final PButton refresh = new PButton("Refresh");
        refresh.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                dataProvider.onPageChange(0);
            }
        });
        formContainer.setWidget(0, 1, refresh);

        final PButton addPonyButton = new PButton("Create new pony");
        addPonyButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                showCreatePonyPopup();
            }

        });
        addPonyButton.addStyleName(PonySDKTheme.BUTTON_GREEN);
        formContainer.setWidget(0, 2, addPonyButton);

        formContainer.setWidget(0, 3, pager.asWidget());
        formContainer.setWidget(0, 4, infoSelectorView);

        // Build create pony form
        buildCreatePonyActivity();

        dataProvider.onPageChange(0);

        listContainer.setWidget(dataGrid);

    }
View Full Code Here

                cell.setValue(d.getValueProvider().getValue(data));
                cell.setW(d.getCellRenderer().render(row, cell.getValue()));
                map.put(d, cell);
                view.addWidget(cell.getW(), cell.getCol(), cell.getRow() + 1, 1);
            }
            view.addWidget(new PSimplePanel(), col, row + 1, 1);
            view.addRowStyle(row + 1, PonySDKTheme.SIMPLELIST_ROW);

        } else {

            final D previousData = valueByKey.remove(key);
View Full Code Here

        dialogBox.center();
    }

    private void buildCreatePonyActivity() {

        createPonyActivityPanel = new PSimplePanel();
        createPonyActivity = new FormActivity(new DefaultFormView("Create a Pony"));
        nameFormField = new FormField(new TextBoxFormFieldRenderer("Name"));
        ageFormField = new FormField(new TextBoxFormFieldRenderer("Age"));
        raceFormField = new FormField(new TextBoxFormFieldRenderer("Race"));
View Full Code Here

        layout.add(new PLabel("Pony SDK styling use Less CSS. It's really easy to customize your styling with the use of a few variable."));
        layout.add(new PLabel("Customize the sample by changing this variables :"));

        final Form form = new Form();

        final PSimplePanel headerPreview = new PSimplePanel();
        final PSimplePanel headerTextColorPreview = new PSimplePanel();
        final PSimplePanel footerPreview = new PSimplePanel();
        final PSimplePanel footerTextColorPreview = new PSimplePanel();
        final PSimplePanel highlightPreview = new PSimplePanel();

        final PSimplePanel blackPreview = new PSimplePanel();
        final PSimplePanel grayDarkerPreview = new PSimplePanel();
        final PSimplePanel grayDarkPreview = new PSimplePanel();
        final PSimplePanel grayPreview = new PSimplePanel();
        final PSimplePanel grayLightPreview = new PSimplePanel();
        final PSimplePanel grayLighterPreview = new PSimplePanel();
        final PSimplePanel whitePreview = new PSimplePanel();

        header = buildColorFormField("498BF4", headerPreview);
        headerTextColor = buildColorFormField("EDEDED", headerTextColorPreview);
        footer = buildColorFormField("498BF4", footerPreview);
        footerTextColor = buildColorFormField("EDEDED", footerTextColorPreview);
View Full Code Here

        examplePanel.setWidget(dockLayoutPanel);
    }

    protected void addTabContent(final PTabPanel tabPanel) {
        final PSimplePanel tabContent = new PSimplePanel();

        final int tabIndex = tabCount;
        final PLabel label = new PLabel("content-" + tabIndex);
        tabContent.setWidget(label);
        tabPanel.add(tabContent, "Tab-" + tabIndex);
        tabCount++;
    }
View Full Code Here

        tabPanel.add(tabContent, "Tab-" + tabIndex);
        tabCount++;
    }

    protected void addCustomTabContent(final PTabPanel tabPanel) {
        final PSimplePanel tabContent = new PSimplePanel();

        final int tabIndex = tabCount;
        final PLabel tabLabel = new PLabel("CustomTab-" + tabIndex);
        tabLabel.setStyleProperty("color", "blue");
        tabLabel.setStyleProperty("whiteSpace", "nowrap");
        final PLabel label = new PLabel("content-" + tabIndex);
        tabContent.setWidget(label);
        tabPanel.add(tabContent, tabLabel);
        tabCount++;
    }
View Full Code Here

        field6Renderer.addItem("Choice 5");
        field6Renderer.addItem("Choice 6");
        field6Renderer.setSelectedItem("Choice 2");
        field6Renderer.setSelectedItem("Choice 3");

        final PSimplePanel formLayout = new PSimplePanel();
        layout.add(formLayout);
        formActivity.start(formLayout);

        final PButton validateButton = new PButton("Validate");
        validateButton.addClickHandler(new PClickHandler() {
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PSimplePanel

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.