You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nikola Vulovic <ni...@gmail.com> on 2013/05/19 16:17:27 UTC

FormFragment checkbox not working

[image: Inline image 1]
Code is provided attachments
Some please tell me why is FormFragment displaying

-- 
nkv1

RE: FormFragment checkbox not working

Posted by Nomen Nomanum <ge...@outlook.com>.
Try adding @Persist(PersistenceConstant.FLASH) to your renew and see how would it behave. 

From: getibicus@outlook.com
To: users@tapestry.apache.org
Subject: RE: FormFragment checkbox not working
Date: Sun, 19 May 2013 20:53:42 +0100




Pozdrav Nikola!
Could you be more specific about what troubles you? From the code, it looks more-less just fine. What is it supposed to do?

Date: Sun, 19 May 2013 17:28:02 +0200
Subject: Re: FormFragment checkbox not working
From: nivukiki@gmail.com
To: users@tapestry.apache.org

tml file
                
            <html t:type="layout" title="${message:title}"      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
      xmlns:p="tapestry:parameter">    <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->

    <!-- A Zone is a component that can be updated in place, triggered by other components. -->
    <t:navbar/>    <t:finances/>    <t:if t:test="clientExists">        <t:delegate to="block:addExpenseBlock"/>        <t:delegate to="block:currencySelectBlock"/>
        <t:delegate to="block:myExpenseListBlock"/>        <t:delegate to="block:trustedExpenseListBlock"/>        <t:if t:test="admin">
            <t:delegate to="block:fullExpenseListBlock"/>        </t:if>    </t:if>    <t:block id="addExpenseBlock">        <t:zone t:id="addExpenseZone">
            <t:form t:id="addExpenseForm">                <table  border="0">                    <thead>                        <tr>
                            <th colspan="2">                                Add new expense form                    <hr/>                    </th>                    </tr>
                    </thead>                    <tbody>                        <tr>                            <td>                    <t:label for="recepient"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="recepient" value="recepientValue"/>
                    </td>                    </tr>                    <tr>                        <td>
                    <t:label for="purposeOfPayment"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="purposeOfPayment" value="purposeOfPaymentValue"/>
                    </td>                    </tr>                    <tr>                    <td>                    <t:label for="currency"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="currency" value="currencyValue"/>
                    </td>                    </tr>                    <tr>                        <td>                    <t:label for="amount"/>(*):
                    </td>                    <td>                        <input  type="number" step="any"  t:type="TextField" t:id="amount" value="amountValue"/>
                    </td>                    </tr>                    <tr>                        <td>                    <t:label for="renew"/>:
                    </td>                    <td>                    <t:checkbox t:id="renew"                                t:mixins="triggerfragment" fragment="f1"/>
                    </td>                    </tr>                    <t:formfragment t:id="f1" visible="renew" hide="fade">                        <tr>
                            <td colspan="2">                                Calculate payment from                            </td>                        </tr>
                        <tr>                            <td>                        <t:label for="dateOfPayment"/>(*):                        </td>
                        <td>                            <input type="date"  t:type="TextField" t:id="dateOfPayment" value="dateOfPaymentValue" />
                        </td>                        </tr>                        <tr>                            <td colspan="2">                                Repeat payment every
                            </td>                        </tr>                        <tr>                            <td>                        <t:label for="number"/>(*):
                        </td>                        <td>                            <input type="number" t:type="TextField" t:id="number"  value="numberValue"/>
                        </td>                        </tr>                        <tr>                            <td>                        <t:label for="timeUnit"/>(*):
                        </td>                        <td>                            <select t:type="Select" t:id="timeUnit" t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
                        </td>                        </tr>                        <tr>                            <td colspan="2">                                Calculate payment until
                            </td>                        </tr>                        <tr>                            <td>                        <t:label for="endDate"/>(*):
                        </td>                        <td>                            <input type="date"  t:type="TextField" t:id="endDate" value="endDateValue" />
                        </td>                        </tr>                    </t:formfragment>                    <tr>                        <td>
                            <input t:type="Submit" t:id="add" value="Add expense"/>                        </td>                        <td>
                            <input type="reset" value="Reset" />                        </td>                    </tr>                    </tbody>
                </table>                <t:errors/>            </t:form>        </t:zone>    </t:block>
    <t:block id="currencySelectBlock">
        <t:zone t:id="currencySelectZone">            <t:form t:id="currencySelectForm">                <table  border="0">                    <thead>
                        <tr>                            <th colspan="2">                                Select currency form                    <hr/>
                    </th>                    </tr>                    </thead>                    <tbody>                        <tr>
                            <td>                    <t:label for="tableCurrency"/>(*):                    </td>                    <td>                        <input t:type="TextField" t:id="tableCurrency" value="tableCurrencyValue"/>
                    </td>                    </tr>                    <tr>                        <td>                            <input t:type="Submit" t:id="selectCurrency" value="Select Currency"/>
                        </td>                        <td>                            <input type="reset" value="Reset" />                        </td>
                    </tr>                    </tbody>                </table>                <t:errors/>            </t:form>        </t:zone>
    </t:block>    <t:block id="myExpenseListBlock">        <t:zone t:id="myExpenseListZone">            <p>                List of your expenses
            </p>            <hr/>            <table t:type="grid" t:source="myExpenseList"                   t:row="gridLine"                   t:rowsPerPage="10" t:pagerPosition="both"
                   t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"                   t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate" add="removeExpense">
                [Grid here]                <p:removeExpenseCell>                    <t:actionlink t:id="myExpenseRemove" t:context="gridLine?.moneyName" >remove payment</t:actionlink>
                </p:removeExpenseCell>            </table>        </t:zone>    </t:block>    <t:block id="trustedExpenseListBlock">
        <t:zone t:id="trustedExpenseListZone">            <p>                List of expenses from trusted            </p>            <hr/>
            <!--            <table t:type="grid" t:source="trustedExpenseList"                               t:row="gridLine"                               t:rowsPerPage="10" t:pagerPosition="both"
                               t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"                               t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]                        </table>-->        </t:zone>    </t:block>
    <t:block id="fullExpenseListBlock">
        <t:zone t:id="fullExpenseListZone">            <p>                List of all clients in your home            </p>            <hr/>
            <!--            <table t:type="grid" t:source="fullExpenseList"                               t:row="gridLine"                               t:rowsPerPage="5" t:pagerPosition="both"
                               t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"                               t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]                        </table>-->        </t:zone>    </t:block></html>Page class

/* * To change this template, choose Tools | Templates * and open the template in the editor. */package rs.edu.fit.cs230web.pages;

import java.util.List;import logic.ws.Client;import logic.ws.ClientType;import logic.ws.ClientWebService;import logic.ws.ExpenseWebService;import logic.ws.Money;
import org.apache.tapestry5.PersistenceConstants;import org.apache.tapestry5.annotations.Persist;import org.apache.tapestry5.annotations.Property;import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.Validate;import org.apache.tapestry5.ioc.annotations.Inject;
/** * * @author nikola */public class Expenses {

    @SessionState    @Property    private Client client;    @Property    private boolean clientExists;    @Persist(PersistenceConstants.FLASH)
    private Boolean admin;    @Inject    private ClientWebService clientWebService;    @Inject    private ExpenseWebService expenseWebService;    @Property
    private Money gridLine;    @Persist    @Property    private List<Money> myExpenseList;    @Persist    @Property    private List<Money> trustedExpenseList;
    @Persist    @Property    private List<Money> fullExpenseList;    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")
    private String recepientValue;    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")    private String purposeOfPaymentValue;
    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")    private String currencyValue;    @Property    @Persist(PersistenceConstants.FLASH)
    @Validate("required")    private Double amountValue;    @Property    @Persist(PersistenceConstants.FLASH)    private String dateOfPaymentValue;    @Property
    @Persist(PersistenceConstants.FLASH)    private Integer numberValue;    @Property    @Persist(PersistenceConstants.FLASH)    private String timeUnitValue;    @Property
    @Persist(PersistenceConstants.FLASH)    private String endDateValue;    @Persist    @Property    private boolean renew;    @Property    @Persist
    private String tableCurrencyValue;
    void onPrepareForRender() {        myExpenseList = expenseWebService.findMyExpenses(client.getClientUsername(), tableCurrencyValue);
        trustedExpenseList = expenseWebService.findFriendsExpenses(client.getClientUsername(), tableCurrencyValue);        fullExpenseList = expenseWebService.findHomeExpenses(client.getClientUsername(), tableCurrencyValue);

    }
    public Boolean getAdmin() {        if (clientExists) {            if (client.getClientType().equals(ClientType.ADMIN)) {                return Boolean.TRUE;
            }        }        return Boolean.FALSE;    }
    Object onActionFromMyExpenseRemove(String name) {        expenseWebService.destroyExpense(name, tableCurrencyValue, client.getClientUsername());
        return null;    }
    void onValidateFromAddExpenseForm() {    }
    Object onSuccessFromAddExpenseForm() {        tableCurrencyValue = currencyValue;
        if (renew == Boolean.FALSE) {            Money makeExpenseOnce = expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue);
        } else {            if (timeUnitValue.equalsIgnoreCase("day")) {                Money makeExpenseDay = expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("week")) {                Money makeExpenseWeek = expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("month")) {                Money makeExpenseMonth = expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("year")) {                Money makeExpenseYear = expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            }        }        return null;    }}

