0
votes

I am using jDeveloper 12.1.3 and MAF 2.0.0.0. I'm attempting to build a settings page in a mobile application. All the items are based on the local SQLite database on the mobile device. I have the POJO (getters and setters) and DC classes set up, the initializedb.sql and connectionfactory.java files ready. Here's my problem:

Any time I check one of the checkboxes, the page refreshes and wipes out everything on the page. I don't have any valueChangeListener associated with any of the checkboxes.

I'm very very new to ADF and MAF, so I assume that I'm missing something simple. Thanks in advance for questions/comments/concerns.

Here's the associated code:

XML for the item itself:

<amx:selectBooleanCheckbox value="#{bindings.requireTagAndStateOrVin.inputValue}" label="#{bindings.requireTagAndStateOrVin.label}" id="sbc1"/>

Java from the Settings class: `public void setRequireTagAndStateOrVin(String requireTagAndStateOrVin) { this.requireTagAndStateOrVin = requireTagAndStateOrVin; }

public String getRequireTagAndStateOrVin() {
    return requireTagAndStateOrVin;
}`

Java from the SettingsDC class

`public class SettingsDC { private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

public SettingsDC() {
    super();
}

public Settings[] getSettings(){
    Settings[] settings = null;
    settings = getSettingsFromDB();
    return settings;
}

private Settings[] getSettingsFromDB(){
    Connection conn = null;
    List returnValue = new ArrayList();
    try {
        conn = ConnectionFactory.getConnection();
        Statement stmt = conn.createStatement();
        ResultSet result = stmt.executeQuery("SELECT * FROM MY_TABLE;");
        while (result.next()){
           settings.setRequireTagAndStateOrVin(result.getString("REQUIRE_TAG_AND_STATE_OR_VIN_IND"));
           returnValue.add(settings);
        }
    } catch (Exception ex){
        Utility.ApplicationLogger.severe(ex.getMessage());
        ex.printStackTrace();
        throw new RuntimeException(ex);
    }
    Collections.sort(returnValue);
    return (Settings[]) returnValue.toArray(new Settings[returnValue.size()]);
}

public void addPropertyChangeListener(PropertyChangeListener l)
{
  propertyChangeSupport.addPropertyChangeListener(l);
}

public void removePropertyChangeListener(PropertyChangeListener l)
{
  propertyChangeSupport.removePropertyChangeListener(l);
}

}`

1

1 Answers

1
votes

You are dOing your settings page in a hard way.

Please use the prefrences that already embded in maf

37 (Core). Setting Device Preferences: http://youtu.be/C469lObO_TQ