You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/03/03 09:35:01 UTC

T5: How to handle lookup?

Hi,

I have this problem, say I have a OrderRec:

public class OrderRec {
    private Long qty;
    private Long supplierID;
    private Long itemNo;
	// getters/setters omitted
}

now I have a Order page:

public class Order {

    private OrderRec rec;
	// getter/setter...
   
    @InjectPage
    private OrderSupplier supplier;
    Object onActionFromSupplier() {
        supplier.setOrder(this);
        return supplier;   
    }
}

<t:beaneditform t:id="rec"/>
<t:actionLink t:id="supplier">supplier</t:actionLink>

when user click the supplier link it will open another page where a supplier
will be selected, and the supplier number should be assigned back to the
orderRec in the Order page:

public class OrderSupplier {
   @Persist
   private Order order;
	// getter/setter omitted
 
   Object onSuccess() {
		// there should be a way to assign the selected supllier number
       return order;
   }
}

what is the usual approach in this case? I'm lost here, any help will be
highly appreciated, thanks.

A.C.


-- 
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15799598.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: AW: T5: How to handle lookup?

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Martin,

Thanks for the fast answer, i tried the javascript approach and it works,
that does give me some idea, in an intranet app, there are so entities that
are used often in the lookup, maybe components like DateField can be built
for them and use in the UI, this will make the app like a desktop app,
interesting.

A.C.


Martin Kersten-2 wrote:
> 
> 
> 1. Order Page -> Click
> 2. Supplier page shows up (same browser tab)
> 3. User selects supplier -> Click
> 4. Order page shows up again + supplier is changed.
> 5. Order page is submitted
> 
> or would you like this one:
> 
> 1. Order Page -> Click
> 2. User types in supplier or selects it
> 3. Order Page is submitted
> 
> The first flow is simply a Wizard / multi-page behavior.
> You need a special page to select the supplier. This page
> must know to redirect to the order page.
> 
> Idea: just use the order record ID + order id to refer to.
> (OnActivate + Persistance)
> 
> The second approach mentioned:
> 
> Use Java Script. Just open a popup just like a date selector.
> An here you are done. It just sounds you are working on a 
> Intranet (InHouse) application.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15805438.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


AW: T5: How to handle lookup?

Posted by Martin Kersten <Ma...@mercateo.com>.
Hi Angelo,

   by asking for a good practice I have one for you:

I use GWT + GWT-Ext works well (but this should work with 
every kind of java script).

This example:

<form>
  <div class="myPopupSelector">
    <input><!-- Textfield in question -->
  </div>
</form>

When your GWT component loads you simply add your 
Button / Image behind the textfield of all divs 
with a given class or id to open up the 
popup and save the selection to the textfield 
within your div. Sweet and simple.

In the end you can also add a marker class to the input
field just to save you a div.

If you dont use GWT you will have the right idea now.
Just walk the DOM at start up and add a button behind
the textfield to open popup and at the end write the value
in the textfield.


Cheers,

Martin


-----Ursprüngliche Nachricht-----
Von: Angelo Chen [mailto:angelochen960@yahoo.com.hk] 
Gesendet: Montag, 3. März 2008 16:19
An: users@tapestry.apache.org
Betreff: Re: T5: How to handle lookup?


hi Davor,

In the case of zone, another area in the same page will be opened for the user to do some query/selection and return the result back to main form when done?

I tried jQuery with Thickbox, it pops up another window and we can do some selection, although it appears like another window, but actually part of the same page, works too.

The need for this is quite common in the Intranet app, would like to know what is the usual practice to adopt, thanks for the idea.

A.C.



Davor Hrg wrote:
> 
> to use popup window you need a separate page, and pair of javascript 
> functions to connect the page in popup with parent page's input....
> 
> I personaly don't like popup windows because they're slow to open, a 
> zone would make a better choice here..
> .. I haven't played arround with it, just some thoughts ...
> 
> Davor Hrg
> 
> 
> 

--
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15806120.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Angelo Chen <an...@yahoo.com.hk>.
hi Davor,

In the case of zone, another area in the same page will be opened for the
user to do some query/selection and return the result back to main form when
done?

I tried jQuery with Thickbox, it pops up another window and we can do some
selection, although it appears like another window, but actually part of the
same page, works too.

The need for this is quite common in the Intranet app, would like to know
what is the usual practice to adopt, thanks for the idea.

A.C.



Davor Hrg wrote:
> 
> to use popup window you need a separate page,
> and pair of javascript functions to connect the page in
> popup with parent page's input....
> 
> I personaly don't like popup windows because they're slow to open,
> a zone would make a better choice here..
> .. I haven't played arround with it, just some thoughts ...
> 
> Davor Hrg
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15806120.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Davor Hrg <hr...@gmail.com>.
an aoutocompleter for entities would be relatively simple to implement


Davor Hrg

On 3/3/08, Davor Hrg <hr...@gmail.com> wrote:
> to use popup window you need a separate page,
> and pair of javascript functions to connect the page in
> popup with parent page's input....
>
> I personaly don't like popup windows because they're slow to open,
> a zone would make a better choice here..
> .. I haven't played arround with it, just some thoughts ...
>
> Davor Hrg
>
> On 3/3/08, Angelo Chen <an...@yahoo.com.hk> wrote:
> >
> > Hi Davor,
> >
> > This sounds interesting, question, how block be used in a popup window?
> >
> > Davor Hrg wrote:
> > >
> > > uh,
> > > I assumed you were talking about popup window,
> > > I'm doing such thing in my form and I just made a component
> > > that triggers event when something is selected
> > > ComponentResources.trigerEvent("nameSelected", new Object{selectedName})
> > > ComponentResources.trigerEvent("cancel")
> > >
> > > then
> > >
> > > onNameSelected(String name){.....}
> > >
> > > I track my components state to display different block depending on
> > > current actions.
> > >
> > > maybe some of this can help you make your own ...
> > >
> > > Davor Hrg
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15805373.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Davor Hrg <hr...@gmail.com>.
to use popup window you need a separate page,
and pair of javascript functions to connect the page in
popup with parent page's input....

I personaly don't like popup windows because they're slow to open,
a zone would make a better choice here..
.. I haven't played arround with it, just some thoughts ...

Davor Hrg

On 3/3/08, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi Davor,
>
> This sounds interesting, question, how block be used in a popup window?
>
> Davor Hrg wrote:
> >
> > uh,
> > I assumed you were talking about popup window,
> > I'm doing such thing in my form and I just made a component
> > that triggers event when something is selected
> > ComponentResources.trigerEvent("nameSelected", new Object{selectedName})
> > ComponentResources.trigerEvent("cancel")
> >
> > then
> >
> > onNameSelected(String name){.....}
> >
> > I track my components state to display different block depending on
> > current actions.
> >
> > maybe some of this can help you make your own ...
> >
> > Davor Hrg
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15805373.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Davor,

This sounds interesting, question, how block be used in a popup window?

Davor Hrg wrote:
> 
> uh,
> I assumed you were talking about popup window,
> I'm doing such thing in my form and I just made a component
> that triggers event when something is selected
> ComponentResources.trigerEvent("nameSelected", new Object{selectedName})
> ComponentResources.trigerEvent("cancel")
> 
> then
> 
> onNameSelected(String name){.....}
> 
> I track my components state to display different block depending on
> current actions.
> 
> maybe some of this can help you make your own ...
> 
> Davor Hrg
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15805373.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Davor Hrg <hr...@gmail.com>.
uh,
I assumed you were talking about popup window,
I'm doing such thing in my form and I just made a component
that triggers event when something is selected
ComponentResources.trigerEvent("nameSelected", new Object{selectedName})
ComponentResources.trigerEvent("cancel")

then

onNameSelected(String name){.....}

I track my components state to display different block depending on
current actions.

maybe some of this can help you make your own ...

Davor Hrg


On Mon, Mar 3, 2008 at 9:47 AM, Martin Kersten
<Ma...@mercateo.com> wrote:
>
>  Hi Angelo,
>
>    what kind of workflow you are referring to?
>
>  1. Order Page -> Click
>  2. Supplier page shows up (same browser tab)
>  3. User selects supplier -> Click
>  4. Order page shows up again + supplier is changed.
>  5. Order page is submitted
>
>  or would you like this one:
>
>  1. Order Page -> Click
>  2. User types in supplier or selects it
>  3. Order Page is submitted
>
>  The first flow is simply a Wizard / multi-page behavior.
>  You need a special page to select the supplier. This page
>  must know to redirect to the order page.
>
>  Idea: just use the order record ID + order id to refer to.
>  (OnActivate + Persistance)
>
>  The second approach mentioned:
>
>  Use Java Script. Just open a popup just like a date selector.
>  An here you are done. It just sounds you are working on a
>  Intranet (InHouse) application.
>
>  Just look at some date picker implementation to get an idea.
>  Maybe you like GWT + Gwt-Ext for this one. GWT-Ext has a
>  editor field that has autocompletion and once you are into
>  it you can generate such a form with ease.
>
>  If you are into JavaScript, just open the popup, place an
>  IFrame into it and use onClose (i am not sure about the event)
>  to send the opening window a message or set the supplier at once.
>
>  Many options harder to explain, check out the java script sites.
>  There are tutorials for the date pickers where you can grab all
>  those ideas needed from.
>
>
>  Cheers,
>
>  Martin (Kersten)
>
>  -----Ursprüngliche Nachricht-----
>  Von: Angelo Chen [mailto:angelochen960@yahoo.com.hk]
>  Gesendet: Montag, 3. März 2008 09:35
>  An: users@tapestry.apache.org
>  Betreff: T5: How to handle lookup?
>
>
>
>
>  Hi,
>
>  I have this problem, say I have a OrderRec:
>
>  public class OrderRec {
>     private Long qty;
>     private Long supplierID;
>     private Long itemNo;
>         // getters/setters omitted
>  }
>
>  now I have a Order page:
>
>  public class Order {
>
>     private OrderRec rec;
>         // getter/setter...
>
>     @InjectPage
>     private OrderSupplier supplier;
>     Object onActionFromSupplier() {
>         supplier.setOrder(this);
>         return supplier;
>     }
>  }
>
>  <t:beaneditform t:id="rec"/>
>  <t:actionLink t:id="supplier">supplier</t:actionLink>
>
>  when user click the supplier link it will open another page where a supplier will be selected, and the supplier number should be assigned back to the orderRec in the Order page:
>
>  public class OrderSupplier {
>    @Persist
>    private Order order;
>         // getter/setter omitted
>
>    Object onSuccess() {
>                 // there should be a way to assign the selected supllier number
>        return order;
>    }
>  }
>
>  what is the usual approach in this case? I'm lost here, any help will be highly appreciated, thanks.
>
>  A.C.
>
>
>  --
>  View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15799598.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


