简体   繁体   English

amx:selectBooleanCheckbox是否需要valueChangeListeners?

[英]Are valueChangeListeners required for amx:selectBooleanCheckbox?

I am using jDeveloper 12.1.3 and MAF 2.0.0.0. 我正在使用jDeveloper 12.1.3和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. 所有项目均基于移动设备上的本地SQLite数据库。 I have the POJO (getters and setters) and DC classes set up, the initializedb.sql and connectionfactory.java files ready. 我已经设置了POJO(getter和setter)和DC类,并准备好initializedb.sql和connectionfactory.java文件。 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. 我没有任何与任何复选框关联的valueChangeListener。

I'm very very new to ADF and MAF, so I assume that I'm missing something simple. 我对ADF和MAF非常陌生,所以我认为我缺少一些简单的东西。 Thanks in advance for questions/comments/concerns. 在此先感谢您的问题/评论/关注。

Here's the associated code: 这是相关的代码:

XML for the item itself: 项目本身的XML:

<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; 设置类中的Java:`public void setRequireTagAndStateOrVin(String requireTagAndStateOrVin){this.requireTagAndStateOrVin = requireTagAndStateOrVin; } }

public String getRequireTagAndStateOrVin() {
    return requireTagAndStateOrVin;
}`

Java from the SettingsDC class SettingsDC类中的Java

`public class SettingsDC { private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); `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);
}

}` }`

You are dOing your settings page in a hard way. 您正在艰难地设置页面。

Please use the prefrences that already embded in maf 请使用已经嵌入在maf中的首选项

37 (Core). 37(核心)。 Setting Device Preferences: http://youtu.be/C469lObO_TQ 设置设备首选项:http: //youtu.be/C469lObO_TQ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM