2011-08-07 14:18, Vangel V. Ajanovski:
In the past I have used the modal window from ChenilleKit, and recently
I read the post from Taha on Java Magic blog, but I wanted to create
something simpler, preferably without additional custom JavaScript code
- just CSS and Tapestry zones.

I think that's a good idea - we're doing something similar.

The difference is that we're always creating a separate component for the dialog - for this dialogs we have a DialogLayout component that guarantees the layout and css.

Another difference is that we use a different zone for the form in the dialog to prevent problems with server-side validation.

Here are some parts of our code, here for a new button:

Page.tml:
<a t:id="newProvider">${message:button.newProvider}</a>
<div t:id="dialogZone">
        <t:block>
                <div t:id="someOtherDialog" />
                <div t:id="newProviderDialog" />
        </t:block>
</div>
-- here goes the grid with the data

Page.java
    @Component(parameters = {"zone=dialogZone"})
    private EventLink newProvider;

    @OnEvent("newProvider")
    Object newProvider()
    {
        return newProviderDialog;
    }

NewProviderDialog.tml
<div t:type="DialogLayout" title="message:NewProviderDialog.title">
        <div t:id="newProviderZone">
                <form t:type="form" zone="newProviderZone">
                        <div t:id="errors"/>

                        <div t:id="newProviderEditor" />

                        <a t:id="save">${message:button.save}</a>
                </form>
        </div>
</div>

NewProviderDialog.java
    @OnEvent("success")
    Object saveNewProvider()
    {
        // backen call
        orderFacade.createNewProvider(provider);

        // return page to refresh whole page
        return componentResources.getPage();
    }

--
Chris

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

Reply via email to