Package org.apache.click.examples.domain

Examples of org.apache.click.examples.domain.Customer


     * @see Page#onGet()
     */
    @Override
    public void onGet() {
        if (id != null) {
            Customer customer = customerService.getCustomerForID(id);

            if (customer != null) {
                form.copyFrom(customer);
            }
        }
View Full Code Here


    }

    public boolean onOkClick() {
        if (form.isValid()) {
            Integer id = (Integer) idField.getValueObject();
            Customer customer = customerService.getCustomerForID(id);

            if (customer == null) {
                customer = new Customer();
            }
            form.copyTo(customer);

            customerService.saveCustomer(customer);
View Full Code Here

    /**
     * @see org.apache.click.Page#onPost()
     */
    @Override
    public void onPost() {
        Customer customer = null;
        String value = textField.getValue().trim();
        String type = typeSelect.getValue().toLowerCase();

        if (type.equals("id")) {
            customer = customerService.findCustomerByID(value);
View Full Code Here

     *
     * @return true
     */
    public boolean onOkClicked() {
        if (form.isValid()) {
            Customer customer = new Customer();
            form.copyTo(customer);

            customerService.saveCustomer(customer);

            form.clearValues();
View Full Code Here

    // --------------------------------------------------------- Event Handlers

    public boolean onEditClick() {
        Integer id = editLink.getValueInteger();
        Customer customer = customerService.getCustomerForID(id);
        if (customer != null) {
            form.setDataObject(customer);
        }
        return true;
    }
View Full Code Here

    public Customer getCustomerForID(Object id) {
        return (Customer) getObjectForPK(Customer.class, id);
    }

    public void deleteCustomer(Integer id) {
        Customer customer = getCustomerForID(id);
        if (customer != null) {
            deleteObject(customer);
            commitChanges();
        }
    }
View Full Code Here

    public ActionResult onChangeCustomer() {
        ActionResult actionResult = new ActionResult();

        // Lookup customer based on request parameter 'customerId'
        String customerId = getContext().getRequest().getParameter("customerId");
        Customer customer = customerService.findCustomerByID(customerId);

        // CustomerPanel will render the customer as an HTML snippet
        CustomerPanel customerPanel = new CustomerPanel(this, customer);
        actionResult.setContent(customerPanel.toString());
View Full Code Here

        super.onInit();

        if (getContext().isForward() && courseBooking != null) {
            courseField.setValueObject(courseBooking);

            Customer customer =
                customerService.findCustomerByID(courseBooking.getCustomerId());

            addModel("customer", customer);
            addModel("courseBooking", courseBooking);
        }
View Full Code Here

     * @param buffer the buffer to render the totals footer to
     */
    private void renderTotalHoldingsFooter(HtmlStringBuffer buffer) {
        double total = 0;
        for (int i = 0; i < table.getRowList().size(); i++) {
            Customer customer = (Customer) table.getRowList().get(i);
            if (customer.getHoldings() != null) {
                total += customer.getHoldings().doubleValue();
            }
        }

        String format = "<b>Total Holdings</b>: &nbsp; ${0,number,#,##0.00}";
        String totalDisplay = MessageFormat.format(format, new Double(total));
View Full Code Here

        addControl(editLink);
        editLink.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                Customer customer = customerService.getCustomerForID(editLink.getValue());
                return new ActionResult("Edit Clicked for customer: " + customer.getName(), ActionResult.TEXT);
            }
        });

        addControl(deleteLink);
        deleteLink.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                Customer customer = customerService.getCustomerForID(deleteLink.getValue());
                return new ActionResult("Delete Clicked for customer: " + customer.getName(), ActionResult.TEXT);
            }
        });

        table.getControlLink().addBehavior(new DefaultAjaxBehavior() {
View Full Code Here

TOP

Related Classes of org.apache.click.examples.domain.Customer

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.