You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2005/07/26 16:06:37 UTC
svn commit: r225313 [1/2] - in /myfaces: examples/trunk/sandbox/
examples/trunk/simple/
sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/
sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/
sandbox/trunk/src/java/org/apac...
Author: schof
Date: Tue Jul 26 07:06:26 2005
New Revision: 225313
URL: http://svn.apache.org/viewcvs?rev=225313&view=rev
Log:
Applied Jurgen's latest schedule patch
Added:
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domLib.js
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domTT.js
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domTT_drag.js
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/fadomatic.js
Modified:
myfaces/examples/trunk/sandbox/schedule.jsp
myfaces/examples/trunk/simple/tree2.jsp
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/PlannerRenderer.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDelegatingRenderer.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/css/schedule.css
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/util/ScheduleEntryComparator.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java
Modified: myfaces/examples/trunk/sandbox/schedule.jsp
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/sandbox/schedule.jsp?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/examples/trunk/sandbox/schedule.jsp (original)
+++ myfaces/examples/trunk/sandbox/schedule.jsp Tue Jul 26 07:06:26 2005
@@ -43,7 +43,7 @@
<x:schedule value="#{simpleSchedule.model}" id="schedule1"
rendered="true" visibleEndHour="18" visibleStartHour="8"
workingEndHour="17" workingStartHour="9" readonly="false"
- actionListener="#{simpleSchedule.actionPerformed}" />
+ actionListener="#{simpleSchedule.actionPerformed}" tooltip="true"/>
</h:form>
</f:view>
</body>
Modified: myfaces/examples/trunk/simple/tree2.jsp
URL: http://svn.apache.org/viewcvs/myfaces/examples/trunk/simple/tree2.jsp?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
Binary files - no diff available.
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/model/SimpleScheduleModel.java Tue Jul 26 07:06:26 2005
@@ -16,7 +16,6 @@
package org.apache.myfaces.custom.schedule.model;
-
import java.io.Serializable;
import java.text.DateFormat;
@@ -30,7 +29,6 @@
import org.apache.myfaces.custom.schedule.util.ScheduleEntryComparator;
-
/**
* <p>
* A simple implementation of the ScheduleModel, not backed by any kind of
@@ -40,9 +38,8 @@
* @author Jurgen Lust (latest modification by $Author$)
* @version $Revision$
*/
-public class SimpleScheduleModel
- extends AbstractScheduleModel
- implements Serializable
+public class SimpleScheduleModel extends AbstractScheduleModel implements
+ Serializable
{
//~ Instance fields --------------------------------------------------------
@@ -73,15 +70,13 @@
*
* @return true if successful
*/
- public void setHoliday(
- Date date,
- String holidayName
- )
+ public void setHoliday(Date date, String holidayName)
{
- if (date == null) {
+ if (date == null)
+ {
return;
}
-
+
String key = holidayFormat.format(date);
holidays.put(key, holidayName);
}
@@ -100,26 +95,21 @@
entries.add(entry);
}
-
/**
* @see org.apache.myfaces.custom.schedule.model.AbstractScheduleModel#loadEntries(java.util.Date, java.util.Date)
*/
- protected Collection loadEntries(
- Date startDate,
- Date endDate
- )
+ protected Collection loadEntries(Date startDate, Date endDate)
{
ArrayList selection = new ArrayList();
- for (Iterator entryIterator = entries.iterator();
- entryIterator.hasNext();
- ) {
+ for (Iterator entryIterator = entries.iterator(); entryIterator
+ .hasNext();)
+ {
ScheduleEntry entry = (ScheduleEntry) entryIterator.next();
- if (
- entry.getEndTime().before(startDate) ||
- entry.getStartTime().after(endDate)
- ) {
+ if (entry.getEndTime().before(startDate)
+ || entry.getStartTime().after(endDate))
+ {
continue;
}
@@ -132,13 +122,22 @@
/**
* @see org.apache.myfaces.custom.schedule.model.AbstractScheduleModel#loadDayAttributes(org.apache.myfaces.custom.schedule.model.Day)
*/
- protected void loadDayAttributes(Day day) {
- if (day == null) return;
+ protected void loadDayAttributes(Day day)
+ {
+ if (day == null)
+ return;
String key = holidayFormat.format(day.getDate());
- String holiday = (String)holidays.get(key);
- if (holiday == null) return;
- day.setSpecialDayName(holiday);
- day.setWorkingDay(false);
+ String holiday = (String) holidays.get(key);
+ if (holiday != null)
+ {
+ day.setSpecialDayName(holiday);
+ day.setWorkingDay(false);
+ }
+ else
+ {
+ day.setSpecialDayName(null);
+ day.setWorkingDay(true);
+ }
}
}
//The End
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/AbstractScheduleRenderer.java Tue Jul 26 07:06:26 2005
@@ -32,6 +32,7 @@
import javax.faces.event.ActionEvent;
import javax.faces.render.Renderer;
+import org.apache.myfaces.component.html.util.AddResource;
import org.apache.myfaces.custom.schedule.HtmlSchedule;
import org.apache.myfaces.custom.schedule.model.ScheduleEntry;
import org.apache.myfaces.custom.schedule.util.ScheduleEntryComparator;
@@ -95,6 +96,16 @@
return;
}
+ AddResource.addStyleSheet(HtmlSchedule.class, "css/schedule.css", context);
+ AddResource.addJavaScriptToHeader(HtmlSchedule.class,
+ "javascript/alphaAPI.js", context);
+ AddResource.addJavaScriptToHeader(HtmlSchedule.class,
+ "javascript/domLib.js", context);
+ AddResource.addJavaScriptToHeader(HtmlSchedule.class,
+ "javascript/domTT.js", context);
+ AddResource.addJavaScriptToHeader(HtmlSchedule.class,
+ "javascript/fadomatic.js", context);
+
HtmlSchedule schedule = (HtmlSchedule) component;
Map attributes = schedule.getAttributes();
ResponseWriter writer = context.getResponseWriter();
@@ -203,11 +214,6 @@
return null;
}
- //TODO enable tooltips again
-
- return "";
-
- /*
StringBuffer buffer = new StringBuffer();
buffer.append(
"return makeTrue(domTT_activate(this, event, 'caption', '"
@@ -233,7 +239,6 @@
buffer.append("', 'trail', true));");
return buffer.toString();
- */
}
/**
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/PlannerRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/PlannerRenderer.java?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/PlannerRenderer.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/PlannerRenderer.java Tue Jul 26 07:06:26 2005
@@ -16,7 +16,6 @@
package org.apache.myfaces.custom.schedule.renderer;
-
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -41,7 +40,6 @@
import org.apache.myfaces.custom.schedule.util.ScheduleEntryComparator;
import org.apache.myfaces.renderkit.html.HTML;
-
/**
* <p>
* Renderer for the UIPlanner component
@@ -51,13 +49,11 @@
* @author Bruno Aranda (adaptation of Jurgen's code to myfaces)
* @version $Revision$
*/
-public class PlannerRenderer
- extends Renderer
+public class PlannerRenderer extends Renderer
{
//~ Static fields/initializers ---------------------------------------------
- private static final ScheduleEntryComparator comparator =
- new ScheduleEntryComparator();
+ private static final ScheduleEntryComparator comparator = new ScheduleEntryComparator();
//~ Instance fields --------------------------------------------------------
@@ -69,17 +65,24 @@
* @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeBegin(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException
{
- if (!component.isRendered()) {
+ if (!component.isRendered())
+ {
return;
}
-
- AddResource.addStyleSheet(HtmlSchedule.class, "css/schedule.css", context);
+
+ AddResource.addStyleSheet(HtmlPlanner.class, "css/schedule.css",
+ context);
+ AddResource.addJavaScriptToHeader(HtmlPlanner.class,
+ "javascript/alphaAPI.js", context);
+ AddResource.addJavaScriptToHeader(HtmlPlanner.class,
+ "javascript/domLib.js", context);
+ AddResource.addJavaScriptToHeader(HtmlPlanner.class,
+ "javascript/domTT.js", context);
+ AddResource.addJavaScriptToHeader(HtmlPlanner.class,
+ "javascript/fadomatic.js", context);
HtmlPlanner planner = (HtmlPlanner) component;
Map attributes = planner.getAttributes();
@@ -91,11 +94,8 @@
writer.startElement(HTML.DIV_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "planner", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: " + String.valueOf(gridHeight) + "px; overflow: hidden;",
- null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR, "height: "
+ + String.valueOf(gridHeight) + "px; overflow: hidden;", null);
writeBackground(context, planner, writer);
writeForegroundStart(context, planner, writer);
}
@@ -104,13 +104,11 @@
* @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeChildren(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException
{
- if (!component.isRendered()) {
+ if (!component.isRendered())
+ {
return;
}
@@ -118,50 +116,45 @@
Map attributes = planner.getAttributes();
ResponseWriter writer = context.getResponseWriter();
- for (
- Iterator entityIterator = planner.getModel().entityIterator();
- entityIterator.hasNext();
- ) {
+ for (Iterator entityIterator = planner.getModel().entityIterator(); entityIterator
+ .hasNext();)
+ {
PlannerEntity entity = (PlannerEntity) entityIterator.next();
writer.startElement(HTML.TR_ELEM, planner);
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "gutter", null);
writer.startElement(HTML.DIV_ELEM, planner);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: 1px; width: " +
- String.valueOf(getGutterWidth(planner.getAttributes())) + "px",
- null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR, "height: 1px; width: "
+ + String.valueOf(getGutterWidth(planner.getAttributes()))
+ + "px", null);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
int numberOfDays = planner.getModel().numberOfDays();
- float columnWidth =
- (numberOfDays == 0) ? 100f : (100 / numberOfDays);
+ float columnWidth = (numberOfDays == 0) ? 100f
+ : (100 / numberOfDays);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "row", null);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: 21px; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
- null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String
+ .valueOf(columnWidth)
+ + "%", null);
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "height: 21px; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
+ null);
writer.startElement(HTML.DIV_ELEM, null);
writer.writeAttribute(HTML.CLASS_ATTR, "row", null);
- writer.writeAttribute(
- HTML.STYLE_CLASS_ATTR,
- "position: relative; top: 0px; left: 0px; width: 100%; height: 100%; padding: 0px; z-index: 0; vertical-align: middle;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_CLASS_ATTR,
+ "position: relative; top: 0px; left: 0px; width: 100%; height: 100%; padding: 0px; z-index: 0; vertical-align: middle;",
+ null);
writeEntries(context, planner, entity, day, writer);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
@@ -175,13 +168,11 @@
* @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeEnd(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException
{
- if (!component.isRendered()) {
+ if (!component.isRendered())
+ {
return;
}
@@ -203,12 +194,15 @@
*/
protected int getGutterWidth(Map attributes)
{
- try {
- Integer width =
- Integer.valueOf((String) attributes.get("gutterWidthInPixels"));
+ try
+ {
+ Integer width = Integer.valueOf((String) attributes
+ .get("gutterWidthInPixels"));
return width.intValue();
- } catch (NumberFormatException nfe) {
+ }
+ catch (NumberFormatException nfe)
+ {
return 200;
}
}
@@ -240,8 +234,10 @@
{
UIComponent parent = component.getParent();
- while (parent != null) {
- if (parent instanceof UIForm) {
+ while (parent != null)
+ {
+ if (parent instanceof UIForm)
+ {
break;
}
@@ -264,7 +260,8 @@
*/
protected boolean showLegend(Map attributes)
{
- return Boolean.valueOf((String) attributes.get("legend")).booleanValue();
+ return Boolean.valueOf((String) attributes.get("legend"))
+ .booleanValue();
}
/**
@@ -278,48 +275,44 @@
*/
protected boolean showTooltip(Map attributes)
{
- return Boolean.valueOf((String) attributes.get("tooltip")).booleanValue();
+ return Boolean.valueOf((String) attributes.get("tooltip"))
+ .booleanValue();
}
- private String getCellClass(
- HtmlPlanner planner,
- Day day,
- int hour
- )
+ private String getCellClass(HtmlPlanner planner, Day day, int hour)
{
- if (!day.isWorkingDay()) {
+ if (!day.isWorkingDay())
+ {
return "free";
}
- if (
- (hour >= planner.getWorkingStartHour()) &&
- (hour < planner.getWorkingEndHour())
- ) {
+ if ((hour >= planner.getWorkingStartHour())
+ && (hour < planner.getWorkingEndHour()))
+ {
return ((hour % 2) == 0) ? "even" : "uneven";
}
return "free";
}
- private String getDateString(
- FacesContext context,
- Map attributes,
- Date date
- )
+ private String getDateString(FacesContext context, Map attributes, Date date)
{
DateFormat format;
String pattern = getHeaderDateFormat(attributes);
- if ((pattern != null) && (pattern.length() > 0)) {
+ if ((pattern != null) && (pattern.length() > 0))
+ {
format = new SimpleDateFormat(pattern);
- } else {
- if (context.getApplication().getDefaultLocale() != null) {
- format =
- DateFormat.getDateInstance(
- DateFormat.MEDIUM,
- context.getApplication().getDefaultLocale()
- );
- } else {
+ }
+ else
+ {
+ if (context.getApplication().getDefaultLocale() != null)
+ {
+ format = DateFormat.getDateInstance(DateFormat.MEDIUM, context
+ .getApplication().getDefaultLocale());
+ }
+ else
+ {
format = DateFormat.getDateInstance(DateFormat.MEDIUM);
}
}
@@ -327,54 +320,50 @@
return format.format(date);
}
- private String getTooltipText(
- ScheduleEntry entry,
- Map attributes
- )
+ private String getTooltipText(ScheduleEntry entry, Map attributes)
{
- if (!showTooltip(attributes)) {
+ if (!showTooltip(attributes))
+ {
return null;
}
-
+
//TODO enable tooltips again
return "";
- /*
- StringBuffer buffer = new StringBuffer();
- buffer.append(
- "return makeTrue(domTT_activate(this, event, 'caption', '"
- );
+ /*
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(
+ "return makeTrue(domTT_activate(this, event, 'caption', '"
+ );
- if (entry.getTitle() != null) {
- buffer.append(escape(entry.getTitle()));
- }
+ if (entry.getTitle() != null) {
+ buffer.append(escape(entry.getTitle()));
+ }
- buffer.append("', 'content', '<i>");
+ buffer.append("', 'content', '<i>");
- if (entry.getSubtitle() != null) {
- buffer.append(escape(entry.getSubtitle()));
- }
+ if (entry.getSubtitle() != null) {
+ buffer.append(escape(entry.getSubtitle()));
+ }
- buffer.append("</i>");
+ buffer.append("</i>");
- if (entry.getDescription() != null) {
- buffer.append("<br/>");
- buffer.append(escape(entry.getDescription()));
- }
+ if (entry.getDescription() != null) {
+ buffer.append("<br/>");
+ buffer.append(escape(entry.getDescription()));
+ }
- buffer.append("', 'trail', true));");
+ buffer.append("', 'trail', true));");
- return buffer.toString();
- */
+ return buffer.toString();
+ */
}
- private boolean containsEntry(
- HtmlPlanner planner,
- Day day,
- ScheduleEntry entry
- )
+ private boolean containsEntry(HtmlPlanner planner, Day day,
+ ScheduleEntry entry)
{
- if ((day == null) || (entry == null)) {
+ if ((day == null) || (entry == null))
+ {
return false;
}
@@ -390,13 +379,14 @@
Date dayEnd = cal.getTime();
- return entry.getEndTime().after(dayStart) &&
- entry.getStartTime().before(dayEnd);
+ return entry.getEndTime().after(dayStart)
+ && entry.getStartTime().before(dayEnd);
}
private String escape(String text)
{
- if (text == null) {
+ if (text == null)
+ {
return null;
}
@@ -415,34 +405,32 @@
* @throws IOException when the background cannot be drawn
* @throws NullPointerException
*/
- private void writeBackground(
- FacesContext context,
- HtmlPlanner planner,
- ResponseWriter writer
- )
- throws IOException
+ private void writeBackground(FacesContext context, HtmlPlanner planner,
+ ResponseWriter writer) throws IOException
{
//a planner component should always be inside a UIForm
UIForm parentForm = getParentForm(planner);
- if (parentForm == null) {
+ if (parentForm == null)
+ {
throw new NullPointerException("No parent UIForm found");
}
writer.startElement(HTML.DIV_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "background", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 0;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 0;",
+ null);
//background table for the schedule grid
writer.startElement(HTML.TABLE_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "background", null);
writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
- writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%;", null);
+ writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%;",
+ null);
writer.startElement(HTML.TBODY_ELEM, planner);
//header row, containing the day names
@@ -450,68 +438,60 @@
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "gutter", null);
writer.writeAttribute("rowspan", "2", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
+ null);
writer.startElement(HTML.DIV_ELEM, planner);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: 1px; width: " +
- String.valueOf(getGutterWidth(planner.getAttributes())) + "px", null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR, "height: 1px; width: "
+ + String.valueOf(getGutterWidth(planner.getAttributes()))
+ + "px", null);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
int numberOfDays = planner.getModel().numberOfDays();
float columnWidth = (numberOfDays == 0) ? 100f : (100 / numberOfDays);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "header", null);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR, "overflow: hidden; height: 31px;", null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
+ + "%", null);
+ writer.writeAttribute(HTML.STYLE_ATTR,
+ "overflow: hidden; height: 31px;", null);
writer.startElement(HTML.DIV_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "header", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: relative; left: 0px; top: 0px; width: 100%; height: 100%;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: relative; left: 0px; top: 0px; width: 100%; height: 100%;",
+ null);
writer.startElement(HTML.SPAN_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "date", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: absolute; left: 0px; top: 0px; width: 100%; height: 15px; overflow: hidden; white-space: nowrap;",
- null
- );
- writer.writeText(
- getDateString(context, planner.getAttributes(), day.getDate()),
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: absolute; left: 0px; top: 0px; width: 100%; height: 15px; overflow: hidden; white-space: nowrap;",
+ null);
+ writer.writeText(getDateString(context, planner.getAttributes(),
+ day.getDate()), null);
writer.endElement(HTML.SPAN_ELEM);
//write the name of the holiday, if there is one
- if (
- (day.getSpecialDayName() != null) &&
- (day.getSpecialDayName().length() > 0)
- ) {
+ if ((day.getSpecialDayName() != null)
+ && (day.getSpecialDayName().length() > 0))
+ {
writer.startElement(HTML.SPAN_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "holiday", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: absolute; left: 0px; top: 15px; width: 100%; overflow: hidden; white-space: nowrap;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: absolute; left: 0px; top: 15px; width: 100%; overflow: hidden; white-space: nowrap;",
+ null);
writer.writeText(day.getSpecialDayName(), null);
writer.endElement(HTML.SPAN_ELEM);
}
@@ -525,54 +505,52 @@
//second header row, containing the hours
writer.startElement(HTML.TR_ELEM, planner);
- int numberOfHours =
- planner.getVisibleEndHour() - planner.getVisibleStartHour();
+ int numberOfHours = planner.getVisibleEndHour()
+ - planner.getVisibleStartHour();
float hourWidth = (numberOfHours <= 0) ? 100f : (100 / numberOfHours);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
+ + "%", null);
writer.startElement(HTML.TABLE_ELEM, planner);
- writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%; width: 100%", null);
+ writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%; width: 100%",
+ null);
writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTR, "0", null);
writer.writeAttribute("border", "0", null);
writer.startElement(HTML.TR_ELEM, planner);
- for (
- int hcol = planner.getVisibleStartHour();
- hcol < planner.getVisibleEndHour(); hcol++
- ) {
+ for (int hcol = planner.getVisibleStartHour(); hcol < planner
+ .getVisibleEndHour(); hcol++)
+ {
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "hours", null);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(hourWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "overflow: hidden; height: 15px; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
- null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String
+ .valueOf(hourWidth)
+ + "%", null);
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "overflow: hidden; height: 15px; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
+ null);
writer.startElement(HTML.DIV_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "header", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: relative; left: 0px; top: 0px; width: 100%; height: 100%;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: relative; left: 0px; top: 0px; width: 100%; height: 100%;",
+ null);
writer.startElement(HTML.SPAN_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "hours", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; overflow: hidden; white-space: nowrap;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; overflow: hidden; white-space: nowrap;",
+ null);
writer.writeText(String.valueOf(hcol) + ":00", null);
writer.endElement(HTML.SPAN_ELEM);
writer.endElement(HTML.DIV_ELEM);
@@ -587,19 +565,18 @@
writer.endElement(HTML.TR_ELEM);
//the actual entity rows start here
- for (
- Iterator entityIterator = planner.getModel().entityIterator();
- entityIterator.hasNext();
- ) {
+ for (Iterator entityIterator = planner.getModel().entityIterator(); entityIterator
+ .hasNext();)
+ {
PlannerEntity entity = (PlannerEntity) entityIterator.next();
writer.startElement(HTML.TR_ELEM, planner);
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "gutter", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
+ null);
writer.startElement(HTML.SPAN_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "title", null);
writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%;", null);
@@ -607,40 +584,36 @@
writer.endElement(HTML.SPAN_ELEM);
writer.endElement(HTML.TD_ELEM);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String
+ .valueOf(columnWidth)
+ + "%", null);
writer.startElement(HTML.TABLE_ELEM, planner);
- writer.writeAttribute(
- HTML.STYLE_ATTR, "height: 100%; width: 100%", null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR,
+ "height: 100%; width: 100%", null);
writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTR, "0", null);
writer.writeAttribute("border", "0", null);
writer.startElement(HTML.TR_ELEM, planner);
- for (
- int hcol = planner.getVisibleStartHour();
- hcol < planner.getVisibleEndHour(); hcol++
- ) {
+ for (int hcol = planner.getVisibleStartHour(); hcol < planner
+ .getVisibleEndHour(); hcol++)
+ {
writer.startElement(HTML.TD_ELEM, planner);
- writer.writeAttribute(
- HTML.CLASS_ATTR, getCellClass(planner, day, hcol), null
- );
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(hourWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: 21px; overflow: hidden; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
- null
- );
+ writer.writeAttribute(HTML.CLASS_ATTR, getCellClass(
+ planner, day, hcol), null);
+ writer.writeAttribute(HTML.WIDTH_ATTR, String
+ .valueOf(hourWidth)
+ + "%", null);
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "height: 21px; overflow: hidden; border-left-style: solid; border-left-width: 1px; border-top-style: none; border-right-style: none; border-bottom-style: none;",
+ null);
writer.write(HTML.NBSP_ENTITY);
writer.endElement(HTML.TD_ELEM);
}
@@ -671,75 +644,61 @@
*
* @throws IOException when the entries cannot be drawn
*/
- private void writeEntries(
- FacesContext context,
- HtmlPlanner planner,
- PlannerEntity entity,
- Day day,
- ResponseWriter writer
- )
- throws IOException
- {
- for (Iterator entryIterator = entity.iterator();
- entryIterator.hasNext();
- ) {
+ private void writeEntries(FacesContext context, HtmlPlanner planner,
+ PlannerEntity entity, Day day, ResponseWriter writer)
+ throws IOException
+ {
+ for (Iterator entryIterator = entity.iterator(); entryIterator
+ .hasNext();)
+ {
ScheduleEntry entry = (ScheduleEntry) entryIterator.next();
- if (containsEntry(planner, day, entry)) {
+ if (containsEntry(planner, day, entry))
+ {
EntryWrapper wrapper = new EntryWrapper(entry, day, entity);
writer.startElement(HTML.DIV_ELEM, planner);
//draw the tooltip
- if (showTooltip(planner.getAttributes())) {
- writer.writeAttribute(
- "onmouseover",
- getTooltipText(wrapper.entry, planner.getAttributes()),
- null
- );
+ if (showTooltip(planner.getAttributes()))
+ {
+ writer.writeAttribute("onmouseover", getTooltipText(
+ wrapper.entry, planner.getAttributes()), null);
}
writer.writeAttribute(HTML.CLASS_ATTR, "entry", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR, wrapper.getBounds(planner), null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR, wrapper
+ .getBounds(planner), null);
writer.endElement(HTML.DIV_ELEM);
}
}
}
- private void writeForegroundEnd(
- FacesContext context,
- HtmlPlanner planner,
- ResponseWriter writer
- )
- throws IOException
+ private void writeForegroundEnd(FacesContext context, HtmlPlanner planner,
+ ResponseWriter writer) throws IOException
{
writer.endElement(HTML.TBODY_ELEM);
writer.endElement(HTML.TABLE_ELEM);
writer.endElement(HTML.DIV_ELEM);
}
- private void writeForegroundStart(
- FacesContext context,
- HtmlPlanner planner,
- ResponseWriter writer
- )
- throws IOException
+ private void writeForegroundStart(FacesContext context,
+ HtmlPlanner planner, ResponseWriter writer) throws IOException
{
writer.startElement(HTML.DIV_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "foreground", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 1;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 1;",
+ null);
//foreground table for the planner grid
writer.startElement(HTML.TABLE_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "foreground", null);
writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
- writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%;", null);
+ writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%;",
+ null);
writer.startElement(HTML.TBODY_ELEM, planner);
//header row containing the day names
@@ -747,36 +706,31 @@
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "gutter", null);
writer.writeAttribute("rowspan", "2", null);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
- null
- );
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "padding: 0px; vertical-align: middle; height: 21px; border-style: none; border-width: 0px; overflow: hidden; whitespace: nowrap;",
+ null);
writer.startElement(HTML.DIV_ELEM, planner);
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "height: 1px; width: " +
- String.valueOf(getGutterWidth(planner.getAttributes())) + "px", null
- );
+ writer.writeAttribute(HTML.STYLE_ATTR, "height: 1px; width: "
+ + String.valueOf(getGutterWidth(planner.getAttributes()))
+ + "px", null);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
int numberOfDays = planner.getModel().numberOfDays();
float columnWidth = (numberOfDays == 0) ? 100f : (100 / numberOfDays);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "header", null);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR, "overflow: hidden; height: 31px;", null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
+ + "%", null);
+ writer.writeAttribute(HTML.STYLE_ATTR,
+ "overflow: hidden; height: 31px;", null);
writer.endElement(HTML.TD_ELEM);
}
@@ -785,21 +739,19 @@
//header row containing the hours
writer.startElement(HTML.TR_ELEM, planner);
- for (
- Iterator dayIterator = planner.getModel().dayIterator();
- dayIterator.hasNext();
- ) {
+ for (Iterator dayIterator = planner.getModel().dayIterator(); dayIterator
+ .hasNext();)
+ {
Day day = (Day) dayIterator.next();
writer.startElement(HTML.TD_ELEM, planner);
writer.writeAttribute(HTML.CLASS_ATTR, "hours", null);
- writer.writeAttribute(
- HTML.WIDTH_ATTR, String.valueOf(columnWidth) + "%", null
- );
- writer.writeAttribute(
- HTML.STYLE_ATTR,
- "overflow: hidden; height: 15px; border-style: none; border-width: 0px",
- null
- );
+ writer.writeAttribute(HTML.WIDTH_ATTR, String.valueOf(columnWidth)
+ + "%", null);
+ writer
+ .writeAttribute(
+ HTML.STYLE_ATTR,
+ "overflow: hidden; height: 15px; border-style: none; border-width: 0px",
+ null);
writer.endElement(HTML.TD_ELEM);
}
@@ -811,8 +763,7 @@
/**
*
*/
- private class EntryWrapper
- implements Comparable
+ private class EntryWrapper implements Comparable
{
//~ Static fields/initializers -----------------------------------------
@@ -826,11 +777,7 @@
//~ Constructors -------------------------------------------------------
- EntryWrapper(
- ScheduleEntry entry,
- Day day,
- PlannerEntity entity
- )
+ EntryWrapper(ScheduleEntry entry, Day day, PlannerEntity entity)
{
this.entry = entry;
this.day = day;
@@ -852,21 +799,22 @@
*/
public boolean equals(Object o)
{
- if (o instanceof EntryWrapper) {
+ if (o instanceof EntryWrapper)
+ {
EntryWrapper other = (EntryWrapper) o;
- boolean returnboolean =
- (entry.getStartTime().equals(other.entry.getStartTime())) &&
- (entry.getEndTime().equals(other.entry.getEndTime())) &&
- (entry.getId().equals(other.entry.getId())) &&
- (day.equals(other.day));
- /*
- new EqualsBuilder().append(
- entry.getStartTime(), other.entry.getStartTime()
- ).append(entry.getEndTime(), other.entry.getEndTime())
- .append(
- entry.getId(), other.entry.getId()
- ).append(day, other.day).isEquals();*/
+ boolean returnboolean = (entry.getStartTime()
+ .equals(other.entry.getStartTime()))
+ && (entry.getEndTime().equals(other.entry.getEndTime()))
+ && (entry.getId().equals(other.entry.getId()))
+ && (day.equals(other.day));
+ /*
+ new EqualsBuilder().append(
+ entry.getStartTime(), other.entry.getStartTime()
+ ).append(entry.getEndTime(), other.entry.getEndTime())
+ .append(
+ entry.getId(), other.entry.getId()
+ ).append(day, other.day).isEquals();*/
return returnboolean;
}
@@ -879,9 +827,8 @@
*/
public int hashCode()
{
- int returnint = entry.getStartTime().hashCode() ^
- entry.getEndTime().hashCode() ^
- entry.getId().hashCode();
+ int returnint = entry.getStartTime().hashCode()
+ ^ entry.getEndTime().hashCode() ^ entry.getId().hashCode();
return returnint;
}
@@ -914,9 +861,8 @@
cal.set(Calendar.MILLISECOND, 0);
long visibleStartMillis = cal.getTimeInMillis();
- startMillis =
- day.equalsDate(entry.getStartTime())
- ? Math.max(startMillis, visibleStartMillis) : visibleStartMillis;
+ startMillis = day.equalsDate(entry.getStartTime()) ? Math.max(
+ startMillis, visibleStartMillis) : visibleStartMillis;
cal.setTime(entry.getEndTime());
cal.set(curyear, curmonth, curday);
@@ -927,26 +873,21 @@
cal.set(Calendar.MILLISECOND, 0);
long visibleEndMillis = cal.getTimeInMillis();
- endMillis =
- day.equalsDate(entry.getEndTime())
- ? Math.min(endMillis, visibleEndMillis) : visibleEndMillis;
-
- float left =
- (float) ((startMillis - visibleStartMillis) * 100) / (float) (visibleEndMillis -
- visibleStartMillis);
- float width =
- (float) ((endMillis - startMillis) * 100) / (float) (visibleEndMillis -
- visibleStartMillis);
+ endMillis = day.equalsDate(entry.getEndTime()) ? Math.min(
+ endMillis, visibleEndMillis) : visibleEndMillis;
+
+ float left = (float) ((startMillis - visibleStartMillis) * 100)
+ / (float) (visibleEndMillis - visibleStartMillis);
+ float width = (float) ((endMillis - startMillis) * 100)
+ / (float) (visibleEndMillis - visibleStartMillis);
StringBuffer buffer = new StringBuffer();
- buffer.append(
- "position: absolute; padding: 0px; top: 0px; height: 21px; left: "
- );
+ buffer
+ .append("position: absolute; padding: 0px; top: 0px; height: 21px; left: ");
buffer.append(String.valueOf(left));
buffer.append("%; width: ");
buffer.append(String.valueOf(width));
- buffer.append(
- "%; overflow: hidden; border-style-none; border-width: 0px;"
- );
+ buffer
+ .append("%; overflow: hidden; border-style-none; border-width: 0px;");
return buffer.toString();
}
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDelegatingRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDelegatingRenderer.java?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDelegatingRenderer.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/renderer/ScheduleDelegatingRenderer.java Tue Jul 26 07:06:26 2005
@@ -16,7 +16,6 @@
package org.apache.myfaces.custom.schedule.renderer;
-
import java.io.IOException;
import javax.faces.component.UIComponent;
@@ -27,7 +26,6 @@
import org.apache.myfaces.custom.schedule.HtmlSchedule;
import org.apache.myfaces.custom.schedule.model.ScheduleModel;
-
/**
* <p>
* Renderer for the Schedule component that delegates the actual rendering
@@ -38,17 +36,13 @@
* @author Bruno Aranda (adaptation of Jurgen's code to myfaces)
* @version $Revision$
*/
-public class ScheduleDelegatingRenderer
- extends Renderer
+public class ScheduleDelegatingRenderer extends Renderer
{
//~ Instance fields --------------------------------------------------------
- private final ScheduleCompactMonthRenderer monthDelegate =
- new ScheduleCompactMonthRenderer();
- private final ScheduleCompactWeekRenderer weekDelegate =
- new ScheduleCompactWeekRenderer();
- private final ScheduleDetailedDayRenderer dayDelegate =
- new ScheduleDetailedDayRenderer();
+ private final ScheduleCompactMonthRenderer monthDelegate = new ScheduleCompactMonthRenderer();
+ private final ScheduleCompactWeekRenderer weekDelegate = new ScheduleCompactWeekRenderer();
+ private final ScheduleDetailedDayRenderer dayDelegate = new ScheduleDetailedDayRenderer();
//~ Methods ----------------------------------------------------------------
@@ -56,10 +50,7 @@
* @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void decode(
- FacesContext context,
- UIComponent component
- )
+ public void decode(FacesContext context, UIComponent component)
{
getDelegateRenderer(component).decode(context, component);
}
@@ -68,13 +59,9 @@
* @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeBegin(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException
{
- AddResource.addStyleSheet(HtmlSchedule.class, "css/schedule.css", context);
getDelegateRenderer(component).encodeBegin(context, component);
}
@@ -82,11 +69,8 @@
* @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeChildren(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException
{
getDelegateRenderer(component).encodeChildren(context, component);
}
@@ -95,11 +79,8 @@
* @see javax.faces.render.Renderer#encodeEnd(javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
- public void encodeEnd(
- FacesContext context,
- UIComponent component
- )
- throws IOException
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException
{
getDelegateRenderer(component).encodeEnd(context, component);
}
@@ -108,19 +89,21 @@
{
HtmlSchedule schedule = (HtmlSchedule) component;
- if ((schedule == null) || (schedule.getModel() == null)) {
+ if ((schedule == null) || (schedule.getModel() == null))
+ {
return dayDelegate;
}
- switch (schedule.getModel().getMode()) {
- case ScheduleModel.WEEK:
- return weekDelegate;
+ switch (schedule.getModel().getMode())
+ {
+ case ScheduleModel.WEEK:
+ return weekDelegate;
- case ScheduleModel.MONTH:
- return monthDelegate;
+ case ScheduleModel.MONTH:
+ return monthDelegate;
- default:
- return dayDelegate;
+ default:
+ return dayDelegate;
}
}
}
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/css/schedule.css
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/css/schedule.css?rev=225313&r1=225312&r2=225313&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/css/schedule.css (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/css/schedule.css Tue Jul 26 07:06:26 2005
@@ -277,13 +277,13 @@
border: 1px solid #333366;
background-color: #333366;
}
-div.domTTCaption {
+div.domTT .caption {
font-family: Verdana, Helvetica;
font-size: 10px;
font-weight: bold;
color: #FFFFFF;
}
-div.domTTContent {
+div.domTT .contents {
font-size: 10px;
font-family: Verdana, Helvetica;
padding: 2px;
Added: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js?rev=225313&view=auto
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js (added)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/alphaAPI.js Tue Jul 26 07:06:26 2005
@@ -0,0 +1,294 @@
+/** $Id: alphaAPI.js 1940 2005-07-16 23:23:54Z dallen $ */
+// {{{ license
+
+/*
+ * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// }}}
+// {{{ intro
+
+/**
+ * Title: alphaAPI
+ * Original Author: chrisken
+ * Original Url: http://www.cs.utexas.edu/users/chrisken/alphaapi.html
+ *
+ * Modified by Dan Allen <da...@mojavelinux.com>
+ * Note: When the stopAlpha is reached and it is equal to 0, the element's
+ * style is set to display: none to fix a bug in domTT
+ */
+
+// }}}
+function alphaAPI(element, fadeInDelay, fadeOutDelay, startAlpha, stopAlpha, offsetTime, deltaAlpha)
+{
+ // {{{ properties
+
+ this.element = typeof(element) == 'object' ? element : document.getElementById(element);
+ this.fadeInDelay = fadeInDelay || 40;
+ this.fadeOutDelay = fadeOutDelay || this.fadeInDelay;
+ this.startAlpha = startAlpha;
+ this.stopAlpha = stopAlpha;
+ // make sure a filter exists so an error is not thrown
+ if (typeof(this.element.filters) == 'object')
+ {
+ if (typeof(this.element.filters.alpha) == 'undefined')
+ {
+ this.element.style.filter += 'alpha(opacity=100)';
+ }
+ }
+
+ this.offsetTime = (offsetTime || 0) * 1000;
+ this.deltaAlpha = deltaAlpha || 10;
+ this.timer = null;
+ this.paused = false;
+ this.started = false;
+ this.cycle = false;
+ this.command = function() {};
+ return this;
+
+ // }}}
+}
+
+// use prototype methods to save memory
+// {{{ repeat()
+
+alphaAPI.prototype.repeat = function(repeat)
+{
+ this.cycle = repeat ? true : false;
+}
+
+// }}}
+// {{{ setAlphaBy()
+
+alphaAPI.prototype.setAlphaBy = function(deltaAlpha)
+{
+ this.setAlpha(this.getAlpha() + deltaAlpha);
+}
+
+// }}}
+// {{{ toggle()
+
+alphaAPI.prototype.toggle = function()
+{
+ if (!this.started)
+ {
+ this.start();
+ }
+ else if (this.paused)
+ {
+ this.unpause();
+ }
+ else
+ {
+ this.pause();
+ }
+}
+
+// }}}
+// {{{ timeout()
+
+alphaAPI.prototype.timeout = function(command, delay)
+{
+ this.command = command;
+ this.timer = setTimeout(command, delay);
+}
+
+// }}}
+// {{{ setAlpha()
+
+alphaAPI.prototype.setAlpha = function(opacity)
+{
+ if (typeof(this.element.filters) == 'object')
+ {
+ this.element.filters.alpha.opacity = opacity;
+ }
+ else if (this.element.style.setProperty)
+ {
+ this.element.style.setProperty('opacity', opacity / 100, '');
+ // handle the case of mozilla < 1.7
+ this.element.style.setProperty('-moz-opacity', opacity / 100, '');
+ // handle the case of old kthml
+ this.element.style.setProperty('-khtml-opacity', opacity / 100, '');
+ }
+}
+
+// }}}
+// {{{ getAlpha()
+
+alphaAPI.prototype.getAlpha = function()
+{
+ if (typeof(this.element.filters) == 'object')
+ {
+ return this.element.filters.alpha.opacity;
+ }
+ else if (this.element.style.getPropertyValue)
+ {
+ var opacityValue = this.element.style.getPropertyValue('opacity');
+ // handle the case of mozilla < 1.7
+ if (opacityValue == '')
+ {
+ opacityValue = this.element.style.getPropertyValue('-moz-opacity');
+ }
+
+ // handle the case of old khtml
+ if (opacityValue == '')
+ {
+ opacityValue = this.element.style.getPropertyValue('-khtml-opacity');
+ }
+
+ return opacityValue * 100;
+ }
+
+ return 100;
+}
+
+// }}}
+// {{{ start()
+
+alphaAPI.prototype.start = function()
+{
+ this.started = true;
+ this.setAlpha(this.startAlpha);
+ // determine direction
+ if (this.startAlpha > this.stopAlpha)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.offsetTime);
+ }
+ else
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.offsetTime);
+ }
+}
+
+// }}}
+// {{{ stop()
+
+alphaAPI.prototype.stop = function()
+{
+ this.started = false;
+ this.setAlpha(this.stopAlpha);
+ if (this.stopAlpha == 0)
+ {
+ this.element.style.display = 'none';
+ }
+
+ this.stopTimer();
+ this.command = function() {};
+}
+
+// }}}
+// {{{ reset()
+
+alphaAPI.prototype.reset = function()
+{
+ this.started = false;
+ this.setAlpha(this.startAlpha);
+ this.stopTimer();
+ this.command = function() {};
+}
+
+// }}}
+// {{{ pause()
+
+alphaAPI.prototype.pause = function()
+{
+ this.paused = true;
+ this.stopTimer();
+}
+
+// }}}
+// {{{ unpause()
+
+alphaAPI.prototype.unpause = function()
+{
+ this.paused = false;
+ if (!this.started)
+ {
+ this.start();
+ }
+ else
+ {
+ this.command();
+ }
+}
+
+// }}}
+// {{{ stopTimer()
+
+alphaAPI.prototype.stopTimer = function()
+{
+ clearTimeout(this.timer);
+ this.timer = null;
+}
+
+// }}}
+// {{{ fadeOut()
+
+alphaAPI.prototype.fadeOut = function()
+{
+ this.stopTimer();
+ if (this.getAlpha() > this.stopAlpha)
+ {
+ this.setAlphaBy(-1 * this.deltaAlpha);
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
+ }
+ else
+ {
+ if (this.cycle)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
+ }
+ else
+ {
+ if (this.stopAlpha == 0)
+ {
+ this.element.style.display = 'none';
+ }
+ this.started = false;
+ }
+ }
+}
+
+// }}}
+// {{{ fadeIn()
+
+alphaAPI.prototype.fadeIn = function()
+{
+ this.stopTimer();
+ if (this.getAlpha() < this.startAlpha)
+ {
+ this.setAlphaBy(this.deltaAlpha);
+ var instance = this;
+ this.timeout(function() { instance.fadeIn(); }, this.fadeInDelay);
+ }
+ else
+ {
+ if (this.cycle)
+ {
+ var instance = this;
+ this.timeout(function() { instance.fadeOut(); }, this.fadeOutDelay);
+ }
+ else
+ {
+ this.started = false;
+ }
+ }
+}
+
+// }}}
Added: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domLib.js
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domLib.js?rev=225313&view=auto
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domLib.js (added)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/schedule/resource/javascript/domLib.js Tue Jul 26 07:06:26 2005
@@ -0,0 +1,659 @@
+/** $Id: domLib.js 1952 2005-07-17 16:24:05Z dallen $ */
+// {{{ license
+
+/*
+ * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// }}}
+// {{{ intro
+
+/**
+ * Title: DOM Library Core
+ * Version: 0.70
+ *
+ * Summary:
+ * A set of commonly used functions that make it easier to create javascript
+ * applications that rely on the DOM.
+ *
+ * Updated: 2005/05/17
+ *
+ * Maintainer: Dan Allen <da...@mojavelinux.com>
+ * Maintainer: Jason Rust <jr...@rustyparts.com>
+ *
+ * License: Apache 2.0
+ */
+
+// }}}
+// {{{ global constants (DO NOT EDIT)
+
+// -- Browser Detection --
+var domLib_userAgent = navigator.userAgent.toLowerCase();
+var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
+var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
+// NOTE: could use window.opera for detecting Opera
+var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
+var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
+var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
+var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
+// Both konqueror and safari use the khtml rendering engine
+var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
+var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && (domLib_userAgent.indexOf('msie 5') != -1 || domLib_userAgent.indexOf('msie 6') != -1 || domLib_userAgent.indexOf('msie 7') != -1));
+var domLib_isIE5up = domLib_isIE;
+var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
+var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
+var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
+// safari and konq may use string "khtml, like gecko", so check for destinctive /
+var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
+var domLib_isMacIE = (domLib_isIE && domLib_isMac);
+var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
+var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;
+
+// -- Browser Abilities --
+var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
+var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
+// fixed in Konq3.2
+var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
+var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
+var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
+var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);
+
+// -- Event Variables --
+var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
+var domLib_eventButton = domLib_isIE ? 'button' : 'which';
+var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
+var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
+// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
+var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
+var domLib_hidePosition = '-1000px';
+var domLib_scrollbarWidth = 14;
+var domLib_autoId = 1;
+var domLib_zIndex = 100;
+
+// -- Detection --
+var domLib_collisionElements;
+var domLib_collisionsCached = false;
+
+var domLib_timeoutStateId = 0;
+var domLib_timeoutStates = new Hash();
+
+// }}}
+// {{{ DOM enhancements
+
+if (!document.ELEMENT_NODE)
+{
+ document.ELEMENT_NODE = 1;
+ document.ATTRIBUTE_NODE = 2;
+ document.TEXT_NODE = 3;
+ document.DOCUMENT_NODE = 9;
+ document.DOCUMENT_FRAGMENT_NODE = 11;
+}
+
+function domLib_clone(obj)
+{
+ var copy = {};
+ for (var i in obj)
+ {
+ var value = obj[i];
+ try
+ {
+ if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
+ {
+ copy[i] = domLib_clone(value);
+ }
+ else
+ {
+ copy[i] = value;
+ }
+ }
+ catch(e)
+ {
+ copy[i] = value;
+ }
+ }
+
+ return copy;
+}
+
+// }}}
+// {{{ class Hash()
+
+function Hash()
+{
+ this.length = 0;
+ this.numericLength = 0;
+ this.elementData = [];
+ for (var i = 0; i < arguments.length; i += 2)
+ {
+ if (typeof(arguments[i + 1]) != 'undefined')
+ {
+ this.elementData[arguments[i]] = arguments[i + 1];
+ this.length++;
+ if (arguments[i] == parseInt(arguments[i]))
+ {
+ this.numericLength++;
+ }
+ }
+ }
+}
+
+// using prototype as opposed to inner functions saves on memory
+Hash.prototype.get = function(in_key)
+{
+ return this.elementData[in_key];
+}
+
+Hash.prototype.set = function(in_key, in_value)
+{
+ if (typeof(in_value) != 'undefined')
+ {
+ if (typeof(this.elementData[in_key]) == 'undefined')
+ {
+ this.length++;
+ if (in_key == parseInt(in_key))
+ {
+ this.numericLength++;
+ }
+ }
+
+ return this.elementData[in_key] = in_value;
+ }
+
+ return false;
+}
+
+Hash.prototype.remove = function(in_key)
+{
+ var tmp_value;
+ if (typeof(this.elementData[in_key]) != 'undefined')
+ {
+ this.length--;
+ if (in_key == parseInt(in_key))
+ {
+ this.numericLength--;
+ }
+
+ tmp_value = this.elementData[in_key];
+ delete this.elementData[in_key];
+ }
+
+ return tmp_value;
+}
+
+Hash.prototype.size = function()
+{
+ return this.length;
+}
+
+Hash.prototype.has = function(in_key)
+{
+ return typeof(this.elementData[in_key]) != 'undefined';
+}
+
+Hash.prototype.find = function(in_obj)
+{
+ for (var tmp_key in this.elementData)
+ {
+ if (this.elementData[tmp_key] == in_obj)
+ {
+ return tmp_key;
+ }
+ }
+}
+
+Hash.prototype.merge = function(in_hash)
+{
+ for (var tmp_key in in_hash.elementData)
+ {
+ if (typeof(this.elementData[tmp_key]) == 'undefined')
+ {
+ this.length++;
+ if (tmp_key == parseInt(tmp_key))
+ {
+ this.numericLength++;
+ }
+ }
+
+ this.elementData[tmp_key] = in_hash.elementData[tmp_key];
+ }
+}
+
+Hash.prototype.compare = function(in_hash)
+{
+ if (this.length != in_hash.length)
+ {
+ return false;
+ }
+
+ for (var tmp_key in this.elementData)
+ {
+ if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// }}}
+// {{{ domLib_isDescendantOf()
+
+function domLib_isDescendantOf(in_object, in_ancestor)
+{
+ if (in_object == in_ancestor)
+ {
+ return true;
+ }
+
+ while (in_object != document.documentElement)
+ {
+ try
+ {
+ if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
+ {
+ return true;
+ }
+ else if ((tmp_object = in_object.parentNode) == in_ancestor)
+ {
+ return true;
+ }
+ else
+ {
+ in_object = tmp_object;
+ }
+ }
+ // in case we get some wierd error, just assume we haven't gone out yet
+ catch(e)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// }}}
+// {{{ domLib_detectCollisions()
+
+/**
+ * For any given target element, determine if elements on the page
+ * are colliding with it that do not obey the rules of z-index.
+ */
+function domLib_detectCollisions(in_object, in_recover, in_useCache)
+{
+ // the reason for the cache is that if the root menu is built before
+ // the page is done loading, then it might not find all the elements.
+ // so really the only time you don't use cache is when building the
+ // menu as part of the page load
+ if (!domLib_collisionsCached)
+ {
+ var tags = [];
+
+ if (!domLib_canDrawOverFlash)
+ {
+ tags[tags.length] = 'object';
+ }
+
+ if (!domLib_canDrawOverSelect)
+ {
+ tags[tags.length] = 'select';
+ }
+
+ domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
+ domLib_collisionsCached = in_useCache;
+ }
+
+ // if we don't have a tip, then unhide selects
+ if (in_recover)
+ {
+ for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
+ {
+ var thisElement = domLib_collisionElements[cnt];
+
+ if (!thisElement.hideList)
+ {
+ thisElement.hideList = new Hash();
+ }
+
+ thisElement.hideList.remove(in_object.id);
+ if (!thisElement.hideList.length)
+ {
+ domLib_collisionElements[cnt].style.visibility = 'visible';
+ if (domLib_isKonq)
+ {
+ domLib_collisionElements[cnt].style.display = '';
+ }
+ }
+ }
+
+ return;
+ }
+ else if (domLib_collisionElements.length == 0)
+ {
+ return;
+ }
+
+ // okay, we have a tip, so hunt and destroy
+ var objectOffsets = domLib_getOffsets(in_object);
+
+ for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
+ {
+ var thisElement = domLib_collisionElements[cnt];
+
+ // if collision element is in active element, move on
+ // WARNING: is this too costly?
+ if (domLib_isDescendantOf(thisElement, in_object))
+ {
+ continue;
+ }
+
+ // konqueror only has trouble with multirow selects
+ if (domLib_isKonq &&
+ thisElement.tagName == 'SELECT' &&
+ (thisElement.size <= 1 && !thisElement.multiple))
+ {
+ continue;
+ }
+
+ if (!thisElement.hideList)
+ {
+ thisElement.hideList = new Hash();
+ }
+
+ var selectOffsets = domLib_getOffsets(thisElement);
+ var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
+ var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
+ // the encompassing circles are overlapping, get in for a closer look
+ if (center2centerDistance < radiusSum)
+ {
+ // tip is left of select
+ if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
+ // tip is right of select
+ (objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
+ // tip is above select
+ (objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
+ // tip is below select
+ (objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
+ {
+ thisElement.hideList.remove(in_object.id);
+ if (!thisElement.hideList.length)
+ {
+ thisElement.style.visibility = 'visible';
+ if (domLib_isKonq)
+ {
+ thisElement.style.display = '';
+ }
+ }
+ }
+ else
+ {
+ thisElement.hideList.set(in_object.id, true);
+ thisElement.style.visibility = 'hidden';
+ if (domLib_isKonq)
+ {
+ thisElement.style.display = 'none';
+ }
+ }
+ }
+ }
+}
+
+// }}}
+// {{{ domLib_getOffsets()
+
+function domLib_getOffsets(in_object)
+{
+ var originalObject = in_object;
+ var originalWidth = in_object.offsetWidth;
+ var originalHeight = in_object.offsetHeight;
+ var offsetLeft = 0;
+ var offsetTop = 0;
+
+ while (in_object)
+ {
+ offsetLeft += in_object.offsetLeft;
+ offsetTop += in_object.offsetTop;
+ in_object = in_object.offsetParent;
+ }
+
+ // MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
+ if (domLib_isMacIE) {
+ offsetLeft += 10;
+ offsetTop += 10;
+ }
+
+ return new Hash(
+ 'left', offsetLeft,
+ 'top', offsetTop,
+ 'right', offsetLeft + originalWidth,
+ 'bottom', offsetTop + originalHeight,
+ 'leftCenter', offsetLeft + originalWidth/2,
+ 'topCenter', offsetTop + originalHeight/2,
+ 'radius', Math.max(originalWidth, originalHeight)
+ );
+}
+
+// }}}
+// {{{ domLib_setTimeout()
+
+function domLib_setTimeout(in_function, in_timeout, in_args)
+{
+ if (typeof(in_args) == 'undefined')
+ {
+ in_args = [];
+ }
+
+ if (in_timeout == -1)
+ {
+ // timeout event is disabled
+ return;
+ }
+ else if (in_timeout == 0)
+ {
+ in_function(in_args);
+ return 0;
+ }
+
+ // must make a copy of the arguments so that we release the reference
+ var args = domLib_clone(in_args);
+
+ if (!domLib_hasBrokenTimeout)
+ {
+ return setTimeout(function() { in_function(args); }, in_timeout);
+ }
+ else
+ {
+ var id = domLib_timeoutStateId++;
+ var data = new Hash();
+ data.set('function', in_function);
+ data.set('args', args);
+ domLib_timeoutStates.set(id, data);
+
+ data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
+ return id;
+ }
+}
+
+// }}}
+// {{{ domLib_clearTimeout()
+
+function domLib_clearTimeout(in_id)
+{
+ if (!domLib_hasBrokenTimeout)
+ {
+ clearTimeout(in_id);
+ }
+ else
+ {
+ if (domLib_timeoutStates.has(in_id))
+ {
+ clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
+ domLib_timeoutStates.remove(in_id);
+ }
+ }
+}
+
+// }}}
+// {{{ domLib_getEventPosition()
+
+function domLib_getEventPosition(in_eventObj)
+{
+ var eventPosition = new Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);
+
+ // IE varies depending on standard compliance mode
+ if (domLib_isIE)
+ {
+ var doc = (domLib_standardsMode ? document.documentElement : document.body);
+ // NOTE: events may fire before the body has been loaded
+ if (doc)
+ {
+ eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
+ eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
+ eventPosition.set('scrollX', doc.scrollLeft);
+ eventPosition.set('scrollY', doc.scrollTop);
+ }
+ }
+ else
+ {
+ eventPosition.set('x', in_eventObj.pageX);
+ eventPosition.set('y', in_eventObj.pageY);
+ eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
+ eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
+ }
+
+ return eventPosition;
+}
+
+// }}}
+// {{{ domLib_cancelBubble()
+
+function domLib_cancelBubble(in_event)
+{
+ var eventObj = in_event ? in_event : window.event;
+ eventObj.cancelBubble = true;
+}
+
+// }}}
+// {{{ domLib_getIFrameReference()
+
+function domLib_getIFrameReference(in_frame)
+{
+ if (domLib_isGecko || domLib_isIE)
+ {
+ return in_frame.frameElement;
+ }
+ else
+ {
+ // we could either do it this way or require an id on the frame
+ // equivalent to the name
+ var name = in_frame.name;
+ if (!name || !in_frame.parent)
+ {
+ return;
+ }
+
+ var candidates = in_frame.parent.document.getElementsByTagName('iframe');
+ for (var i = 0; i < candidates.length; i++)
+ {
+ if (candidates[i].name == name)
+ {
+ return candidates[i];
+ }
+ }
+ }
+}
+
+// }}}
+// {{{ domLib_getElementsByClass()
+
+function domLib_getElementsByClass(in_class)
+{
+ var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
+ var matches = [];
+ var cnt = 0;
+ for (var i = 0; i < elements.length; i++)
+ {
+ if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
+ {
+ matches[cnt++] = elements[i];
+ }
+ }
+
+ return matches;
+}
+
+// }}}
+// {{{
+
+function domLib_getElementsByTagNames(in_list, in_excludeHidden)
+{
+ var elements = [];
+ for (var i = 0; i < in_list.length; i++)
+ {
+ var matches = document.getElementsByTagName(in_list[i]);
+ for (var j = 0; j < matches.length; j++)
+ {
+ if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
+ {
+ continue;
+ }
+
+ elements[elements.length] = matches[j];
+ }
+ }
+
+ return elements;
+}
+
+// }}}
+// {{{
+
+function domLib_getComputedStyle(in_obj, in_property)
+{
+ if (domLib_isIE)
+ {
+ var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
+ return eval('in_obj.currentStyle.' + humpBackProp);
+ }
+ // getComputedStyle() is broken in konqueror, so let's go for the style object
+ else if (domLib_isKonq)
+ {
+ var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
+ return eval('in_obj.style.' + in_property);
+ }
+ else
+ {
+ return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
+ }
+}
+
+// }}}
+// {{{ makeTrue()
+
+function makeTrue()
+{
+ return true;
+}
+
+// }}}
+// {{{ makeFalse()
+
+function makeFalse()
+{
+ return false;
+}
+
+// }}}