On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com> wrote:

Code is provided attachments
Some please tell me why is FormFragment displaying

-- 
nkv1


-- 
Pozdrav Nikola Vulovic
 		 	   		   		 	   		  

RE: FormFragment checkbox not working

Posted by Nomen Nomanum <ge...@outlook.com>.
Pozdrav Nikola!
Could you be more specific about what troubles you? From the code, it looks more-less just fine. What is it supposed to do?

Date: Sun, 19 May 2013 17:28:02 +0200
Subject: Re: FormFragment checkbox not working
From: nivukiki@gmail.com
To: users@tapestry.apache.org

tml file
                
            <html t:type="layout" title="${message:title}"      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
      xmlns:p="tapestry:parameter">    <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->

    <!-- A Zone is a component that can be updated in place, triggered by other components. -->
    <t:navbar/>    <t:finances/>    <t:if t:test="clientExists">        <t:delegate to="block:addExpenseBlock"/>        <t:delegate to="block:currencySelectBlock"/>
        <t:delegate to="block:myExpenseListBlock"/>        <t:delegate to="block:trustedExpenseListBlock"/>        <t:if t:test="admin">
            <t:delegate to="block:fullExpenseListBlock"/>        </t:if>    </t:if>    <t:block id="addExpenseBlock">        <t:zone t:id="addExpenseZone">
            <t:form t:id="addExpenseForm">                <table  border="0">                    <thead>                        <tr>
                            <th colspan="2">                                Add new expense form                    <hr/>                    </th>                    </tr>
                    </thead>                    <tbody>                        <tr>                            <td>                    <t:label for="recepient"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="recepient" value="recepientValue"/>
                    </td>                    </tr>                    <tr>                        <td>
                    <t:label for="purposeOfPayment"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="purposeOfPayment" value="purposeOfPaymentValue"/>
                    </td>                    </tr>                    <tr>                    <td>                    <t:label for="currency"/>(*):
                    </td>                    <td>                        <input t:type="TextField" t:id="currency" value="currencyValue"/>
                    </td>                    </tr>                    <tr>                        <td>                    <t:label for="amount"/>(*):
                    </td>                    <td>                        <input  type="number" step="any"  t:type="TextField" t:id="amount" value="amountValue"/>
                    </td>                    </tr>                    <tr>                        <td>                    <t:label for="renew"/>:
                    </td>                    <td>                    <t:checkbox t:id="renew"                                t:mixins="triggerfragment" fragment="f1"/>
                    </td>                    </tr>                    <t:formfragment t:id="f1" visible="renew" hide="fade">                        <tr>
                            <td colspan="2">                                Calculate payment from                            </td>                        </tr>
                        <tr>                            <td>                        <t:label for="dateOfPayment"/>(*):                        </td>
                        <td>                            <input type="date"  t:type="TextField" t:id="dateOfPayment" value="dateOfPaymentValue" />
                        </td>                        </tr>                        <tr>                            <td colspan="2">                                Repeat payment every
                            </td>                        </tr>                        <tr>                            <td>                        <t:label for="number"/>(*):
                        </td>                        <td>                            <input type="number" t:type="TextField" t:id="number"  value="numberValue"/>
                        </td>                        </tr>                        <tr>                            <td>                        <t:label for="timeUnit"/>(*):
                        </td>                        <td>                            <select t:type="Select" t:id="timeUnit" t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
                        </td>                        </tr>                        <tr>                            <td colspan="2">                                Calculate payment until
                            </td>                        </tr>                        <tr>                            <td>                        <t:label for="endDate"/>(*):
                        </td>                        <td>                            <input type="date"  t:type="TextField" t:id="endDate" value="endDateValue" />
                        </td>                        </tr>                    </t:formfragment>                    <tr>                        <td>
                            <input t:type="Submit" t:id="add" value="Add expense"/>                        </td>                        <td>
                            <input type="reset" value="Reset" />                        </td>                    </tr>                    </tbody>
                </table>                <t:errors/>            </t:form>        </t:zone>    </t:block>
    <t:block id="currencySelectBlock">
        <t:zone t:id="currencySelectZone">            <t:form t:id="currencySelectForm">                <table  border="0">                    <thead>
                        <tr>                            <th colspan="2">                                Select currency form                    <hr/>
                    </th>                    </tr>                    </thead>                    <tbody>                        <tr>
                            <td>                    <t:label for="tableCurrency"/>(*):                    </td>                    <td>                        <input t:type="TextField" t:id="tableCurrency" value="tableCurrencyValue"/>
                    </td>                    </tr>                    <tr>                        <td>                            <input t:type="Submit" t:id="selectCurrency" value="Select Currency"/>
                        </td>                        <td>                            <input type="reset" value="Reset" />                        </td>
                    </tr>                    </tbody>                </table>                <t:errors/>            </t:form>        </t:zone>
    </t:block>    <t:block id="myExpenseListBlock">        <t:zone t:id="myExpenseListZone">            <p>                List of your expenses
            </p>            <hr/>            <table t:type="grid" t:source="myExpenseList"                   t:row="gridLine"                   t:rowsPerPage="10" t:pagerPosition="both"
                   t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"                   t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate" add="removeExpense">
                [Grid here]                <p:removeExpenseCell>                    <t:actionlink t:id="myExpenseRemove" t:context="gridLine?.moneyName" >remove payment</t:actionlink>
                </p:removeExpenseCell>            </table>        </t:zone>    </t:block>    <t:block id="trustedExpenseListBlock">
        <t:zone t:id="trustedExpenseListZone">            <p>                List of expenses from trusted            </p>            <hr/>
            <!--            <table t:type="grid" t:source="trustedExpenseList"                               t:row="gridLine"                               t:rowsPerPage="10" t:pagerPosition="both"
                               t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"                               t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]                        </table>-->        </t:zone>    </t:block>
    <t:block id="fullExpenseListBlock">
        <t:zone t:id="fullExpenseListZone">            <p>                List of all clients in your home            </p>            <hr/>
            <!--            <table t:type="grid" t:source="fullExpenseList"                               t:row="gridLine"                               t:rowsPerPage="5" t:pagerPosition="both"
                               t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"                               t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]                        </table>-->        </t:zone>    </t:block></html>Page class

/* * To change this template, choose Tools | Templates * and open the template in the editor. */package rs.edu.fit.cs230web.pages;

