codename one actionlistener is not calling properly in ipad device - actionlistener

i want to update the text field value when i was changed.for this i use action listener because every updation time one trigger was fired in my code so,that's the reason i used action listener instead of data changed listener.for data changed listener on key pressed the listener is called updation done but my requirement is after completion of entering the data on text field only the listener is called.but it is not calling properly.
please find the below code,
agencyWorker.addActionListener(createAgencyActionListener(agencyWorker,eventPostchedules.getSerialId()));
private ActionListener createAgencyActionListener(final TextField searchField, String serialId){
return new ActionListener() {
#Override
public void actionPerformed(ActionEvent evt) {
String agencyText = searchField.getText();
searchField.setPreferredW(110);
roasterDao = RoasterDao.getInstance();
roasterDao.updateEventPostScheduleAgency(agencyText, serialId, "supervisor");
}
};
}
thanks in advance.

I just tested this on my iPad and action listener was invoked as expected. Check that you don't have a different error that is causing this e.g. networking error related to https change in iOS.
FYI on a side note, it's really bad to write this:
searchField.setPreferredW(110);
You are limiting the size of the field based in pixels which is rarely the right thing to do. The method is deprecated for a reason...

Related

Getting Change Event to Fire in SyncFusion's SFAutoComplete Control

I am trying to use the SFAutoComplete control from SyncFusion in a Xamarin iPad app. (only iPad).
I am not able to get any sort of change event to fire.
What I've tried:
If you download SyncFusion and install it, it comes with a "SampleBrowser" app that has samples for all the controls in the suite.
If you open that SampleBrowser in visual studio and open the AutoComplete_Tablet.cs file after line 97, I've added this code:
countryAutoComplete.ValueChanged += (sender, args) =>
{
suggestionModeLabel.Text = "IT WORKED!";
};
But it never fires.
I've tried to use several different events from the list of events this control has (partial list from screenshot):
None of them seem to fire (I haven't tried ALL of them).
What do I need to do to get one of these events to fire? What am I missing?
Thanks for using Syncfusion Controls.
Delegate property can be used to hook the SFAutoComplete's events as per in the following code example,
Declaration code for Delegate property
SFAutoComplete autocomplete = new SFAutoComplete();
autocomplete.Delegate = new SFAutoCompleteDelegate();
The way to hook the events in SFAutoComplete
public class SFAutoCompleteDelegate : AutoCompleteDelegate
{
public override void DidTextChange(SFAutoComplete SFAutoComplete, string value)
{
//It fired while changing the text in AutoComplete
}
public override void DidSelectionChange(SFAutoComplete SFAutoComplete, string value)
{
//It fired while changing the suggestion from suggestion box.
}
}
We have created a sample for achieving your requirement. Please download the same from the following link
Link:http://www.syncfusion.com/downloads/support/forum/125261/ze/testingAutoComplete_21799375630
Thanks & Regards,
Hemalatha M.R

What is the Closing event in UWP Page?

In WPF, there is a Closing event on <Window... tag, where we can hook up some dispose code in MainWindow_OnClosing.
But there is no such event in UWP app. The closing I guess is Unloaded, not even Unloading is there.
I just placed my disposing code there but still feel concerned. Is Unloaded event supposed for this type of work? Is there something I need to take note?
According to the MSDN, the Window class has a Closed event.
I'm mentioning this as you posted the Closing event of a window component, but keep in mind the remark of the event:
The Closed event occurs when a Window closes. However, Windows Store
apps typically use a single Window instance, and do not open and close
additional Window instances.
Now, when using the Frame navigation system of the main window with Pages, I advise you to use the OnNavigatedTo and OnNavigatedFrom events to manipulate all initialisation and dispose functionality of the class.
You may want to pay attention to the OnNavigationFrom as it is invoked immediately before the Page is unloaded and is no longer the current source of a parent Frame.
A really simple example:
Windows.ApplicationModel.Resources.ResourceLoader loader;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
loader = new Windows.ApplicationModel.Resources.ResourceLoader();
var navigationPageContentFormat = loader.GetString("NavigationPageContent");
var navigationPageContentWhenEmpty = loader.GetString("NavigationPageContentWhenEmpty");
this.ParameterTextBlock.Text = String.Format(navigationPageContentFormat, e.Parameter?.ToString() ?? navigationPageContentWhenEmpty);
}
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
loader = null;
}

Synchronising GEF editor with EMF model with two EMF adapters

