package mobile;

import javax.el.ValueExpression;

import oracle.adfmf.amx.event.ActionEvent;
import oracle.adfmf.framework.api.AdfmfContainerUtilities;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
import oracle.adfmf.java.beans.PropertyChangeListener;
import oracle.adfmf.java.beans.PropertyChangeSupport;

public class MyClass {
    public MyClass() {
    }

    public void clearHandler(ActionEvent actionEvent) {
        AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getActiveContextId(), "doClear",
                                                                  new Object[] { });
    }

    public void fetchHandler(ActionEvent actionEvent) {
        AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getActiveContextId(), "doFetch",
                                                                  new Object[] { });
    }

    // This method will be called by the Javascript method

    public void FetchCallback(String fetchData) {
        ValueExpression ve = AdfmfJavaUtilities.getValueExpression("#{pageFlowScope.fetchData}", String.class);
        ve.setValue(AdfmfJavaUtilities.getAdfELContext(), fetchData);
    }
}
