Package org.apache.click.examples.domain

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


     *
     * @see Page#onGet()
     */
    public void onGet() {
        if (id != null) {
            Customer customer = getCustomerService().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 = getCustomerService().getCustomerForID(id);

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

            getCustomerService().saveCustomer(customer);
View Full Code Here

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

    public boolean onEditClick() {
        Integer id = editLink.getValueInteger();
        Customer customer = getCustomerService().getCustomerForID(id);
        if (customer != null) {
            form.setDataObject(customer);
        }
        return true;
    }
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

        return true;
    }

    public boolean onAddClick() {
        if (customerForm.isValid()) {
            Customer customer = new Customer();
            customerForm.copyTo(customer);
            customerService.saveCustomer(customer);

            // The FormTable customer was set in the onInit phase. Since we just
            // added a new customer we refresh the FormTable row list
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

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

        final Customer customer = loadCustomer();

        form.add(fieldSet);

        // Disable fields
        nameField.setDisabled(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

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.