[jboss-user] [JBoss Seam] - Combining list and all CRUD functionality on a single page?
Hi, I'm just wondering whether it makes sense to combine listing and all create, read, update and delete functionality all on the same page? The reason I ask is that all the examples I've seen tend to split this functionality out onto separate pages, and coming from a Swing background this seems strange to me. I think I can see why web apps used to be done this way (because people thought in terms of pages and page-flows and due to not being easily able to store a page's state), but I can't see why you'd go for this approach now when using Seam to develop a desktop app replacement (especially if using Ajax). Can anyone tell me why the single page approach isn't used? Have I missed something? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021914#4021914 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021914 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Combining list and all CRUD functionality on a single pa
Also, is using disabled input components (e.g. h:inputText) instead of output components (e.g. h:outputText) considered bad practice? The reason I ask is that it would certainly simplify my forms if I can just set the disabled attribute on components rather than having to duplicate every input component with a matching output one. Any thoughts? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021919#4021919 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021919 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Combining list and all CRUD functionality on a single pa
Thanks Pete - that's reassuring to hear. I like being able to model and think of my pages in terms of state machines so combining related functionality on a single page (like you would on a desktop app) makes sense to me. It seems to make even more sense with web2 / ajax. Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021945#4021945 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021945 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Any way to apply same attribute/value to several tags?
Hi, I have a page with a large number of inputText fields and was wondering if there is an easy way to set them all be enabled/disabled (i.e. I'd like to avoid having to to add disabled=true to every inputText tag). Is this possible? If I was doing this in a desktop app I could disable a number of controls by disabling the controls' containing component - is there some such container tag that I can use in Seam or standard HTML? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021955#4021955 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021955 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Any way to apply same attribute/value to several tags?
I've browsed through all the HTML spec and had a good Google and have drawn a blank so, unless anyone can inform me otherwise, I'm guessing my options are either to manually add disabled=#{...} to every component, or else pull that Javascript book of the bookshelf View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4022069#4022069 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4022069 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Do I need to override EntityHome.persist for ordered List?
Hi, I have a requirement for my Customer object to contain an ordered collection of Script child objects, and to be able to display these in in table with move up and move down functionality. My first thought was to store these in a List and use Hibernate's @IndexColumn. However, I'm not sure what would happen if 2 users fetch the data and then both create a new Script. Won't the 2nd user to save get an exception because Hibernate will try to assign the a duplicate value to the index column of this second object (i.e. it will be the same as the first objects and the database will disallow the CREATE because of unique constraint)? Am I correct in my thinking? As an alternative, I could just use a ordered Set and manually manage the index column. Is this a better solution? If so, I assume I would need to override the EntityHome.persist method in my ScriptHome, and in this method add a query to select the max(index) and then assign this value + 1 to my Script's index property. Is this a better solution? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021573#4021573 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021573 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Easy way to secure all pages in an app?
Many thanks Gavin - jobs a good'un! Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021014#4021014 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021014 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Where should no-conversation-view-id be set?
Hi, My seam-gen generated app has no-conversation-view-id set in two places: 1. components.xml core:pages no-conversation-view-id=/home.xhtml/ 2. pages.xml pages no-conversation-view-id=/home.xhtml | login-view-id=/login.xhtml Is this necessary? If not, in which of these files should I be configuring this? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4021085#4021085 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4021085 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Easy way to secure all pages in an app?
Hi Pete, Just tried this and can't seem to make it work - IE just hangs indefinitely and Firefox gives me the following message: anonymous wrote : The page isn't redirecting properly | | Firefox has detected that the server is redirecting the request for this address in a way that will never complete. I tried setting page login-required=false in login.page.xml but this didn't help. Any thoughts? Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4020666#4020666 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4020666 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Latest CVS seam-gen...
I'm seeing this as well on apps previously generated with seam-gen (although I just generated a very basic new app with seam-gen and it seems to work ok). Confused... Regards, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4020735#4020735 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4020735 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: SFSB vs SLSBs for implementing actions in a conversation
I've been mulling over all the posts overnight and I have to say that I'm still a little bit confused... If I understand correctly, what is being said is that there are three quite different approaches to take when writing Seam apps (but you might use 1 2 together): 1. Implement all your conversational code in Stateful Session Beans. Each SFSB will implement a number of related use-cases (conversations). You would use an EJB3 Extended Persistence Context which has the scope of the SFSBs lifetime. 2. Implement all your conversational code in SLSBs and hold your conversation state in some other components and inject/outject them on your SLSB on every method call. You would use the Seam-Managed Persistence Context as this has the scope of a conversation. (Although, like Christian says, this seems like making work for yourself unless you are passing very small amounts of state and want bookmark-ability) 3. Implement all your conversational code using Seam-managed Javabeans. You would use the Seam-Managed Persistence Context as this has the scope of a conversation. Now where I'm getting bit lost (and I might be being a bit thick because I'm full of flu and didn't get much sleep last night) is how you would actually implement the Seam-managed Javabeans approach. How does Seam know to make a regular Javabean into a Seam-managed Javabean (and does this bean now basically mimic a SFSB but with Seam storing its state in the Session)? Have you got to extend EntityHome to get this functionality? Also, if you were going the SFSB or the Seam-managed Javabean route, would you tend to implement all the related use-cases (/conversations) for a particular business area in the same one bean? Say you also had a requirement to display a list of Customers (and provide each row with view, edit, delete links), would you implement this functionality in the same bean as well? Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4019290#4019290 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4019290 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: SFSB vs SLSBs for implementing actions in a conversation
Thanks again for your help Pete - I feel I'm getting close to that A-ha! moment... Are you saying that all you have to do to make a Seam-managed Javabean component is inject EntityManager and mark all methods as @Transactional and it will then give you the same behaviour as a SFSB (i.e. the only difference is that Seam handles storing and fetching the component's state from the Http Session instead of SFSBs EJB container-managed state management)? I suppose what I am really trying to grasp is whether you can use a Seam-managed Javabean component exactly like you would a SFSB? Or do you have to code your apps differently? Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4019309#4019309 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4019309 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Is managing conversations in *.page.xml files good practice?
Hi, Seam-gen generates apps which have their conversational behaviour managed (i.e. have their conversations begun and ended) by settings in their *.page.xml files. However, the reference documentation doesn't mention this practice, and none of the Seam example apps appear to be coded this way. What are the advantages and disadvantages of this approach? And, is this actually best practice that I should follow in my apps or not? I'm also wondering whether this practice will hold up if my pages get more complicated (for example, a page with a list of Customers on the LHS and on the RHS allowing you to edit a selected that you have selected from the list)? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4019484#4019484 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4019484 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Problem debugging Seam apps in Eclipse/JBossIDE
I'm having a problem trying to debug Seam apps in Eclipse (I'm using Eclipse 3.2.1, JBossIDE 2.0.0 Beta2, and JBoss AS 4.0.5 with EJB3 profile). When I set a breakpoint inside any class which uses annotations, and try to debug code, I get the following dialog: Unable to install breakpoint in | com.mydomain.myproject.Converters$$EnhancerByCGLIB$$2b84c6ef | due to missing line number attributes. Modify compiler options to generate line number attributes. | | Reason: | Absent Line Number Information My build.xml has debug on for javac tasks, and I have line numbers turned on in both my global preferences and project specific settings, and my JBoss server is started in debug mode. I can use breakpoints in classes that don't have annotations (i.e. that aren't enhanced by CGLib) - I just can't make it work for classes which are annotated. Googling hasn't turned up any possible solutions, so I'd be really grateful for some help here... Any ideas??? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018723#4018723 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018723 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Booking example question
Hi, I've just been re-reading the Seam tutorial and I just wanted to check if my understanding is correct regarding the Booking example code... In the HotelBookingAction class the selectHotel method reads as follows: @Begin | public String selectHotel(Hotel selectedHotel) { | hotel = em.merge(selectedHotel); | return hotel; | } Am I correct that the reason the line hotel = em.merge(selectedHotel) is necessary is because the selectedHotel object was obtained by a different entity manager? And, if so, does this mean that you always need to use em.merge when an object that was loaded in one class is passed as a parameter to a method in another class? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018730#4018730 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018730 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: When is @Out necessary?
Many thanks for that - I couldn't seem to find a clear answer for that in the docs. Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018743#4018743 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018743 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Booking example question
Also, is there any reason why you couldn't / wouldn't code the method as follows instead??? @Begin | public String selectHotel(Hotel selectedHotel) { | hotel = em.find(Hotel.class, selectedHotel.getId()); | return hotel; | } View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018793#4018793 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018793 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam, Trinidad, Ajax4Jsf and Facelets
@ehstowa I believe that in order to pass parameters to your EL action listener method you need to be using Seam's enhanced expression language (and from your stack trace it doesn't look like you've got this configured). From the Seam reference manual (Chapter 23): anonymous wrote : To use this feature in Facelets, you will need to declare a special view handler, SeamFaceletViewHandler in | faces-config.xml. | | faces-config | | application | | view-handlerorg.jboss.seam.ui.facelet.SeamFaceletViewHandler/view-handler | | /application | | /faces-config Hope this helps, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018811#4018811 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018811 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Problem debugging Seam apps in Eclipse/JBossIDE
Is it only me having this problem? (Or perhaps I'm the only person on this forum who uses Eclipse ;) ) Are you able to successfully debug your Seam apps in Eclipse? (And, if so, what versions are you using, and did you have to set up any special config options?) Any help would be much appreciated... Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018863#4018863 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018863 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Problem debugging Seam apps in Eclipse/JBossIDE
Currently I'm freally just using Eclipse as a glorified editor, and using Ant to compile/build/deploy, but I am using JBossIDE JBoss Server View to start JBoss AS in debug mode. I take it I would have to set up my Seam project completely as an Eclipse project (with compile/build/deploy being performed by Eclipse rather than Ant) in order to set up debugging as detailed in the other post? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018920#4018920 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018920 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - SFSB vs SLSBs for implementing actions in a conversation
Hi, One thing that is still confusing me with Seam is when you should implement your conversational action methods in one stateful session bean and when you should choose to implement them in one or more stateless session beans. What are the advantages / disadvantages of each approach? In what scenario would you choose SFSB over SLSBs, and vice versa? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018935#4018935 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018935 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: SFSB vs SLSBs for implementing actions in a conversation
Thanks for your reply Pete. Could I ask why you prefer this strategy over using SFSB or SLSBs? I can't seem to find anything in the docs or by searching the forums that gives an idea as to how to choose the most appropriate strategy for a particular app, so I'd be really grateful for any advice you can offer me as I'm feeling a bit lost... Or perhaps there is some helpful documentation / forum posts that I've missed to which you could point me? Many thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018965#4018965 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018965 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: SFSB vs SLSBs for implementing actions in a conversation
Thanks Christian - So if I understand you correctly, you are saying that your first choice would always be to use SFSBs unless you were not running in an EJB3 container, in which case you would be limited to using the built-in Seam components (EntityHome, etc) to hold conversational state? But there's no reason you shouldn't use EntityHome and the other Seam Application Framework components if you are running under an EJB3 container, right? Regards, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4019001#4019001 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4019001 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Needing help for the lazy initialize
Take a look at section 8.4 'Using the JPA delegate' and 8.5 'Using Hibernate filters' in the Seam reference documentation - it seems like this might be what you are looking for. Hope this helps, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4018222#4018222 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4018222 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - s:selectItems - whto work
Hi, I'm having problems getting s:selectItems and ec:convertEntity to work, and wondered if anyone had any suggestions? When I run my app, if I select any item from the drop-down (apart from the noSelectionLabel item) then I get an value is not valid validation message when I save. If I don't select an item (i.e. leave the noSelectionLabel item selected) then I get an exception (detailed below). Can anyone shed any light on why s:selectItems isn't working for me? CustomerEdit.xhtml h:selectOneMenu value=#{customerHome.instance.status} id=status | s:selectItems value=#{statuses.resultList} var=status label=#{status.description} noSelectionLabel=Please Select... / | ec:convertEntity / | /h:selectOneMenu CustomerHome.java @Name(customerHome) | public class CustomerHome extends EntityHomeCustomer { | | public void setCustomerId(Integer id) { | setId(id); | } | | public Integer getCustomerId() { | return (Integer) getId(); | } | | @Override | protected Customer createInstance() { | Customer customer = new Customer(); | return customer; | } | | public Customer getManagedInstance() { | return isManaged() ? getInstance() : null; | } | | public ListActivity getActivities() { | return getInstance() == null ? null : new ArrayListActivity( | getInstance().getActivities()); | } | | } Customer.java @Entity | @Table(name = CUSTOMER, catalog = CustomerBuilder) | public class Customer implements java.io.Serializable { | | private int id; | private String name; | private String description; | private Status status; | private SetActivity activities = new HashSetActivity(0); | | public Customer() { | } | | public Customer(int id, String name, Status status) { | this.id = id; | this.name = name; | this.status = status; | } | public Customer(int id, String name, String description, Status status, | SetActivity activities) { | this.id = id; | this.name = name; | this.description = description; | this.status = status; | this.activities = activities; | } | | @Id @GeneratedValue | @Column(name = ID, unique = true, nullable = false) | @NotNull | public int getId() { | return this.id; | } | | public void setId(int id) { | this.id = id; | } | | @Column(name = NAME, nullable = false, length = 50) | @NotNull | @Length(max = 50) | public String getName() { | return this.name; | } | | public void setName(String name) { | this.name = name; | } | | @Column(name = DESCRIPTION) | public String getDescription() { | return this.description; | } | | public void setDescription(String description) { | this.description = description; | } | | @ManyToOne(fetch = FetchType.LAZY) | @JoinColumn(name = STATUS_ID, nullable = false) | @NotNull | public Status getStatus() { | return this.status; | } | | public void setStatus(Status status) { | this.status = status; | } | | @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = customer) | public SetActivity getActivities() { | return this.activities; | } | | public void setActivities(SetActivity activities) { | this.activities = activities; | } | | } Status.java @Entity | @Name(status) | @Table(name = REF_STATUS, catalog = CustomerBuilder) | public class Status implements java.io.Serializable { | | private int id; | private String description; | | public Status() { | } | | public Status(int id, String description) { | this.id = id; | this.description = description; | } | | @Id | @Column(name = ID, unique = true, nullable = false) | @NotNull | public int getId() { | return this.id; | } | | public void setId(int id) { | this.id = id; | } | | @Column(name = DESCRIPTION, nullable = false, length = 50) | @NotNull | @Length(max = 50) | public String getDescription() { | return this.description; | } | | public void setDescription(String description) { | this.description = description; | } | } components.xml ... | framework:entity-query name=statuses ejbql=select status from Status status / | ... Exception: javax.servlet.ServletException: Error calling action
[jboss-user] [JBoss Seam] - Re: s:selectItems - whto work
I just updated seam from a CVS build on 10th Feb to the most recent nightly build and now I get the above exception (org.hibernate.PropertyValueException: not-null property references a null or transient value: com.jaywing.commsbuilder.Customer.status) whether or not I select an item in my drop-down. What I can't figure out is: 1. Why the I now seemingly always get a null value set for status. 2. Why before I upgraded to the latest nightly build I was getting a value is not valid when I selected an item in the drop-down. 3. Also, why I'm getting an exception rather than a validation message. Any ideas? Are these issues with ec:convertEntity / s:selectItems, or is there somewhere I'm going wrong in my code? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4016393#4016393 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016393 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: s:selectItems - whto work
Sorry, what I meant was that my seam-gen generated CustomerHome class extends Seam Application Framework EntityHome (which, of course, has conversational scope). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4016410#4016410 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016410 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - seam-gen code for many-to-one associations and reference dat
Hi, I'm trying to understand the seam-generated code for many-to-one associations, and whether / how I need to modify it if I'm dealing with reference data that either is read-only (i.e. will be an Enum and will have matching database lookup table), or modified only very occasionally by an administrator (will be a class mapped to a database lookup/reference table). seam-gen generates the following Seam Application Framework EntityHome code for my example project's Customer class: @Name(customerHome) | public class CustomerHome extends EntityHomeCustomer { | | @In(value = #{statusHome.managedInstance}, required = false) | Status status; | | @In(value = #{customerTypeHome.managedInstance}, required = false) | CustomerType customerType; | | public void setCustomerId(Integer id) { | setId(id); | } | | public Integer getCustomerId() { | return (Integer) getId(); | } | | @Override | protected Customer createInstance() { | Customer customer = new Customer(); | return customer; | } | | public void wire() { | if (status != null) { | getInstance().setStatus(status); | } | if (customerType != null) { | getInstance().setCustomerType(customerType); | } | } | | public boolean isWired() { | if (getInstance().getStatus() == null) | return false; | if (getInstance().getCustomerType() == null) | return false; | return true; | } | | public Customer getManagedInstance() { | return isManaged() ? getInstance() : null; | } | | } and CustomerEdit.page.xml is generated as follows page no-conversation-view-id=/CustomerList.xhtml | |restrict#{identity.loggedIn}/restrict | |begin-conversation join=true/ | |action execute=#{customerHome.wire}/ | |param name=customerFrom/ |param name=customerId value=#{customerHome.customerId}/ | |param name=statusFrom/ |param name=statusId value=#{statusHome.statusId}/ | |param name=customerTypeFrom/ |param name=customerTypeId value=#{customerTypeHome.customerTypeId}/ | |navigation from-action=#{customerHome.persist} |end-conversation/ |redirect view-id=/Customer.xhtml/ |/navigation | |navigation from-action=#{customerHome.update} |end-conversation/ |redirect view-id=/Customer.xhtml/ |/navigation | |navigation from-action=#{customerHome.remove} |end-conversation/ |redirect view-id=/CustomerList.xhtml/ |/navigation | | /page So if I want Status to be an Enum, and CustomerType to be an immutable class that will be mapped to a database lookup/reference table, then what changes should I make to the seam-gen code??? I particular, I'm confused by the need for the wire() and isWired() methods - can anyone shed any light on what they are for and whether I'll still need them? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4016451#4016451 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016451 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - s:selectDate component continues to be displayed after losin
Hi, I've just started using the s:selectDate component in my application and it does not behave as I would expect... Once you have opened a s:selectDate component (by clicking on its icon), the only way to make the component close seems to be to select a date - the component currently does not close (/disappear) if you click on another control on the page. Have I missed out some configuration setting, or is this a bug? Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4015728#4015728 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4015728 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: s:selectDate component continues to be displayed after l
Thanks for your speedy reply Gavin. I'd missed that you could close the component by clicking on the icon. However, I'd still argue that the expected behaviour for such a date selection component is also to close when it loses focus (i.e. when another component is clicked). Just to confirm my thinking I had a look on a number of different web sites, and all the date components closed when they lost focus (and in a couple of instances the date components also closed after the mouse had been hovering over another part of the screen other than the component for more than a couple of seconds). Any chance that this behaviour could be added? Thanks, Lawrie. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4015871#4015871 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4015871 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: s:selectDate component continues to be displayed after l
Thanks for that Gavin - much appreciated. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4015903#4015903 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4015903 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to use si:selectItems with an object that has a Stri
I've done some more investigating and the problem is that the h:selectOneMenu value property (which is #{customerHome.instance.customerType}) is passed to the BasicEntityConverter, and that customerHome.instance.customerType holds a new instance of CustomerType which doesn't have any fields set. The issue seems to stem from the seam-gen generated entity home code: @Name(customerHome) | public class CustomerHome extends EntityHomeCustomer { | | @In(value = #{customerTypeHome.instance}, required = false) | CustomerType customerType; | @In(value = #{refCustomerStatusHome.instance}, required = false) | RefCustomerStatus refCustomerStatus; | | public void setCustomerId(Integer id) { | setId(id); | } | | public Integer getCustomerId() { | return (Integer) getId(); | } | | @Override | protected Customer createInstance() { | Customer result = new Customer(); | result.setCustomerType(customerType); | result.setRefCustomerStatus(refCustomerStatus); | return result; | } | | public ListActivity getActivities() { | return getInstance() == null ? null : new ArrayListActivity( | getInstance().getActivities()); | } | | } | Do I need to change the seam-gen generated code (i.e. is it incorrect)? (I presume I do if the BasicEntityConverter doesn't convert a null id to whatever is required for the no item selected item in the drop down list to be selected. What value for #{customerHome.instance.customerType} in (h:selectOneMenu value property) would cause my drop down to correctly have the Please Select... (no item selected) item selected when the page is displayed? Should my CustomerHome createInstance() method instead be setting the customerType to null rather than #{customerTypeHome.instance}??? Any help would be really appreciated as I'm struggling to get my code working with h:selectOneMenu si:selectItems and none of the examples are really helping to clarify things... Thanks in advance, Lawrie. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4009344#4009344 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4009344 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - How to use si:selectItems with an object that has a String i
Hi, I'm a Seam newbie and I'm trying to get my head around si:selectItems and the Seam application framework. My CustomerType object has a String id so when I initially tried to use si:selectItems without creating and specifying a converter I got an exception: h:selectOneMenu value=#{ customerHome.instance.customerType} id=customerType | si:selectItems value=#{customerTypes.resultList} var=customerType label=#{customerType.name} noSelectionLabel=Please Select... / | /h:selectOneMenu javax.faces.convert.ConverterException: [EMAIL PROTECTED] com.mycomp.myapp.CustomerType | at org.jboss.seam.selectitems.ui.BasicEntityConverter.getIdAsString(BasicEntityConverter.java:61) | at org.jboss.seam.selectitems.jsf.EntityConverter.convertToString(EntityConverter.java:36) | at org.jboss.seam.selectitems.jsf.SelectItemsConverter.getAsString(SelectItemsConverter.java:131) | at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544) | ... | | Caused by: java.lang.NullPointerException | at org.jboss.seam.selectitems.ui.BasicEntityConverter.getIdAsString(BasicEntityConverter.java:59) | ... 43 more So I then created a CustomerTypeSelectItemsConverter which extends SelectItemsConverter: @Name(customerTypeSelectItemsConverter) | public class CustomerTypeSelectItemsConverter extends org.jboss.seam.selectitems.jsf.SelectItemsConverter { | | @Override | protected Object convertToObject(FacesContext arg0, UIComponent arg1, String arg2) | throws ConverterException { | return arg2; | } | | @Override | protected String convertToString(FacesContext arg0, UIComponent arg1, Object arg2) | throws ConverterException { | return ((CustomerType)arg2).getId(); | } | | } and changed my facelets code: h:selectOneMenu value=#{customerHome.instance.customerType} converter=#{customerTypeSelectItemsConverter} id=customerType |si:selectItems value=#{customerTypes.resultList} var=customerType label=#{customerType.name} noSelectionLabel=Please Select... / | /h:selectOneMenu | This gets my drop down list displaying correctly but gives me a validation error value is not valid when I try to save. I presume this means that I should be returning a CustomerType object (rather than the CustomerType object's id) from CustomerTypeSelectItemsConverter's convertToObject() method? Am I on the right lines now? If so, what is the correct way for me to obtain the CustomerType object? Should I somehow be getting the List from the Seam Application Framework EntityQuery object (customerTypes) that was used to populate the si:selectItems tag and then iterating the List to find find the CustomerType with the specified id? Or is there a better way? Any help would be greatly appreciated as I can't find any examples which match my problem and I'm struggling to find any answers... Thanks, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4008752#4008752 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4008752 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to use si:selectItems with an object that has a Stri
CustomerType class: @Entity | @Table(name = CUSTOMER_TYPE, catalog = CustomerBuilder) | public class CustomerType implements java.io.Serializable { | | private String id; | private String name; | private SetScript scripts = new HashSetScript(0); | | public CustomerType() { | } | | public CustomerType(String id, String name) { | this.id = id; | this.name = name; | } | public CustomerType(String id, String name, SetScript scripts) { | this.id = id; | this.name = name; | this.scripts = scripts; | } | | @Id @GeneratedValue | @Column(name = ID, unique = true, nullable = false, length = 1) | @NotNull | @Length(max = 1) | public String getId() { | return this.id; | } | | public void setId(String id) { | this.id = id; | } | | @Column(name = NAME, nullable = false, length = 50) | @NotNull | @Length(max = 50) | public String getName() { | return this.name; | } | | public void setName(String name) { | this.name = name; | } | @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) | @JoinTable(name = CUSTOMER_TYPE_SCRIPT, | [EMAIL PROTECTED](name = CUSTOMER_TYPE_ID)}, | [EMAIL PROTECTED](name = SCRIPT_ID)}) | public SetScript getScripts() { | return this.scripts; | } | | public void setScripts(SetScript scripts) { | this.scripts = scripts; | } | | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4008763#4008763 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4008763 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to use si:selectItems with an object that has a Stri
Thanks for your help Pete. From what I read in the wiki, I thought I should be able to use the inbuilt EntityConverter, so I was a bit surprised when this didn't work... I've just checked, and the two objects in the list both have non-null ids - do you have any other ideas what might be causing the problem? Cheers, Lawrie. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4008773#4008773 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4008773 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to use si:selectItems with an object that has a Stri
I stepped through the code and you are quite right that the first CampaignType object passed to BasicEntityConverter's getIdAsString method has null values in its fields. If I modify the BasicEntityConverter code to not throw an exception, then I see that on the second and third calls to the getIdAsString method, the entity argument contains the CampaignType objects I would expect. customerTypes.resultList is populated by a Seam Application Framework Entity-Query: framework:entity-query name=customerTypes ejbql=select customerType from CustomerType customerType / | I've checked that my entity-query only returns two CustomerType objects which have non-null id values. My si:selectItems tag is as follows: h:selectOneMenu value=#{customerHome.instance.customerType} id=customerType | si:selectItems value=#{customerTypes.resultList} var=customerType label=#{customerType.name} noSelectionLabel=Please Select... / | /h:selectOneMenu So now I'm more than a bit confused as to how a CustomerType with a null id value is being passed to BasicEntityConverter's getIdAsString method. Does the object from the h:selectOneMenu value property get passed to the BasicEntityConverter??? The reason I ask is because I'm creating a new Customer and therefore #{customerHome.instance.customerType} would initially contain a new instance of CustomerType. If so, how do you work around this? Any help would be very much appreciated as I'm starting to tear my hair out... Cheers, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4009047#4009047 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4009047 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Seam application with tree on left and editor for selected t
I've just started looking at Seam and am investigating whether it might be well-suited to a new application I'll be developing. I envisage the app having a tree on the left and an editor for the currently selected tree nore object on the right. And if a user selects an object and starts editing it but then clicks on another tree node before saving I'd like to display a Do you want to save your changes dialog with Yes, No and Cancel options. Is this sort of functionality easy (/possible) to implement with Seam? (I'm coming from a Swing background so perhaps there is a better way to design this as a Seam web app???) Any help would be really appreciated! Thanks in advance, Lawrie View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3978855#3978855 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3978855 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam application with tree on left and editor for select
Thanks ever so much, Christian - that's really helpful. You've certainly encouraged me to investigate further now that I know it's all do-able. I'm looking forward to seeing the CaveatEmptor sample app - although, unfortunately, I've got to get out a prototype before then... Thanks again, Lawrie. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3978861#3978861 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3978861 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user