Overridding the label of "ok" button in <af:dialog> component in ADF - java

In web layer of my project I am using ADF Faces component.In places I have used ADF popup element nested with dialog.
<af:popup id="myPopup" popupFetchListener="#{.....}">
<af:dialog contentWidth="400" title="Dialog Title" contentHeight="100" closeIconVisible="true"
modal="true" type="okCancel" id="d3"
dialogListener="#{mybean.myDialogListener}">
</af:dialog>
</af:popup>
In my backing bean I'm trapping the "ok"/"cancel" event with the help of DialogEvent class.
I want to change the label of framework build "ok" button to some custom label based upon my project requirement.If I add the desired label in message bundle how to reflect that in framework generated button?
Can anyone provide any clue for this?

You have to use the Type, AffirmativeTextAndAccessKey and CancelTextAndAccessKey properties of the dialog element.
To have the "ok" display "yes please" :
<af:popup id="myPopup" popupFetchListener="#{.....}">
<af:dialog contentWidth="400" title="Dialog Title" contentHeight="100" closeIconVisible="true"
modal="true" type="okCancel" id="d3"
dialogListener="#{mybean.myDialogListener}" type="yesNo" affirmativeTextAndAccessKey="yes please">
</af:dialog>
Note : it will change the type of the response in your dialog listener from
dialogEvent.Outcome.ok
to
dialogEvent.Outcome.yes

Related

Programmatically adding text to the editor eclipse plugin

I'm developing an eclipse plugin , and at some point in my plugin , a jframe is opened , and inside the jframe, there is a button . I have added a mouselistener to the button , and when pressed , I want some code to be added to the editor at caret point . but, I get null pointer exception here:
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
It appears you don't have an active page. Maybe your Swing based code is displaying a separate window?
Use IWorkbenchWindow.getPages() to get an array of IWorkbenchPage containing all the pages and look through the pages for the one containing the editor you want.

reload popup page by using spring MVC

I am using a controller to get the form values from the html. And doing some kind of validations. If validation fails i want to reload that popup by throwing the validation message and the popup page view name to reload the popup page. Like
If i have a page A, in that page A there is a button B.
Now if i click the button B, there will be open a popup window C.
Here in the page C, if i click the form submit. It will goes to the controller.
Here in the controller i do some validations, if validation fails i just want to reload that popup page C with the error message.
Any body can help to overcome the issues.
It will be easy if you use jQuery UI Modal.
Just go through this link
Is this what you want to do here It can be achieved by basic JQuery, CSS, js. Explorer some. if you have to validate it from data base and than show use <f:ajax /> this is whole work do some effort

Refresh only update panel on parent from pop-up window

I have a button which opens a pop-up window and an Ajax update panel. Inside that window I have another button.
What code do I have to run if I want that update panel to be refreshed, when I press the button from the parent page, without refreshing the whole page?
I sow this code on a web which refreshes the page:
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
I am such a good friend with Java.
You need to utilize window.opener object.
window.opener.document.getElementById('Container').onclick();
I'd suggest using jQuery to ensure cross-browser compatibility. And also adding some null-checks of course.
Use Jquery :
If the DIV ID remains static :
$("#Container").click(function() {
// REFRESH CONTAINER HERE
});
If the Div ID is dynamic then make use of class instead of ID:
$(".Container").click(function() {
// REFRESH CONTAINER HERE
});

Setting Session Variable on Popup Focus In ADF

I have an application that is somewhat heavy on ADF Popup dialogs. They will be defined in the index page like this:
<af:popup id="popup1" contentDelivery="lazyUncached" binding="managedBean1">
<jsp:include page="page1.jsp" />
</af:popup>
<af:popup id="popup2" contentDelivery="lazyUncached" binding="managedBean1">
<jsp:include page="page2.jsp" />
</af:popup>
etc, etc.
What I would like to do is whenever the popup opens and/or receives the focus, I want to set a session-scoped variable named "whereami". This variable will be used for further customization of pages, context menus, etc.
Can anyone assist?
Jason
You can attach click event to the body or div whatever, of the popup using JavaScript. And this can be achieved from backend by firing JavaScript from the Listener method of PopupFetchListener. As:
ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(), ExtendedRenderKitService.class);
service.addScript(FacesContext.getCurrentInstance(), "yourmethod();");
Then you can follow either of the following way.
Add a commandButton with actionListener and let it hidden. From the onclick JavaScript method of the popup you can trigger the click event of that hidden button by:
var button = AdfPage.PAGE.findComponentByAbsoluteId("hiddenButton");
ActionEvent.queue(button,true);
This will fire the actionListener.
Or you could take the help of af:serverListener to call backing method.
I didn't test it, but this should work.
The popup component has a PopupFetchListener event. The event is fired when the popup is displayed.
Capture that method in your backing bean and set your session bean there.

tapestry form type=image in input not working

I am trying to use an image for a submit buttin like this
<input t:id="submitButton" t:type="image" type="image" src="images/h_logon_button.png"/>
but when i render the page, i get this error
Unable to resolve 'image' to a component class name.
How do I use an image to create the submit button. if I use css, the image disappears after validation fails.
Any ideas?
Tx
CSS will work. It sounds like another CSS rule with higher specificity is applied to the button on failed validation. Just inspect the button and see which rule overwrites it.
The error you are seeing is due to the t:type="image". Here you are telling tapestry that your input should be of component type image. You can fix this in three ways:
Remove the t:id="submitButton" and t:type="image" so that your submit will just be a plain old html submit
change the t:type to submit like t:type="submit"
Remove the t:type="image" and add a component relating to your provided id like #Component(id="submitButton") private Submit submitButton;
Tapestry has a specific component, ImageSubmit, for your situation.

Categories

Resources