/** * This method should be implemented in any subclasses of this component interested in processing * parameters from an html post operation. The component should interogate the HttpServletRequest * for any parameters it is interested in and change its internal state to reflect the parms. * * @return true if this component is the one that submitted the page and false if not. * @param parms a HashTable containing all the parameters for the servlet. */ public boolean processParms(Hashtable parms, int rowNo) throws Exception { Object parm = parms.get(getFullName()); if (parm == null) return false; String[] command = (String[]) parm; if (command[0] == null || command[0].trim().equals("")) return false; String st[] = getLookupComponent(); if (command[0].startsWith("changeMonth:")) { int monthInc = Integer.parseInt(command[0].substring(12)); GregorianCalendar g = new GregorianCalendar(_currentYear, _currentMonth, 1); g.add(Calendar.MONTH, monthInc); CalendarMonthChangeEvent e = new CalendarMonthChangeEvent( this, _currentMonth, _currentYear, g.get(Calendar.MONTH), g.get(Calendar.YEAR)); _calEvent = e; if (st != null) { _scrollTo = true; getPage().scrollToItem(getFullName() + "CalStart"); } } else if (command[0].startsWith("selectDate:")) { String newDate = command[0].substring(11); int pos = newDate.indexOf("-"); String day = newDate.substring(0, pos); String year = newDate.substring(pos + 1); int dayInt = Integer.parseInt(day); int yearInt = Integer.parseInt(year); GregorianCalendar g = new GregorianCalendar(); g.set(Calendar.YEAR, yearInt); g.set(Calendar.DAY_OF_YEAR, dayInt); java.sql.Date d = new java.sql.Date(g.getTime().getTime()); CalendarDateSelectedEvent e = new CalendarDateSelectedEvent(this, g, d); _calEvent = e; if (st == null) { _scrollTo = true; getPage().scrollToItem(getFullName() + "CalStart"); } else { HtmlScriptGenerator gen = new HtmlScriptGenerator(getPage()); String format = st[1]; String dtString = null; if (format != null) { SimpleDateFormat df = new SimpleDateFormat(format); dtString = df.format(d); } else { dtString = d.toString(); } getPage().writeScript(gen.generateReturnValueToLookupScript(dtString, "")); } } return true; }