import java.util.List;import logic.ws.Client;import logic.ws.ClientType;import logic.ws.ClientWebService;import logic.ws.ExpenseWebService;import logic.ws.Money;
import org.apache.tapestry5.PersistenceConstants;import org.apache.tapestry5.annotations.Persist;import org.apache.tapestry5.annotations.Property;import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.Validate;import org.apache.tapestry5.ioc.annotations.Inject;
/** * * @author nikola */public class Expenses {

    @SessionState    @Property    private Client client;    @Property    private boolean clientExists;    @Persist(PersistenceConstants.FLASH)
    private Boolean admin;    @Inject    private ClientWebService clientWebService;    @Inject    private ExpenseWebService expenseWebService;    @Property
    private Money gridLine;    @Persist    @Property    private List<Money> myExpenseList;    @Persist    @Property    private List<Money> trustedExpenseList;
    @Persist    @Property    private List<Money> fullExpenseList;    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")
    private String recepientValue;    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")    private String purposeOfPaymentValue;
    @Property    @Persist(PersistenceConstants.FLASH)    @Validate("required")    private String currencyValue;    @Property    @Persist(PersistenceConstants.FLASH)
    @Validate("required")    private Double amountValue;    @Property    @Persist(PersistenceConstants.FLASH)    private String dateOfPaymentValue;    @Property
    @Persist(PersistenceConstants.FLASH)    private Integer numberValue;    @Property    @Persist(PersistenceConstants.FLASH)    private String timeUnitValue;    @Property
    @Persist(PersistenceConstants.FLASH)    private String endDateValue;    @Persist    @Property    private boolean renew;    @Property    @Persist
    private String tableCurrencyValue;
    void onPrepareForRender() {        myExpenseList = expenseWebService.findMyExpenses(client.getClientUsername(), tableCurrencyValue);
        trustedExpenseList = expenseWebService.findFriendsExpenses(client.getClientUsername(), tableCurrencyValue);        fullExpenseList = expenseWebService.findHomeExpenses(client.getClientUsername(), tableCurrencyValue);

    }
    public Boolean getAdmin() {        if (clientExists) {            if (client.getClientType().equals(ClientType.ADMIN)) {                return Boolean.TRUE;
            }        }        return Boolean.FALSE;    }
    Object onActionFromMyExpenseRemove(String name) {        expenseWebService.destroyExpense(name, tableCurrencyValue, client.getClientUsername());
        return null;    }
    void onValidateFromAddExpenseForm() {    }
    Object onSuccessFromAddExpenseForm() {        tableCurrencyValue = currencyValue;
        if (renew == Boolean.FALSE) {            Money makeExpenseOnce = expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue);
        } else {            if (timeUnitValue.equalsIgnoreCase("day")) {                Money makeExpenseDay = expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("week")) {                Money makeExpenseWeek = expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("month")) {                Money makeExpenseMonth = expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("year")) {                Money makeExpenseYear = expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue, client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue, endDateValue, numberValue);
            }        }        return null;    }}

On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com> wrote:

Code is provided attachments
Some please tell me why is FormFragment displaying

-- 
nkv1


-- 
Pozdrav Nikola Vulovic
 		 	   		  

Re: FormFragment checkbox not working

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 21 May 2013 12:02:01 -0300, Nomen Nomanum <ge...@outlook.com>  
wrote:

> Here is the code to see how this could be achieve
>     public Object getChoosenOne() {
>         if(first==true){
>             zona.getBody();
>             return firstBlock;
>         }
>         else if(second== true)
>         {
>             zona.getBody();
>             return blokLokaciji;
>         }
>         else
>             zona.getBody();
>             return null;
>     }

This method is a mess. Why do you call zona.getBody() and then return a  
Block? Just return the block. In addition, you're not doing AJAX (your  
ActionLinks don't have a zone parameter), so you don't need the Zone at  
all. 		 	   		

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: FormFragment checkbox not working

Posted by Lance Java <la...@googlemail.com>.
You have many @Persist annotations which I think are unnecessary. As a
rule, if it's in the database, you don't need to store it in the session.
Instead, pass an id (or ids) in the URL via the page activation context and
look up the entities each time.

There's a caveat to this rule that you often need to store the user id in
the session for security reasons (you can't trust a url).

In earlier versions of tapestry, you needed flash persistence for errors
since the state is not stored in the DB and tapestry did a redirect after
post. In later versions of tapestry this is not required since it does not
redirect after post for validation errors.

RE: FormFragment checkbox not working

Posted by Nomen Nomanum <ge...@outlook.com>.
Here is the code to see how this could be achieve

<t:actionlink t:id="first">
     <h2>dgdgdgdg</h2>
</t:actionlink>
<t:actionlink t:id="second"> <!--or in your case put here checker trigger-->
     <h2>fsfsf</h2> 
</t:actionlink>

<t:zone t:id="zone">
   <t:delegate to="choosenOne"/>
     <t:block id="first">dgdgde</t:block>
     <t:block id="second">gdgdgd</t:block>
</t:zone t:id="zone">

    @InjectComponent
    private Zone zone;
    @Persist(PersistenceConstants.FLASH)// will keep your data consistent during just one page life cycle.
    private boolean first,second;
    @Inject
    private Block firstBlock, secondBlock;

    public void onActionFromFirst() {
        first= true;
        second=false;
    }

    public void onActionFromSecond() { 
        first = false;
        second=true;
    }

    // you could easily implement that once ticked, sets mod to true, false otherwise.
    public Object getChoosenOne() {
        if(first==true){
            zona.getBody();
            return firstBlock;
        }
        else if(second== true)
        {
            zona.getBody();
            return blokLokaciji;
        }
        else
            zona.getBody();
            return null;
    }
 		 	   		  

RE: FormFragment checkbox not working

Posted by Nomen Nomanum <ge...@outlook.com>.
OK, remove completely annotation @Persist, since you don't need it, if you want that behavior.
 		 	   		  

Re: FormFragment checkbox not working

Posted by Nikola Vulovic <ni...@gmail.com>.
component does not work because of table tag works without it.


On Mon, May 20, 2013 at 9:45 AM, Nikola Vulovic <ni...@gmail.com> wrote:

> behaviour is completely the same with and with out
> (PersistenceConstant.FLASH)
>
>
> On Sun, May 19, 2013 at 11:10 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>
>> formfragment is shown when checkox "renew" is not checked
>>
>>
>>
>> On Sun, May 19, 2013 at 5:28 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>>
>>> tml file
>>> <html t:type="layout" title="${message:title}"
>>>       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>>>       xmlns:p="tapestry:parameter">
>>>     <!-- Most of the page content, including <head>, <body>, etc. tags,
>>> comes from Layout.tml -->
>>>
>>>
>>>     <!-- A Zone is a component that can be updated in place, triggered
>>> by other components. -->
>>>     <t:navbar/>
>>>     <t:finances/>
>>>     <t:if t:test="clientExists">
>>>         <t:delegate to="block:addExpenseBlock"/>
>>>         <t:delegate to="block:currencySelectBlock"/>
>>>         <t:delegate to="block:myExpenseListBlock"/>
>>>         <t:delegate to="block:trustedExpenseListBlock"/>
>>>         <t:if t:test="admin">
>>>             <t:delegate to="block:fullExpenseListBlock"/>
>>>         </t:if>
>>>     </t:if>
>>>     <t:block id="addExpenseBlock">
>>>         <t:zone t:id="addExpenseZone">
>>>             <t:form t:id="addExpenseForm">
>>>                 <table  border="0">
>>>                     <thead>
>>>                         <tr>
>>>                              <th colspan="2">
>>>                                 Add new expense form
>>>                     <hr/>
>>>                     </th>
>>>                     </tr>
>>>                     </thead>
>>>                     <tbody>
>>>                         <tr>
>>>                             <td>
>>>                     <t:label for="recepient"/>(*):
>>>                     </td>
>>>                     <td>
>>>                         <input t:type="TextField" t:id="recepient"
>>> value="recepientValue"/>
>>>                     </td>
>>>                     </tr>
>>>                     <tr>
>>>                         <td>
>>>
>>>                     <t:label for="purposeOfPayment"/>(*):
>>>                     </td>
>>>                     <td>
>>>                         <input t:type="TextField"
>>> t:id="purposeOfPayment" value="purposeOfPaymentValue"/>
>>>                     </td>
>>>                     </tr>
>>>                     <tr>                    <td>
>>>                     <t:label for="currency"/>(*):
>>>                     </td>
>>>                     <td>
>>>                         <input t:type="TextField" t:id="currency"
>>> value="currencyValue"/>
>>>                     </td>
>>>                     </tr>
>>>                     <tr>
>>>                         <td>
>>>                     <t:label for="amount"/>(*):
>>>                     </td>
>>>                     <td>
>>>                         <input  type="number" step="any"
>>>  t:type="TextField" t:id="amount" value="amountValue"/>
>>>                     </td>
>>>                     </tr>
>>>                     <tr>
>>>                         <td>
>>>                     <t:label for="renew"/>:
>>>                     </td>
>>>                     <td>
>>>                     <t:checkbox t:id="renew"
>>>                                 t:mixins="triggerfragment"
>>> fragment="f1"/>
>>>                     </td>
>>>                     </tr>
>>>                     <t:formfragment t:id="f1" visible="renew"
>>> hide="fade">
>>>                         <tr>
>>>                             <td colspan="2">
>>>                                 Calculate payment from
>>>                             </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td>
>>>                         <t:label for="dateOfPayment"/>(*):
>>>                         </td>
>>>                         <td>
>>>                             <input type="date"  t:type="TextField"
>>> t:id="dateOfPayment" value="dateOfPaymentValue" />
>>>                         </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td colspan="2">
>>>                                 Repeat payment every
>>>                             </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td>
>>>                         <t:label for="number"/>(*):
>>>                         </td>
>>>                         <td>
>>>                             <input type="number" t:type="TextField"
>>> t:id="number"  value="numberValue"/>
>>>                         </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td>
>>>                         <t:label for="timeUnit"/>(*):
>>>                         </td>
>>>                         <td>
>>>                             <select t:type="Select" t:id="timeUnit"
>>> t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
>>>                         </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td colspan="2">
>>>                                 Calculate payment until
>>>                             </td>
>>>                         </tr>
>>>                         <tr>
>>>                             <td>
>>>                         <t:label for="endDate"/>(*):
>>>                         </td>
>>>                         <td>
>>>                             <input type="date"  t:type="TextField"
>>> t:id="endDate" value="endDateValue" />
>>>                         </td>
>>>                         </tr>
>>>                     </t:formfragment>
>>>                     <tr>
>>>                         <td>
>>>                             <input t:type="Submit" t:id="add" value="Add
>>> expense"/>
>>>                         </td>
>>>                         <td>
>>>                             <input type="reset" value="Reset" />
>>>                         </td>
>>>                     </tr>
>>>                     </tbody>
>>>                 </table>
>>>                 <t:errors/>
>>>             </t:form>
>>>         </t:zone>
>>>     </t:block>
>>>
>>>     <t:block id="currencySelectBlock">
>>>         <t:zone t:id="currencySelectZone">
>>>             <t:form t:id="currencySelectForm">
>>>                 <table  border="0">
>>>                     <thead>
>>>                         <tr>
>>>                             <th colspan="2">
>>>                                 Select currency form
>>>                     <hr/>
>>>                     </th>
>>>                     </tr>
>>>                     </thead>
>>>                     <tbody>
>>>                         <tr>
>>>                             <td>
>>>                     <t:label for="tableCurrency"/>(*):
>>>                     </td>
>>>                     <td>
>>>                         <input t:type="TextField" t:id="tableCurrency"
>>> value="tableCurrencyValue"/>
>>>                     </td>
>>>                     </tr>
>>>                     <tr>
>>>                         <td>
>>>                             <input t:type="Submit" t:id="selectCurrency"
>>> value="Select Currency"/>
>>>                         </td>
>>>                         <td>
>>>                             <input type="reset" value="Reset" />
>>>                         </td>
>>>                     </tr>
>>>                     </tbody>
>>>                 </table>
>>>                 <t:errors/>
>>>             </t:form>
>>>         </t:zone>
>>>     </t:block>
>>>     <t:block id="myExpenseListBlock">
>>>         <t:zone t:id="myExpenseListZone">
>>>             <p>
>>>                 List of your expenses
>>>             </p>
>>>             <hr/>
>>>             <table t:type="grid" t:source="myExpenseList"
>>>                    t:row="gridLine"
>>>                    t:rowsPerPage="10" t:pagerPosition="both"
>>>
>>>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"
>>>
>>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate"
>>> add="removeExpense">
>>>                 [Grid here]
>>>                 <p:removeExpenseCell>
>>>                     <t:actionlink t:id="myExpenseRemove"
>>> t:context="gridLine?.moneyName" >remove payment</t:actionlink>
>>>                 </p:removeExpenseCell>
>>>             </table>
>>>         </t:zone>
>>>     </t:block>
>>>     <t:block id="trustedExpenseListBlock">
>>>         <t:zone t:id="trustedExpenseListZone">
>>>             <p>
>>>                 List of expenses from trusted
>>>             </p>
>>>             <hr/>
>>>             <!--            <table t:type="grid"
>>> t:source="trustedExpenseList"
>>>                                t:row="gridLine"
>>>                                t:rowsPerPage="10" t:pagerPosition="both"
>>>
>>>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"
>>>
>>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>>>                             [Grid here]
>>>                         </table>-->
>>>         </t:zone>
>>>     </t:block>
>>>
>>>     <t:block id="fullExpenseListBlock">
>>>         <t:zone t:id="fullExpenseListZone">
>>>             <p>
>>>                 List of all clients in your home
>>>             </p>
>>>             <hr/>
>>>             <!--            <table t:type="grid"
>>> t:source="fullExpenseList"
>>>                                t:row="gridLine"
>>>                                t:rowsPerPage="5" t:pagerPosition="both"
>>>
>>>  t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"
>>>
>>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>>>                             [Grid here]
>>>                         </table>-->
>>>         </t:zone>
>>>     </t:block>
>>> </html>
>>> Page class
>>>
>>> /*
>>>  * To change this template, choose Tools | Templates
>>>  * and open the template in the editor.
>>>  */
>>> package rs.edu.fit.cs230web.pages;
>>>
>>> import java.util.List;
>>> import logic.ws.Client;
>>> import logic.ws.ClientType;
>>> import logic.ws.ClientWebService;
>>> import logic.ws.ExpenseWebService;
>>> import logic.ws.Money;
>>> import org.apache.tapestry5.PersistenceConstants;
>>> import org.apache.tapestry5.annotations.Persist;
>>> import org.apache.tapestry5.annotations.Property;
>>> import org.apache.tapestry5.annotations.SessionState;
>>> import org.apache.tapestry5.beaneditor.Validate;
>>> import org.apache.tapestry5.ioc.annotations.Inject;
>>>
>>> /**
>>>  *
>>>  * @author nikola
>>>  */
>>> public class Expenses {
>>>
>>>     @SessionState
>>>     @Property
>>>     private Client client;
>>>     @Property
>>>     private boolean clientExists;
>>>     @Persist(PersistenceConstants.FLASH)
>>>     private Boolean admin;
>>>     @Inject
>>>     private ClientWebService clientWebService;
>>>     @Inject
>>>     private ExpenseWebService expenseWebService;
>>>     @Property
>>>     private Money gridLine;
>>>     @Persist
>>>     @Property
>>>     private List<Money> myExpenseList;
>>>     @Persist
>>>     @Property
>>>     private List<Money> trustedExpenseList;
>>>     @Persist
>>>     @Property
>>>     private List<Money> fullExpenseList;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     @Validate("required")
>>>     private String recepientValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     @Validate("required")
>>>     private String purposeOfPaymentValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     @Validate("required")
>>>     private String currencyValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     @Validate("required")
>>>     private Double amountValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     private String dateOfPaymentValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     private Integer numberValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     private String timeUnitValue;
>>>     @Property
>>>     @Persist(PersistenceConstants.FLASH)
>>>     private String endDateValue;
>>>     @Persist
>>>     @Property
>>>     private boolean renew;
>>>     @Property
>>>     @Persist
>>>     private String tableCurrencyValue;
>>>
>>>     void onPrepareForRender() {
>>>         myExpenseList =
>>> expenseWebService.findMyExpenses(client.getClientUsername(),
>>> tableCurrencyValue);
>>>         trustedExpenseList =
>>> expenseWebService.findFriendsExpenses(client.getClientUsername(),
>>> tableCurrencyValue);
>>>         fullExpenseList =
>>> expenseWebService.findHomeExpenses(client.getClientUsername(),
>>> tableCurrencyValue);
>>>
>>>     }
>>>
>>>     public Boolean getAdmin() {
>>>         if (clientExists) {
>>>             if (client.getClientType().equals(ClientType.ADMIN)) {
>>>                 return Boolean.TRUE;
>>>             }
>>>         }
>>>         return Boolean.FALSE;
>>>     }
>>>
>>>     Object onActionFromMyExpenseRemove(String name) {
>>>         expenseWebService.destroyExpense(name, tableCurrencyValue,
>>> client.getClientUsername());
>>>         return null;
>>>     }
>>>
>>>     void onValidateFromAddExpenseForm() {
>>>     }
>>>
>>>     Object onSuccessFromAddExpenseForm() {
>>>         tableCurrencyValue = currencyValue;
>>>         if (renew == Boolean.FALSE) {
>>>             Money makeExpenseOnce =
>>> expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue,
>>> client.getClientUsername(), amountValue, currencyValue);
>>>         } else {
>>>             if (timeUnitValue.equalsIgnoreCase("day")) {
>>>                 Money makeExpenseDay =
>>> expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue,
>>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>>> endDateValue, numberValue);
>>>             } else if (timeUnitValue.equalsIgnoreCase("week")) {
>>>                 Money makeExpenseWeek =
>>> expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue,
>>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>>> endDateValue, numberValue);
>>>             } else if (timeUnitValue.equalsIgnoreCase("month")) {
>>>                 Money makeExpenseMonth =
>>> expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue,
>>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>>> endDateValue, numberValue);
>>>             } else if (timeUnitValue.equalsIgnoreCase("year")) {
>>>                 Money makeExpenseYear =
>>> expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue,
>>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>>> endDateValue, numberValue);
>>>             }
>>>         }
>>>         return null;
>>>     }
>>> }
>>>
>>>
>>> On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>>>
>>>> [image: Inline image 1]
>>>> Code is provided attachments
>>>> Some please tell me why is FormFragment displaying
>>>>
>>>> --
>>>> nkv1
>>>>
>>>
>>>
>>>
>>> --
>>> Pozdrav Nikola Vulovic
>>>
>>
>>
>>
>> --
>> Pozdrav Nikola Vulovic
>>
>
>
>
> --
> Pozdrav Nikola Vulovic
>



