Re: It's never easy
Re: It's never easy
- Subject: Re: It's never easy
- From: David LeBer <email@hidden>
- Date: Sun, 29 Jan 2012 23:20:28 -0500
Use ERXComponent instead of WOComponent - you are using Wonder, might as well take advantage of it.
Synchronizing components don't understand 'valueForBinding'
Turn off synchronization to get those to work:
@Override
public boolean synchronizesVariablesWithBindings() {
return false;
}
D
--
David LeBer
Codeferous Software
On 2012-01-29, at 11:08 PM, Theodore Petrosky wrote:
> ok I will give it a try. I did try this but ran into a few problems but based on the two part example from 2009 I see that the custom component extends ERXStatelessComponent.
>
> But then I get this error:
>
> Error: java.lang.IllegalStateException: <<com.as.application.ui.components.NewPublicationContactComponent name: com.as.application.ui.components.NewPublicationContactComponent subcomponents: null >>: A stateless component can not have a stateful child (<er.ajax.AjaxInPlace name: er.ajax.AjaxInPlace subcomponents: null >).
>
> of course if I just extend the component from WOComponent, then it doesn't think I have key():
>
>
> UnknownKeyException: [<com.as.application.ui.components.NewPublicationContactComponent name: com.as.application.ui.components.NewPublicationContactComponent subcomponents: null > takeValueForKey()]: attempt to assign value to unknown key: 'key'.
> This WOComponent does not have an instance variable of the name key or _key, nor a method of the name setKey or _setKey
>
>
> here is my java from my component.
>
> public class NewPublicationContactComponent extends WOComponent {
> public NewPublicationContactComponent(WOContext context) {
> super(context);
> }
>
> public EOEnterpriseObject object() {
> return (EOEnterpriseObject)valueForBinding("object");
> }
>
> public String key() {
> return (String)valueForBinding(key());
> }
>
> public String displayValue() {
> return (String)object().valueForKey(key());
> }
>
> public WOActionResults saveAfterLeavingInPlaceEditor() {
>
> object().editingContext().saveChanges();
>
> return null;
> }
> }
>
>
> There is obviously a lot that I need to learn to use this. I will try again in the morning. My head is just tired.
>
> Ted
>
>
> --- On Sun, 1/29/12, David LeBer <email@hidden> wrote:
>
>> From: David LeBer <email@hidden>
>> Subject: Re: It's never easy
>> To: "Theodore Petrosky" <email@hidden>
>> Cc: "WebObjects Development" <email@hidden>
>> Date: Sunday, January 29, 2012, 9:31 PM
>> A string containing line breaks will
>> display as multiple lines in a textarea, but line breaks
>> mean nothing in html so they are ignored otherwise.
>>
>> It looks like you are going to have to duplicate the
>> functionality of the AjaxInPlaceEditor with an AjaxInPlace
>> and edit and view template.
>>
>> The edit template wrapping a WOText, the view template
>> wrapping an ERXStringWithLineBreaks.
>>
>> D
>>
>> --
>> David LeBer
>> Codeferous Software
>>
>> On 2012-01-29, at 6:05 PM, Theodore Petrosky wrote:
>>
>>> I tried this before but here it is for list
>> edification. I created a component with an object
>>>
>>> <webobject name = "PublicationEditInPlace"/>
>>> and bound it with
>>> PublicationEditInPlace : AjaxInPlaceEditor {
>>> value = object.publication;//VALID
>>> rows = 5;
>>> cols = 15;
>>> }
>>>
>>> Perhaps because my component is bound into a repetition
>> but it does not respect the rows and cols bindings so that
>> before I click on the object it will show a single string.
>> Then when I click to select, I get the textarea with the
>> line feeds.
>>>
>>> Give me a clue. When I attempt to use the AjaxinPlace
>> and the multiple bindings, my component complains that there
>> is no setKey nor _setKey etc.
>>>
>>> I could use some expert guidance.
>>>
>>> Ted
>>>
>>> --- On Sun, 1/29/12, David LeBer <email@hidden>
>> wrote:
>>>
>>>> From: David LeBer <email@hidden>
>>>> Subject: Re: It's never easy
>>>> To: "Theodore Petrosky" <email@hidden>
>>>> Cc: "WebObjects Development" <email@hidden>
>>>> Date: Sunday, January 29, 2012, 3:06 PM
>>>> Ted,
>>>>
>>>> Please respond to the list.
>>>>
>>>> It looks like AjaxInPlaceEditor will render a
>> textarea if
>>>> you supply it with a rows and cols binding.
>>>>
>>>> The AjaxExample app in Wonder has a multiline
>> in-place
>>>> editor example that should give you what you need.
>>>>
>>>> Alternately you can use AjaxInPlace and give it
>> your own
>>>> edit and view templates (also shown in that
>> example).
>>>>
>>>> D
>>>>
>>>> --
>>>> David LeBer
>>>> Codeferous Software
>>>>
>>>> On 2012-01-29, at 12:15 PM, Theodore Petrosky
>> wrote:
>>>>
>>>>> So either I wasn't clear or I don't understand
>> the
>>>> answer.
>>>>>
>>>>> In the ListObject view, I want to present the
>> user with
>>>> an AjaxInPlaceEditor (I shouldn't say that, I want
>> them to
>>>> be able to select and edit a cell). For my values
>> that will
>>>> always be a single line (a name of something), it
>> works
>>>> great as an AjaxInPlaceEditor.
>>>>>
>>>>> However, when there is a list of items:
>>>>>
>>>>> Billy
>>>>> Sam
>>>>> Jon
>>>>>
>>>>> they appear as:
>>>>>
>>>>> Billy Sam Jon (of course on a
>> single
>>>> line instead of three lines in the
>> AjaxInPlaceEditor.)
>>>>>
>>>>> I examined the source of AjaxInPlaceEditor and
>> it
>>>> appears to me that this is an implementation of
>>>> AjaxInPlace.
>>>>>
>>>>>
>>>>>
>>>>> --- On Sun, 1/29/12, David LeBer <email@hidden>
>>>> wrote:
>>>>>
>>>>>> From: David LeBer <email@hidden>
>>>>>> Subject: Re: It's never easy
>>>>>> To: "Theodore Petrosky" <email@hidden>
>>>>>> Date: Sunday, January 29, 2012, 10:37 AM
>>>>>> There is no 'magic' Ted, D2W is just
>>>>>> WO with a rule engine on top.
>>>>>>
>>>>>> An ERD2WEditLargString is just a property
>> level
>>>> component
>>>>>> containing a WOText (textarea). So
>> implement that.
>>>>>>
>>>>>> D
>>>>>>
>>>>>> --
>>>>>> David LeBer
>>>>>> Codeferous Software
>>>>>>
>>>>>> On 2012-01-29, at 7:58 AM, Theodore
>> Petrosky
>>>> wrote:
>>>>>>
>>>>>>> I viewed David Leber's two part D2W
>> tutorial
>>>> from 2009
>>>>>> where he show how to use a
>> CustomComponent.
>>>>>>>
>>>>>>> Great, I figured out how to add an
>>>> AjaxInPlaceEditor to
>>>>>> my D2W list page. But now I need a
>> combination. An
>>>>>> ERD2WEditLargeString that is an
>> AjaxInPlaceEditor.
>>>>>>>
>>>>>>> Is there some magic that can help me
>> with this
>>>> one?
>>>>>>>
>>>>>>> Ted
>>>>>>>
>>>> _______________________________________________
>>>>>>> Do not post admin requests to the list.
>> They
>>>> will be
>>>>>> ignored.
>>>>>>> Webobjects-dev mailing list
>>
>>>> (email@hidden)
>>>>>>> Help/Unsubscribe/Update your
>> Subscription:
>>>>>>>
>>>>>>> This email sent to email@hidden
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden