From 4dd5e2335185decd80b0e1f6d2c5e0fe96204e9d Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Tue, 24 Jan 2012 16:59:57 +0000 Subject: [PATCH] Restructuring repo to match branches/tags/trunk. --- showcase/pom.xml | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/java/org/richfaces/schedule/Bean.java | 659 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/java/org/richfaces/schedule/ScheduleTask.java | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/resources/myMessages.properties | 0 showcase/src/main/resources/myMessages_fr.properties | 0 showcase/src/main/webapp/META-INF/MANIFEST.MF | 3 +++ showcase/src/main/webapp/WEB-INF/faces-config.xml | 6 ++++++ showcase/src/main/webapp/WEB-INF/web.xml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/index.xhtml | 24 ++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_1.xhtml | 45 +++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_2.xhtml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_3.xhtml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_4.xhtml | 33 +++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_5.xhtml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_6.xhtml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/focus_7.xhtml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/pages/focus/menu.xhtml | 14 ++++++++++++++ showcase/src/main/webapp/resources/css/main.css | 9 +++++++++ showcase/src/main/webapp/resources/css/reset.css | 44 ++++++++++++++++++++++++++++++++++++++++++++ showcase/src/main/webapp/template.xhtml | 31 +++++++++++++++++++++++++++++++ 20 files changed, 1454 insertions(+), 0 deletions(-) create mode 100644 showcase/pom.xml create mode 100644 showcase/src/main/java/org/richfaces/schedule/Bean.java create mode 100644 showcase/src/main/java/org/richfaces/schedule/ScheduleTask.java create mode 100644 showcase/src/main/resources/myMessages.properties create mode 100644 showcase/src/main/resources/myMessages_fr.properties create mode 100644 showcase/src/main/webapp/META-INF/MANIFEST.MF create mode 100644 showcase/src/main/webapp/WEB-INF/faces-config.xml create mode 100644 showcase/src/main/webapp/WEB-INF/web.xml create mode 100644 showcase/src/main/webapp/index.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_1.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_2.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_3.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_4.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_5.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_6.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/focus_7.xhtml create mode 100644 showcase/src/main/webapp/pages/focus/menu.xhtml create mode 100644 showcase/src/main/webapp/resources/css/main.css create mode 100644 showcase/src/main/webapp/resources/css/reset.css create mode 100644 showcase/src/main/webapp/template.xhtml diff --git a/showcase/pom.xml b/showcase/pom.xml new file mode 100644 index 0000000..8470777 --- /dev/null +++ b/showcase/pom.xml @@ -0,0 +1,93 @@ + + + + 4.0.0 + 3.3.4-SNAPSHOT + org.richfaces.sandbox + showcase + showcase + war + + + ${project.artifactId} + + + maven-compiler-plugin + 2.3.2 + + 1.5 + 1.5 + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.3 + + ${project.build.sourceEncoding} + + + + + + + + org.richfaces.sandbox.ui + richfaces-assembly + 3.3.4-SNAPSHOT + + + org.richfaces.ui + richfaces-ui + 3.3.4-SNAPSHOT + + + org.richfaces.framework + richfaces-impl + ${project.version} + + + com.uwyn + jhighlight + 1.0 + + + javax.faces + jsf-api + 1.2_12 + + + javax.faces + jsf-impl + 1.2_12 + + + + javax.servlet + jstl + 1.2 + + + com.sun.facelets + jsf-facelets + 1.1.15.B1 + + + + + + + + + + UTF-8 + Tomcat + + \ No newline at end of file diff --git a/showcase/src/main/java/org/richfaces/schedule/Bean.java b/showcase/src/main/java/org/richfaces/schedule/Bean.java new file mode 100644 index 0000000..9b4cf0f --- /dev/null +++ b/showcase/src/main/java/org/richfaces/schedule/Bean.java @@ -0,0 +1,659 @@ +package org.richfaces.schedule; + +import org.ajax4jsf.model.DataVisitor; +import org.ajax4jsf.model.ExtendedDataModel; +import org.ajax4jsf.model.Range; +import org.richfaces.component.UISchedule; +import org.richfaces.component.event.ScheduleDateRangeChangeEvent; +import org.richfaces.component.event.ScheduleDateRangeChangeListener; +import org.richfaces.component.event.ScheduleDateRangeSelectEvent; +import org.richfaces.component.event.ScheduleDateRangeSelectListener; +import org.richfaces.component.event.ScheduleDateSelectEvent; +import org.richfaces.component.event.ScheduleDateSelectListener; +import org.richfaces.component.event.ScheduleItemMoveEvent; +import org.richfaces.component.event.ScheduleItemMoveListener; +import org.richfaces.component.event.ScheduleItemResizeEvent; +import org.richfaces.component.event.ScheduleItemResizeListener; +import org.richfaces.component.event.ScheduleItemSelectEvent; +import org.richfaces.component.event.ScheduleItemSelectListener; +import org.richfaces.component.event.ScheduleViewChangeEvent; +import org.richfaces.component.event.ScheduleViewChangeListener; +import org.richfaces.component.model.DateRange; + +import javax.faces.application.FacesMessage; +import javax.faces.application.FacesMessage.Severity; +import javax.faces.context.FacesContext; +import javax.faces.event.FacesEvent; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class Bean { + + private String text; + private boolean allowTaskMoving; + private List allTasks = new ArrayList(); + private ExtendedDataModel lazyDataModel = new MyDataModel(); + private String selectedEventId; + private int firstDay = Calendar.SUNDAY; + private boolean showWeekends; + private Date initialDate; + private boolean allowTaskResizing; + private String weekMode = UISchedule.WEEK_MODE_FIXED; + private String allDayText = "All day"; + private boolean allDayByDefault; + private boolean allDaySlot = true; + private Double aspectRatio = 1.; + private String axisFormat = "h(:mm)tt"; + private Integer defaultEventMinutes = 90; + private Integer contentHeight = 400; + private Double dragOpacity = .2; + private Integer dragRevertDuration = 2000; + private Boolean editable = true; + private Boolean selectable = true; + private Boolean selectHelper = true; + private Boolean unselectAuto = true; + private String unselectCancel = ""; + private Integer firstHour = 8; + private String headerCenter = "title"; + private String headerLeft = "prevYear,nextYear"; + private String headerRight = "basicDay,basicWeek agendaDay,agendaWeek month today prev,next"; + private Integer height = 400; + private boolean isRTL; + private Integer maxTime = 17; + private Integer minTime = 8; + private Integer slotMinutes = 30; + private String columnFormat = null; + private String titleFormat = null; + private String timeFormat = null; + private String view = UISchedule.VIEW_MONTH; + private String locale; + private CustomScheduleListener additionalListener = new CustomScheduleListener(); + private int taskIdSequence = 1; + + public Bean() { + Calendar instance = Calendar.getInstance(); + instance.setTime(getInitialDate()); + Random random = new Random(); + for (int i = -30; i < 60; i++) { + instance.set(Calendar.HOUR, minTime + random.nextInt(maxTime - minTime)); + instance.set(Calendar.MINUTE, random.nextInt(59)); + instance.add(Calendar.DAY_OF_YEAR, 1); + Map data = new HashMap(); + data.put("category", "category-" + (i % 3)); + int taskId = taskIdSequence++; + allTasks.add(new ScheduleTask("" + taskId, "Title " + taskId, instance.getTime(), instance.getTime(), data)); + } + + } + + public Boolean taskMoved(ScheduleItemMoveEvent event) { + System.out.println("taskMoved invoked " + event + " : " + isAllowTaskMoving()); + if (isAllowTaskMoving()) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Item moved", event.toString())); + ScheduleTask task = getTask(event.getEventId()); + selectedEventId = event.getEventId(); + if (task != null) { + boolean endDateEqualsStartDate = task.getStartDate().equals(task.getEndDate()); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(task.getStartDate()); + calendar.add(Calendar.DAY_OF_MONTH, event.getDayDelta()); + calendar.add(Calendar.MINUTE, event.getMinuteDelta()); + task.setStartDate(calendar.getTime()); + if (!event.isAllDay() && endDateEqualsStartDate) { + calendar.setTime(task.getStartDate()); + calendar.add(Calendar.MINUTE, getDefaultEventMinutes()); + } else { + calendar.setTime(task.getEndDate()); + calendar.add(Calendar.DAY_OF_MONTH, event.getDayDelta()); + calendar.add(Calendar.MINUTE, event.getMinuteDelta()); + } + task.setEndDate(calendar.getTime()); + task.setAllDay(event.isAllDay()); + } + } else { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "It is not allowed to move this item", event.toString())); + } + return isAllowTaskMoving(); + } + + public Boolean taskResized(ScheduleItemResizeEvent event) { + System.out.println("taskResized invoked " + event + " : " + isAllowTaskResizing()); + if (isAllowTaskResizing()) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Item resized", event.toString())); + ScheduleTask task = getTask(event.getEventId()); + selectedEventId = event.getEventId(); + if (task != null) { + Calendar calendar = Calendar.getInstance(); + Date date = task.getEndDate() == null ? task.getStartDate() : task.getEndDate(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_MONTH, event.getDayDelta()); + calendar.add(Calendar.MINUTE, event.getMinuteDelta()); + task.setEndDate(calendar.getTime()); + } + } else { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "It is not allowed to resize this item", event.toString())); + } + return isAllowTaskResizing(); + } + + public void viewChanged(ScheduleViewChangeEvent event) { + System.out.println("viewChanged invoked " + event); + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("View changed", event.toString())); + setView(event.getView()); + } + + public void taskSelected(ScheduleItemSelectEvent event) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Task selected", event.toString())); + selectedEventId = event.getEventId(); + } + + public void dateRangeChanged(ScheduleDateRangeChangeEvent event) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Date range changed", event.toString())); + if (UISchedule.VIEW_MONTH.equals(getView())) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(event.getStartDate()); + calendar.add(Calendar.DATE, 15); + setInitialDate(calendar.getTime()); + } else { + setInitialDate(event.getStartDate()); + } + } + + public void dateRangeSelected(ScheduleDateRangeSelectEvent event) { + if (editable) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Date range selected", event.toString())); + int taskId = taskIdSequence++; + allTasks.add(new ScheduleTask("" + taskId, "Title-" + taskId, event.getStartDate(), event.getEndDate(), event.isAllDay())); + } else { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Date range selected", "Cannot create item. Not in edit mode.")); + } + } + + public void dateSelected(ScheduleDateSelectEvent event) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Date selected", event.toString())); + setInitialDate(event.getDate()); + } + + public ScheduleTask getSelectedTask() { + return getTask(getSelectedEventId()); + } + + protected ScheduleTask getTask(String id) { + if (id == null) { + return null; + } + for (ScheduleTask task : allTasks) { + if (id.equals(task.getId())) { + return task; + } + } + return null; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public List getAllEvents() { + return allTasks; + } + + public ExtendedDataModel getLazyDataModel() { + return lazyDataModel; + } + + public boolean isAllowTaskMoving() { + return allowTaskMoving; + } + + public void setAllowTaskMoving(boolean allowTaskMoving) { + this.allowTaskMoving = allowTaskMoving; + } + + public boolean isAllowTaskResizing() { + return allowTaskResizing; + } + + public void setAllowTaskResizing(boolean allowTaskResizing) { + this.allowTaskResizing = allowTaskResizing; + } + + public String getSelectedEventId() { + return selectedEventId; + } + + public Date getInitialDate() { + if (initialDate == null) { + Calendar instance = Calendar.getInstance(); + instance.set(Calendar.YEAR, 2012); + instance.set(Calendar.MONTH, 7); + instance.set(Calendar.DATE, 22); + initialDate = instance.getTime(); + } + return initialDate; + } + + public int getFirstDay() { + return firstDay; + } + + public void setFirstDay(int firstDay) { + this.firstDay = firstDay; + } + + public boolean isShowWeekends() { + return showWeekends; + } + + public void setShowWeekends(boolean showWeekends) { + this.showWeekends = showWeekends; + } + + public void setInitialDate(Date initialDate) { + this.initialDate = initialDate; + } + + public String getWeekMode() { + return weekMode; + } + + public void setWeekMode(String weekMode) { + this.weekMode = weekMode; + } + + public void setAllDayText(String allDayText) { + this.allDayText = allDayText; + } + + public String getAllDayText() { + return allDayText; + } + + public void setAllDayByDefault(boolean allDayByDefault) { + this.allDayByDefault = allDayByDefault; + } + + public boolean getAllDayByDefault() { + return allDayByDefault; + } + + public void setAllDaySlot(boolean allDaySlot) { + this.allDaySlot = allDaySlot; + } + + public boolean getAllDaySlot() { + return allDaySlot; + } + + public void setAspectRatio(Double aspectRatio) { + this.aspectRatio = aspectRatio; + } + + public Double getAspectRatio() { + return aspectRatio; + } + + public void setAxisFormat(String axisFormat) { + this.axisFormat = axisFormat; + } + + public String getAxisFormat() { + return axisFormat; + } + + public void setDefaultEventMinutes(Integer defaultEventMinutes) { + this.defaultEventMinutes = defaultEventMinutes; + } + + public Integer getDefaultEventMinutes() { + return defaultEventMinutes; + } + + public void setContentHeight(Integer contentHeight) { + this.contentHeight = contentHeight; + } + + public Integer getContentHeight() { + return contentHeight; + } + + public void setDragOpacity(Double dragOpacity) { + this.dragOpacity = dragOpacity; + } + + public Double getDragOpacity() { + return dragOpacity; + } + + public void setDragRevertDuration(Integer dragRevertDuration) { + this.dragRevertDuration = dragRevertDuration; + } + + public Integer getDragRevertDuration() { + return dragRevertDuration; + } + + public void setEditable(Boolean editable) { + this.editable = editable; + } + + public Boolean getEditable() { + return editable; + } + + public void setSelectable(Boolean selectable) { + this.selectable = selectable; + } + + public Boolean getSelectable() { + return selectable; + } + + public void setFirstHour(Integer firstHour) { + this.firstHour = firstHour; + } + + public Integer getFirstHour() { + return firstHour; + } + + public void setHeaderCenter(String headerCenter) { + this.headerCenter = headerCenter; + } + + public String getHeaderCenter() { + return headerCenter; + } + + public void setHeaderLeft(String headerLeft) { + this.headerLeft = headerLeft; + } + + public String getHeaderLeft() { + return headerLeft; + } + + public void setHeaderRight(String headerRight) { + this.headerRight = headerRight; + } + + public String getHeaderRight() { + return headerRight; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Integer getHeight() { + return height; + } + + public void setIsRTL(Boolean isRTL) { + this.isRTL = isRTL; + } + + public Boolean getIsRTL() { + return isRTL; + } + + public void setMaxTime(Integer maxTime) { + this.maxTime = maxTime; + } + + public Integer getMaxTime() { + return maxTime; + } + + public void setMinTime(Integer minTime) { + this.minTime = minTime; + } + + public Integer getMinTime() { + return minTime; + } + + public void setSlotMinutes(Integer slotMinutes) { + this.slotMinutes = slotMinutes; + } + + public Integer getSlotMinutes() { + return slotMinutes; + } + + public void setView(String view) { + this.view = view; + } + + public String getView() { + return view; + } + + public String getColumnFormat() { + return columnFormat; + } + + public void setColumnFormat(String columnFormat) { + this.columnFormat = columnFormat; + } + + public String getTitleFormat() { + return titleFormat; + } + + public void setTitleFormat(String titleFormat) { + this.titleFormat = titleFormat; + } + + public String getTimeFormat() { + return timeFormat; + } + + public void setTimeFormat(String timeFormat) { + this.timeFormat = timeFormat; + } + + public CustomScheduleListener getAdditionalListener() { + return additionalListener; + } + + public Boolean getSelectHelper() { + return selectHelper; + } + + public void setSelectHelper(Boolean selectHelper) { + this.selectHelper = selectHelper; + } + + public Boolean getUnselectAuto() { + return unselectAuto; + } + + public void setUnselectAuto(Boolean unselectAuto) { + this.unselectAuto = unselectAuto; + } + + public String getUnselectCancel() { + return unselectCancel; + } + + public void setUnselectCancel(String unselectCancel) { + this.unselectCancel = unselectCancel; + } + + public String getLocale() { + if (locale == null) { + locale = FacesContext.getCurrentInstance().getViewRoot().getLocale().getLanguage(); + } + return locale; + } + + public void setLocale(String locale) { + this.locale = locale; + } + + private class MyDataModel extends ExtendedDataModel { + + Object rowKey; + java.util.Map wrappedDataMap = new HashMap(); + java.util.Map indexToRowKey = new HashMap(); + java.util.Map rowKeyToIndex = new HashMap(); + int rowCount = -1; + int rowIndex = -1; + + @Override + public void setRowKey(Object key) { + this.rowKey = key; + Integer index = (Integer) rowKeyToIndex.get(key); + if (index == null) { + index = -1; + } + if (index != getRowIndex()) { + setRowIndex(rowIndex); + } + } + + @Override + public Object getRowKey() { + return rowKey; + } + + @Override + public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) throws IOException { + Date startDate = ((DateRange) range).getStartDate(); + Date endDate = ((DateRange) range).getEndDate(); + wrappedDataMap.clear(); + indexToRowKey.clear(); + rowKeyToIndex.clear(); + int i = 0; + for (ScheduleTask task : allTasks) { + if ((startDate == null || task.getStartDate().compareTo(startDate) >= 0) && (endDate == null || task.getStartDate().compareTo(endDate) < 0)) { + wrappedDataMap.put(task.getId(), task); + int index = i++; + indexToRowKey.put(index, task.getId()); + rowKeyToIndex.put(task.getId(), index); + visitor.process(context, task.getId(), argument); + } + } + rowCount = -1; + } + + @Override + public boolean isRowAvailable() { + if (getRowKey() == null) { + return false; + } else { + return null != wrappedDataMap.get(getRowKey()); + } + } + + @Override + public int getRowCount() { + if (rowCount == -1) { + rowCount = wrappedDataMap.size(); + } + return rowCount; + } + + @Override + public Object getRowData() { + if (getRowKey() == null) { + return null; + } else { + return wrappedDataMap.get(getRowKey()); + } + } + + @Override + public int getRowIndex() { + return rowIndex; + } + + @Override + public void setRowIndex(int rowIndex) { + this.rowIndex = rowIndex; + Object key = indexToRowKey.get(rowIndex); + if ((key != null && !key.equals(getRowKey())) || (key == null && getRowKey() != null)) { + setRowKey(key); + } + } + + @Override + public Object getWrappedData() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setWrappedData(Object data) { + throw new UnsupportedOperationException("Not supported yet."); + } + } + + public static class CustomScheduleListener implements ScheduleDateRangeChangeListener, ScheduleDateSelectListener, ScheduleItemMoveListener, ScheduleItemResizeListener, ScheduleItemSelectListener, ScheduleViewChangeListener, ScheduleDateRangeSelectListener { + + private static FacesEvent recentlyProcessedEvent; + + private void addMessage(String text, Severity severity) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "Additional listener", text)); + } + + public void dateRangeChanged(ScheduleDateRangeChangeEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage(event.toString(), FacesMessage.SEVERITY_INFO); + } + } + + public void dateSelected(ScheduleDateSelectEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage(event.toString(), FacesMessage.SEVERITY_INFO); + } + } + + public void itemMove(ScheduleItemMoveEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage("I'd like to veto moving, but nobody cares!", FacesMessage.SEVERITY_WARN); + } + } + + public void itemResize(ScheduleItemResizeEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage("I'd like to veto resizing, but nobody cares!", FacesMessage.SEVERITY_WARN); + } + } + + public void itemSelected(ScheduleItemSelectEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage(event.toString(), FacesMessage.SEVERITY_INFO); + } + } + + public void viewChanged(ScheduleViewChangeEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage(event.toString(), FacesMessage.SEVERITY_INFO); + } + } + + public void dateRangeSelected(ScheduleDateRangeSelectEvent event) { + if (event != recentlyProcessedEvent) { + recentlyProcessedEvent = event; + addMessage(event.toString(), FacesMessage.SEVERITY_INFO); + } + } + } +} diff --git a/showcase/src/main/java/org/richfaces/schedule/ScheduleTask.java b/showcase/src/main/java/org/richfaces/schedule/ScheduleTask.java new file mode 100644 index 0000000..7f07787 --- /dev/null +++ b/showcase/src/main/java/org/richfaces/schedule/ScheduleTask.java @@ -0,0 +1,139 @@ +package org.richfaces.schedule; + +import java.util.Date; +import java.util.Map; + +//TODO base this example on classroom schedule +public class ScheduleTask { + // TODO shouldn't ID be an object? + private String id; + private String title; + private Date startDate; + private Date endDate; + private Boolean allDay; + private Map data; + private Boolean editable; + private String url; + private String details; + + public ScheduleTask() { + } + + public ScheduleTask(String id, String title, Date start, Date end) { + this.id = id; + this.title = title; + this.startDate = start; + this.endDate = end; + } + + public ScheduleTask(String id, String title, Date start, Date end, boolean allDay) { + this.id = id; + this.title = title; + this.startDate = start; + this.endDate = end; + this.allDay = allDay; + } + + public ScheduleTask(String id, String title, Date start, Date end, Map data) { + this.id = id; + this.title = title; + this.startDate = start; + this.endDate = end; + this.data = data; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Boolean getAllDay() { + return allDay; + } + + public void setAllDay(boolean allDay) { + this.allDay = allDay; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } + + public Boolean getEditable() { + return editable; + } + + public void setEditable(Boolean editable) { + this.editable = editable; + } + + public String getURL() { + return url; + } + + public void setURL(String url) { + this.url = url; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ScheduleTask)) { + return false; + } + + ScheduleTask toCompare = (ScheduleTask) obj; + return this.id != null && this.id.equals(toCompare.id); + + } + + @Override + public int hashCode() { + int hash = 1; + if (this.id != null) { + hash = hash * 31 + this.id.hashCode(); + } + return hash; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } +} diff --git a/showcase/src/main/resources/myMessages.properties b/showcase/src/main/resources/myMessages.properties new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/showcase/src/main/resources/myMessages.properties diff --git a/showcase/src/main/resources/myMessages_fr.properties b/showcase/src/main/resources/myMessages_fr.properties new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/showcase/src/main/resources/myMessages_fr.properties diff --git a/showcase/src/main/webapp/META-INF/MANIFEST.MF b/showcase/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/showcase/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/showcase/src/main/webapp/WEB-INF/faces-config.xml b/showcase/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..ddece9e --- /dev/null +++ b/showcase/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/showcase/src/main/webapp/WEB-INF/web.xml b/showcase/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..8774e5d --- /dev/null +++ b/showcase/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,76 @@ + + + + javax.faces.CONFIG_FILES + /WEB-INF/faces-config.xml + + + org.richfaces.SKIN + classic + + + javax.faces.DEFAULT_SUFFIX + .xhtml + + + facelets.REFRESH_PERIOD + 2 + + + facelets.DEVELOPMENT + true + + + facelets.SKIP_COMMENTS + true + + + javax.faces.STATE_SAVING_METHOD + server + + + com.sun.faces.validateXml + true + + + com.sun.faces.verifyObjects + false + + + org.ajax4jsf.VIEW_HANDLERS + com.sun.facelets.FaceletViewHandler + + + org.ajax4jsf.COMPRESS_SCRIPT + false + + + Ajax4jsf Filter + ajax4jsf + org.ajax4jsf.Filter + + + ajax4jsf + Faces Servlet + REQUEST + FORWARD + INCLUDE + ERROR + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + faces/index.xhtml + + \ No newline at end of file diff --git a/showcase/src/main/webapp/index.xhtml b/showcase/src/main/webapp/index.xhtml new file mode 100644 index 0000000..b132ccc --- /dev/null +++ b/showcase/src/main/webapp/index.xhtml @@ -0,0 +1,24 @@ + + + + + + + + +
    +
  • Focus Samples
  • +
