コード例 #1
0
ファイル: DatePicker.java プロジェクト: OndraZizka/sandbox
 /** @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component) */
 public void onRendered(Component component) {
   super.onRendered(component);
   // Append the span and img icon right after the rendering of the
   // component. Not as pretty as working with a panel etc, but works
   // for behaviors and is more efficient
   Response response = component.getResponse();
   response.write("\n<span>&nbsp;<img style=\"");
   response.write(getIconStyle());
   response.write("\" id=\"");
   response.write(getIconId());
   response.write("\" src=\"");
   CharSequence iconUrl = getIconUrl();
   // displayCalendar(document.forms[0].theDate,'yyyy/mm/dd',this)
   response.write(Strings.escapeMarkup(iconUrl != null ? iconUrl.toString() : ""));
   response.write("\" onclick=\"displayCalendar(document.getElementById('");
   response.write(component.getMarkupId());
   response.write("'),'");
   String datePattern = getDatePattern().replaceAll("mm", "ii").toLowerCase();
   datePattern = datePattern.replace('s', '0'); // (mili)seconds are not supported
   response.write(datePattern);
   if (datePattern.indexOf("h") == -1) {
     response.write("',this)\"");
   } else {
     response.write("',this,true)\"");
   }
   response.write(" /></span>");
 }
コード例 #2
0
 /** @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component) */
 @Override
 public void onRendered(Component component) {
   // do not add default spans for + -; img buttons substitute those
   if (getSpinUpComponent() == null) {
     Response response = component.getResponse();
     response.write(
         "</td><td style = \"margin: 0px; padding: 0px; width: 5px;\">&nbsp</td><td style = \"margin: 0px; padding: 0px; width: 16px;\">"); //$NON-NLS-1$
     response.write(
         "<table style=\"margin: 0px; padding: 0px; border-collapse: collapse; table-layout: fixed;\"><tbody><tr style=\"margin: 0px; padding: 0px;\">"); //$NON-NLS-1$
     response.write("<td style=\"margin: 0px; padding: 0px;\">"); // $NON-NLS-1$
     response.write("\n<img style=\"cursor: pointer; border: none;\" id=\""); // $NON-NLS-1$
     response.write(field.getMarkupId() + "-SpinnerUp"); // $NON-NLS-1$
     response.write("\" src=\""); // $NON-NLS-1$
     response.write(Strings.escapeMarkup(getUpIconUrl().toString()));
     response.write(
         "\"/></td></tr><tr style=\"margin: 0px; padding: 0px;\"><td style=\"margin: 0px; padding: 0px;\">"); //$NON-NLS-1$
     response.write("\n<img style=\"cursor: pointer; border: none;\" id=\""); // $NON-NLS-1$
     response.write(field.getMarkupId() + "-SpinnerDown"); // $NON-NLS-1$
     response.write("\" src=\""); // $NON-NLS-1$
     response.write(Strings.escapeMarkup(getDownIconUrl().toString()));
     response.write("\"/></td></tr></tbody></table>"); // $NON-NLS-1$
   }
 }