It really works now.
 
Thank you very much!!!!
 

davy.mailing
2006-09-05

发件人: Peter Mahoney
发送时间: 2006-09-05 20:45:58
收件人: MyFaces Discussion
抄送:
主题: Re: Schedule component, mouseListener is not triggered At all
 
Yes. You will need to add something like:
<tag >
<tag-name >schedule </tag-name >
<component >
<component-type >org.apache.myfaces.Schedule </component-type >
<renderer-type >org.apache.myfaces.Schedule </renderer-type >
<handler-class >
package.ScheduleComponentHandler
</handler-class >
</component >
</tag >
 
davy.mailing wrote:
> thank u very much, Peter Mahoney
> Yes, i am using Facelets
> Where and How to register the class named ScheduleComponentHandler ?
> Is it in the taglib.xml
> ------------------------------------------------------------------------
> davy.mailing
> 2006-09-05
> ------------------------------------------------------------------------
> *发件人:* Peter Mahoney
> *发送时间:* 2006-09-05 15:22:34
> *收件人:* MyFaces Discussion
> *抄送:*
> *主题:* Re: Schedule component, mouseListener is not triggered At all
> Are you using Facelets? If so you will need to have a component handler
> registered. It will look something like this:
> public class ScheduleComponentHandler extends HtmlComponentHandler {
> private static final String RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME =
> "renderZeroLengthEntries";
> private static final String MOUSE_LISTENER_METHOD_ATTRIBUTE_NAME =
> "mouseListener";
> private static final String EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME =
> "expandToFitEntries";
> public ScheduleComponentHandler(ComponentConfig tagConfig) {
> super(tagConfig);
> }
> protected MetaRuleset createMetaRuleset(Class type)
> {
> MetaRuleset m = super.createMetaRuleset(type);
> m.addRule(new MethodRule(MOUSE_LISTENER_METHOD_ATTRIBUTE_NAME, null, new
> Class[] {ScheduleMouseEvent.class}));
> return m;
> }
> @Override
> protected void onComponentCreated(FaceletContext context, UIComponent
> component, UIComponent parent) {
> if (getAttribute(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME) != null) {
> component.getAttributes().put(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME,
> getAttribute(RENDER_ZERO_LENGTH_ENTRIES_ATTRIBUTE_NAME).getObject(context));
> }
> if (getAttribute(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME) != null) {
> component.getAttributes().put(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME,
> getAttribute(EXPAND_TO_FIT_ENTRIES_ATTRIBUTE_NAME).getObject(context));
> }
> }
> }
> I hope this helps.
> Peter
> davy.mailing wrote:
>  > Thanks in advance .
>  > I have put it into the form, and when i clicked the schedule, it did
>  > refresh the page, but the method was not called at all
>  > ------------------------------------------------------------------------
>  > davy.mailing
>  > 2006-09-05
>  > ------------------------------------------------------------------------
>  > *发件人:* Jurgen Lust
>  > *发送时间:* 2006-09-05 08:11:47
>  > *收件人:* MyFaces Discussion
>  > *抄送:*
>  > *主题:* Re: Re: Schedule component, mouseListener is not triggered
> At all
>  > Have you put the schedule inside a h:form? Anything that should trigger
>  > an action should be inside a form, otherwise the page can't be
>  > submitted.
>  > Jurgen
>  > Op di, 05-09-2006 te 00:07 +0800, schreef davy.mailing:
>  >  > It does not work.
>  >  >
>  >  > Nothing happened on the page.
>  >  >
>  >  > It seems that it does not call the action at all.
>  >  >
>  >  > I have write "a log.debug" at the first line of the method
>  >  >
>  >  > Nothing output, why?
>  >  >
>  >  >
>  >  > ______________________________________________________________________
>  >  > davy.mailing
>  >  > 2006-09-05
>  >  >
>  >  > ______________________________________________________________________
>  >  > 发件人: Jurgen Lust
>  >  > 发送时间: 2006-09-04 17:44:09
>  >  > 收件人: MyFaces Discussion
>  >  > 抄送:
>  >  > 主题: Re: Re: Schedule component, mouseListener is not triggered At
>  >  > all
>  >  >
>  >  > Try this code (taken from schedule example 5) in your
> onMouseClickAction
>  >  > method:
>  >  >
>  >  > public void onMouseClickAction(ScheduleMouseEvent event)
>  >  > {
>  >  > StringBuffer buffer = new StringBuffer();
>  >  > switch (event.getEventType())
>  >  > {
>  >  > case ScheduleMouseEvent.SCHEDULE_BODY_CLICKED:
>  >  > buffer.append("schedule body was clicked: ");
>  >  > buffer.append(event.getClickedTime());
>  >  > break;
>  >  > case ScheduleMouseEvent.SCHEDULE_HEADER_CLICKED:
>  >  > buffer.append("schedule header was clicked: ");
>  >  > buffer.append(event.getClickedDate());
>  >  > break;
>  >  > case ScheduleMouseEvent.SCHEDULE_ENTRY_CLICKED:
>  >  > buffer.append("schedule entry was clicked.");
>  >  > break;
>  >  > default:
>  >  > buffer.append("no schedule mouse events registered");
>  >  > }
>  >  > mouseActionText = buffer.toString();
>  >  > }
>  >  >
>  >  > And then just put a h:outputText with the mouseActionText in your page
>  >  > to see what happens.
>  >  >
>  >  > Jurgen
>  >  >
>  >  > Op ma, 04-09-2006 te 17:08 +0800, schreef davy.mailing:
>  >  >  > I have correct the mistake, but it still not work?
>  >  >  >
>  >  >  >
>  >  >  >
> ______________________________________________________________________
>  >  >  > davy.mailing
>  >  >  > 2006-09-04
>  >  >  >
>  >  >  >
> ______________________________________________________________________
>  >  >  > 发件人: Bruno Aranda
>  >  >  > 发送时间: 2006-09-04 16:20:45
>  >  >  > 收件人: MyFaces Discussion
>  >  >  > 抄送:
>  >  >  > 主题: Re: Schedule component, mouseListener is not triggered At all
>  >  >  >
>  >  >  > The method called should be 'onMouseClickAction', from what I
> read in
>  >  >  > the mouse listener
>  >  >  >
>  >  >  > mouseListener="#{pt_addEntryHandler.onMouseClickAction}"/  >
>  >  >  >
>  >  >  > and not 'onMouseClick'...
>  >  >  >
>  >  >  > Cheers,
>  >  >  >
>  >  >  > Bruno
>  >  >  >
>  >  >  > On 9/4/06, davy.mailing  <[EMAIL PROTECTED]  > wrote:
>  >  >  >  >
>  >  >  >  >
>  >  >  >  > Dear all
>  >  >  >  >
>  >  >  >  > I am using Schedule component like this
>  >  >  >  >
>  >  >  >  >  <t:schedule value="#{pt_addEntryHandler.model}"
>  >  >  >  > id="schedule1"
>  >  >  >  > rendered="true"
>  >  >  >  > visibleEndHour="18"
>  >  >  >  > visibleStartHour="8"
>  >  >  >  > workingEndHour="17"
>  >  >  >  > workingStartHour="9"
>  >  >  >  > readonly="false"
>  >  >  >  > theme="default"
>  >  >  >  > tooltip="true"
>  >  >  >  > submitOnClick="true"
>  >  >  >  >
>  >  >  >  > mouseListener="#{pt_addEntryHandler.onMouseClickAction}"/  >
>  >  >  >  >
>  >  >  >  > in the bean file
>  >  >  >  >
>  >  >  >  > public void onMouseClick(ScheduleMouseEvent event){
>  >  >  >  > log.debug("select time ="+event.getClickedTime());
>  >  >  >  > }
>  >  >  >  >
>  >  >  >
>  >  >  > but when i clicked the schedule, the method was not called at all
>  >  >  >  >
>  >  >  >  > Does somebody knows why?
>  >  >  >  >
>  >  >  >  > ________________________________
>  >  >  >  >
>  >  >  >  > davy.mailing
>  >  >  >  > 2006-09-04
>  >  >
 

Reply via email to