/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *   2008 C.Marchand - christophe.marchand@axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.search;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import fr.gouv.finances.dgfip.xemelios.web.gwt.client.dto.PjRefInfoDTO;

/**
 *
 * @author chm
 */
public class ShowAvailablesPJsDialogBox extends DialogBox {
    private VerticalPanel mainPane = null;
    private ScrollPanel scroller;

    public ShowAvailablesPJsDialogBox() {
        super(true,true);
        init();
    }
    public ShowAvailablesPJsDialogBox(PjRefInfoDTO[] pjs) {
        this();
        for(PjRefInfoDTO pj:pjs) {
            scroller.add(new PjRefWidget(pj,this));
        }
    }
    protected void init() {
        setHTML("Pi&egrave;ces justificatives");
        mainPane = new VerticalPanel();
        scroller = new ScrollPanel();
        scroller.setSize("200","140");
        mainPane.add(scroller);
        HorizontalPanel buttonPane = new HorizontalPanel();
        buttonPane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        Button cancelButton = new Button();
        cancelButton.setText("Fermer");
        cancelButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                hide();
            }
        });
        buttonPane.add(cancelButton);
        mainPane.add(buttonPane);
        mainPane.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        setWidget(mainPane);
    }
}
