0

how to show modal Window programmaticaly

asked 2011-05-12 07:49:47 +0800

mihael gravatar image mihael
57

i am trying to show a modal window.

i have created a window programmaticaly



      Window win = new Window("Details", "1", true);
        win.setId("BECY");
        Grid grid = new Grid();
        Columns columns = new Columns();
        Rows rows = new Rows();

        for (MonthlyCurrencyResult<ServiceTypes> monthlyCurrencyResult : data)
        {
            Column column = new Column(monthlyCurrencyResult.getMonth());
            columns.appendChild(column);

            Row row = new Row();
            row.appendChild(new Label(monthlyCurrencyResult.getValue().toString()));
            rows.appendChild(row);
        }
        grid.appendChild(columns);
        grid.appendChild(rows);
        win.appendChild(grid);

        return win;



and sending this window via a parameter to a zul file where i want to do something like:

<zk xmlns="http://www.zkoss.org/2005/zul"
    xmlns:h="http://www.w3.org/1999/xhtml"
    xmlns:w="http://www.zkoss.org/2005/zk/client">
    <window border="none">
        <caption style="padding-right: 5px;">
            <image src="/images/icons/information_16x16.png" width="18px" height="18px" style="cursor:pointer;">
                <attribute name="onClick"><![CDATA[
                     import org.zkoss.zul.Window;
          
                     Window win = arg.get("paramDetailsWindow");
                     win.doModal();
                ]]></attribute>
            </image>
        </caption>
</window>

But i kep getting Null Pointer in Method Invocation.

And i know about Window wing = (Window) Executions.createComponents("",null,""). but i cant create new zul file becose i would have more then 50 files.

Please help.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2011-05-12 08:55:56 +0800

Arsen gravatar image Arsen
384 5

Could you please write down your code "sending this window via a parameter to a zul"?

link publish delete flag offensive edit

answered 2011-05-12 11:23:12 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

@mihael, you do realize your grid is going to have an every increasing number of columns in it because of the first 2 lines in your for loop, don't you? I don't think this is what you want. I don't know if you're wanting to put the values for every month on 1 row or the value for each month on a separate row. If it's the former, you need to quit creating a new Row in the loop. If it's the latter you need to quit creating columns inside the loop and just add a couple before the loop.

link publish delete flag offensive edit

answered 2011-05-13 05:19:02 +0800

mihael gravatar image mihael
57

HI Arsen

The uper code shows a method that returns the window that has to be show when i click on a details button. But to answer you question :


        Map params = new HashMap();
        params.put("paramData", monthlyExpensesResult);
        params.put("paramDetailsWindow", genereteBECYDetailsWindow(monthlyExpensesResult));

        Window win = (Window) Executions.createComponents("/window/bookkeeping/multi_series_column_3d_chart.zul", null, params);
        win.setTitle(title);
        win.setStyle("color: white;");

        return win;

link publish delete flag offensive edit

answered 2011-05-13 15:25:41 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

win.doModal();

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-05-12 07:49:47 +0800

Seen: 442 times

Last updated: May 13 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More