/*
 * Copyright
 *   2007 axYus - www.axyus.com
 *   2010 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.welcome;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Image;
import fr.gouv.finances.dgfip.xemelios.web.gwt.client.utils.DoneListener;
import fr.gouv.finances.dgfip.xemelios.web.gwt.client.utils.GWTUtils;
import fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.exports.DlgSelectExport;
import fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.navigate.DlgSelectNavigationTarget;

public class WelcomeWidget extends Composite {

    static private WelcomeWidget welcomeWidgetInstance;
    private DockPanel mainPanel = null;
    private Image image = null;

    public WelcomeWidget() {
        super();
        mainPanel = new DockPanel();
        mainPanel.setSize("100%", "100%");
        mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        mainPanel.getElement().setId("mainPanel");
        image = new Image(GWTUtils.getContextPath()+"/img/montage3.jpg");
        mainPanel.add(image, DockPanel.CENTER);
        initWidget(this.mainPanel);
        getElement().setId("AccueilWidget");
    }
    public static native void defineJSMethod() /*-{
        $wnd._configExport = @fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.welcome.WelcomeWidget::_configExport();
        $wnd._openNavigation = function(documentId) {
            @fr.gouv.finances.dgfip.xemelios.web.gwt.client.widget.welcome.WelcomeWidget::_openNavigation(Ljava/lang/String;) (documentId);
        }
     }-*/;

    public void init(final DoneListener doneListener) {
        defineJSMethod();
        WelcomeWidget.welcomeWidgetInstance = WelcomeWidget.this;
        doneListener.done(this);
    }
    static public void _configExport() {
        DlgSelectExport dlg = new DlgSelectExport();
        dlg.show();
    }
    static public void _openNavigation(String documentId) {
        DlgSelectNavigationTarget nt = new DlgSelectNavigationTarget(documentId);
    }
}