+
+ + + + + + +
+ \ No newline at end of file diff --git a/showcase/src/main/webapp/pages/focus/focus_1.xhtml b/showcase/src/main/webapp/pages/focus/focus_1.xhtml new file mode 100644 index 0000000..7930062 --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_1.xhtml @@ -0,0 +1,45 @@ + + + + + + Focus sample + + + + + + + +

Focus should be placed on email: +

    +
  • username gets default priority 0
  • +
  • email gets priority -1
  • +
+

+ + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_2.xhtml b/showcase/src/main/webapp/pages/focus/focus_2.xhtml new file mode 100644 index 0000000..c7f585b --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_2.xhtml @@ -0,0 +1,52 @@ + + + + + + Focus sample + + + + + + + + +

Focus should be placed on first radio : +

    +
  • username gets priority 9999
  • +
  • email gets default priority 1
  • +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_3.xhtml b/showcase/src/main/webapp/pages/focus/focus_3.xhtml new file mode 100644 index 0000000..6c1075e --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_3.xhtml @@ -0,0 +1,47 @@ + + + + + + Focus sample + + + + + + + + +

Focus should be placed on username : +

    +
  • username gets default priority 0
  • +
  • email gets priority 1
  • +
+

+ + + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_4.xhtml b/showcase/src/main/webapp/pages/focus/focus_4.xhtml new file mode 100644 index 0000000..630f348 --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_4.xhtml @@ -0,0 +1,33 @@ + + + + + + Focus sample + + + + + + + + + +