-- 
Pozdrav Nikola Vulovic

Re: FormFragment checkbox not working

Posted by Nikola Vulovic <ni...@gmail.com>.
behaviour is completely the same with and with out
(PersistenceConstant.FLASH)


On Sun, May 19, 2013 at 11:10 PM, Nikola Vulovic <ni...@gmail.com> wrote:

> formfragment is shown when checkox "renew" is not checked
>
>
>
> On Sun, May 19, 2013 at 5:28 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>
>> tml file
>> <html t:type="layout" title="${message:title}"
>>       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>>       xmlns:p="tapestry:parameter">
>>     <!-- Most of the page content, including <head>, <body>, etc. tags,
>> comes from Layout.tml -->
>>
>>
>>     <!-- A Zone is a component that can be updated in place, triggered by
>> other components. -->
>>     <t:navbar/>
>>     <t:finances/>
>>     <t:if t:test="clientExists">
>>         <t:delegate to="block:addExpenseBlock"/>
>>         <t:delegate to="block:currencySelectBlock"/>
>>         <t:delegate to="block:myExpenseListBlock"/>
>>         <t:delegate to="block:trustedExpenseListBlock"/>
>>         <t:if t:test="admin">
>>             <t:delegate to="block:fullExpenseListBlock"/>
>>         </t:if>
>>     </t:if>
>>     <t:block id="addExpenseBlock">
>>         <t:zone t:id="addExpenseZone">
>>             <t:form t:id="addExpenseForm">
>>                 <table  border="0">
>>                     <thead>
>>                         <tr>
>>                              <th colspan="2">
>>                                 Add new expense form
>>                     <hr/>
>>                     </th>
>>                     </tr>
>>                     </thead>
>>                     <tbody>
>>                         <tr>
>>                             <td>
>>                     <t:label for="recepient"/>(*):
>>                     </td>
>>                     <td>
>>                         <input t:type="TextField" t:id="recepient"
>> value="recepientValue"/>
>>                     </td>
>>                     </tr>
>>                     <tr>
>>                         <td>
>>
>>                     <t:label for="purposeOfPayment"/>(*):
>>                     </td>
>>                     <td>
>>                         <input t:type="TextField" t:id="purposeOfPayment"
>> value="purposeOfPaymentValue"/>
>>                     </td>
>>                     </tr>
>>                     <tr>                    <td>
>>                     <t:label for="currency"/>(*):
>>                     </td>
>>                     <td>
>>                         <input t:type="TextField" t:id="currency"
>> value="currencyValue"/>
>>                     </td>
>>                     </tr>
>>                     <tr>
>>                         <td>
>>                     <t:label for="amount"/>(*):
>>                     </td>
>>                     <td>
>>                         <input  type="number" step="any"
>>  t:type="TextField" t:id="amount" value="amountValue"/>
>>                     </td>
>>                     </tr>
>>                     <tr>
>>                         <td>
>>                     <t:label for="renew"/>:
>>                     </td>
>>                     <td>
>>                     <t:checkbox t:id="renew"
>>                                 t:mixins="triggerfragment" fragment="f1"/>
>>                     </td>
>>                     </tr>
>>                     <t:formfragment t:id="f1" visible="renew" hide="fade">
>>                         <tr>
>>                             <td colspan="2">
>>                                 Calculate payment from
>>                             </td>
>>                         </tr>
>>                         <tr>
>>                             <td>
>>                         <t:label for="dateOfPayment"/>(*):
>>                         </td>
>>                         <td>
>>                             <input type="date"  t:type="TextField"
>> t:id="dateOfPayment" value="dateOfPaymentValue" />
>>                         </td>
>>                         </tr>
>>                         <tr>
>>                             <td colspan="2">
>>                                 Repeat payment every
>>                             </td>
>>                         </tr>
>>                         <tr>
>>                             <td>
>>                         <t:label for="number"/>(*):
>>                         </td>
>>                         <td>
>>                             <input type="number" t:type="TextField"
>> t:id="number"  value="numberValue"/>
>>                         </td>
>>                         </tr>
>>                         <tr>
>>                             <td>
>>                         <t:label for="timeUnit"/>(*):
>>                         </td>
>>                         <td>
>>                             <select t:type="Select" t:id="timeUnit"
>> t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
>>                         </td>
>>                         </tr>
>>                         <tr>
>>                             <td colspan="2">
>>                                 Calculate payment until
>>                             </td>
>>                         </tr>
>>                         <tr>
>>                             <td>
>>                         <t:label for="endDate"/>(*):
>>                         </td>
>>                         <td>
>>                             <input type="date"  t:type="TextField"
>> t:id="endDate" value="endDateValue" />
>>                         </td>
>>                         </tr>
>>                     </t:formfragment>
>>                     <tr>
>>                         <td>
>>                             <input t:type="Submit" t:id="add" value="Add
>> expense"/>
>>                         </td>
>>                         <td>
>>                             <input type="reset" value="Reset" />
>>                         </td>
>>                     </tr>
>>                     </tbody>
>>                 </table>
>>                 <t:errors/>
>>             </t:form>
>>         </t:zone>
>>     </t:block>
>>
>>     <t:block id="currencySelectBlock">
>>         <t:zone t:id="currencySelectZone">
>>             <t:form t:id="currencySelectForm">
>>                 <table  border="0">
>>                     <thead>
>>                         <tr>
>>                             <th colspan="2">
>>                                 Select currency form
>>                     <hr/>
>>                     </th>
>>                     </tr>
>>                     </thead>
>>                     <tbody>
>>                         <tr>
>>                             <td>
>>                     <t:label for="tableCurrency"/>(*):
>>                     </td>
>>                     <td>
>>                         <input t:type="TextField" t:id="tableCurrency"
>> value="tableCurrencyValue"/>
>>                     </td>
>>                     </tr>
>>                     <tr>
>>                         <td>
>>                             <input t:type="Submit" t:id="selectCurrency"
>> value="Select Currency"/>
>>                         </td>
>>                         <td>
>>                             <input type="reset" value="Reset" />
>>                         </td>
>>                     </tr>
>>                     </tbody>
>>                 </table>
>>                 <t:errors/>
>>             </t:form>
>>         </t:zone>
>>     </t:block>
>>     <t:block id="myExpenseListBlock">
>>         <t:zone t:id="myExpenseListZone">
>>             <p>
>>                 List of your expenses
>>             </p>
>>             <hr/>
>>             <table t:type="grid" t:source="myExpenseList"
>>                    t:row="gridLine"
>>                    t:rowsPerPage="10" t:pagerPosition="both"
>>
>>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"
>>
>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate"
>> add="removeExpense">
>>                 [Grid here]
>>                 <p:removeExpenseCell>
>>                     <t:actionlink t:id="myExpenseRemove"
>> t:context="gridLine?.moneyName" >remove payment</t:actionlink>
>>                 </p:removeExpenseCell>
>>             </table>
>>         </t:zone>
>>     </t:block>
>>     <t:block id="trustedExpenseListBlock">
>>         <t:zone t:id="trustedExpenseListZone">
>>             <p>
>>                 List of expenses from trusted
>>             </p>
>>             <hr/>
>>             <!--            <table t:type="grid"
>> t:source="trustedExpenseList"
>>                                t:row="gridLine"
>>                                t:rowsPerPage="10" t:pagerPosition="both"
>>
>>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"
>>
>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>>                             [Grid here]
>>                         </table>-->
>>         </t:zone>
>>     </t:block>
>>
>>     <t:block id="fullExpenseListBlock">
>>         <t:zone t:id="fullExpenseListZone">
>>             <p>
>>                 List of all clients in your home
>>             </p>
>>             <hr/>
>>             <!--            <table t:type="grid"
>> t:source="fullExpenseList"
>>                                t:row="gridLine"
>>                                t:rowsPerPage="5" t:pagerPosition="both"
>>
>>  t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"
>>
>>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>>                             [Grid here]
>>                         </table>-->
>>         </t:zone>
>>     </t:block>
>> </html>
>> Page class
>>
>> /*
>>  * To change this template, choose Tools | Templates
>>  * and open the template in the editor.
>>  */
>> package rs.edu.fit.cs230web.pages;
>>
>> import java.util.List;
>> import logic.ws.Client;
>> import logic.ws.ClientType;
>> import logic.ws.ClientWebService;
>> import logic.ws.ExpenseWebService;
>> import logic.ws.Money;
>> import org.apache.tapestry5.PersistenceConstants;
>> import org.apache.tapestry5.annotations.Persist;
>> import org.apache.tapestry5.annotations.Property;
>> import org.apache.tapestry5.annotations.SessionState;
>> import org.apache.tapestry5.beaneditor.Validate;
>> import org.apache.tapestry5.ioc.annotations.Inject;
>>
>> /**
>>  *
>>  * @author nikola
>>  */
>> public class Expenses {
>>
>>     @SessionState
>>     @Property
>>     private Client client;
>>     @Property
>>     private boolean clientExists;
>>     @Persist(PersistenceConstants.FLASH)
>>     private Boolean admin;
>>     @Inject
>>     private ClientWebService clientWebService;
>>     @Inject
>>     private ExpenseWebService expenseWebService;
>>     @Property
>>     private Money gridLine;
>>     @Persist
>>     @Property
>>     private List<Money> myExpenseList;
>>     @Persist
>>     @Property
>>     private List<Money> trustedExpenseList;
>>     @Persist
>>     @Property
>>     private List<Money> fullExpenseList;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     @Validate("required")
>>     private String recepientValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     @Validate("required")
>>     private String purposeOfPaymentValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     @Validate("required")
>>     private String currencyValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     @Validate("required")
>>     private Double amountValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     private String dateOfPaymentValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     private Integer numberValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     private String timeUnitValue;
>>     @Property
>>     @Persist(PersistenceConstants.FLASH)
>>     private String endDateValue;
>>     @Persist
>>     @Property
>>     private boolean renew;
>>     @Property
>>     @Persist
>>     private String tableCurrencyValue;
>>
>>     void onPrepareForRender() {
>>         myExpenseList =
>> expenseWebService.findMyExpenses(client.getClientUsername(),
>> tableCurrencyValue);
>>         trustedExpenseList =
>> expenseWebService.findFriendsExpenses(client.getClientUsername(),
>> tableCurrencyValue);
>>         fullExpenseList =
>> expenseWebService.findHomeExpenses(client.getClientUsername(),
>> tableCurrencyValue);
>>
>>     }
>>
>>     public Boolean getAdmin() {
>>         if (clientExists) {
>>             if (client.getClientType().equals(ClientType.ADMIN)) {
>>                 return Boolean.TRUE;
>>             }
>>         }
>>         return Boolean.FALSE;
>>     }
>>
>>     Object onActionFromMyExpenseRemove(String name) {
>>         expenseWebService.destroyExpense(name, tableCurrencyValue,
>> client.getClientUsername());
>>         return null;
>>     }
>>
>>     void onValidateFromAddExpenseForm() {
>>     }
>>
>>     Object onSuccessFromAddExpenseForm() {
>>         tableCurrencyValue = currencyValue;
>>         if (renew == Boolean.FALSE) {
>>             Money makeExpenseOnce =
>> expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue,
>> client.getClientUsername(), amountValue, currencyValue);
>>         } else {
>>             if (timeUnitValue.equalsIgnoreCase("day")) {
>>                 Money makeExpenseDay =
>> expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue,
>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>> endDateValue, numberValue);
>>             } else if (timeUnitValue.equalsIgnoreCase("week")) {
>>                 Money makeExpenseWeek =
>> expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue,
>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>> endDateValue, numberValue);
>>             } else if (timeUnitValue.equalsIgnoreCase("month")) {
>>                 Money makeExpenseMonth =
>> expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue,
>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>> endDateValue, numberValue);
>>             } else if (timeUnitValue.equalsIgnoreCase("year")) {
>>                 Money makeExpenseYear =
>> expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue,
>> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
>> endDateValue, numberValue);
>>             }
>>         }
>>         return null;
>>     }
>> }
>>
>>
>> On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>>
>>> [image: Inline image 1]
>>> Code is provided attachments
>>> Some please tell me why is FormFragment displaying
>>>
>>> --
>>> nkv1
>>>
>>
>>
>>
>> --
>> Pozdrav Nikola Vulovic
>>
>
>
>
> --
> Pozdrav Nikola Vulovic
>



-- 
Pozdrav Nikola Vulovic

Re: FormFragment checkbox not working

Posted by Nikola Vulovic <ni...@gmail.com>.
formfragment is shown when checkox "renew" is not checked



On Sun, May 19, 2013 at 5:28 PM, Nikola Vulovic <ni...@gmail.com> wrote:

> tml file
> <html t:type="layout" title="${message:title}"
>       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>       xmlns:p="tapestry:parameter">
>     <!-- Most of the page content, including <head>, <body>, etc. tags,
> comes from Layout.tml -->
>
>
>     <!-- A Zone is a component that can be updated in place, triggered by
> other components. -->
>     <t:navbar/>
>     <t:finances/>
>     <t:if t:test="clientExists">
>         <t:delegate to="block:addExpenseBlock"/>
>         <t:delegate to="block:currencySelectBlock"/>
>         <t:delegate to="block:myExpenseListBlock"/>
>         <t:delegate to="block:trustedExpenseListBlock"/>
>         <t:if t:test="admin">
>             <t:delegate to="block:fullExpenseListBlock"/>
>         </t:if>
>     </t:if>
>     <t:block id="addExpenseBlock">
>         <t:zone t:id="addExpenseZone">
>             <t:form t:id="addExpenseForm">
>                 <table  border="0">
>                     <thead>
>                         <tr>
>                             <th colspan="2">
>                                 Add new expense form
>                     <hr/>
>                     </th>
>                     </tr>
>                     </thead>
>                     <tbody>
>                         <tr>
>                             <td>
>                     <t:label for="recepient"/>(*):
>                     </td>
>                     <td>
>                         <input t:type="TextField" t:id="recepient"
> value="recepientValue"/>
>                     </td>
>                     </tr>
>                     <tr>
>                         <td>
>
>                     <t:label for="purposeOfPayment"/>(*):
>                     </td>
>                     <td>
>                         <input t:type="TextField" t:id="purposeOfPayment"
> value="purposeOfPaymentValue"/>
>                     </td>
>                     </tr>
>                     <tr>                    <td>
>                     <t:label for="currency"/>(*):
>                     </td>
>                     <td>
>                         <input t:type="TextField" t:id="currency"
> value="currencyValue"/>
>                     </td>
>                     </tr>
>                     <tr>
>                         <td>
>                     <t:label for="amount"/>(*):
>                     </td>
>                     <td>
>                         <input  type="number" step="any"
>  t:type="TextField" t:id="amount" value="amountValue"/>
>                     </td>
>                     </tr>
>                     <tr>
>                         <td>
>                     <t:label for="renew"/>:
>                     </td>
>                     <td>
>                     <t:checkbox t:id="renew"
>                                 t:mixins="triggerfragment" fragment="f1"/>
>                     </td>
>                     </tr>
>                     <t:formfragment t:id="f1" visible="renew" hide="fade">
>                         <tr>
>                             <td colspan="2">
>                                 Calculate payment from
>                             </td>
>                         </tr>
>                         <tr>
>                             <td>
>                         <t:label for="dateOfPayment"/>(*):
>                         </td>
>                         <td>
>                             <input type="date"  t:type="TextField"
> t:id="dateOfPayment" value="dateOfPaymentValue" />
>                         </td>
>                         </tr>
>                         <tr>
>                             <td colspan="2">
>                                 Repeat payment every
>                             </td>
>                         </tr>
>                         <tr>
>                             <td>
>                         <t:label for="number"/>(*):
>                         </td>
>                         <td>
>                             <input type="number" t:type="TextField"
> t:id="number"  value="numberValue"/>
>                         </td>
>                         </tr>
>                         <tr>
>                             <td>
>                         <t:label for="timeUnit"/>(*):
>                         </td>
>                         <td>
>                             <select t:type="Select" t:id="timeUnit"
> t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
>                         </td>
>                         </tr>
>                         <tr>
>                             <td colspan="2">
>                                 Calculate payment until
>                             </td>
>                         </tr>
>                         <tr>
>                             <td>
>                         <t:label for="endDate"/>(*):
>                         </td>
>                         <td>
>                             <input type="date"  t:type="TextField"
> t:id="endDate" value="endDateValue" />
>                         </td>
>                         </tr>
>                     </t:formfragment>
>                     <tr>
>                         <td>
>                             <input t:type="Submit" t:id="add" value="Add
> expense"/>
>                         </td>
>                         <td>
>                             <input type="reset" value="Reset" />
>                         </td>
>                     </tr>
>                     </tbody>
>                 </table>
>                 <t:errors/>
>             </t:form>
>         </t:zone>
>     </t:block>
>
>     <t:block id="currencySelectBlock">
>         <t:zone t:id="currencySelectZone">
>             <t:form t:id="currencySelectForm">
>                 <table  border="0">
>                     <thead>
>                         <tr>
>                             <th colspan="2">
>                                 Select currency form
>                     <hr/>
>                     </th>
>                     </tr>
>                     </thead>
>                     <tbody>
>                         <tr>
>                             <td>
>                     <t:label for="tableCurrency"/>(*):
>                     </td>
>                     <td>
>                         <input t:type="TextField" t:id="tableCurrency"
> value="tableCurrencyValue"/>
>                     </td>
>                     </tr>
>                     <tr>
>                         <td>
>                             <input t:type="Submit" t:id="selectCurrency"
> value="Select Currency"/>
>                         </td>
>                         <td>
>                             <input type="reset" value="Reset" />
>                         </td>
>                     </tr>
>                     </tbody>
>                 </table>
>                 <t:errors/>
>             </t:form>
>         </t:zone>
>     </t:block>
>     <t:block id="myExpenseListBlock">
>         <t:zone t:id="myExpenseListZone">
>             <p>
>                 List of your expenses
>             </p>
>             <hr/>
>             <table t:type="grid" t:source="myExpenseList"
>                    t:row="gridLine"
>                    t:rowsPerPage="10" t:pagerPosition="both"
>
>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"
>
>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate"
> add="removeExpense">
>                 [Grid here]
>                 <p:removeExpenseCell>
>                     <t:actionlink t:id="myExpenseRemove"
> t:context="gridLine?.moneyName" >remove payment</t:actionlink>
>                 </p:removeExpenseCell>
>             </table>
>         </t:zone>
>     </t:block>
>     <t:block id="trustedExpenseListBlock">
>         <t:zone t:id="trustedExpenseListZone">
>             <p>
>                 List of expenses from trusted
>             </p>
>             <hr/>
>             <!--            <table t:type="grid"
> t:source="trustedExpenseList"
>                                t:row="gridLine"
>                                t:rowsPerPage="10" t:pagerPosition="both"
>
>  t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"
>
>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>                             [Grid here]
>                         </table>-->
>         </t:zone>
>     </t:block>
>
>     <t:block id="fullExpenseListBlock">
>         <t:zone t:id="fullExpenseListZone">
>             <p>
>                 List of all clients in your home
>             </p>
>             <hr/>
>             <!--            <table t:type="grid" t:source="fullExpenseList"
>                                t:row="gridLine"
>                                t:rowsPerPage="5" t:pagerPosition="both"
>
>  t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"
>
>  t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
>                             [Grid here]
>                         </table>-->
>         </t:zone>
>     </t:block>
> </html>
> Page class
>
> /*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
> package rs.edu.fit.cs230web.pages;
>
> import java.util.List;
> import logic.ws.Client;
> import logic.ws.ClientType;
> import logic.ws.ClientWebService;
> import logic.ws.ExpenseWebService;
> import logic.ws.Money;
> import org.apache.tapestry5.PersistenceConstants;
> import org.apache.tapestry5.annotations.Persist;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.annotations.SessionState;
> import org.apache.tapestry5.beaneditor.Validate;
> import org.apache.tapestry5.ioc.annotations.Inject;
>
> /**
>  *
>  * @author nikola
>  */
> public class Expenses {
>
>     @SessionState
>     @Property
>     private Client client;
>     @Property
>     private boolean clientExists;
>     @Persist(PersistenceConstants.FLASH)
>     private Boolean admin;
>     @Inject
>     private ClientWebService clientWebService;
>     @Inject
>     private ExpenseWebService expenseWebService;
>     @Property
>     private Money gridLine;
>     @Persist
>     @Property
>     private List<Money> myExpenseList;
>     @Persist
>     @Property
>     private List<Money> trustedExpenseList;
>     @Persist
>     @Property
>     private List<Money> fullExpenseList;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     @Validate("required")
>     private String recepientValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     @Validate("required")
>     private String purposeOfPaymentValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     @Validate("required")
>     private String currencyValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     @Validate("required")
>     private Double amountValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private String dateOfPaymentValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private Integer numberValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private String timeUnitValue;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private String endDateValue;
>     @Persist
>     @Property
>     private boolean renew;
>     @Property
>     @Persist
>     private String tableCurrencyValue;
>
>     void onPrepareForRender() {
>         myExpenseList =
> expenseWebService.findMyExpenses(client.getClientUsername(),
> tableCurrencyValue);
>         trustedExpenseList =
> expenseWebService.findFriendsExpenses(client.getClientUsername(),
> tableCurrencyValue);
>         fullExpenseList =
> expenseWebService.findHomeExpenses(client.getClientUsername(),
> tableCurrencyValue);
>
>     }
>
>     public Boolean getAdmin() {
>         if (clientExists) {
>             if (client.getClientType().equals(ClientType.ADMIN)) {
>                 return Boolean.TRUE;
>             }
>         }
>         return Boolean.FALSE;
>     }
>
>     Object onActionFromMyExpenseRemove(String name) {
>         expenseWebService.destroyExpense(name, tableCurrencyValue,
> client.getClientUsername());
>         return null;
>     }
>
>     void onValidateFromAddExpenseForm() {
>     }
>
>     Object onSuccessFromAddExpenseForm() {
>         tableCurrencyValue = currencyValue;
>         if (renew == Boolean.FALSE) {
>             Money makeExpenseOnce =
> expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue,
> client.getClientUsername(), amountValue, currencyValue);
>         } else {
>             if (timeUnitValue.equalsIgnoreCase("day")) {
>                 Money makeExpenseDay =
> expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue,
> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
> endDateValue, numberValue);
>             } else if (timeUnitValue.equalsIgnoreCase("week")) {
>                 Money makeExpenseWeek =
> expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue,
> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
> endDateValue, numberValue);
>             } else if (timeUnitValue.equalsIgnoreCase("month")) {
>                 Money makeExpenseMonth =
> expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue,
> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
> endDateValue, numberValue);
>             } else if (timeUnitValue.equalsIgnoreCase("year")) {
>                 Money makeExpenseYear =
> expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue,
> client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
> endDateValue, numberValue);
>             }
>         }
>         return null;
>     }
> }
>
>
> On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com>wrote:
>
>> [image: Inline image 1]
>> Code is provided attachments
>> Some please tell me why is FormFragment displaying
>>
>> --
>> nkv1
>>
>
>
>
> --
> Pozdrav Nikola Vulovic
>



