Accessing updated PageParameters in the onConfigure method of a page - java

I am trying to get around a peculiarity with Wicket pages—I have a page containing an ajax tabbed panel, and would like to make it so the user can alter the URL so that the next time the page displays, the tab is the one specified in the URL.
Example:
The user would click on a link elsewhere in the system that would take them to: http://example.com/customer/edit?tab=summary
(This gets changed by wicket to include a version number:
http://example.com/customer/edit?1&tab=summary)
This would show the first tab as expected, but
If the user altered the url to http://example.com/customer/edit?1&tab=orders
Then the user would expect the orders tab to be displayed, but it isn't. It still displays the summary tab.
The problem is that the Page class is only ever given parameters on construction, so getPageParameters().get( "tab" ); would always be 'summary', unless the user alters that number that always gets appended to the params to one not already used. Then a new instance of the page is created with a fresh set of params.
Is there a way to make it so when the page is refreshed, it picks up the new url parameters of the request in onConfigure?

Try using the actual request parameters instead:
RequestCycle.get().getRequest().getQueryParameters()

Related

Wicket Page's ListView LoadableDetachableModel is modified via AJAX call. Page doesn't re-draw

Consider a page which sub-classes WebPage. Its constructor creates
and adds a WebMarkupContainer, which contains a ListView component
backed by a LoadableDetachableModel.
The page also adds two instances of anonymous sub-classes of AbstractDefaultAjaxBehavior [each overriding the class' renderHead and respond methods].
The corresponding HTML contains a <div> bound by wicket:id to the WMC
and a <table> with <tr>'s bound to the ListView component's ListItems.
The page displays correctly the first time.
Based on user interaction with the client, the AbstractDefaultAjaxBehavior in question sets information on the model's model object. The information is intended to be used to change the way a specific listitem appears as a <td> within the row in the table -- specifically a selected row's text should appear in bold face.
Diagnostic debugger breakpoints and System.out info on both sides of
the AJAX call confirm that the behavior's respond method is being called correctly and that the model object is being correctly modified.
The page is never re-drawn automatically. Manually re-loading the page
from the browser demonstrates correct behavior.
I've researched this problem and found a variety of possibly related
solutions, which I've tried, including
calling target.add( webMarkupContainer); from the behavior's
respond method, in conjunction with
calling target.appendJavaScript( "window.location.reload();" ); from the respond method.
calling setResponsePage( this );, setResponsePage( Page.class );, and setResponsePage( getPage() ); from the respond method, as well as from an overridden onBeforeRender method on the page.
Any suggestions?
AbstractDefaultAjaxBehavior does not update any components automatically.
Did target.add( webMarkupContainer) help? If not, have you called webMarkupContainer.setOutputMarkupId(true)?

Oracle ADF stop validation on empty table row, validate in popup form instead

I'm currently developing a simple application which does crud operations on a few tables.
It looks like this:
I have a problem with the add item form, invoked by pressing the button saying "Nova jedinica mjere". It opens a popup containing an ADF form as follows:
As you can see it does a create insert operation on popup fetch event, creating an empty row. When I fill the form with data, and press OK(the ok button is handled in the bean, doing a commit operation), I get an empty error message as follows:
This only happens if the table is editable(consisting of input text elements). If it is set to click to edit, this problem does not occur. How can I make validation only occur on form fields?
If you need any more info, please let me know because I too am new to adf.
EDIT:
This is the page in question:(posted as a pastebin link to not take up much space).
http://pastebin.com/5TKyPxEs
The form in the popup is a static region from a task flow with a method call and a page:
http://pastebin.com/9h69fRW4
You mean to say that when you enter the value in the form and Click OK, it should be there in the Table,If so, the values are not getting displayed in Table. It means your Iterator is not fetching the values. You have to Refresh your Iterator, VO and Table Compoent through Bean. So that the values in the form once you click OK, it will be there in the Table.

Jumping from screen A((Web Page) to Screen B(Web Page) bypassing intermediate screens(Web Pages) using selenium webdriver

This question is not about window handling or juggling of multiple browser windows, its about navigating through web pages of a web application within same window.
I have a situation where
1.I navigate as screen A->Screen x->Screen Y-> Screen B
2.I need to capture certain parameters on screen B from First login
3.I need to verify those parameters on screen B from second login
Here what i wish to do is to avoid the non important task of navigating through intermediate screens & jump directly to the concerned screen. Or directly capture the concerned parameter without bothering about UI.
Note- The URL on this application window is non editable manually.
Example-
Login->Jump to Screen B(First Login)
Login->Jump to Screen B(Second Login)
Firsts of all, is it possible at all??
Please help me with the suggestions of how to achieve this
Additional Detail-
URL to view a project named Selenium Test 275 (A specific web page in the application) is ->
http://172.24.186.71/esssfa/sfanew/UnitList.aspx?OID=12762&PID=12731&PRID=1&SecID=3
Edit:
I think I understand what your asking now. If you want to easily jump back a few pages, to that spefic screen B, I would use JavaScript.
(-1) will get the last page that was on your browsers stack. (-2) two pages, and (2) will then make the browser get two pages forward on the browser.
If you want to go back to Screen B try something like this after logging in.
driver.execute_script("window.history.go(-2)")
Then a variable can be used to store the data from the last login that you want to compare.
Possibly that the second window opens based on response from the server?
For e.g - the server could be returning a URI along with a session/security attribute(JSESSIONID, Authorization, etc) which is then appended with base URI to open up the new window. The session/security attribute explains the invalid session page message when you try to driver.get(URL) of the second page.
At the risk of being repetitive (rephrasing Vivek's question) - are you able to open the second screen in this way :
Login to the application (first screen) -> Open a fresh browser window -> Paste the (read-only) URL of the second screen and hit Enter -> Check second screen opens.
If yes, then it seems to be a case where it is not just simple GET request but possibly a request with some sort of Authorization code in the request headers.
Additional details might help answer your question : is it possible ?!

How to restrict user from going to Next Page if all the fields are not populated in Eclipse SWT

I have a requirement like this:-
The user shouldn't be allowed to traverse to the Next Page in case he has not entered all the required parameters in the First Page itself. Also, in case he has entered something erroneous he should be displayed the warning and restricted from going to the Next Page. This needs to be implemented using Eclipse Plugin Developement using JFace/SWT.
Check your GUIItem.value() for empty on the Next Page button action or deactivate the button until the required fields have data.
use WizardPage.setPageComplete(boolean complete) method (easy way), or use JFace databinding. Even better if you wire databinding with org.eclipse.jface.databinding.wizard.WizardPageSupport.
Override the ispagecomplete method to return true only when all the values in your wizardpage are complete. When the user edits any value ensure that you have listener on these fields that call getContainer().updatebuttons() This should work for your requirement.

JSF component doesn't update if changes came from grid click

I have a JSF/IceFaces application where there is a screen divided into 3 sections. Search fields, a grid and some details fields below. Currently if I enter some data into the search fields and click on a Search button (!) the grid shows the results and a certain method is called that puts the first result record's details into the backing beans of the details fields below the grid. This shows that there is no problem with the way I put data into the details fields.
However I have a gridclicklistener method as well that would like to change the detail fields according to the selection. After the click the same method gets called with the correct parameters that works well if invoked after the click on the Search button. The data is updated in the backing beans but the changes are not rendered even if I click the refresh button in the browser.
I found that if I click on the search button, the data-updating-method gets called from InvokeApplicationPhase.execute. When I get to this line after the grid click then it is from the ApplyRequestValuesPhase.
Do you have any ideas what could make this difference and how to get this work?
Update:
I can clearly see the updated value in the backing bean but it is not reflected on screen at all, even after F5.
I don't know what is causing your original problem.
With the icefaces push renderer however you could force an update:
http://wiki.icefaces.org/display/ICE/Getting+Started+with+ICEfaces+2#GettingStartedwithICEfaces2-icepush

Categories

Resources