This example shows that focus can be put on non JSF control

+ + + 1 + 2 + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_5.xhtml b/showcase/src/main/webapp/pages/focus/focus_5.xhtml new file mode 100644 index 0000000..a6ecf70 --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_5.xhtml @@ -0,0 +1,58 @@ + + + + + + Focus sample + + + + + + + + +

On initial request focus should be placed on username. This is because direct parent of + focus component is not UIInput. + In such situation focus is put on first UIInput in parent form. + Please not that focus component is not direct child of form. + This sample is to ensure you that UIInput is not searched + within direct parent of focus component, but within nesting form. +

+
    +
  • username gets default priority 0
  • +
  • email gets priority 1
  • +
+

On form submit, when username is valid and email is invalid, focus + should be placed on email. +

+ +

On form submit, when all fields are valid, focus + should be placed on username. +

+ + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_6.xhtml b/showcase/src/main/webapp/pages/focus/focus_6.xhtml new file mode 100644 index 0000000..8c6c0e6 --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_6.xhtml @@ -0,0 +1,61 @@ + + + + + + Focus sample + + + + + + + + + + +

+ Some components like h:selectOneRadio render elements that have identifiers matching component's clientId+suffix. + This might be a pain if we want to have single "focus" component inside form, but be able to focus any type of the invalid + components. + That's what focusModifier component is for. + Some components cause even grater pain cause you cannot nest anything inside (rich:calendar). + To cope with this put focusModifier inside "focusModifier" facet.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/focus_7.xhtml b/showcase/src/main/webapp/pages/focus/focus_7.xhtml new file mode 100644 index 0000000..7d3a788 --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/focus_7.xhtml @@ -0,0 +1,60 @@ + + + + + + Focus sample + + + + + + + + + +

