Author: ayanul
Date: 2008-06-25 04:45:05 -0400 (Wed, 25 Jun 2008)
New Revision: 9207
Added:
trunk/test-applications/jsp/src/main/java/hotKey/
trunk/test-applications/jsp/src/main/java/hotKey/HotKey.java
trunk/test-applications/jsp/src/main/webapp/HotKey/
trunk/test-applications/jsp/src/main/webapp/HotKey/HotKey.jsp
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-HotKey.xml
Modified:
trunk/test-applications/jsp/src/main/java/rich/RichBean.java
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
Log:
add hotKey
Added: trunk/test-applications/jsp/src/main/java/hotKey/HotKey.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/hotKey/HotKey.java
(rev 0)
+++ trunk/test-applications/jsp/src/main/java/hotKey/HotKey.java 2008-06-25 08:45:05 UTC
(rev 9207)
@@ -0,0 +1,143 @@
+/**
+ *
+ */
+package hotKey;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.html.HtmlHotKey;
+
+/**
+ * @author AYanul
+ *
+ */
+public class HotKey {
+ private HtmlHotKey binding = null;
+ private String bindingInfo = "";
+ private String handler = "alert('#{hotKey.key} is pressed; event type: ' +
event.type); return false;";
+ private String key = "alt+a";
+ private String selector = "none";
+ private String timing = "immediate";
+ private String type = "onkeydown";
+ private boolean rendered = true;
+ private boolean disableInInput = false;
+ private boolean checkParent = false;
+
+ /**
+ * @return the binding
+ */
+ public HtmlHotKey getBinding() {
+ return binding;
+ }
+ /**
+ * @param binding the binding to set
+ */
+ public void setBinding(HtmlHotKey binding) {
+ this.binding = binding;
+ }
+ /**
+ * @return the handler
+ */
+ public String getHandler() {
+ return handler;
+ }
+ /**
+ * @param handler the handler to set
+ */
+ public void setHandler(String handler) {
+ this.handler = handler;
+ }
+ /**
+ * @return the key
+ */
+ public String getKey() {
+ return key;
+ }
+ /**
+ * @param key the key to set
+ */
+ public void setKey(String key) {
+ this.key = key;
+ }
+ /**
+ * @return the selector
+ */
+ public String getSelector() {
+ return selector;
+ }
+ /**
+ * @param selector the selector to set
+ */
+ public void setSelector(String selector) {
+ this.selector = selector;
+ }
+ /**
+ * @return the timing
+ */
+ public String getTiming() {
+ return timing;
+ }
+ /**
+ * @param timing the timing to set
+ */
+ public void setTiming(String timing) {
+ this.timing = timing;
+ }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+ /**
+ * @return the rendered
+ */
+ public boolean isRendered() {
+ return rendered;
+ }
+ /**
+ * @param rendered the rendered to set
+ */
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+ /**
+ * @return the disableInInput
+ */
+ public boolean isDisableInInput() {
+ return disableInInput;
+ }
+ /**
+ * @param disableInInput the disableInInput to set
+ */
+ public void setDisableInInput(boolean disableInInput) {
+ this.disableInInput = disableInInput;
+ }
+ /**
+ * @return the checkParent
+ */
+ public boolean isCheckParent() {
+ return checkParent;
+ }
+ /**
+ * @param checkParent the checkParent to set
+ */
+ public void setCheckParent(boolean checkParent) {
+ this.checkParent = checkParent;
+ }
+ /**
+ * @return the bindingInfo
+ */
+ public String getBindingInfo() {
+ String b = binding.getClientId(FacesContext.getCurrentInstance());
+ if(b != null && b.length() != 0)
+ return "work";
+ return "don't work";
+ }
+}
Modified: trunk/test-applications/jsp/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2008-06-25 07:39:46 UTC
(rev 9206)
+++ trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2008-06-25 08:45:05 UTC
(rev 9207)
@@ -1,12 +1,24 @@
package rich;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.richfaces.component.html.HtmlCalendar;
+import org.xml.sax.SAXException;
+
+import util.RichComponent.RichComponent;
+import util.RichComponent.RichHandler;
+
//import org.richfaces.VersionBean;
public class RichBean {
@@ -16,9 +28,24 @@
private String srcContainer;
private MapComponent map;
private List<SelectItem> list;
+// private RichComponent richComponent = RichComponent.getInstance();
+ public RichBean() {
+// try {
+// SAXParserFactory factory = SAXParserFactory.newInstance();
+// factory.setNamespaceAware(true);
+// SAXParser saxParser = factory.newSAXParser();
+// // InputStream in = new URL(url).openStream();
+// RichHandler handler = new RichHandler();
+// saxParser.parse(getClass().getResourceAsStream("richfaces.tld"),
handler);
+// } catch (SAXException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// } catch (ParserConfigurationException e) {
+// e.printStackTrace();
+// }
- public RichBean() {
list = new ArrayList<SelectItem>();
src = "Blank";
srcContainer = "Blank";
@@ -69,6 +96,7 @@
map.add("InplaceSelect", add("/InplaceSelect/InplaceSelect", new
boolean [] {false, true, false}));
map.add("InplaceInput", add("/InplaceInput/InplaceInput", new
boolean [] {false, true, false}));
map.add("Skinning", add("/Skinning/Skinning", new boolean []
{false, false, false}));
+ map.add("HotKey", add("/HotKey/HotKey", new boolean [] {false,
false, false}));
Iterator<String> iterator = map.getSet().iterator();
while(iterator.hasNext()){
list.add(new SelectItem(iterator.next()));
Added: trunk/test-applications/jsp/src/main/webapp/HotKey/HotKey.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/HotKey/HotKey.jsp
(rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/HotKey/HotKey.jsp 2008-06-25 08:45:05 UTC
(rev 9207)
@@ -0,0 +1,69 @@
+<%@ 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.binding}"
+ disableInInput="#{hotKey.disableInInput}"
handler="#{hotKey.handler}" key="#{hotKey.key}"
+ rendered="#{hotKey.rendered}" selector="#{hotKey.selector}"
timing="#{hotKey.timing}"/>
+
+ <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}">
+ <a4j:support reRender="hotKeyID"
event="onchange"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="timing"></h:outputText>
+ <h:selectOneMenu value="#{hotKey.timing}"
onchange="submit();">
+ <f:selectItem itemLabel="immediate" itemValue="immediate"/>
+ <f:selectItem itemLabel="onload" itemValue="onload"/>
+ <f:selectItem itemLabel="onregistercall"
itemValue="onregistercall"/>
+ </h:selectOneMenu>
+
+ <h:outputText value="selector"></h:outputText>
+ <h:selectOneMenu value="#{hotKey.selector}">
+ <f:selectItem itemLabel="Button"
itemValue="#commandButtonID"/>
+ <f:selectItem itemLabel="none" itemValue=" "/>
+ <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(#{hotKey.key}' is pressed; event type:
' + event.type); return false;" itemLabel="alert(...)"/>
+ </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="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>
+
+ <button onclick="${rich:component('hotKeyID')}.enable(); return
false;">turn on</button>
+ <button onclick="${rich:component('hotKeyID')}.disable(); return
false;">turn off</button><br />
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-HotKey.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-HotKey.xml
(rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-HotKey.xml 2008-06-25
08:45:05 UTC (rev 9207)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.0//EN"
+
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>hotKey</managed-bean-name>
+ <managed-bean-class>hotKey.HotKey</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config.xml 2008-06-25
07:39:46 UTC (rev 9206)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config.xml 2008-06-25
08:45:05 UTC (rev 9207)
@@ -33,7 +33,7 @@
<default-locale>en</default-locale>
</locale-config>
</application>
- <lifecycle>
+ <lifecycle>
<phase-listener
id="phaseTracker">util.phaseTracker.PhaseTracker</phase-listener>
</lifecycle>
</faces-config>
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2008-06-25 07:39:46 UTC
(rev 9206)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2008-06-25 08:45:05 UTC
(rev 9207)
@@ -20,7 +20,7 @@
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
-
<param-value>/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,!
/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml</param-value>
+
<param-value>/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,!
/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces!
-config-Custom.xml</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>