AW: T5: How to handle lookup?

Posted by Martin Kersten <Ma...@mercateo.com>.
 
Hi Angelo,

   what kind of workflow you are referring to?

1. Order Page -> Click
2. Supplier page shows up (same browser tab)
3. User selects supplier -> Click
4. Order page shows up again + supplier is changed.
5. Order page is submitted

or would you like this one:

1. Order Page -> Click
2. User types in supplier or selects it
3. Order Page is submitted

The first flow is simply a Wizard / multi-page behavior.
You need a special page to select the supplier. This page
must know to redirect to the order page.

Idea: just use the order record ID + order id to refer to.
(OnActivate + Persistance)

The second approach mentioned:

Use Java Script. Just open a popup just like a date selector.
An here you are done. It just sounds you are working on a 
Intranet (InHouse) application.

Just look at some date picker implementation to get an idea.
Maybe you like GWT + Gwt-Ext for this one. GWT-Ext has a 
editor field that has autocompletion and once you are into
it you can generate such a form with ease.

If you are into JavaScript, just open the popup, place an
IFrame into it and use onClose (i am not sure about the event)
to send the opening window a message or set the supplier at once.

Many options harder to explain, check out the java script sites.
There are tutorials for the date pickers where you can grab all 
those ideas needed from.


Cheers,

Martin (Kersten)

-----Ursprüngliche Nachricht-----
Von: Angelo Chen [mailto:angelochen960@yahoo.com.hk] 
Gesendet: Montag, 3. März 2008 09:35
An: users@tapestry.apache.org
Betreff: T5: How to handle lookup?


Hi,

I have this problem, say I have a OrderRec:

public class OrderRec {
    private Long qty;
    private Long supplierID;
    private Long itemNo;
	// getters/setters omitted
}

now I have a Order page:

public class Order {

    private OrderRec rec;
	// getter/setter...
   
    @InjectPage
    private OrderSupplier supplier;
    Object onActionFromSupplier() {
        supplier.setOrder(this);
        return supplier;   
    }
}

<t:beaneditform t:id="rec"/>
<t:actionLink t:id="supplier">supplier</t:actionLink>

when user click the supplier link it will open another page where a supplier will be selected, and the supplier number should be assigned back to the orderRec in the Order page:

public class OrderSupplier {
   @Persist
   private Order order;
	// getter/setter omitted
 
   Object onSuccess() {
		// there should be a way to assign the selected supllier number
       return order;
   }
}

what is the usual approach in this case? I'm lost here, any help will be highly appreciated, thanks.

A.C.


--
View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15799598.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: How to handle lookup?

Posted by Davor Hrg <hr...@gmail.com>.
Are you aware of the client side this involves ?
This is not server side problem...

you have a popup window, which is basicaly another browser with same session.

you have to use javascript...
the popup can reference the parent window by: "window.opener"

...

Davor Hrg

On Mon, Mar 3, 2008 at 9:35 AM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>  Hi,
>
>  I have this problem, say I have a OrderRec:
>
>  public class OrderRec {
>     private Long qty;
>     private Long supplierID;
>     private Long itemNo;
>         // getters/setters omitted
>  }
>
>  now I have a Order page:
>
>  public class Order {
>
>     private OrderRec rec;
>         // getter/setter...
>
>     @InjectPage
>     private OrderSupplier supplier;
>     Object onActionFromSupplier() {
>         supplier.setOrder(this);
>         return supplier;
>     }
>  }
>
>  <t:beaneditform t:id="rec"/>
>  <t:actionLink t:id="supplier">supplier</t:actionLink>
>
>  when user click the supplier link it will open another page where a supplier
>  will be selected, and the supplier number should be assigned back to the
>  orderRec in the Order page:
>
>  public class OrderSupplier {
>    @Persist
>    private Order order;
>         // getter/setter omitted
>
>    Object onSuccess() {
>                 // there should be a way to assign the selected supllier number
>        return order;
>    }
>  }
>
>  what is the usual approach in this case? I'm lost here, any help will be
>  highly appreciated, thanks.
>
>  A.C.
>
>
>  --
>  View this message in context: http://www.nabble.com/T5%3A-How-to-handle-lookup--tp15799598p15799598.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org