Re: Generic DAO

2012-08-30 Thread Markus Grell
Greetings!

I'm no expert at all for this topic but I can't see your problem with
generic DAOs. I wrote a couple of typical database apps and they all use
generic DAOs. Stuff that is unique to an entity is handled by named
queries defined in the entities.

Works great and saves a lot of code to write.

Markus

> Why do you ever need such a generic DAOs at all?
>
>
> For example, here's how my DAOs look like:
> http://imgbin.org/images/9339.png
>
>
> There's not so much common between them and I'm sure you will have
> similar structure.
>
> You may also have some class hierarchy for you DAOs (say all your DAOs
> will inherit CRUD methods from GenericDAO), but this doesn't relate to
> Tapestry
> at all.
>
> To let Tapestry create *instances* of your DAOs for you (with dependency
> injection and all cool stuff) you should declare your DAOs in your
> AppModule like this:
>
>
> public static void bind(ServiceBinder binder) throws
> ClassNotFoundException
> {
> binder.bind(UserDAO.class, UserDAOImpl.class); // etc.
> }
>
>
> Or you can try to auto-bind them like described here:
>
>
> http://killertilapia.blogspot.com/2012/08/autobind-all-tapestry5-services
> .html
>
>
> On Fri, Aug 31, 2012 at 2:15 AM, Miguel O. Carvajal <
> tapes...@carvajalonline.com> wrote:
>
>> Hey all,
>>
>>
>> I am taking a look again at how we have implemented a generic DAO in
>> our Tapestry application, since our currently implementation is a bit
>> hackish.
>>
>> I was looking at the great article over at
>> http://tawus.wordpress.com/**
>> 2011/05/28/tapestry-magic-13-**generic-data-access-objects/> .wordpress.com/2011/05/28/tapestry-magic-13-generic-data-access-objects
>> />
>>
>>
>> And while I do see it as an option, it seems a bit verbose for doing
>> something that maybe I can do with less code in Tapestry.
>>
>> I saw in the issue 2550 (https://issues.apache.org/**
>> jira/browse/TAPESTRY-2550> -2550>)
>> that ServiceBuilder was created exactly for this purpose, but since I
>> have no way of determining the generic type (or other way of determining
>> what Hibernate/JPA entity I am working with) within the ServiceBuilder
>> implementation. I just don't see how this can be done with
>> ServiceBuilder.
>>
>>
>> Is there something obvious I am missing or is the article I mentioned
>> above the only way it can be done?
>>
>> Thanks,
>>
>>
>> Miguel
>>
>>
>> --**--**---
>> --
>> To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.**apache.org> he.org> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>>
>
>
> --
> Dmitry Gusev
>
>
> AnjLab Team
> http://anjlab.com
>
>



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



Hourglass during fle upload

2012-06-25 Thread Markus Grell
Greetings!

I'm using Tapestry file upload capabilities to upload some files. Is it
possible to replace mouse pointer to something like an hourglass or so to
show that system is busy doing stuff? At the moment I've no clue where to
start here.
Any ideas?

M. Grell



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



Re: How do you feel about requiring JRE 1.6 for Tapestry 5.4?

2012-05-02 Thread Markus Grell
With Java 6 released end of 2006, I can't see any point in supporting an
older release for a new Tapestry version.

Markus

> When in doubt, let's ask the community: would you object to requiring
> JRE 1.6 for running Tapestry 5.4? So far, T5 has run on JRE 1.5 but
> the time for requiring 1.6 will come at some point. Not necessarily yet -
> we can likely work around this - but current Hibernate 4.x releases are
> built with 1.6.
>
> Kalle
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>



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



Reading HTTP headers

2012-04-11 Thread Markus Grell
Greetings!

Depending on a value of a custom HTTP header field I need to sent out
different output from my page.

Any hints how I can read HTTP headers?

Markus Grell



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



Accessing zone form elements

2012-03-21 Thread Markus Grell
Greetings!

I have a page that has the following structure:

...

 
  
 


The idea: The select list "item" is updated based on the choosen value of
select list "manufactuer". Content for "item" is pulled from a database.
That works fine but now I need to add some javascript that operates on the
"item" select list. After the first update of the zone, the id of the
select list changes to "item_".
Due to this new id the Javascript document.getElementById("item") fails,
for sure.

How can I solve that?  Any ideas?

Markus



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



Header text for recordError()

2012-03-02 Thread Markus Grell
Greetings!

After submitting a form I'nm using recordError() to display errors.
recordError() produces a red box with the following header:
"You must correct the following errors before continuing."

Who can I change that text?

Any ideas?

markus



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



Validator name for numeric fields

2012-03-01 Thread Markus Grell
Greetings!

