Package org.apache.click.examples.domain

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


        editLink.setParameter("referrer", pagePath);
    }

    public boolean onViewClick() {
        Integer id = viewLink.getValueInteger();
        Customer customerDetail = customerService.getCustomerForID(id);
        addModel("customerDetail", customerDetail);

        return true;
    }
View Full Code Here


        Column column = new Column("name");
        column.setSortable(false);
        column.setDecorator(new Decorator() {
            public String render(Object row, Context context) {
                Customer customer = (Customer) row;
                String email = customer.getEmail();
                String name = customer.getName();
                return "<a href='mailto:" + email + "'>" + name + "</a>";
            }
        });
        table.addColumn(column);

        column = new Column("investments");
        column.setAutolink(true);
        table.addColumn(column);

        column = new Column("holdings");
        column.setFormat("${0,number,#,##0.00}");
        column.setTextAlign("right");
        table.addColumn(column);

        viewLink.setTitle("View customer details");

        editLink.setListener(this, "onEditClick");
        editLink.setTitle("Edit customer details");
        editLink.setParameter("referrer", "/table/table-decorator.htm");

        deleteLink.setTitle("Delete customer record");
        deleteLink.setAttribute("onclick", "return window.confirm('Are you sure you want to delete this record?');");

        column = new Column("Action");
        column.setDecorator(new Decorator() {
            public String render(Object row, Context context) {
                Customer customer = (Customer) row;
                String id = String.valueOf(customer.getId());

                viewLink.setValue(id);
                editLink.setParameter("id", id);
                deleteLink.setValue(id);
View Full Code Here

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

    public boolean onViewClick() {
        Integer id = viewLink.getValueInteger();
        Customer customerDetail = customerService.getCustomerForID(id);
        addModel("customerDetail", customerDetail);
        return true;
    }
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

    @Override
    public void onInit() {
        super.onInit();

        final Customer customer = loadCustomer();

        form.add(fieldSet);

        // Disable fields
        nameField.setDisabled(true);
View Full Code Here

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

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

    }

    public boolean onSaveClick() {
        if (form.isValid()) {
            String id = form.getFieldValue(OBJECT_ID);
            Customer customer = customerService.getCustomerForID(id);
            form.copyTo(customer);
            BaseContext.getThreadObjectContext().commitChanges();
            clearNonHiddenFieldValues(form);
        }
        return true;
View Full Code Here

        customerSelect.setAttribute("onchange", "onCustomerChange(this);");

        List customerList = getCustomerService().getCustomersSortedByName(8);
        for (Iterator i = customerList.iterator(); i.hasNext();) {
            Customer customer = (Customer) i.next();
            customerSelect.add(new Option(customer.getId(), customer.getName()));
        }

        customerSelect.setSize(customerList.size());
    }
View Full Code Here

        super.onInit();

        List customerList = getCustomerService().getCustomers();
        customerSelect.add(new Option(""));
        for (Iterator i = customerList.iterator(); i.hasNext();) {
            Customer customer = (Customer) i.next();
            customerSelect.add(new Option(customer.getId(), customer.getName()));
        }

        if (getContext().isForward() && courseBooking != null) {
            customerSelect.setValueObject(courseBooking.getCustomerId());
            dateField.setDate(courseBooking.getBookingDate());
View Full Code Here

                getBookingService().findCourseBookingByID(id);

            if (courseBooking != null) {
                addModel("courseBooking", courseBooking);

                Customer customer =
                    getCustomerService().findCustomerByID(courseBooking.getCustomerId());
                addModel("customer", customer);
            }
        }
    }
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.