/*
 * Copyright 2004-2014 ICEsoft Technologies Canada Corp.
 *
 * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS
 * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

package org.icefaces.samples.showcase.example.ace.drawerPanel;


import org.icefaces.samples.showcase.metadata.annotation.*;
import org.icefaces.samples.showcase.metadata.context.ComponentExampleImpl;

import javax.annotation.PostConstruct;
import javax.faces.bean.CustomScoped;
import javax.faces.bean.ManagedBean;
import java.io.Serializable;

@ComponentExample(
        title = "example.ace.drawerpanel.title",
        description = "example.ace.drawerpanel.description",
        example = "/resources/examples/ace/drawerpanel/drawerPanel.xhtml"
)
@ExampleResources(
        resources ={
            // xhtml
            @ExampleResource(type = ResourceType.xhtml,
                    title="drawerPanel.xhtml",
                    resource = "/resources/examples/ace/drawerpanel/drawerPanel.xhtml"),
            // Java Source
            @ExampleResource(type = ResourceType.java,
                    title="DrawerPanelBean.java",
                    resource = "/WEB-INF/classes/org/icefaces/samples/showcase"+
                    "/example/ace/drawerPanel/DrawerPanelBean.java")
        }
)
@Menu(
	title = "menu.ace.drawerpanel.subMenu.config",
	menuLinks = {
	        @MenuLink(title = "menu.ace.drawerpanel.subMenu.config",
	                isDefault = true,
                    exampleBeanName = DrawerPanelBean.BEAN_NAME)
    }
)

@ManagedBean(name= DrawerPanelBean.BEAN_NAME)
@CustomScoped(value = "#{window}")
public class DrawerPanelBean extends ComponentExampleImpl<DrawerPanelBean>
        implements Serializable {
    public static final String BEAN_NAME = "drawerPanelBean";
	public String getBeanName() { return BEAN_NAME; }

	public DrawerPanelBean(){
        super(DrawerPanelBean.class);
	}
	@PostConstruct
	public void initMetaData() {
     super.initMetaData();
 }

	private String position = "left";
	public String getPosition() { return position; }
	public void setPosition(String position) { this.position = position; }

	private boolean showHandleOpen = true;
	public boolean isShowHandleOpen() { return showHandleOpen; }
	public void setShowHandleOpen(boolean showHandleOpen) { this.showHandleOpen = showHandleOpen; }

	private boolean showHandleClose = true;
	public boolean isShowHandleClose() { return showHandleClose; }
	public void setShowHandleClose(boolean showHandleClose) { this.showHandleClose = showHandleClose; }

	private boolean divContainer = false;
	public boolean isDivContainer() { return divContainer; }
	public void setDivContainer(boolean divContainer) { this.divContainer = divContainer; }

	public String getContainer() {
		if (divContainer) return "div";
		else return "window";
	}

	private boolean visible = false;
	public boolean isVisible() { return visible; }
	public void setVisible(boolean visible) { this.visible = visible; }
}