+ Focus is placed on control withing modal panel. Modal panel is rendered before it is shown, thus + javascript that sets focus should not be invoked at that moment. + To cope with that focus component has "timing" attribute which, when valued to "onJScall" + allows setting focus later whenever user wishes. When "timing" is set to "onJScall" then "name" attribute + must be also specified. It is name of JavaScript function that will be generated and can be called by user + to set focus in any moment. + In this example we put onshow="focusTheForm();" in modal panel which causes + focus to be placed after the modal is visible. + Notice that "name" attribute of focuse component is equal to "focusTheForm". +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/showcase/src/main/webapp/pages/focus/menu.xhtml b/showcase/src/main/webapp/pages/focus/menu.xhtml new file mode 100644 index 0000000..5c1fe1e --- /dev/null +++ b/showcase/src/main/webapp/pages/focus/menu.xhtml @@ -0,0 +1,14 @@ + +
+
    +
  • Example 1
  • +
  • Example 2
  • +
  • Example 3
  • +
  • Example 4
  • +
  • Example 5
  • +
  • Example 6
  • +
  • Example 7
  • +
+
+
diff --git a/showcase/src/main/webapp/resources/css/main.css b/showcase/src/main/webapp/resources/css/main.css new file mode 100644 index 0000000..b914df0 --- /dev/null +++ b/showcase/src/main/webapp/resources/css/main.css @@ -0,0 +1,9 @@ +@CHARSET "UTF-8"; +#pageWrapper{ + margin-top: 20px; + width: 1200px; + min-height: 800px; + border: 1px solid; + margin-left: auto; + margin-right: auto; +} \ No newline at end of file diff --git a/showcase/src/main/webapp/resources/css/reset.css b/showcase/src/main/webapp/resources/css/reset.css new file mode 100644 index 0000000..eb11fe8 --- /dev/null +++ b/showcase/src/main/webapp/resources/css/reset.css @@ -0,0 +1,44 @@ +@CHARSET "UTF-8"; +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/showcase/src/main/webapp/template.xhtml b/showcase/src/main/webapp/template.xhtml new file mode 100644 index 0000000..570d60d --- /dev/null +++ b/showcase/src/main/webapp/template.xhtml @@ -0,0 +1,31 @@ + + + + + + + Sandbox samples + + + + + + +
+
+ +
+
+ +
+
+ +
+
+ + -- libgit2 0.24.0