/*
 * ICESOFT COMMERCIAL SOURCE CODE LICENSE V 1.1
 *
 * The contents of this file are subject to the ICEsoft Commercial Source
 * Code License Agreement V1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the
 * License at
 * http://www.icesoft.com/license/commercial-source-v1.1.html
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations under
 * the License.
 *
 * Copyright 2009-2015 ICEsoft Technologies Canada, Corp. All Rights Reserved.
 */
package com.icesoft.faces.facelets.example.dialog;

import com.icesoft.faces.facelets.component.dialog.Dialog;
import com.icesoft.faces.facelets.component.dialog.DialogTypes;

/**
 * DialogType is a configured Dialog.  Dialogs can present different options
 * (OK, No, Yes, Cancel) to the user - in the form of commandButtons.
 * Each Dialog has a reference to an include that constitutes the popup content.
 * <p/>
 * This class contains a "basicDialog" using basicContent.xhtml which
 * simply displays a String message as the popup content.  It also contains
 * "generalError" using errorContent.xhtml which has fields for two messages (an
 * application generated message and the error message).
 * <p/>
 * Add as many DialogTypes as you want to this class.  Make the included xhtml
 * file as sophisticated as you want.
 */
public class ApplicationDialogTypes extends DialogTypes {

    public static final String BASIC_DIALOG = "basicDialog";
    public static final String GENERAL_ERROR = "generalError";

    public ApplicationDialogTypes() {
        super();

        // basic dialog
        Dialog dialog = new Dialog(
                "/WEB-INF/includes/examples/composition-components/dialogs/basicContent.xhtml",
                Dialog.OK_CANCEL_OPTION);
        dialog.setCssStyle("basicOptionDialog");
        put(BASIC_DIALOG, dialog);

        // general error dialog.
        dialog = new Dialog(
                "/WEB-INF/includes/examples/composition-components/dialogs/errorContent.xhtml",
                Dialog.OKAY_OPTION);
        dialog.setCssStyle("applicationErrorDialog");
        put(GENERAL_ERROR, dialog);
    }
}