I'm having trouble synchronising my GEF editor with the EMF-based model. I think this is due to the fact that the model-internal EMF Adapter, or rather the methods it calls, aren't finished before the editor's Adapter's notifyChanged() is called and updates the model children. This leads to the editor view being out-of-sync with the model itself, or rather, the changes to the model not being represented in the view when they should be.
Consider this set up. A Command "CreateNodeCommand" adds a node to the underlying model:
#Override
public void execute() {
...
getNewNode().setGraph(getGraph());
...
}
The GraphEditPart has an internal class extending org.eclipse.emf.common.notify.Adapter. It's notifyChanged() method is indeed notified, as tested similar to below (incomplete code):
#Override
public void notifyChanged(Notification notification) {
switch (notification.getEventType()) {
case Notification.ADD:
System.err.println("ADD occurred!");
refreshChildren();
}
The problem is, that the (third-party) model itself also implements an Adapter, which in turn runs a number of methods on the new model element, such as adding an ID, etc.
It seems to me that the fact that the new element's figure doesn't show up in the editor directly after it's been created - but only after the next editing step, the figure for which then doesn't appear - suggests that the model adapter is still busy setting up the new element while refreshChildren() is already being called by the editor adapter.
This seems to call for synchronisation, but I'm unsure whether this can be achieved with built-in Java functionality for multithreading, or calls for an EMF-based approach.
Please share your knowledge about synchronising in EMF.
Many thanks in advance!
EDIT
On request, here is the source code for the getModelChildren() method:
#Override
protected List<EObject> getModelChildren() {
List<EObject> allModelObjects = new ArrayList<EObject>();
allModelObjects.addAll(((MyGraph) getModel()).getTokens());
allModelObjects.addAll(((MyGraph) getModel()).getNodes());
return allModelObjects;
}
Debugging the (3rd party) model, I found out that the Graph's enotify() fired the notification before the actual adding took place, hence my Adapterreceived the notification too early, i.e., before the node had been added.
The notification is now called after the add and everything works fine.
Thanks for all of your help!
Try extending EContentAdapter instead of AdapterImpl, and not forget to call
super.notifyChanged(Notification notification);
in it. It's an adapter, which will add itself to new elements of the model, and notify you then they are changed.

How to set value of icefaces inputTextarea control

I'm using Icefaces 1.8.2 and an ice:inputTextarea control, and I can't figure why the value is not getting set here:
.jsp
<ice:inputTextarea binding="#{easp$RecordSearch.repairRemark}" id="repairRemark"
partialSubmit="true" style="height:40px; width:100%;" />
.java
//bean
private HtmlInputTextarea repairRemark = new HtmlInputTextarea();
public HtmlInputTextarea getRepairRemark() {
return repairRemark;
}
public void setRepairRemark(HtmlInputTextarea hit) {
this.repairRemark = hit;
}
....
public String button3_action() {
...
//code that sets value
String myVal = "new value";
this.repairRemark.setValue(myVal);
...
return null;
}
The code that sets the value is part of a button click event that I know is getting fired because I'm setting several other Icefaces controls, and all the other setters are working except this one. I just noticed that it actually appears to set the text very briefly, but disappears instantly. I checked all the code on that page, and I'm almost certain there is no other setter overwriting it. Does anyone know what is going here?
Update:
It does not seem to be a "phase" related issue, as this event is being processed in the INVOKE_APPLICATION phase. Also to note, I'm experiencing the same issue with the jsf h:inputTextarea
I found the cause and solution. The cause was the ice:commandButtons that were triggering this click event were in a column in a ice:dataTable. The ice:dataTable had an ice:rowSelector that seemed like it was causing an additional server request when a button was clicked. When I removed the ice:rowSelector, the problem went away.
The solution was to add either toggleOnClick="false" or toggleOnInput="false" to the ice:rowSelector. I added both, just in case.
http://res.icesoft.org/docs/v1_8_2/tld/ice/rowSelector.html
Hope this helps anyone else that runs into this issue.

Input File component error messages

I'm facing a serious problem with ice:inputFile component.
When an error occurred while uploading process (like : invalid file name error, empty file name error, exceeding max size error), i use ice:message tag to show these error messages.
I use ice:panelPopup and display the ice:inputFile component inside it.
The problem is : when i toggle the uploading popup the error message still appears, i need any way to clear these messagses.
Please help me, any help is appreciated......................... :)
I'm not 100% sure, if I understood your question correctly, however I guess that the immediate keyword, applied on the action, which triggers the popup, will help you.
<ice:commandLink
action="#{this.popup}"
immediate="true">
<h:outputText value="foo" />
</ice:commandLink>
In regular JSF Life Cycle, action events are normally fired after the Process Validations phase. Additionally, values will be updated from the UI to the model.
The immediate property, which is available to basically every JSF component which can cause any kind of event, bypasses validation and, depending on the event type, also the Model Update phase.
alt text http://img43.imageshack.us/img43/3900/jsfimmediatecomponents.png
(Geary, Horstmann, 2008. Core JavaServer Faces - Second Edition. Prentice Hall)
You'll find more information on this topic in Suns JSF Tutorial: The immediate Attribute
Here are two things that have worked for me.
Bind your ice:inputFile component to a property on your backing bean and manually call the reset method on the property when you close the popup pane.
<ice:inputFile binding="#{Bean.uploadedFile}"/>
class BackingBean {
private UICommand uploadedFile;
public UICommand getUploadedFile() { return uploadedFile; }
public void setUploadedFile(UICommand uploadedFile) { this.uploadedFile = uploadedFile; }
public void onClose(ActionEvent event) {
((InputFile) uploadedFile).reset();
}
}
-OR-
Add an actionListener to your ice:inputFile component. This will stop the inputFile component from adding its own validation errors to the context. You can implement whatever validation you need in the actionListener method and display the validation errors using an ice:messages tag. I've found that this works better than relying on inputFile's validation because it gives you complete control over the error message text/style and because the error messages clear automatically when the popup pane goes away.
<ice:inputFile actionListener="#{Bean.onFileUpload}"/>
public class BackingBean {
public void onFileUpload(ActionEvent event) {
FileInfo info = ((InputFile) event.getSource()).getFileInfo();
switch (info.getStatus()) {
case FileInfo.SAVED :
// handle uploaded file
case FileInfo.SIZE_LIMIT_EXCEEDED :
// file too big error
...
}
}
}

Resources