You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Robert Patt-Corner <ro...@gmail.com> on 2007/12/28 06:18:12 UTC

Java MethodBinding syntax for Tomahawk Scheduler ScheduleMouseEvent

Hi ...

Can someone assist me with how to create a method binding in a Java backing
bean that will successfully bind a tomahawk Scheduler component's
ScheduleMouseEvent?

I find that I can create valuebindings with no problem, and action
methodbindings (which take no argument).  However any attempt to create a
methodbinding for a method
that has a nonempty signature results in the method not being found by the
methodbinding code.

for example, in the code below the commented out line attempts to bind the
mouse listener to an extant method.  If the method exists with the proper
signature:

public void handleScheduleClick(ScheduleMouseEvent event)
or even:
public void handleScheduleClick(Object e){

we get a "method not found" from the binding code.

If, however the method has no arguments:
public void handleScheduleClick()

then all goes swimmingly ... except that the arguments are wrong and we get
the corresponding error.

Clearly I'm missing something, probably how to add an argument to a method
binding from the Java side.

FWIW, the tag code, should I use a tag, works fine -- but I need to generate
these schedules dynamically in tabs.

My current workaround involves dredging up the schedule in the action method
and probing for its lastClickedDate, but it's not a pretty sight.

Any thoughts?

R.




============= Attempted Method Binding===============
HtmlSchedule mySchedule = new HtmlSchedule();
            mySchedule.setId("schedule" + p.getPid());
            mySchedule.setValueBinding("value", scheduleBinding);
            mySchedule.setValueBinding("visibleStartHour",
createValueBinding("#{scheduleSettings.visibleStartHour}"));
            mySchedule.setValueBinding("visibleEndHour",
createValueBinding("#{scheduleSettings.visibleEndHour}"));
            mySchedule.setValueBinding("workingStartHour",
createValueBinding("#{scheduleSettings.workingStartHour}"));
            mySchedule.setValueBinding("workingEndHour",
createValueBinding("#{scheduleSettings.workingEndHour}"));
            //mySchedule.setValueBinding("readonly", createValueBinding("#{
scheduleSettings.readonly}"));
            mySchedule.setValueBinding("theme", createValueBinding("#{
scheduleSettings.theme}"));
            mySchedule.setValueBinding("compactWeekRowHeight",
createValueBinding("#{scheduleSettings.compactWeekRowHeight}"));
            mySchedule.setValueBinding("compactMonthRowHeight",
createValueBinding("#{scheduleSettings.compactMonthRowHeight}"));
            mySchedule.setValueBinding("detailedRowHeight",
createValueBinding("#{scheduleSettings.detailedRowHeight}"));

            //mySchedule.setMouseListener(createMethodBinding("#{
providerTemplateScheduleHandler.handleScheduleClick}"));

            mySchedule.setAction(createMethodBinding("#{
providerTemplateScheduleHandler.scheduleAction}"));
            mySchedule.setReadonly(false);
            mySchedule.setSubmitOnClick(true);
            UIComponentTagUtils.setStringProperty(getFacesContext(),
mySchedule, "headerDateFormat", "EEEE");
=========End===============

Re: Java MethodBinding syntax for Tomahawk Scheduler ScheduleMouseEvent

Posted by Robert Patt-Corner <ro...@gmail.com>.
Yes, that works fine.  I'm not using the tags tho ... kind of fallout from
being unable to use a JSTL forEach.  I have to create the binding in Java,
not JSP.  If you know how, grateful to hear.

r.

On Dec 28, 2007 3:16 AM, Łukasz Budnik <lu...@gmail.com> wrote:

> Hi!
>
> I use this:
>
> public void scheduleClicked(ScheduleMouseEvent event) {
> }
>
> and in JSF I have:
>
> <t:schedule mouseListener="#{ScheduleController.scheduleClicked}" ... />
>
> best regards
> Łukasz
>
> On 28/12/2007, Robert Patt-Corner <ro...@gmail.com> wrote:
> > Hi ...
> >
> > Can someone assist me with how to create a method binding in a Java
> backing
> > bean that will successfully bind a tomahawk Scheduler component's
> > ScheduleMouseEvent?
> >
> > I find that I can create valuebindings with no problem, and action
> > methodbindings (which take no argument).  However any attempt to create
> a
> > methodbinding for a method
> > that has a nonempty signature results in the method not being found by
> the
> > methodbinding code.
> >
> > for example, in the code below the commented out line attempts to bind
> the
> > mouse listener to an extant method.  If the method exists with the
> proper
> > signature:
> >
> > public void handleScheduleClick(ScheduleMouseEvent event)
> > or even:
> > public void handleScheduleClick(Object e){
> >
> > we get a "method not found" from the binding code.
> >
> > If, however the method has no arguments:
> > public void handleScheduleClick()
> >
> > then all goes swimmingly ... except that the arguments are wrong and we
> get
> > the corresponding error.
> >
> > Clearly I'm missing something, probably how to add an argument to a
> method
> > binding from the Java side.
> >
> > FWIW, the tag code, should I use a tag, works fine -- but I need to
> generate
> > these schedules dynamically in tabs.
> >
> > My current workaround involves dredging up the schedule in the action
> method
> > and probing for its lastClickedDate, but it's not a pretty sight.
> >
> > Any thoughts?
> >
> > R.
> >
> >
> >
> >
> > ============= Attempted Method Binding===============
> > HtmlSchedule mySchedule = new HtmlSchedule();
> >             mySchedule.setId("schedule" + p.getPid());
> >             mySchedule.setValueBinding("value", scheduleBinding);
> >             mySchedule.setValueBinding("visibleStartHour",
> > createValueBinding("#{scheduleSettings.visibleStartHour}"));
> >             mySchedule.setValueBinding("visibleEndHour",
> > createValueBinding("#{scheduleSettings.visibleEndHour}"));
> >             mySchedule.setValueBinding("workingStartHour",
> > createValueBinding("#{
> > scheduleSettings.workingStartHour}"));
> >             mySchedule.setValueBinding("workingEndHour",
> > createValueBinding("#{scheduleSettings.workingEndHour}"));
> >             //mySchedule.setValueBinding("readonly",
> > createValueBinding("#{ scheduleSettings.readonly}"));
> >             mySchedule.setValueBinding("theme",
> > createValueBinding("#{scheduleSettings.theme}"));
> >             mySchedule.setValueBinding("compactWeekRowHeight",
> > createValueBinding("#{
> > scheduleSettings.compactWeekRowHeight}"));
> >             mySchedule.setValueBinding("compactMonthRowHeight",
> > createValueBinding("#{scheduleSettings.compactMonthRowHeight}"));
> >             mySchedule.setValueBinding ("detailedRowHeight",
> > createValueBinding("#{scheduleSettings.detailedRowHeight}"));
> >
> >
> > //mySchedule.setMouseListener(createMethodBinding("#{
> providerTemplateScheduleHandler.handleScheduleClick
> > }"));
> >
> >
> > mySchedule.setAction(createMethodBinding("#{
> providerTemplateScheduleHandler.scheduleAction}"));
> >             mySchedule.setReadonly(false);
> >             mySchedule.setSubmitOnClick (true);
> >
> > UIComponentTagUtils.setStringProperty(getFacesContext(),
> > mySchedule, "headerDateFormat", "EEEE");
> > =========End===============
> >
>

Re: Java MethodBinding syntax for Tomahawk Scheduler ScheduleMouseEvent

Posted by Łukasz Budnik <lu...@gmail.com>.
Hi!

I use this:

public void scheduleClicked(ScheduleMouseEvent event) {
}

and in JSF I have:

<t:schedule mouseListener="#{ScheduleController.scheduleClicked}" ... />

best regards
Łukasz

On 28/12/2007, Robert Patt-Corner <ro...@gmail.com> wrote:
> Hi ...
>
> Can someone assist me with how to create a method binding in a Java backing
> bean that will successfully bind a tomahawk Scheduler component's
> ScheduleMouseEvent?
>
> I find that I can create valuebindings with no problem, and action
> methodbindings (which take no argument).  However any attempt to create a
> methodbinding for a method
> that has a nonempty signature results in the method not being found by the
> methodbinding code.
>
> for example, in the code below the commented out line attempts to bind the
> mouse listener to an extant method.  If the method exists with the proper
> signature:
>
> public void handleScheduleClick(ScheduleMouseEvent event)
> or even:
> public void handleScheduleClick(Object e){
>
> we get a "method not found" from the binding code.
>
> If, however the method has no arguments:
> public void handleScheduleClick()
>
> then all goes swimmingly ... except that the arguments are wrong and we get
> the corresponding error.
>
> Clearly I'm missing something, probably how to add an argument to a method
> binding from the Java side.
>
> FWIW, the tag code, should I use a tag, works fine -- but I need to generate
> these schedules dynamically in tabs.
>
> My current workaround involves dredging up the schedule in the action method
> and probing for its lastClickedDate, but it's not a pretty sight.
>
> Any thoughts?
>
> R.
>
>
>
>
> ============= Attempted Method Binding===============
> HtmlSchedule mySchedule = new HtmlSchedule();
>             mySchedule.setId("schedule" + p.getPid());
>             mySchedule.setValueBinding("value", scheduleBinding);
>             mySchedule.setValueBinding("visibleStartHour",
> createValueBinding("#{scheduleSettings.visibleStartHour}"));
>             mySchedule.setValueBinding("visibleEndHour",
> createValueBinding("#{scheduleSettings.visibleEndHour}"));
>             mySchedule.setValueBinding("workingStartHour",
> createValueBinding("#{
> scheduleSettings.workingStartHour}"));
>             mySchedule.setValueBinding("workingEndHour",
> createValueBinding("#{scheduleSettings.workingEndHour}"));
>             //mySchedule.setValueBinding("readonly",
> createValueBinding("#{ scheduleSettings.readonly}"));
>             mySchedule.setValueBinding("theme",
> createValueBinding("#{scheduleSettings.theme}"));
>             mySchedule.setValueBinding("compactWeekRowHeight",
> createValueBinding("#{
> scheduleSettings.compactWeekRowHeight}"));
>             mySchedule.setValueBinding("compactMonthRowHeight",
> createValueBinding("#{scheduleSettings.compactMonthRowHeight}"));
>             mySchedule.setValueBinding ("detailedRowHeight",
> createValueBinding("#{scheduleSettings.detailedRowHeight}"));
>
>
> //mySchedule.setMouseListener(createMethodBinding("#{providerTemplateScheduleHandler.handleScheduleClick
> }"));
>
>
> mySchedule.setAction(createMethodBinding("#{providerTemplateScheduleHandler.scheduleAction}"));
>             mySchedule.setReadonly(false);
>             mySchedule.setSubmitOnClick (true);
>
> UIComponentTagUtils.setStringProperty(getFacesContext(),
> mySchedule, "headerDateFormat", "EEEE");
> =========End===============
>

[Trinidad] Disclosing the first item in a tr:tree

Posted by Richard Yee <ry...@cruzio.com>.
Hi,
I'm using Trinidad 1.0.4 and MyFaces 1.1.5 and am trying to make the 
first item in a tr:tree be disclosed when the component is rendered. I 
am using a ChildPropertyTreeModel as the tree model. Right now the tree 
is displaying okay but I can't get the first item to be disclosed.

Thanks,

Richard


Re: Java MethodBinding syntax for Tomahawk Scheduler ScheduleMouseEvent

Posted by Robert Patt-Corner <ro...@gmail.com>.
In reply to my own message, in case others find it useful.

Fairly straightforward (after weeks of research!) ... the constructor for a
method binding takes the class of the argument as an argument to the
constructor.  So do this:

Class args[] = {ScheduleMouseEvent.class};
MethodBinding clickBinding =
getFacesContext().getApplication().createMethodBinding("#{
myHandlerName.myClickHandlingMethod}", args);


Sigh.

On Fri, Dec 28, 2007 at 8:29 AM, Robert Patt-Corner <ro...@gmail.com>
wrote:

> Other clues to what I may be doing wrong:
>
> 1. If I use the <t:schedule> tag to place a tag-created (distinct from my
> managed bean-created) schedule directly below the dynamically created
> schedules I see the following behaviour when clicking the tab-created
> schedule:
>
> a. If the dynamically created schedule is present (e.g. executed) a click
> on the tag-created schedule fails in the same way, e.g. method not found.
> b. If I comment out the creation of the dynamically created schedule, a
> click on the tag-created schedule succeeds!
>
> Suggesting that my creation technique in the managed bean is doing
> something evil.
>
> 2. I am creating the dynamic components in the setter of the parent
> component.  I was unable to create them in the backing bean constructor, as
> the parent component is not yet instantiated.  I see references to an
> "init()" method of managed beans in the literature but cannot create an
> effective one.  A simple public void init() is never invoked.
>
> The setter looks like this:
>
> public void setTabbedPaneTarget(HtmlPanelTabbedPane tabbedPaneTarget) {
>         this.tabbedPaneTarget = tabbedPaneTarget;
>         if (tabbedPaneTarget != null && tabbedPaneTarget.getChildCount ()
> == 0) {
>             populateTabs(tabbedPaneTarget);
>         }
>     }
>
> where populateTabs does the dirty work of instantiating tabs and a
> schedule as a child of each, shown below.
>
> R.
>
>
> On Dec 28, 2007 12:18 AM, Robert Patt-Corner <ro...@gmail.com> wrote:
>
> > Hi ...
> >
> > Can someone assist me with how to create a method binding in a Java
> > backing bean that will successfully bind a tomahawk Scheduler component's
> > ScheduleMouseEvent?
> >
> > I find that I can create valuebindings with no problem, and action
> > methodbindings (which take no argument).  However any attempt to create a
> > methodbinding for a method
> > that has a nonempty signature results in the method not being found by
> > the methodbinding code.
> >
> > for example, in the code below the commented out line attempts to bind
> > the mouse listener to an extant method.  If the method exists with the
> > proper signature:
> >
> > public void handleScheduleClick(ScheduleMouseEvent event)
> > or even:
> > public void handleScheduleClick(Object e){
> >
> > we get a "method not found" from the binding code.
> >
> > If, however the method has no arguments:
> > public void handleScheduleClick()
> >
> > then all goes swimmingly ... except that the arguments are wrong and we
> > get the corresponding error.
> >
> > Clearly I'm missing something, probably how to add an argument to a
> > method binding from the Java side.
> >
> > FWIW, the tag code, should I use a tag, works fine -- but I need to
> > generate these schedules dynamically in tabs.
> >
> > My current workaround involves dredging up the schedule in the action
> > method and probing for its lastClickedDate, but it's not a pretty sight.
> >
> > Any thoughts?
> >
> > R.
> >
> >
> >
> >
> > ============= Attempted Method Binding===============
> > HtmlSchedule mySchedule = new HtmlSchedule();
> >             mySchedule.setId("schedule" + p.getPid());
> >             mySchedule.setValueBinding("value", scheduleBinding);
> >             mySchedule.setValueBinding("visibleStartHour",
> > createValueBinding("#{scheduleSettings.visibleStartHour}"));
> >             mySchedule.setValueBinding("visibleEndHour",
> > createValueBinding("#{scheduleSettings.visibleEndHour}"));
> >             mySchedule.setValueBinding("workingStartHour",
> > createValueBinding("#{ scheduleSettings.workingStartHour}"));
> >             mySchedule.setValueBinding("workingEndHour",
> > createValueBinding("#{scheduleSettings.workingEndHour}"));
> >             //mySchedule.setValueBinding("readonly",
> > createValueBinding("#{ scheduleSettings.readonly}"));
> >             mySchedule.setValueBinding("theme", createValueBinding("#{
> > scheduleSettings.theme}"));
> >             mySchedule.setValueBinding("compactWeekRowHeight",
> > createValueBinding("#{ scheduleSettings.compactWeekRowHeight}"));
> >             mySchedule.setValueBinding("compactMonthRowHeight",
> > createValueBinding("#{scheduleSettings.compactMonthRowHeight}"));
> >             mySchedule.setValueBinding ("detailedRowHeight",
> > createValueBinding("#{scheduleSettings.detailedRowHeight}"));
> >
> >             //mySchedule.setMouseListener(createMethodBinding("#{
> > providerTemplateScheduleHandler.handleScheduleClick }"));
> >
> >             mySchedule.setAction(createMethodBinding("#{
> > providerTemplateScheduleHandler.scheduleAction}"));
> >             mySchedule.setReadonly(false);
> >             mySchedule.setSubmitOnClick (true);
> >             UIComponentTagUtils.setStringProperty(getFacesContext(),
> > mySchedule, "headerDateFormat", "EEEE");
> > =========End===============
> >
>
>

Re: Java MethodBinding syntax for Tomahawk Scheduler ScheduleMouseEvent

Posted by Robert Patt-Corner <ro...@gmail.com>.
Other clues to what I may be doing wrong:

1. If I use the <t:schedule> tag to place a tag-created (distinct from my
managed bean-created) schedule directly below the dynamically created
schedules I see the following behaviour when clicking the tab-created
schedule:

a. If the dynamically created schedule is present (e.g. executed) a click on
the tag-created schedule fails in the same way, e.g. method not found.
b. If I comment out the creation of the dynamically created schedule, a
click on the tag-created schedule succeeds!

Suggesting that my creation technique in the managed bean is doing something
evil.

2. I am creating the dynamic components in the setter of the parent
component.  I was unable to create them in the backing bean constructor, as
the parent component is not yet instantiated.  I see references to an
"init()" method of managed beans in the literature but cannot create an
effective one.  A simple public void init() is never invoked.

The setter looks like this:

public void setTabbedPaneTarget(HtmlPanelTabbedPane tabbedPaneTarget) {
        this.tabbedPaneTarget = tabbedPaneTarget;
        if (tabbedPaneTarget != null && tabbedPaneTarget.getChildCount() ==
0) {
            populateTabs(tabbedPaneTarget);
        }
    }

where populateTabs does the dirty work of instantiating tabs and a schedule
as a child of each, shown below.

R.

On Dec 28, 2007 12:18 AM, Robert Patt-Corner <ro...@gmail.com> wrote:

> Hi ...
>
> Can someone assist me with how to create a method binding in a Java
> backing bean that will successfully bind a tomahawk Scheduler component's
> ScheduleMouseEvent?
>
> I find that I can create valuebindings with no problem, and action
> methodbindings (which take no argument).  However any attempt to create a
> methodbinding for a method
> that has a nonempty signature results in the method not being found by the
> methodbinding code.
>
> for example, in the code below the commented out line attempts to bind the
> mouse listener to an extant method.  If the method exists with the proper
> signature:
>
> public void handleScheduleClick(ScheduleMouseEvent event)
> or even:
> public void handleScheduleClick(Object e){
>
> we get a "method not found" from the binding code.
>
> If, however the method has no arguments:
> public void handleScheduleClick()
>
> then all goes swimmingly ... except that the arguments are wrong and we
> get the corresponding error.
>
> Clearly I'm missing something, probably how to add an argument to a method
> binding from the Java side.
>
> FWIW, the tag code, should I use a tag, works fine -- but I need to
> generate these schedules dynamically in tabs.
>
> My current workaround involves dredging up the schedule in the action
> method and probing for its lastClickedDate, but it's not a pretty sight.
>
> Any thoughts?
>
> R.
>
>
>
>
> ============= Attempted Method Binding===============
> HtmlSchedule mySchedule = new HtmlSchedule();
>             mySchedule.setId("schedule" + p.getPid());
>             mySchedule.setValueBinding("value", scheduleBinding);
>             mySchedule.setValueBinding("visibleStartHour",
> createValueBinding("#{scheduleSettings.visibleStartHour}"));
>             mySchedule.setValueBinding("visibleEndHour",
> createValueBinding("#{scheduleSettings.visibleEndHour}"));
>             mySchedule.setValueBinding("workingStartHour",
> createValueBinding("#{ scheduleSettings.workingStartHour}"));
>             mySchedule.setValueBinding("workingEndHour",
> createValueBinding("#{scheduleSettings.workingEndHour}"));
>             //mySchedule.setValueBinding("readonly",
> createValueBinding("#{ scheduleSettings.readonly}"));
>             mySchedule.setValueBinding("theme", createValueBinding("#{
> scheduleSettings.theme}"));
>             mySchedule.setValueBinding("compactWeekRowHeight",
> createValueBinding("#{ scheduleSettings.compactWeekRowHeight}"));
>             mySchedule.setValueBinding("compactMonthRowHeight",
> createValueBinding("#{scheduleSettings.compactMonthRowHeight}"));
>             mySchedule.setValueBinding ("detailedRowHeight",
> createValueBinding("#{scheduleSettings.detailedRowHeight}"));
>
>             //mySchedule.setMouseListener(createMethodBinding("#{
> providerTemplateScheduleHandler.handleScheduleClick }"));
>
>             mySchedule.setAction(createMethodBinding("#{
> providerTemplateScheduleHandler.scheduleAction}"));
>             mySchedule.setReadonly(false);
>             mySchedule.setSubmitOnClick (true);
>             UIComponentTagUtils.setStringProperty(getFacesContext(),
> mySchedule, "headerDateFormat", "EEEE");
> =========End===============
>