I have a bean that has a List<Person> people property. This holds custom POJO objects Person that are populated from a notes view.
The list is then surface in an xpage using a custom repeat control
I have tested this with a hundred or so records and performance is fine, but when testing with larger datasets > 10000 records, performance drops.
I have an idea that I can lazy load the people by only loading the first page (say 30 records) bean.loadData(0, 30) and then load the next set, when the user uses the pager associated with the repeat control.
How do I intercept the pager click to call the loadData(startRow, endRow) method? Or is there another approach I should/could use that still makes use of the bean.
There is at least one way I know to do that, but unfortunately it requires a bit of work. I have created a complete DataSource of my own. If a DataSource's Model class extends TabularDataModel, it works seamlessly with the Pager control. IBM's DominoViewDataModel class works that way.
The complete procedure is a bit long, but was explained in this (highly interesting) LotusSphere 2011 session: http://www.slideshare.net/NotesSensei/show107-the-datasource-session-take-xpages-data-boldly-where-no-xpages-data-has-been-taken-before
Related
I am building an application that has very large documents, and many documents in the views. In my testing environment, these views take a view seconds to load, but for the customer, these views (shown in the dynamicViewPanel) are taking upwards of 12 seconds (or up to a minute the first time it is being loaded on a given day) to load. No update is made on the browser until add data becomes available. My question is not about performance however.
How can I go about immediately loading the xpage so that the user sees "something is happening and the browser did not swallow my request", yet load the view when the data eventually becomes available while using the dynamic view panel control?
Regarding partial refreshs Fredrik Norling made a neat control called "Standby Custom Control" that displays a "wait" icon when partial refreshs happen. Not sure if it will work when loading the whole page though...
http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control
If you are using Dojo modules there is a simple way to implement such a stand by for Partial Update and for opening new pages.
I found it in a blog by Vikas Tiwari
This is a two step process:
Add following Dojo modules to your XPage.
< xp:this.resources>
< xp:dojoModule name="extlib.dijit.ExtLib">< /xp:dojoModule>
< xp:dojoModule name="extlib.dijit.Loading">< /xp:dojoModule>
< /xp:this.resources>
Add following lines to the EventHandler of your button/link which is going to be used for Partial Update:
< xp:this.onStart>< /xp:this.onStart>
< xp:this.onComplete>< /xp:this.onComplete>
< xp:this.onError>< /xp:this.onError>
Not an answer to your question but you could try my ViewGrid plugin from here OpenNTF ViewGrid. If the view indexes are being build, the control 'waits' until that process is done (with a loading indicator)
I have a question regarding coded ui UIMap.
Every time I record an action on the same application, coded ui generates a new object for the same window in the application.
It looks like:
UIAdminWindow
UIAdminWindow1
UIAdminWindow2
and so on...
every window class holds different buttons, even though it's the same window.
Thus it's very hard to keep code maintenance.
What i would like is that every time i perform actions and records on a window, even if not at the same time, the already generated class for this window, will be updated with the new controls.
any suggestions to why it happens?
Thanks a lot!
You can clean up your UIMaps by doing two things:
Use the UIMap Toolbox (from codeplex) to move controls within the UIMap so they are all under one control tree.
When you have duplicate UI controls, go to the properties for the action that references the duplicate control and change the UI Control property to point to the original control in the UIMap.
The duplicate trees should now be unreferenced and you can delete it from your map, keeping things clean.
And yes, it's a pain to do, but it's worth it for maintainability.
In UIMap.uitest you can change the action name and the control name for better maintenance.
For example: you can set UIAdminWindow as FirstAcessWindow or other name that will express comfortably the control or the action.
What I can guess is that there is some randomly generated content or element identification data such as class or title that may be causing it. This may be caused by different username for example. Also you can update the element from UI map element tree.
I have a xhtml page with Search criteria and search results. Clicking on search button will dynamically update the results on the same page. I have a controller for search/results xhtml in Page Scope.
There is an edit button in every record in the search results. Clicking on the edit button will open a new page(new controller in Page scope). Once I edit and save I want to come back to the search criteria page with search resutls.
I can store the search criteria in session and requery and display the results. I looked at conversation and I am not sure if I can use it in this scenario?
Any ideas other than dumping the data in session for this scenario?
Pass the search criteria to the edit view as well (but don't display them or something) and then let the edit view pass it back to the search view once editing is finished.
If you want to persist data between two pages, you have many ways:
1) String parameters
2) Session data
3) Long running Conversation
4) Serialize your data elsewhere (DB or other).
Since you are talking about "saving" I may think you are saving your data in a database. If you have persisted your data in the second page in some way you can just query for them.
Otherwise you can use session and conversation, the second has a "smaller" and defined scope. You can decide when to create one and to create destroy. Simply put a in the first page pages.xml and create a bean with conversation scope.
The session scope will keep your data in your session scoped component until you close your browser.
Hope this helps.
I would go with the session scoped bean. If you use a search bean you can go anywhere in your application and maintain your search state, also it lends itself to saving searches in the database (so users can save searches between sessions).
#Scope(ScopeType.SESSION)
#Name("someRandomSearch")
public class SomeRandomSearch {
private SearchObj1 userSelection1;
private List<SearchObj1> searchCriteriaList1;
private SearchObj2 userSelection2;
private List<SearchObj2> searchCriteriaList2;
private String randomUserInput;
// getters/setters, some helper classes, cascade dropdown stuff, etc.....
// clear search criteria
public void reset(){
this.userSelection1 = null;
this.userSelection2 = null;
this.randomUserInput = null;
}
}
Just make sure to implement equals method in your model classes - maybe that's obvious, but when I first started using Seam I missed this little tidbit and it took forever to figure out why we couldn't hold onto dropdown selections in our search pages.
If when you say "open a new page", you mean navigate to another page in the same browser window/tab, then a Conversation is the ideal method for storing the search state.
Depending on your detailed use case, you might prefer to setup nested conversations (when you click on the edit).
You might also want to setup a pageflow to manage that particular navigation logic.
See the official documentation.
I want to able to create reusable user controls within my web app and i'm wondering on how to go about doing so.
Should a user controls properties be
visible to a form that's using it?
What's the best way to go about
loading the controls on the user
control from the form thats using
it? Should there be a public method
within the control that allows you
to load it from an external form or should the user
control be loaded in the page load
event
Is it okay to nest user controls within user controls?
etc...
Thanks for any advice
1) You only need to make properties visible if any page needs to read or modify information on your control. I personally like to keep my user controls as self contained as possible, and keep this to a minimum.
2) I would just rely on the built in page life cycle to render your control, but it is important to note when each of your control's events fire in relation to your pages. You may find that there are times that you need something on your control to render before something on your page does. In this case you will need to rely on the page_init in your control more than the page_load of your control.
3) You technically can nest user controls, but things will get tricky if you need to start reading and writing information (as in your first question) from any of the nested controls. Also, the page life cycle of the nested controls gets even more important. I would avoid this if you can.
I have 2 webparts which are connected, where the provider sends a string to the consumer.
However it fails to work if I put any TextBox controls in the consumer webpart. (works fine if I use a Label or Literal control.
The idea is that the consumer is to be composed of form controls like TextBoxes.
e.g. the codeproject sample at http://www.codeproject.com/KB/sharepoint/ConnectingCustomWebParts.aspx
Works fine... until you replace the consumer Label control with a TextBox.
Any help gratefully received.
Well, if this still needs an answer....
Why it would work with one control and not another, I'm not sure. The reason I couldn't get it to work consistently as is coded in that sample is due to the issues brought to fore in this article. The data just isn't always there in the create controls part of the web part life cycle. I had much better luck getting my data and putting it somewhere, either the session or the viewstate during the ConnectionConsumer event, then setting the value to the control that needed to display it in the OnPreRender event, or just somehow binding to the control, say in a grid, and just calling refresh on the List I was using as a datasource in the OnPreRender, calling Refresh in the create controls didn't work reliably, only in OnPreRender.
Once I truly grokked the web part lifecycle, things became much simpler for me, and finally taught me why in Java portlets they went with the post/redirect/get cycle to try and avoid this very granular coordination between various portlets on a page.