Author: ilya_shaikovsky
Date: 2008-06-30 10:02:22 -0400 (Mon, 30 Jun 2008)
New Revision: 9301
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/scripts/
trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
Log:
organiser demo started
hotKey demo draft finished
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,187 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo.calendar.modelImpl;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.event.ValueChangeEvent;
+
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class CalendarDataModelImpl implements CalendarDataModel {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
+ */
+
+ private CalendarDataModelItem[] items;
+
+ private String currentDescription;
+ private String currentShortDescription;
+ private Date currentDate;
+ private boolean currentDisabled;
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.CalendarDataModel#getData(java.util.Date[])
+ */
+ public CalendarDataModelItem[] getData(Date[] dateArray) {
+ if (dateArray == null) {
+ return null;
+ }
+ if (items==null) {
+ items = new CalendarDataModelItem[dateArray.length];
+ for (int i = 0; i < dateArray.length; i++) {
+ items[i] = createDataModelItem(dateArray[i]);
+ }
+ }
+ return items;
+ }
+
+ /**
+ * @param date
+ * @return CalendarDataModelItem for date
+ */
+ protected CalendarDataModelItem createDataModelItem(Date date) {
+ CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();
+ Map data = new HashMap();
+ data.put("shortDescription", "Nothing planned");
+ data.put("description", "");
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ item.setDay(c.get(Calendar.DAY_OF_MONTH));
+ item.setEnabled(true);
+ item.setStyleClass("rel-hol");
+ item.setData(data);
+ return item;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.CalendarDataModel#getToolTip(java.util.Date)
+ */
+ public Object getToolTip(Date date) {
+
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @return items
+ */
+ public CalendarDataModelItem[] getItems() {
+ return items;
+ }
+
+ /**
+ * @param setter for items
+ */
+ public void setItems(CalendarDataModelItem[] items) {
+ this.items = items;
+ }
+
+ /**
+ * @param valueChangeEvent handling
+ */
+ public void valueChanged(ValueChangeEvent event) {
+ System.out.println(event.getNewValue()+"selected");
+ setCurrentDate((Date)event.getNewValue());
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(getCurrentDate());
+ setCurrentDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("description"));
+ setCurrentShortDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("shortDescription"));
+ }
+
+ /**
+ * Storing changes action
+ */
+ public void storeDayDetails() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(getCurrentDate());
+ ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("shortDescription",
getCurrentShortDescription());
+ ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("description",
getCurrentDescription());
+ }
+
+ /**
+ * @return currentDescription
+ */
+ public String getCurrentDescription() {
+ return currentDescription;
+ }
+
+ /**
+ * @param currentDescription
+ */
+ public void setCurrentDescription(String currentDescription) {
+ this.currentDescription = currentDescription;
+ }
+
+ /**
+ * @return currentDisabled
+ */
+ public boolean isCurrentDisabled() {
+ return currentDisabled;
+ }
+
+ /**
+ * @param currentDisabled
+ */
+ public void setCurrentDisabled(boolean currentDisabled) {
+ this.currentDisabled = currentDisabled;
+ }
+
+ /**
+ * @return currentShortDescription
+ */
+ public String getCurrentShortDescription() {
+ return currentShortDescription;
+ }
+
+ /**
+ * @param currentShortDescription
+ */
+ public void setCurrentShortDescription(String currentShortDescription) {
+ this.currentShortDescription = currentShortDescription;
+ }
+
+ /**
+ * @return currentDate
+ */
+ public Date getCurrentDate() {
+ return currentDate;
+ }
+
+ /**
+ * @param currentDate
+ */
+ public void setCurrentDate(Date currentDate) {
+ this.currentDate = currentDate;
+ }
+
+}
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java
===================================================================
---
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,111 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo.calendar.modelImpl;
+
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 04.07.2007
+ *
+ */
+public class CalendarDataModelItemImpl implements CalendarDataModelItem {
+
+ private Object data;
+ private String styleClass;
+ private Object toolTip;
+ private int day;
+ private boolean enabled = true;
+
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getData()
+ */
+ public Object getData() {
+ return data;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getStyleClass()
+ */
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getToolTip()
+ */
+ public Object getToolTip() {
+ return toolTip;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#hasToolTip()
+ */
+ public boolean hasToolTip() {
+ return getToolTip() != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#isEnabled()
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ /**
+ * @param styleClass the styleClass to set
+ */
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+
+ /**
+ * @param toolTip the toolTip to set
+ */
+ public void setToolTip(Object toolTip) {
+ this.toolTip = toolTip;
+ }
+
+ /**
+ * @param enabled the enabled to set
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+}
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,82 @@
+/**
+ *
+ */
+package org.richfaces.demo.slides;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class SlidesBean {
+
+ private final static String FILE_EXT = ".jpg";
+ private final static int FILES_COUNT = 8;
+ private final static String PATH_PREFIX = "/richfaces/jQuery/images/";
+ private final static String PIC_NAME = "pic";
+
+ private List<String> pictures;
+ private int currentIndex = 1;
+
+ public SlidesBean() {
+ pictures = new ArrayList<String>();
+ for (int i = 1; i <= FILES_COUNT; i++) {
+ pictures.add(PATH_PREFIX + PIC_NAME + i + FILE_EXT);
+ }
+ }
+
+ public void next() {
+ if (currentIndex<FILES_COUNT) {
+ currentIndex++;
+ }else{
+ setCurrentIndex(1);
+ }
+ }
+
+ public void previous() {
+ if (currentIndex>1) {
+ currentIndex--;
+ }else
+ {
+ setCurrentIndex(FILES_COUNT);
+ }
+ }
+
+ public List<String> getPictures() {
+ return pictures;
+ }
+
+ public void setPictures(List<String> pictures) {
+ this.pictures = pictures;
+ }
+
+ public int getCurrentIndex() {
+ return currentIndex;
+ }
+
+ public void setCurrentIndex(int currentIndex) {
+ this.currentIndex = currentIndex;
+ }
+
+ public String getCurrentPicture() {
+ return pictures.get(currentIndex-1);
+ }
+
+ public static String getFILE_EXT() {
+ return FILE_EXT;
+ }
+
+ public static int getFILES_COUNT() {
+ return FILES_COUNT;
+ }
+
+ public static String getPATH_PREFIX() {
+ return PATH_PREFIX;
+ }
+
+ public static String getPIC_NAME() {
+ return PIC_NAME;
+ }
+}
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
---
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-06-30
13:34:04 UTC (rev 9300)
+++
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-06-30
14:02:22 UTC (rev 9301)
@@ -82,4 +82,5 @@
columns =richDataIterators, \t Columns, \t\t\t/images/ico_columns.gif,
\t\t/images/cn_Columns.gif, columns.html,
jbossrichfaces/freezone/docs/tlddoc/rich/columns.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/taglib/ColumnsTag.html,
\t\t\t\t\t/richfaces/columns.jsf
fileUpload =richInputs, \t File Upload, \t\t/images/ico_FileUpload.gif,
\t\t/images/cn_FileUpload.gif, fileUpload.html,
jbossrichfaces/freezone/docs/tlddoc/rich/fileUpload.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIFileUpload.html,
\t\t\t\t\t/richfaces/fileUpload.jsf
StandardSkinning =richMisc, \t Standard Skinning,
\t\t/images/ico_StandardComponentsSkinning.gif,
\t\t/images/cn_StandardComponentsSkinning.gif,
ArchitectureOverview.html\#StControlsSkinning,
jbossrichfaces/freezone/docs/tlddoc/rich/StandardSkinning.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html,
\t\t\t\t\t/richfaces/standardSkinning.jsf
-plugnskin =richMisc, \t Plug'n'Skin, \t\t/images/ico_plugnskin.gif,
\t\t/images/cn_plugnskin.gif, ArchitectureOverview.html\#plugnskin,
jbossrichfaces/freezone/docs/tlddoc/rich/plugnskin.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html,
\t\t\t\t\t/richfaces/plugnskin.jsf
\ No newline at end of file
+plugnskin =richMisc, \t Plug'n'Skin, \t\t/images/ico_plugnskin.gif,
\t\t/images/cn_plugnskin.gif, ArchitectureOverview.html\#plugnskin,
jbossrichfaces/freezone/docs/tlddoc/rich/plugnskin.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html,
\t\t\t\t\t/richfaces/plugnskin.jsf
+hotKey=richMisc, \t Hot Key, \t\t/images/ico_hotkey.gif,
\t\t/images/cn_hotkey.gif, ArchitectureOverview.html\#hotkey,
jbossrichfaces/freezone/docs/tlddoc/rich/hotkey.html,
jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIhotkey.html,
\t\t\t\t\t/richfaces/hotKey.jsf
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30
13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -313,6 +313,16 @@
<managed-bean-class>org.richfaces.demo.push.PushBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>calendarDataModelImpl</managed-bean-name>
+
<managed-bean-class>org.richfaces.demo.calendar.modelImpl.CalendarDataModelImpl</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>slidesBean</managed-bean-name>
+
<managed-bean-class>org.richfaces.demo.slides.SlidesBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,50 @@
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <h:form id="form">
+ <rich:messages/>
+ <rich:calendar value="#{calendarBean.selectedDate}"
+ popup="false" showApplyButton="false"
+ cellWidth="120px" cellHeight="120px"
+ boundaryDatesMode="none" showWeeksBar="false"
+ dataModel="#{calendarDataModel}" oncurrentdateselect="return
false" id="organizer"
valueChangeListener="#{calendarDataModel.valueChanged}"
showFooter="false">
+ <f:facet name="header">
+ <h:outputText value="{currentMonthControl}"/>
+ </f:facet>
+ <a4j:outputPanel layout="block" id="cell">
+ <h:panelGrid columns="1">
+ <h:outputText value="{day}" style="align:center"/>
+ <h:outputText value="{data.shortDescription}"/>
+ <h:outputText value="{data.description}"/>
+ </h:panelGrid>
+ <rich:contextMenu attached="true" disableDefaultMenu="true"
submitMode="ajax" event="oncontextmenu" id="menu">
+ <rich:menuItem value="Disable({day})"/>
+ </rich:contextMenu>
+ </a4j:outputPanel>
+ <a4j:support event="onchanged"
oncomplete="#{rich:component('panel')}.show()"
reRender="editContent"/>
+ </rich:calendar>
+ </h:form>
+ <rich:modalPanel id="panel">
+ <f:facet name="header">Edit Day:</f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png"
style="cursor:pointer" id="hidelink"/>
+ <rich:componentControl for="panel" attachTo="hidelink"
operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+ <h:form>
+ <h:panelGrid columns="2" id="editContent">
+ <h:outputText value="Short Descrition:"/>
+ <h:inputText value="#{calendarDataModel.currentShortDescription}"/>
+ <h:outputText value="Day Notes:"/>
+ <h:inputTextarea value="#{calendarDataModel.currentDescription}"/>
+ <a4j:commandButton value="Store"
action="#{calendarDataModel.storeDayDetails}" id="storebutton"
oncomplete="#{rich:component('panel')}.hide()"
reRender="organizer"/>
+ <button type="button" id="cancelbutton"
onclick="#{rich:component('panel')}.hide()">Cancel</button>
+ </h:panelGrid>
+ </h:form>
+ </rich:modalPanel>
+</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ Description
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Calendar Demo</legend>
+ <div class="sample-container" >
+ <ui:include src="/richfaces/calendar/examples/organiser.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/calendar/examples/organiser.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ <p>
+ More description
+ </p>
+ </ui:define>
+
+</ui:composition>
+</html>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml 2008-06-30
13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -13,6 +13,9 @@
<rich:tab name="usage" label="Usage">
<ui:include src="/richfaces/calendar/usage.xhtml" />
</rich:tab>
+ <rich:tab name="organizer" label="Organizer Creation">
+ <ui:include src="/richfaces/calendar/organizer.xhtml" />
+ </rich:tab>
<rich:tab name="model" label="Calendar Model">
<ui:include src="/richfaces/calendar/model.xhtml" />
</rich:tab>
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-06-30
13:34:04 UTC (rev 9300)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -15,26 +15,16 @@
text-align:left;
}
</style>
+ <a4j:loadScript src="/scripts/picturesUtils.js"/>
<h:panelGrid columns="1" columnClasses="cent">
<h:panelGroup id="picture">
<h:graphicImage value="/richfaces/jQuery/images/pic1.jpg"
id="pic" style="border : 5px solid #E4EAEF"/>
<rich:contextMenu event="oncontextmenu" attachTo="pic"
submitMode="none">
- <rich:menuItem value="Zoom In" onclick="enlarge();"
id="zin"></rich:menuItem>
- <rich:menuItem value="Zoom Out" onclick="decrease();"
id="zout"></rich:menuItem>
+ <rich:menuItem value="Zoom In"
onclick="enlarge('pic');" id="zin"></rich:menuItem>
+ <rich:menuItem value="Zoom Out"
onclick="decrease('pic');"
id="zout"></rich:menuItem>
</rich:contextMenu>
</h:panelGroup>
</h:panelGrid>
- <script type="text/javascript">
- function enlarge(){
- document.getElementById('pic').width=document.getElementById('pic').width*1.1;
- document.getElementById('pic').height=document.getElementById('pic').height*1.1;
- }
- function decrease(){
- document.getElementById('pic').width=document.getElementById('pic').width*0.9;
- document.getElementById('pic').height=document.getElementById('pic').height*0.9;
- }
- </script>
-
</ui:composition>
\ No newline at end of file
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition>
+ <a4j:loadScript src="/scripts/picturesUtils.js"/>
+ <h:form>
+ <a4j:jsFunction name="prev" action="#{slidesBean.previous}"
reRender="slideContainer"/>
+ <a4j:jsFunction name="next" action="#{slidesBean.next}"
reRender="slideContainer"/>
+ </h:form>
+ <rich:panel id="slideContainer">
+ <f:facet name="header">
+ <h:outputText value="Image #{slidesBean.currentIndex}"/>
+ </f:facet>
+ <h:graphicImage value="#{slidesBean.currentPicture}"
id="pic"/>
+ </rich:panel>
+ <rich:hotKey key="ctrl+up"
handler="enlarge('#{rich:clientId('pic')}');return false;"/>
+ <rich:hotKey key="ctrl+down"
handler="decrease('#{rich:clientId('pic')}');return
false;"/>
+ <rich:hotKey key="ctrl+left" handler="prev();return
false;"/>
+ <rich:hotKey key="ctrl+right" handler="next();return
false;"/>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml
===================================================================
---
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:a4j="http://richfaces.org/a4j">
+
+ <ui:composition>
+ <rich:listShuttle var="cap"
sourceValue="#{capitalsBean.capitals}" id="ls"
+ sourceListWidth="300px" targetListWidth="300px">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State flag"/>
+ </f:facet>
+ <h:graphicImage value="#{cap.stateFlag}"/>
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State name"/>
+ </f:facet>
+ <h:outputText value="#{cap.name}"/>
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State capital"/>
+ </f:facet>
+ <h:outputText value="#{cap.state}"/>
+ </rich:column>
+ </rich:listShuttle>
+ <rich:hotKey selector="#ls" key="right"
handler="#{rich:component('ls')}.copy()"/>
+ <rich:hotKey selector="#ls" key="left"
handler="#{rich:component('ls')}.remove()"/>
+ <rich:hotKey selector="#ls" key="end"
handler="#{rich:component('ls')}.copyAll()"/>
+ <rich:hotKey selector="#ls" key="home"
handler="#{rich:component('ls')}.removeAll()"/>
+ </ui:composition>
+
+
+</html>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml
(rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ The <b>hotKey </b>component allows registering hot keys on the page or
+ particular elements and defining client side processing functions for
+ these keys.
+ </p>
+ <p>
+ Main component attributes are:
+ </p>
+ <ul>
+ <li><b>key</b> - hot key definition <i>("up",
"ctrl+a", etc...)</i></li>
+ <li><b>handler</b> - defines callback function for this
hotKey</li>
+ <li>
+ <b>selector</b> - JQuerry selector, defines elements which will
process
+ defined hotKey(<i>html[0] by default</i>)
+ </li>
+ </ul>
+ <p>
+ First example shows you simple <b>hotKey </b>components usage. In order
to enlarge
+ or reduce image size - press <i>CTRL + Up/Down</i> combinations. And in
order to
+ browse between images - use <i>CTRL + left/right</i> keys.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Hot Key example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/hotKey/examples/example.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/hotKey/examples/example.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ <p>
+ In next example we've used <b>selector</b> atribute. So the keys will
works
+ only if listShuttle component focused.
+ </p>
+ <p>
+ Press <i>right</i> or <i>left</i> keys in order to move some
selected items
+ between lists. Press <i>Home</i> or <i>End</i> buttons in
order to move all items between
+ lists.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Targeted Hot Key example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/hotKey/examples/inputNumbers.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath"
value="/richfaces/hotKey/examples/inputNumbers.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ </ui:define>
+
+ </ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml
(rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components -
Hot Key</ui:define>
+ <ui:define name="body">
+ <ui:include src="/templates/include/tab-panel.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
(rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js 2008-06-30
14:02:22 UTC (rev 9301)
@@ -0,0 +1,10 @@
+function enlarge(id){
+ var pic =document.getElementById(id);
+ pic.width=document.getElementById(id).width*1.1;
+ pic.height=document.getElementById(id).height*1.1;
+}
+function decrease(id){
+ var pic =document.getElementById(id);
+ pic.width=document.getElementById(id).width*0.9;
+ pic.height=document.getElementById(id).height*0.9;
+}