Still not quite sure what you are trying to do. You can't currently use a 
ListButton to enter text, though "combo box"-like functionality may be 
implemented for Pivot 2.1.

But perhaps I am misunderstanding the use case. Can you provide a little more 
detail?

On Oct 28, 2010, at 11:34 AM, [email protected] wrote:

> Hi Greg,
> 
> I would like to let list button as TextInput which can bind the Map.
> For  Example,
> I have simple POJO class.
> I would like to let list button bind the g2102,(for textIput ,I can easy to
> use textKey to bind g2101)
> and user form.load to reflect data and set setButtonData and show in
> screen.
> ,how can I do that list textInput.
> public class GWU002T1 {
>   private String G2101;
>   private String G2102 ;
> }
> Json map is {g2101:"1", g2102:"2")
> Best regards,
> Ken Jiang
> 
> *******************************************
> Murata Electronics Trading  (Shenzhen) Co.,Ltd
> Tel:86-755-82847251
> E-mail:[email protected]
> *******************************************
> 
> 
> 
>  From:       Greg Brown <[email protected]>                                     
>         
> 
>  To:         [email protected]                                            
>         
> 
>  Date:       10/28/2010 11:23 PM                                              
>         
> 
>  Subject:    Re: [Inquires]Data binding for list button.                      
>         
> 
> 
> 
> 
> 
> 
> Simply changing the selectedItemKey to "id" is not going to work, since the
> list button doesn't contain any items that would match the "id" property of
> the IM account.
> 
> Can you describe more specifically what you are trying to do?
> 
> 
> On Oct 28, 2010, at 10:58 AM, [email protected] wrote:
> 
>> Hi Greg,
>> 
>> Yes.I use the example data-binding from  pivot-tutorials.just change the
>> XML.my pivot version is 1.5.1
>> 
> |--------------------------------------------------------------------------|
> 
>> |package testing;
> |
>> |
> |
>> |import java.io.InputStream;
> |
>> |
> |
>> |import org.apache.pivot.beans.BeanAdapter;
> |
>> |import org.apache.pivot.collections.Map;
> |
>> |import org.apache.pivot.json.JSONSerializer;
> |
>> |import org.apache.pivot.wtk.Application;
> |
>> |import org.apache.pivot.wtk.Button;
> |
>> |import org.apache.pivot.wtk.ButtonPressListener;
> |
>> |import org.apache.pivot.wtk.DesktopApplicationContext;
> |
>> |import org.apache.pivot.wtk.Display;
> |
>> |import org.apache.pivot.wtk.Form;
> |
>> |import org.apache.pivot.wtk.Label;
> |
>> |import org.apache.pivot.wtk.PushButton;
> |
>> |import org.apache.pivot.wtk.Window;
> |
>> |import org.apache.pivot.wtkx.WTKXSerializer;
> |
>> |
> |
>> |public class DataBinding implements Application {
> |
>> |    private Window window = null;
> |
>> |    private Form form = null;
> |
>> |    private PushButton loadJavaButton = null;
> |
>> |    private PushButton loadJSONButton = null;
> |
>> |    private PushButton clearButton = null;
> |
>> |    private Label sourceLabel = null;
> |
>> |
> |
>> |    private static final Contact CONTACT = new Contact("101", "Joe
> User", |
>> |        new Address("123 Main St.", "Cambridge", "MA", "02142"),
> |
>> |        "(617) 555-1234", "[email protected]",
> |
>> |        new IMAccount("juser1234", "AIM"));
> |
>> |
> |
>> |    @Override
> |
>> |    public void startup(Display display, Map<String, String> properties)
> |
>> |        throws Exception {
> |
>> |        WTKXSerializer wtkxSerializer = new WTKXSerializer();
> |
>> |        window = (Window)wtkxSerializer.readObject(this,
> |
>> |"data_binding.wtkx");
> |
>> |        form = (Form)wtkxSerializer.get("form");
> |
>> |        loadJavaButton =
> (PushButton)wtkxSerializer.get("loadJavaButton");|
>> |        loadJSONButton =
> (PushButton)wtkxSerializer.get("loadJSONButton");|
>> |        clearButton = (PushButton)wtkxSerializer.get("clearButton");
> |
>> |        sourceLabel = (Label)wtkxSerializer.get("sourceLabel");
> |
>> |
> |
>> |        loadJavaButton.getButtonPressListeners().add(new
> |
>> |ButtonPressListener() {
> |
>> |            @Override
> |
>> |            public void buttonPressed(Button button) {
> |
>> |                form.load(new BeanAdapter(CONTACT));
> |
>> |                sourceLabel.setText("Java");
> |
>> |            }
> |
>> |        });
> |
>> 
> |--------------------------------------------------------------------------|
> 
>> 
>> 
>> 
>>   private static final Contact CONTACT = new Contact("101", "Joe User",
>>       new Address("123 Main St.", "Cambridge", "MA", "02142"),
>>       "(617) 555-1234", "[email protected]",
>>       new IMAccount("juser1234", "AIM"));
>> Best regards,
>> Ken Jiang
>> 
>> *******************************************
>> Murata Electronics Trading  (Shenzhen) Co.,Ltd
>> Tel:86-755-82847251
>> E-mail:[email protected]
>> *******************************************
>> 
>> 
>> 
>> From:       Greg Brown <[email protected]>
> 
>> 
>> To:         [email protected]
> 
>> 
>> Date:       10/28/2010 07:58 PM
> 
>> 
>> Subject:    Re: [Inquires]Data binding for list button.
> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Is there a value with a key of "id" in your bind context?
>> 
>> On Oct 28, 2010, at 6:33 AM, [email protected] wrote:
>> 
>>> 
>>> Hi All,
>>> 
>>> I would like  use Data binding for list button for simple data.but it
>>> doesn't work.
>>> 
>>>  I just change this segment,but can't load the id to listButton.
>>> 
>>> <ListButton selectedItemKey="imAccount.type"
>>> 
>>> listData="['AIM', 'Jabber', 'Yahoo']"/>
>>> from
>>> 
>>> 
>>> 
>>> <ListButton selectedItemKey="id"/>
>>> 
>> 
> |--------------------------------------------------------------------------|
> 
>> 
>>> |Form wtkx:id="form" styles="{showFlagIcons:false}">
>> |
>>> |                        <sections>
>> |
>>> |                            <Form.Section>
>> |
>>> |                                <Label wtkx:id="sourceLabel"
>> |
>>> |Form.label="Source" styles="{font:{italic:true}}"/>
>> |
>>> |
>> |
>>> |                                <Label Form.label="ID" textKey="id"/>
>> |
>>> |                                <TextInput Form.label="Name"
>> |
>>> |textKey="name"/>
>> |
>>> |
>> |
>>> |                                <BoxPane Form.label="Address"
>> |
>>> |orientation="vertical">
>> |
>>> |                                    <TextInput textKey="name"
>> |
>>> |prompt="Street"/>
>> |
>>> |                                    <BoxPane>
>> |
>>> |                                        <TextInput
>> textKey="address.city" |
>>> |prompt="City"/>
>> |
>>> |                                        <TextInput
>> textKey="address.state"|
>>> |textSize="6" prompt="State"/>
>> |
>>> |                                        <TextInput
> textKey="address.zip"
>> |
>>> |textSize="6" prompt="Zip"/>
>> |
>>> |                                    </BoxPane>
>> |
>>> |                                </BoxPane>
>> |
>>> |
>> |
>>> |                                <TextInput Form.label="Phone"
>> |
>>> |textKey="phoneNumber"/>
>> |
>>> |                                <TextInput Form.label="Email"
>> |
>>> |textKey="emailAddress"/>
>> |
>>> |
>> |
>>> |                                <BoxPane Form.label="IM">
>> |
>>> |                                    <TextInput textKey="imAccount.id"/>
>> |
>>> |                                    <ListButton selectedItemKey="id"
>> |
>>> |                                      />
>> |
>>> |                                </BoxPane>
>> |
>>> |                            </Form.Section>
>> |
>>> |                        </sections>
>> |
>>> |                    </Form>
>> |
>>> 
>> 
> |--------------------------------------------------------------------------|
> 
>> 
>>> 
>>> 
>>> Best regards,
>>> Ken Jiang
>>> 
>>> *******************************************
>>> Murata Electronics Trading  (Shenzhen) Co.,Ltd
>>> Tel:86-755-82847251
>>> E-mail:[email protected]
>>> *******************************************
>>> 
>> 
>> 
>> 
> 
> 
> 

Reply via email to