-- 
Pozdrav Nikola Vulovic

Re: FormFragment checkbox not working

Posted by Nikola Vulovic <ni...@gmail.com>.
tml file
<html t:type="layout" title="${message:title}"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
      xmlns:p="tapestry:parameter">
    <!-- Most of the page content, including <head>, <body>, etc. tags,
comes from Layout.tml -->


    <!-- A Zone is a component that can be updated in place, triggered by
other components. -->
    <t:navbar/>
    <t:finances/>
    <t:if t:test="clientExists">
        <t:delegate to="block:addExpenseBlock"/>
        <t:delegate to="block:currencySelectBlock"/>
        <t:delegate to="block:myExpenseListBlock"/>
        <t:delegate to="block:trustedExpenseListBlock"/>
        <t:if t:test="admin">
            <t:delegate to="block:fullExpenseListBlock"/>
        </t:if>
    </t:if>
    <t:block id="addExpenseBlock">
        <t:zone t:id="addExpenseZone">
            <t:form t:id="addExpenseForm">
                <table  border="0">
                    <thead>
                        <tr>
                            <th colspan="2">
                                Add new expense form
                    <hr/>
                    </th>
                    </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>
                    <t:label for="recepient"/>(*):
                    </td>
                    <td>
                        <input t:type="TextField" t:id="recepient"
value="recepientValue"/>
                    </td>
                    </tr>
                    <tr>
                        <td>

                    <t:label for="purposeOfPayment"/>(*):
                    </td>
                    <td>
                        <input t:type="TextField" t:id="purposeOfPayment"
value="purposeOfPaymentValue"/>
                    </td>
                    </tr>
                    <tr>                    <td>
                    <t:label for="currency"/>(*):
                    </td>
                    <td>
                        <input t:type="TextField" t:id="currency"
value="currencyValue"/>
                    </td>
                    </tr>
                    <tr>
                        <td>
                    <t:label for="amount"/>(*):
                    </td>
                    <td>
                        <input  type="number" step="any"
 t:type="TextField" t:id="amount" value="amountValue"/>
                    </td>
                    </tr>
                    <tr>
                        <td>
                    <t:label for="renew"/>:
                    </td>
                    <td>
                    <t:checkbox t:id="renew"
                                t:mixins="triggerfragment" fragment="f1"/>
                    </td>
                    </tr>
                    <t:formfragment t:id="f1" visible="renew" hide="fade">
                        <tr>
                            <td colspan="2">
                                Calculate payment from
                            </td>
                        </tr>
                        <tr>
                            <td>
                        <t:label for="dateOfPayment"/>(*):
                        </td>
                        <td>
                            <input type="date"  t:type="TextField"
t:id="dateOfPayment" value="dateOfPaymentValue" />
                        </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                Repeat payment every
                            </td>
                        </tr>
                        <tr>
                            <td>
                        <t:label for="number"/>(*):
                        </td>
                        <td>
                            <input type="number" t:type="TextField"
t:id="number"  value="numberValue"/>
                        </td>
                        </tr>
                        <tr>
                            <td>
                        <t:label for="timeUnit"/>(*):
                        </td>
                        <td>
                            <select t:type="Select" t:id="timeUnit"
t:model="literal:day,week,month,year" t:value="timeUnitValue"/>
                        </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                Calculate payment until
                            </td>
                        </tr>
                        <tr>
                            <td>
                        <t:label for="endDate"/>(*):
                        </td>
                        <td>
                            <input type="date"  t:type="TextField"
t:id="endDate" value="endDateValue" />
                        </td>
                        </tr>
                    </t:formfragment>
                    <tr>
                        <td>
                            <input t:type="Submit" t:id="add" value="Add
expense"/>
                        </td>
                        <td>
                            <input type="reset" value="Reset" />
                        </td>
                    </tr>
                    </tbody>
                </table>
                <t:errors/>
            </t:form>
        </t:zone>
    </t:block>

    <t:block id="currencySelectBlock">
        <t:zone t:id="currencySelectZone">
            <t:form t:id="currencySelectForm">
                <table  border="0">
                    <thead>
                        <tr>
                            <th colspan="2">
                                Select currency form
                    <hr/>
                    </th>
                    </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>
                    <t:label for="tableCurrency"/>(*):
                    </td>
                    <td>
                        <input t:type="TextField" t:id="tableCurrency"
value="tableCurrencyValue"/>
                    </td>
                    </tr>
                    <tr>
                        <td>
                            <input t:type="Submit" t:id="selectCurrency"
value="Select Currency"/>
                        </td>
                        <td>
                            <input type="reset" value="Reset" />
                        </td>
                    </tr>
                    </tbody>
                </table>
                <t:errors/>
            </t:form>
        </t:zone>
    </t:block>
    <t:block id="myExpenseListBlock">
        <t:zone t:id="myExpenseListZone">
            <p>
                List of your expenses
            </p>
            <hr/>
            <table t:type="grid" t:source="myExpenseList"
                   t:row="gridLine"
                   t:rowsPerPage="10" t:pagerPosition="both"

 t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate,moneyTs,cliClientId"

 t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate"
add="removeExpense">
                [Grid here]
                <p:removeExpenseCell>
                    <t:actionlink t:id="myExpenseRemove"
t:context="gridLine?.moneyName" >remove payment</t:actionlink>
                </p:removeExpenseCell>
            </table>
        </t:zone>
    </t:block>
    <t:block id="trustedExpenseListBlock">
        <t:zone t:id="trustedExpenseListZone">
            <p>
                List of expenses from trusted
            </p>
            <hr/>
            <!--            <table t:type="grid"
t:source="trustedExpenseList"
                               t:row="gridLine"
                               t:rowsPerPage="10" t:pagerPosition="both"

 t:exclude="moneyId,moneyIO,moneyNextDate,moneyFinishDate"

 t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDateCalendar,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]
                        </table>-->
        </t:zone>
    </t:block>

    <t:block id="fullExpenseListBlock">
        <t:zone t:id="fullExpenseListZone">
            <p>
                List of all clients in your home
            </p>
            <hr/>
            <!--            <table t:type="grid" t:source="fullExpenseList"
                               t:row="gridLine"
                               t:rowsPerPage="5" t:pagerPosition="both"

 t:exclude="mmoneyId,moneyIO,moneyNextDate,moneyFinishDate"

 t:reorder="moneyName,moneyPurpose,moneyAmount,moneyCurrency,moneyDate,moneyNumber,moneyRenewal,cliClientId?.clientUsername">
                            [Grid here]
                        </table>-->
        </t:zone>
    </t:block>
</html>
Page class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rs.edu.fit.cs230web.pages;

import java.util.List;
import logic.ws.Client;
import logic.ws.ClientType;
import logic.ws.ClientWebService;
import logic.ws.ExpenseWebService;
import logic.ws.Money;
import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.ioc.annotations.Inject;

/**
 *
 * @author nikola
 */
public class Expenses {

    @SessionState
    @Property
    private Client client;
    @Property
    private boolean clientExists;
    @Persist(PersistenceConstants.FLASH)
    private Boolean admin;
    @Inject
    private ClientWebService clientWebService;
    @Inject
    private ExpenseWebService expenseWebService;
    @Property
    private Money gridLine;
    @Persist
    @Property
    private List<Money> myExpenseList;
    @Persist
    @Property
    private List<Money> trustedExpenseList;
    @Persist
    @Property
    private List<Money> fullExpenseList;
    @Property
    @Persist(PersistenceConstants.FLASH)
    @Validate("required")
    private String recepientValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    @Validate("required")
    private String purposeOfPaymentValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    @Validate("required")
    private String currencyValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    @Validate("required")
    private Double amountValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    private String dateOfPaymentValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    private Integer numberValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    private String timeUnitValue;
    @Property
    @Persist(PersistenceConstants.FLASH)
    private String endDateValue;
    @Persist
    @Property
    private boolean renew;
    @Property
    @Persist
    private String tableCurrencyValue;

    void onPrepareForRender() {
        myExpenseList =
expenseWebService.findMyExpenses(client.getClientUsername(),
tableCurrencyValue);
        trustedExpenseList =
expenseWebService.findFriendsExpenses(client.getClientUsername(),
tableCurrencyValue);
        fullExpenseList =
expenseWebService.findHomeExpenses(client.getClientUsername(),
tableCurrencyValue);

    }

    public Boolean getAdmin() {
        if (clientExists) {
            if (client.getClientType().equals(ClientType.ADMIN)) {
                return Boolean.TRUE;
            }
        }
        return Boolean.FALSE;
    }

    Object onActionFromMyExpenseRemove(String name) {
        expenseWebService.destroyExpense(name, tableCurrencyValue,
client.getClientUsername());
        return null;
    }

    void onValidateFromAddExpenseForm() {
    }

    Object onSuccessFromAddExpenseForm() {
        tableCurrencyValue = currencyValue;
        if (renew == Boolean.FALSE) {
            Money makeExpenseOnce =
expenseWebService.makeExpenseOnce(recepientValue, purposeOfPaymentValue,
client.getClientUsername(), amountValue, currencyValue);
        } else {
            if (timeUnitValue.equalsIgnoreCase("day")) {
                Money makeExpenseDay =
expenseWebService.makeExpenseDay(recepientValue, purposeOfPaymentValue,
client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("week")) {
                Money makeExpenseWeek =
expenseWebService.makeExpenseWeek(recepientValue, purposeOfPaymentValue,
client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("month")) {
                Money makeExpenseMonth =
expenseWebService.makeExpenseMonth(recepientValue, purposeOfPaymentValue,
client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
endDateValue, numberValue);
            } else if (timeUnitValue.equalsIgnoreCase("year")) {
                Money makeExpenseYear =
expenseWebService.makeExpenseYear(recepientValue, purposeOfPaymentValue,
client.getClientUsername(), amountValue, currencyValue, dateOfPaymentValue,
endDateValue, numberValue);
            }
        }
        return null;
    }
}


On Sun, May 19, 2013 at 4:17 PM, Nikola Vulovic <ni...@gmail.com> wrote:

> [image: Inline image 1]
> Code is provided attachments
> Some please tell me why is FormFragment displaying
>
> --
> nkv1
>



-- 
Pozdrav Nikola Vulovic