What's the name of the system validator for numeric fields in a form? One
of the fields in my form is of type "Double". Tapestry is intelligent
enough to validate that and provide the message "You must provide a
numeric value for " if I try to submit with letters.
For translating this message I need to know the validators name, and it is
not listed under "Available Validators".

Any hints?

Markus



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



Global validation messages translation

2012-03-01 Thread Markus Grell
Greetings!

I need to translate the messages of the standard validators. The Tapestry
documentation reads:

-
Each validator (such as "required" or "minlength") has a default message
used (on the client side and the server side) when the constraint is
violated; that is, when the user input is not valid.

The message can be customized by adding an entry to the page's message
catalog (or the containing component's message catalog). As with any
localized property, this can also go into the application's message
catalog.
-

Since it is quite uncomfortable to add a property file for every page that
uses a standard validator ("You must provide a value for XY"):

Is it possible to override the default message with a translation? I 
didn't find info on that (or just did misunderstand existing documentation
;))

Markus



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



Re: Simplest way to detect change of Select component?

2012-02-23 Thread Markus Grell


> I'm trying to implement a select object to control a filter to a grid
> form. For example, a drop down list box of employee first names followed
> by a grid of employee data. If I select a first name from the DDLB, I'd
> like to see only those employees with that first name.
>
> I haven't found a good way to do this without having to click a button
> associated with the DDLB, like "Apply Filter". And I haven't found a way
> to intercept a changed event on the select without dealing with zones.
> Using
> Ajax zones seems like overkill for this, plus, I am having a really hard
> time getting it to work.

George,

I have done exactly the same (a drop-down box that filters entries
displayed in a grid) - it is very, very easy using a zone and works like a
charm.
Where exactly do you have problems getting it to work?

Markus


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



Re: Get Server Name in AppModule

2012-02-15 Thread Markus Grell
> As was already mentioned, you don't have any requests on application
> start, so you can't get the request URI.
>
> And request URI (the host part of it) may be different even on the same
> application instance.
>
> You can try to get local host name like this:
>
>
> InetAddress.getLocalHost().getHostName();

Unfortunately, on a system hosting maybe hundred virtual hosts,
getHostName() is most likely something completely different than the host
part of your URL.

Markus



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



Re: Get Server Name in AppModule

2012-02-14 Thread Markus Grell
>> Like Kalle said.
>>
>>
>>
>> For example, if you use WebLogic, inside the launch script you will
>> find:
>> java  -DserverName=Server_1
>>
>> Almost all appServers starts through a script (on unix systems), you
>> should add it to each instance(in a cluster, i mean) if it is missing.
>
>
> I'm wondering if he is really talking about the application server name
> or about something that can be found in
>
> HttpServletRequest request
> request.getRequestURI()

Sorry, should have been
request.getRequestURL()


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



Re: Get Server Name in AppModule

2012-02-14 Thread Markus Grell
> Like Kalle said.
>
>
> For example, if you use WebLogic, inside the launch script you will find:
>  java  -DserverName=Server_1
>
> Almost all appServers starts through a script (on unix systems), you
> should add it to each instance(in a cluster, i mean) if it is missing.


I'm wondering if he is really talking about the application server name or
about something that can be found in

HttpServletRequest request
request.getRequestURI()

Markus



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



Re: Form error for beaneditform

2012-02-13 Thread Markus Grell
> On Mon, 13 Feb 2012 18:11:17 -0200, Markus Grell 
> wrote:
>
>
>> Greetings!
>>
>>
>> For my forms I use something like the following:
>>
>>
>> ...
>> @Component(id = "form")
>> private Form form; ...
>> form.recordError("Could not save blabla");
>>
>> And in the template I'm using
>> ...
>> 
>> ...
>>
>>
>>
>> Is there something similar for the beaneditform?
>>
>
> Yes. Have you even tried before posting? ;)

:-)
Yes, I did, but it now turned out that I tried it the wrong way:




...

@Persist
private Supplier supplier;
@Component(id="form")
private Form form;


It needs to be
@Persist
@Property
private Supplier supplier;
@Component(id="form")
private BeanEditForm form;

My bad, sorry for confusion.

Markus



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



Form error for beaneditform

2012-02-13 Thread Markus Grell
Greetings!

For my forms I use something like the following:

...
@Component(id = "form")
private Form form;
...
form.recordError("Could not save blabla");

And in the template I'm using
...

...


Is there something similar for the beaneditform?

Markus



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



Display textfield dynamically

2012-02-01 Thread Markus Grell
Greetings!

I have a form that display a select list. This list is filled with data
from a database query. Now I would like following behaviour but have no
clue on how to implement that:

I would like to add the option "Other" to the select list. A soon as this
option is choosen (without submitting the form), a textfield should appear
so that the user can add a value that is not available in the select list.

Any hints here how to achieve this?

Thanks
Markus



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



Re: Preselect radio option

2012-01-23 Thread Markus Grell
Ahhh, understood.

*Wow*, that was easy and works like a charm!

Thanks guys for your quick help, more questions to come ;)

Markus


> Set your "capacity" value before rendering.  You have:
>
>
> 
>
>
> This gets/sets the value of the radio group.
>
>
> mrg
>
>
> On Mon, Jan 23, 2012 at 8:06 AM, Markus Grell 
> wrote:
>
>>> On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell
>>> 
>>> wrote:
>>>
>>>
>>>
>>>> Greetings!
>>>>
>>>>
>>>>
>>>> It looks like as if I'm blind,  but i just can't find it:
>>>>
>>>>
>>>>
>>>> How can I preselect a radio option in a radio group?
>>>>
>>>>
>>>
>>> Set the desired value to the edited property before rendering. This
>>> works  for every form field component.
>>>
>>
>>
>> Sorry, I don't get that :-(
>>
>>
>> I have the following in my template:
>>
>>
>>
>> 
>> 
>> 
>> > label="prop:label"/>
>> 
>> 
>>
>>
>> In the Java file:
>>
>>
>> ...
>>        public List getCapacityValues() {
>>        return crudService.findWithNamedQuery(Capacity.ALL);
>>
>>
>>        }
>>
>>
>>        public String getLabel() {
>>                return currentLeistungElement.label;
>>        }
>> }
>> ...
>>
>>
>> The possible values for the Radio group are pulled from a database.
>> Which radio button should already be selected when the form is displayed
>>  (i.e. pre-selected) is pulled from another table. (It's a 1:n
>> relation, nut I think that doesn't matter here).
>>
>> Where do I have to do what you did suggest above?
>>
>>
>> Markus
>>
>>
>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>
>



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



Re: Preselect radio option

2012-01-23 Thread Markus Grell
> On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell 
> wrote:
>
>
>> Greetings!
>>
>>
>> It looks like as if I'm blind,  but i just can't find it:
>>
>>
>> How can I preselect a radio option in a radio group?
>>
>
> Set the desired value to the edited property before rendering. This works
>  for every form field component.


Sorry, I don't get that :-(

I have the following in my template:









In the Java file:

...
public List getCapacityValues() {
return crudService.findWithNamedQuery(Capacity.ALL);

}

public String getLabel() {
return currentLeistungElement.label;
}
}
...

The possible values for the Radio group are pulled from a database.
Which radio button should already be selected when the form is displayed
(i.e. pre-selected) is pulled from another table. (It's a 1:n relation,
nut I think that doesn't matter here).

Where do I have to do what you did suggest above?

Markus




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



Preselect radio option

2012-01-23 Thread Markus Grell
Greetings!

It looks like as if I'm blind,  but i just can't find it:

How can I preselect a radio option in a radio group?

Markus


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



Re: Programmatical page/component rendering

2012-01-20 Thread Markus Grell
Great idea!

Which approach do you recommend if I want to sent out a mail that does not
need to look like a web page but just contains plain text? I somehow feel
uncomfortable to put a complete mail text into a message catalog file.

Markus

> http://tapestry.1045711.n5.nabble.com/Generating-HTML-email-content-with-
> Tapestry-td5075717.html
>
>
> On Jan 20, 2012, at 3:27 AM, Guillaume Bodet wrote:
>
>
>> Hi all,
>>
>>
>> I need to send mails from my application, and I would like to use
>> Tapestry's templating to create the body of the mail.
>> Is there any way to programmatically get the rendering of a page or
>> component (in an output stream, for instance) ?
>>
>> Regards
>>
>>
>> Guillaume
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>
>



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



Grid displaying database relation

2012-01-16 Thread Markus Grell
Greetings!

Let me quickly introduce myself: I'm a long-time PHP developer, starting
developing PHP back mid of 90s. After a long pause I started with web
application again, but this time I had a look onto Tapestry. Even though
I'm knowing Java not very well I think that developing apps with Tapestry
is a great fun, especially in comparison to that PHP-Scripting I did in
the past.

OK, now to my first question:

I'm developing a app with a database backend, using tapestry-hibernate.
Displaying a grid with content from a database table is quite easy and
well described, but what's the best approach to display a grid with
content from a database table that has relations?
I have a list of users, each of them has role. I have the tables 'user'
and 'role'. Displaying all users in a grid was easy, but I also want to
display the role in the grid.
Any hints into the right direction?

Thanks
Markus


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