Author: jpapouse
Date: 2012-01-10 04:38:24 -0500 (Tue, 10 Jan 2012)
New Revision: 23135
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichHotKeyBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/editor.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/orderingList.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/pickList.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/simple.xhtml
Log:
fixed samples for rich:hotKey component
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichHotKeyBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichHotKeyBean.java 2012-01-09
14:55:52 UTC (rev 23134)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichHotKeyBean.java 2012-01-10
09:38:24 UTC (rev 23135)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -22,6 +22,8 @@
package org.richfaces.tests.metamer.bean.rich;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
@@ -36,6 +38,7 @@
* Managed bean for rich:hotKey.
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
* @version $Revision$
*/
@ManagedBean(name = "richHotKeyBean")
@@ -46,6 +49,7 @@
private static Logger logger;
private Attributes attributes;
private Attributes attributes2;
+ private Collection<String> hiddenAttributes = new ArrayList<String>();
/**
* Initializes the managed bean.
@@ -58,15 +62,23 @@
attributes = Attributes.getComponentAttributesFromFacesConfig(UIHotKey.class,
getClass());
attributes2 = Attributes.getComponentAttributesFromFacesConfig(UIHotKey.class,
getClass());
+ String[] attrsToHide = { "onkeydown", "onkeyup" };
+
attributes.setAttribute("enabledInInput", true);
attributes.setAttribute("key", "ctrl+x");
attributes.setAttribute("rendered", true);
- attributes.remove("onpress");
+ attributes.setAttribute("preventDefault", true);
attributes2.setAttribute("enabledInInput", true);
attributes2.setAttribute("key", "alt+x");
attributes2.setAttribute("rendered", true);
- attributes2.remove("onpress");
+ attributes2.setAttribute("preventDefault", true);
+
+ for (String attrToHide : attrsToHide) {
+ attributes.remove(attrToHide);
+ attributes2.remove(attrToHide);
+ hiddenAttributes.add(attrToHide);
+ }
}
public Attributes getAttributes() {
@@ -84,4 +96,12 @@
public void setAttributes2(Attributes attributes) {
this.attributes2 = attributes;
}
+
+ public Collection<String> getHiddenAttributes() {
+ return hiddenAttributes;
+ }
+
+ public void setHiddenAttributes(Collection<String> hiddenAttributes) {
+ this.hiddenAttributes = hiddenAttributes;
+ }
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/editor.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/editor.xhtml 2012-01-09
14:55:52 UTC (rev 23134)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/editor.xhtml 2012-01-10
09:38:24 UTC (rev 23135)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010-2011, Red Hat, Inc. and individual contributors
+Copyright 2010-2012, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -40,15 +40,21 @@
<rich:editor id="editor" />
- <rich:hotKey id="richHotKey1"
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes['key'].value}"
onpress="#{rich:component('editor')}.focus()"
- rendered="#{richHotKeyBean.attributes['rendered'].value}"
selector="#{richHotKeyBean.attributes['selector'].value}"
- type="#{richHotKeyBean.attributes['type'].value}" />
+ <rich:hotKey id="richHotKey1"
+
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes['key'].value}"
+ onkeydown="#{rich:component('editor')}.focus()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
+ rendered="#{richHotKeyBean.attributes['rendered'].value}"
+ selector="#{richHotKeyBean.attributes['selector'].value}"
/>
- <rich:hotKey id="richHotKey2"
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes2['key'].value}"
onpress="#{rich:component('editor')}.blur()"
+ <rich:hotKey id="richHotKey2"
+
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes2['key'].value}"
+ onkeydown="#{rich:component('editor')}.blur()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
rendered="#{richHotKeyBean.attributes2['rendered'].value}"
- selector="#{richHotKeyBean.attributes2['selector'].value}"
type="#{richHotKeyBean.attributes2['type'].value}" />
+ selector="#{richHotKeyBean.attributes2['selector'].value}"
/>
</ui:define>
@@ -64,6 +70,13 @@
<legend>Hot key that calls editor's blur() function</legend>
<metamer:attributes value="#{richHotKeyBean.attributes2}"
id="attributes2" />
</fieldset>
+ <hr />
+ <p>
+ Following attributes are hidden:
+ </p>
+ <rich:list id="hiddenAttributes"
value="#{richHotKeyBean.hiddenAttributes}" var="attribute">
+ <h:outputText value="#{attribute}" />
+ </rich:list>
</ui:define>
</ui:composition>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/orderingList.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/orderingList.xhtml 2012-01-09
14:55:52 UTC (rev 23134)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/orderingList.xhtml 2012-01-10
09:38:24 UTC (rev 23135)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010-2011, Red Hat, Inc. and individual contributors
+Copyright 2010-2012, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -55,15 +55,21 @@
</rich:orderingList>
- <rich:hotKey id="richHotKey1"
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes['key'].value}"
onpress="#{rich:component('orderingList')}.upTop()"
- rendered="#{richHotKeyBean.attributes['rendered'].value}"
selector="#{richHotKeyBean.attributes['selector'].value}"
- type="#{richHotKeyBean.attributes['type'].value}" />
+ <rich:hotKey id="richHotKey1"
+
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes['key'].value}"
+ onkeydown="#{rich:component('orderingList')}.upTop()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
+ rendered="#{richHotKeyBean.attributes['rendered'].value}"
+ selector="#{richHotKeyBean.attributes['selector'].value}"
/>
- <rich:hotKey id="richHotKey2"
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes2['key'].value}"
onpress="#{rich:component('orderingList')}.downBottom()"
+ <rich:hotKey id="richHotKey2"
+
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes2['key'].value}"
+ onkeydown="#{rich:component('orderingList')}.downBottom()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
rendered="#{richHotKeyBean.attributes2['rendered'].value}"
- selector="#{richHotKeyBean.attributes2['selector'].value}"
type="#{richHotKeyBean.attributes2['type'].value}" />
+ selector="#{richHotKeyBean.attributes2['selector'].value}"
/>
</ui:define>
@@ -79,6 +85,13 @@
<legend>>Hot key that calls ordering list's downBottom()
function</legend>
<metamer:attributes value="#{richHotKeyBean.attributes2}"
id="attributes2" />
</fieldset>
+ <hr />
+ <p>
+ Following attributes are hidden:
+ </p>
+ <rich:list id="hiddenAttributes"
value="#{richHotKeyBean.hiddenAttributes}" var="attribute">
+ <h:outputText value="#{attribute}" />
+ </rich:list>
</ui:define>
<!-- we don't want two logs on the page -->
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/pickList.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/pickList.xhtml 2012-01-09
14:55:52 UTC (rev 23134)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/pickList.xhtml 2012-01-10
09:38:24 UTC (rev 23135)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010-2011, Red Hat, Inc. and individual contributors
+Copyright 2010-2012, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -62,15 +62,21 @@
</rich:pickList>
- <rich:hotKey id="richHotKey1"
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes['key'].value}"
onpress="#{rich:component('pickList')}.add()"
- rendered="#{richHotKeyBean.attributes['rendered'].value}"
selector="#{richHotKeyBean.attributes['selector'].value}"
- type="#{richHotKeyBean.attributes['type'].value}" />
+ <rich:hotKey id="richHotKey1"
+
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes['key'].value}"
+ onkeydown="#{rich:component('pickList')}.add()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
+ rendered="#{richHotKeyBean.attributes['rendered'].value}"
+ selector="#{richHotKeyBean.attributes['selector'].value}"
/>
- <rich:hotKey id="richHotKey2"
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes2['key'].value}"
onpress="#{rich:component('pickList')}.remove()"
+ <rich:hotKey id="richHotKey2"
+
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes2['key'].value}"
+ onkeydown="#{rich:component('pickList')}.remove()"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
rendered="#{richHotKeyBean.attributes2['rendered'].value}"
- selector="#{richHotKeyBean.attributes2['selector'].value}"
type="#{richHotKeyBean.attributes2['type'].value}" />
+
selector="#{richHotKeyBean.attributes2['selector'].value}"/>
</ui:define>
@@ -86,6 +92,13 @@
<legend>Hot key that calls pick list's remove()
function</legend>
<metamer:attributes value="#{richHotKeyBean.attributes2}"
id="attributes2" />
</fieldset>
+ <hr />
+ <p>
+ Following attributes are hidden:
+ </p>
+ <rich:list id="hiddenAttributes"
value="#{richHotKeyBean.hiddenAttributes}" var="attribute">
+ <h:outputText value="#{attribute}" />
+ </rich:list>
</ui:define>
</ui:composition>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/simple.xhtml 2012-01-09
14:55:52 UTC (rev 23134)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richHotKey/simple.xhtml 2012-01-10
09:38:24 UTC (rev 23135)
@@ -45,15 +45,23 @@
<h:inputText id="firstInput" styleClass="first-input"
value="first input" />
<h:inputText id="secondInput"
styleClass="second-input" value="second input" />
- <rich:hotKey id="richHotKey1"
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes['key'].value}"
onpress="RichFaces.log.info('hotkey 1')"
+ <rich:hotKey id="richHotKey1"
+
enabledInInput="#{richHotKeyBean.attributes['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes['key'].value}"
+ onkeydown="RichFaces.log.info('hotkey 1 : onkeydown')"
+ onkeyup="RichFaces.log.info('hotkey 1 : onkeyup')"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
rendered="#{richHotKeyBean.attributes['rendered'].value}"
-
selector="#{richHotKeyBean.attributes['selector'].value}"
type="#{richHotKeyBean.attributes['type'].value}" />
+
selector="#{richHotKeyBean.attributes['selector'].value}"/>
- <rich:hotKey id="richHotKey2"
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
- key="#{richHotKeyBean.attributes2['key'].value}"
onpress="RichFaces.log.info('hotkey 2')"
+ <rich:hotKey id="richHotKey2"
+
enabledInInput="#{richHotKeyBean.attributes2['enabledInInput'].value}"
+ key="#{richHotKeyBean.attributes2['key'].value}"
+ onkeydown="RichFaces.log.info('hotkey 2 : onkeydown')"
+ onkeyup="RichFaces.log.info('hotkey 2 : onkeyup')"
+
preventDefault="#{richHotKeyBean.attributes['preventDefault'].value}"
rendered="#{richHotKeyBean.attributes2['rendered'].value}"
-
selector="#{richHotKeyBean.attributes2['selector'].value}"
type="#{richHotKeyBean.attributes2['type'].value}" />
+
selector="#{richHotKeyBean.attributes2['selector'].value}"/>
</a4j:outputPanel>
@@ -71,6 +79,13 @@
<legend>hot key 2</legend>
<metamer:attributes value="#{richHotKeyBean.attributes2}"
id="attributes2" />
</fieldset>
+ <hr />
+ <p>
+ Following attributes are hidden:
+ </p>
+ <rich:list id="hiddenAttributes"
value="#{richHotKeyBean.hiddenAttributes}" var="attribute">
+ <h:outputText value="#{attribute}" />
+ </rich:list>
</ui:define>
<!-- we don't want two logs on the page -->