Package org.apache.click.examples.domain

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


    /**
     * @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")) {
            if (NumberUtils.isDigits(value)) {
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

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

            if (customer != null) {
                // Copy customer data to form. The idField value will be set by
                // this call
                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

    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

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

            customerService.saveCustomer(customer);

            form.clearValues();
View Full Code Here

                bookingService.findCourseBookingByID(id);

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

                Customer customer =
                    customerService.findCustomerByID(courseBooking.getCustomerId());
                addModel("customer", customer);
            }
        }
    }
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 Object[] { new Double(total) });
View Full Code Here

        return true;
    }

     public boolean onInsertClick() {
        Customer customer = new Customer();
        customer.setName("Alpha");
        customer.setDateJoined(new Date());
        customerService.saveCustomer(customer);

        // The FormTable customer were already set in the onInit phase. Because
        // a customer was deleted we refresh the FormTable row list
        refreshTableCustomers();
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.