<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<f:subview id="hotKeySubviewID">
	<rich:calendar id="hotKeyCalendarID" popup="false" />
	
	
	<h:commandButton id="commandButtonID" onclick="return false;" value="test select"></h:commandButton>
	<rich:hotKey id="hotKeyID" binding="#{hotKey.htmlHotKey}"
		disableInInput="#{hotKey.disableInInput}" handler="#{hotKey.handler}"
		key="#{hotKey.key}" rendered="#{hotKey.rendered}"
		selector="#{hotKey.selector}" timing="#{hotKey.timing}" type="#{hotKey.type}" disableInInputTypes="#{hotKey.disableInInputTypes}"/>

	<h:panelGrid columns="2">
		<h:outputText value="type"></h:outputText>
		<h:selectOneMenu value="#{hotKey.type}">
			<f:selectItem itemLabel="onkeydown" itemValue="onkeydown" />
			<f:selectItem itemLabel="onkeypress" itemValue="onkeypress" />
			<f:selectItem itemLabel="onkeyup" itemValue="onkeyup" />
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectOneMenu>

		<h:outputText value="key"></h:outputText>
		<h:inputText value="#{hotKey.key}" onchange="submit();">
		</h:inputText>

		<h:outputText value="timing"></h:outputText>
		<h:selectOneMenu value="#{hotKey.timing}" onchange="submit();">
			<f:selectItem itemLabel="onload" itemValue="onload" />
			<f:selectItem itemLabel="immediate" itemValue="immediate" />
		</h:selectOneMenu>

		<h:outputText value="selector"></h:outputText>
		<h:selectOneMenu value="#{hotKey.selector}">
			<f:selectItem itemLabel="" itemValue="" />
			<f:selectItem itemLabel="Button" itemValue="#commandButtonID" />
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectOneMenu>

		<h:outputText value="handler"></h:outputText>
		<h:selectOneMenu value="#{hotKey.handler}" onchange="submit();">
			<f:selectItem
				itemValue="$('formID:hotKeySubviewID:hotKeyCalendarID').component.nextYear();"
				itemLabel="nextYear(Calendar)" />
			<f:selectItem itemValue="alert('work')" itemLabel="alert('work')" />
		</h:selectOneMenu>

		<h:outputText value="disableInInput"></h:outputText>
		<h:selectBooleanCheckbox value="#{hotKey.disableInInput}">
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectBooleanCheckbox>
		
		<h:outputText value="disableInInput"></h:outputText>
		<h:selectOneRadio value="#{hotKey.disableInInputTypes}" >
			<f:selectItem itemValue="all" itemLabel="all"/>
			<f:selectItem itemValue="buttons" itemLabel="buttons"/>
			<f:selectItem itemValue="texts" itemLabel="texts"/>
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectOneRadio>

		<%--<h:outputText value="checkParent"></h:outputText>
		<h:selectBooleanCheckbox value="#{hotKey.checkParent}">
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectBooleanCheckbox>--%>

		<h:outputText value="rendered"></h:outputText>
		<h:selectBooleanCheckbox value="#{hotKey.rendered}">
			<a4j:support reRender="hotKeyID" event="onchange"></a4j:support>
		</h:selectBooleanCheckbox>

		<h:outputText value="test binding:"></h:outputText>
		<h:outputText value="#{hotKey.bindingInfo}"></h:outputText>

		<h:commandButton onclick="#{rich:component('hotKeyID')}.enable(); return false;" value="enable"></h:commandButton>
		<h:commandButton onclick="#{rich:component('hotKeyID')}.disable(); return false;" value="disable"></h:commandButton>
	</h:panelGrid>
	<f:verbatim><hr /></f:verbatim>
	
	<rich:hotKey id="jsID" timing="onregistercall" />

	<h:panelGrid columns="2">
		<h:commandButton id="jsAddCCID" value="add hotkey: alt+z" onclick="return false;"></h:commandButton>
		<h:commandButton id="jsRemoveCCID" value="remove hotkey: alt+z" onclick="return false;"></h:commandButton>

		<rich:componentControl disableDefault="true" attachTo="jsAddCCID" for="jsID" event="onclick" operation="add">
			<f:param name="key" value="alt+z" />
			<f:param name="handler" value="alert('alt+z')" />
		</rich:componentControl>

		<rich:componentControl disableDefault="true" attachTo="jsRemoveCCID" for="jsID" event="onclick" operation="remove">
			<f:param name="key" value="alt+z" />
		</rich:componentControl>
	</h:panelGrid>
	<f:verbatim><hr /></f:verbatim>
	<h:commandButton action="#{hotKey.add}" value="add test" />
	<div style="FONT-WEIGHT: bold;">rich:findComponent</div>
	<h:panelGrid columns="2">
		<rich:column>
			<a4j:commandLink value="getRendererType" reRender="findID"></a4j:commandLink>
		</rich:column>
		<rich:column id="findID">
			<h:outputText value="#{rich:findComponent('hotKeyID').rendererType}" />
		</rich:column>
	</h:panelGrid>
</f:subview>