Author: ezheleznyakov
Date: 2007-09-26 05:14:13 -0400 (Wed, 26 Sep 2007)
New Revision: 3804
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Create template for <rich:calendar/> component.
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css 2007-09-26
09:14:13 UTC (rev 3804)
@@ -0,0 +1,137 @@
+.rich-calendar-exterior {
+ border: 1px solid #c0c0c0; /*panelBorderColor*/
+}
+
+.rich-calendar-btn {
+ cursor: pointer;
+}
+
+.rich-calendar-header {
+ border-bottom: 1px solid #c0c0c0; /*panelBorderColor*/
+ background: #C7D7EC; /*additionalBackgroundColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: verdana; /*generalFamilyFont*/
+ padding: 7px;
+ height: 22px;
+}
+
+.rich-cell-size {
+ width: 25px;
+ height: 22px;
+}
+
+.rich-calendar-cell {
+ background-color: #FFFFFF; /*generalBackgroundColor*/
+ border-bottom: 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right: 1px solid #c0c0c0; /*panelBorderColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: verdana; /*generalFamilyFont*/
+ padding: 0px;
+ vertical-align: middle;
+ text-align: center;
+}
+
+.rich-calendar-tool {
+ border-bottom: 1px solid #c0c0c0; /*panelBorderColor*/
+ background-color: #D4CFC7; /*headerBackgroundColor*/
+ font-size: 11px; /*headerSizeFont*/
+ font-family: Arial, Verdana, sans-serif;
+ color: #000000; /*headerTextColor*/
+ font-weight: bold;
+ vertical-align: middle;
+ text-align: center;
+ width: 25px;
+ height: 22px;
+}
+
+.rich-calendar-month {
+ border-bottom: 1px solid #c0c0c0; /*panelBorderColor*/
+ background-color: #D4CFC7; /*headerBackgroundColor*/
+ border-bottom-color: #C4C0B9;
+ font-size: 11px; /*headerSizeFont*/
+ font-family: Arial, Verdana, sans-serif;
+ color: #000000;
+ /*headerTextColor*/
+ font-weight: bold;
+ vertical-align: middle;
+ text-align: center;
+ color: #000000;
+ font-size: 11px
+}
+
+.rich-calendar-days {
+ background: #F1EEE9 none repeat scroll 0%;
+ border-bottom: 1px solid #C4C0B9; /*panelBorderColor*/
+ border-right: 0px solid #C4C0B9; /*panelBorderColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: Arial, Verdana, sans-serif;
+ vertical-align: middle;
+ text-align: center;
+ height: 22px;
+ vertical-align: middle;
+}
+
+.rich-calendar-week {
+ border-bottom: 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right: 1px solid #c0c0c0; /*panelBorderColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: verdana; /*generalFamilyFont*/
+ background-color: #f5f5f5; /*unknown parameter - need to add*/
+ vertical-align: middle;
+ text-align: center;
+ width: 25px;
+}
+
+.rich-calendar-holly {
+ background-color: # #FFEBDA; /*unknown parameter - need to add*/
+ color: #FF7800; /*unknown parameter - need to add*/
+}
+
+.rich-calendar-today {
+ background-color: #ff7800; /*unknown parameter - need to add*/
+ color: #ffebda; /*unknown parameter - need to add*/
+ font-weight: bold;
+}
+
+.rich-calendar-spec {
+ background-color: #e4f5e2; /*unknown parameter - need to add*/
+}
+
+.rich-calendar-select {
+ background-color: #224986; /*headerBackgroundColor*/
+ color: #FFFFFF; /*headerTextColor*/
+ font-weight: bold;
+}
+
+.rich-right-cell {
+ border-right: 0px;
+}
+
+.rich-bottom-cell {
+ border-bottom: 0px;
+}
+
+.rich-calendar-toolfooter {
+ border-top: 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right: 0px solid #c0c0c0; /*panelBorderColor*/
+ background: #F1EEE9; /*additionalBackgroundColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: verdana; /*generalFamilyFont*/
+ padding: 0px 7px 0px 7px;
+ height: 22px;
+}
+
+.rich-calendar-footer {
+ border-top: 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right: 0px solid #c0c0c0; /*panelBorderColor*/
+ background: #C7D7EC; /*additionalBackgroundColor*/
+ font-size: 11px; /*generalSizeFont*/
+ font-family: verdana; /*generalFamilyFont*/
+ padding: 7px;
+ height: 22px;
+}
+
+.rich-calendar-popupicon {
+ cursor: pointer;
+ vertical-align: middle;
+}
\ No newline at end of file
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
___________________________________________________________________
Name: svn:mime-type
+ text/css
Name: svn:eol-style
+ native
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-26
08:41:28 UTC (rev 3803)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-09-26
09:14:13 UTC (rev 3804)
@@ -17,6 +17,9 @@
*
*/
public class HtmlComponentUtil {
+
+ /** HTML TAG BR */
+ public static final String HTML_TAG_BR = "br";
/** HTML TAG COLGROUP */
public static final String HTML_TAG_COLGROUP = "colgroup";
@@ -125,6 +128,9 @@
/** HTML_ROWSPAN_ATTR * */
public static final String HTML_ROWSPAN_ATTR = "rowspan";
+
+ /** HTML_READONLY_ATTR * */
+ public static final String HTML_READONLY_ATTR = "readonly";
/** HTML_SIZE_ATTR * */
public static final String HTML_SIZE_ATTR = "size";
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2007-09-26
09:14:13 UTC (rev 3804)
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * Displays template for calendar
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class RichFacesCalendarTemplate extends VpeAbstractTemplate {
+
+ static String[] HEADER_CONTENT = { "<<", "<", "",
">", ">>" };
+ private String[] weeks = new String[7];
+ private int[] monthDays = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+ final static String STYLE_PATH = "calendar/calendar.css";
+ final static String BUTTON_IMG = "calendar/calendar.gif";
+ final static int COLUMN = 8;
+ final static String FILL_WIDTH = "100%";
+ final static int NUM_DAYS_IN_WEEK = 7;
+ final static String TODAY = "Today";
+ final static int CALENDAR_WIDTH = 200;
+ final static int CALENDAR_IMAGE_WIDTH = 20;
+ final static String ATTRIBUTE_POPUP = "popup";
+ final static String ATTRIBUTE_TEXT = "text";
+
+ public RichFacesCalendarTemplate() {
+ super();
+ Calendar cal = Calendar.getInstance();
+ int firstDayOfWeek = cal.getFirstDayOfWeek();
+ while (firstDayOfWeek != cal.get(Calendar.DAY_OF_WEEK)) {
+ cal.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("EE");
+ for (int i = 0; i < NUM_DAYS_IN_WEEK; i++) {
+ weeks[i] = new String(sdf.format(cal.getTime()));
+ cal.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+ }
+
+ /**
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+ Element source = (Element) sourceNode;
+ String popup = source.getAttribute(ATTRIBUTE_POPUP);
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "calendar");
+ VpeCreationData creationData;
+ if (popup != null && popup.equalsIgnoreCase("false")) {
+ Element calendar = createCalendar(visualDocument);
+ creationData = new VpeCreationData(calendar);
+ } else {
+ Element calendarWithPopup = createCalendarWithPopup(visualDocument,
+ source);
+ creationData = new VpeCreationData(calendarWithPopup);
+ }
+ return creationData;
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ private Element createCalendarWithPopup(Document visualDocument,
+ Element source) {
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ HtmlComponentUtil.HTML_ATR_WIDTH + " : " + CALENDAR_WIDTH
+ + "px;");
+ Element input = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ input.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ HtmlComponentUtil.HTML_ATR_WIDTH + " : "
+ + (CALENDAR_WIDTH - CALENDAR_IMAGE_WIDTH) + "px;");
+ input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR, ATTRIBUTE_TEXT);
+ input.setAttribute(HtmlComponentUtil.HTML_READONLY_ATTR, "true");
+ String value = source.getAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+ if (value != null) {
+ input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR, value);
+ }
+
+ Element image = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ image.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-popupicon");
+ ComponentUtil.setImg(image, BUTTON_IMG);
+
+ div.appendChild(input);
+ div.appendChild(image);
+
+ return div;
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Atrribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Element visualNode,
+ Object data, String name, String value) {
+ if (name.equalsIgnoreCase(ATTRIBUTE_POPUP)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ private Element createCalendar(Document visualDocument) {
+ Element div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
+ HtmlComponentUtil.HTML_ATR_WIDTH + " : " + CALENDAR_WIDTH
+ + "px;");
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "calendar-exterior");
+
+ Element tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ Element header = createCalendarHeader(visualDocument);
+ Element calendarBody = createCalendarBody(visualDocument);
+ tbody.appendChild(header);
+ tbody.appendChild(calendarBody);
+ table.appendChild(tbody);
+ div.appendChild(table);
+
+ return div;
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ private Element createCalendarHeader(Document visualDocument) {
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td.setAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN, "" + COLUMN);
+
+ SimpleDateFormat sdf = new SimpleDateFormat("MMMM, yyyy");
+ Calendar cal = Calendar.getInstance();
+ HEADER_CONTENT[2] = sdf.format(cal.getTime());
+
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, FILL_WIDTH);
+
+ Element tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+
+ Element tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ for (int i = 0; i < HEADER_CONTENT.length; i++) {
+ Element td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ i == 2 ? "rich-calendar-month" : "rich-calendar-tool");
+
+ Text text1 = visualDocument.createTextNode(HEADER_CONTENT[i]);
+ td1.appendChild(text1);
+ tr1.appendChild(td1);
+ }
+
+ tbody.appendChild(tr1);
+ table.appendChild(tbody);
+ td.appendChild(table);
+ tr.appendChild(td);
+ return tr;
+ }
+
+ /**
+ *
+ * @param visualDocument
+ * @return Node of the visual tree.
+ */
+ private Element createCalendarBody(Document visualDocument) {
+ Element tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+
+ Element bodyTR = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ for (int i = 0; i < COLUMN; i++) {
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-days");
+ if (i == 0) {
+ Element br = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_BR);
+ td.appendChild(br);
+ } else {
+ Text text = visualDocument.createTextNode(i == 0 ? ""
+ : weeks[i - 1]);
+ td.appendChild(text);
+ }
+ bodyTR.appendChild(td);
+ }
+
+ tbody.appendChild(bodyTR);
+
+ // // Calendar body
+ int jumped = 0;
+ int inserted = 1;
+
+ Calendar cal = Calendar.getInstance();
+ int month = cal.get(Calendar.MONTH);
+ int day = cal.get(Calendar.DAY_OF_WEEK);
+ int dayN = cal.get(Calendar.DAY_OF_MONTH);
+ int days = monthDays[month];
+ if (month == 1) {
+ int year = cal.get(Calendar.YEAR);
+ if (year % 4 == 0)
+ days = 29;
+ }
+
+ int start = day
+ - (dayN % NUM_DAYS_IN_WEEK + cal.getFirstDayOfWeek() - 1);
+ if (start < 0)
+ start += NUM_DAYS_IN_WEEK;
+ int weeks = (start + days) / NUM_DAYS_IN_WEEK;
+ if ((start + days) % NUM_DAYS_IN_WEEK != 0)
+ weeks++;
+ for (int i = weeks; i > 0; i--) {
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ // Week in year
+ Element weekTD = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ weekTD.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-week");
+ cal.set(Calendar.DAY_OF_MONTH, inserted);
+ Text weekText = visualDocument.createTextNode(""
+ + cal.get(Calendar.WEEK_OF_YEAR));
+ weekTD.appendChild(weekText);
+ tr.appendChild(weekTD);
+ for (int j = NUM_DAYS_IN_WEEK; j > 0; j--) {
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ if (jumped < start || inserted > days) {
+ cal.set(Calendar.DAY_OF_MONTH, inserted);
+ int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ td
+ .setAttribute(
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ (dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) ?
"rich-cell-size rich-calendar-cell rich-calendar-holly rich-right-cell"
+ : "rich-cell-size rich-calendar-cell rich-calendar-cell");
+ Element br = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_BR);
+ td.appendChild(br);
+ tr.appendChild(td);
+ jumped++;
+ } else {
+ if (inserted == dayN) {
+
+ td
+ .setAttribute(
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-cell-size rich-calendar-cell rich-calendar-today ");
+ Text text = visualDocument
+ .createTextNode("" + inserted);
+ td.appendChild(text);
+ tr.appendChild(td);
+ } else {
+ cal.set(Calendar.DAY_OF_MONTH, inserted);
+ int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ td
+ .setAttribute(
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ (dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) ?
"rich-cell-size rich-calendar-cell rich-calendar-holly rich-right-cell "
+ : "rich-cell-size rich-calendar-cell");
+ Text text = visualDocument
+ .createTextNode("" + inserted);
+ td.appendChild(text);
+ tr.appendChild(td);
+ }
+ inserted++;
+ }
+ }
+ tbody.appendChild(tr);
+ }
+
+ // Footer for calendar
+
+ Element tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ Element td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td.setAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN, "" + COLUMN);
+
+ Element table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, FILL_WIDTH);
+
+ Element tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ Element td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-toolfooter");
+
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
+ cal = Calendar.getInstance();
+
+ Text text1 = visualDocument.createTextNode(sdf.format(cal.getTime()));
+ td1.appendChild(text1);
+ tr1.appendChild(td1);
+
+ Element td2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td2.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, FILL_WIDTH);
+ td2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-toolfooter");
+ tr1.appendChild(td2);
+
+ Element td3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ td3.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, FILL_WIDTH);
+ td3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "rich-calendar-toolfooter");
+ td3.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_RIGHT_VALUE);
+ Text text3 = visualDocument.createTextNode(TODAY);
+ td3.appendChild(text3);
+ tr1.appendChild(td3);
+
+ table.appendChild(tr1);
+ td.appendChild(table);
+ tr.appendChild(td);
+
+ tbody.appendChild(tr);
+
+ return tbody;
+ }
+
+ /**
+ *
+ */
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name,
+ String value) {
+ super.setAttribute(pageContext, sourceElement, visualDocument,
+ visualNode, data, name, value);
+ if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_VALUE_ATTR)) {
+ String popup = sourceElement.getAttribute(ATTRIBUTE_POPUP);
+ if (popup != null && popup.equalsIgnoreCase("false"))
+ return;
+ Element element = (Element) visualNode;
+ NodeList list = element.getChildNodes();
+ Node tableNode = list.item(0);
+ Element input = (Element) tableNode;
+ input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR, value);
+ }
+
+ }
+
+ /**
+ *
+ */
+ public void removeAttribute(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node visualNode,
+ Object data, String name) {
+ super.removeAttribute(pageContext, sourceElement, visualDocument,
+ visualNode, data, name);
+ if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_VALUE_ATTR)) {
+ String popup = sourceElement.getAttribute(ATTRIBUTE_POPUP);
+ if (popup != null && popup.equalsIgnoreCase("false"))
+ return;
+ Element element = (Element) visualNode;
+ NodeList list = element.getChildNodes();
+ Node tableNode = list.item(0);
+ Element input = (Element) tableNode;
+ input.removeAttribute(HtmlComponentUtil.HTML_VALUE_ATTR);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-26
08:41:28 UTC (rev 3803)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-26
09:14:13 UTC (rev 3804)
@@ -452,6 +452,20 @@
</vpe:template>
</vpe:tag>
+ <vpe:tag name="rich:calendar" case-sensitive="yes">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesCalendarTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
<vpe:tag name="rich:virtualEarth" case-sensitive="yes">
<vpe:template children="no" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesVirtualEarthTemplate">