Search in sources :

Example 11 with DataMapDefaults

use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.

the class StandardModeController method createView.

protected GeneratorControllerPanel createView() {
    this.view = new StandardModePanel();
    Set<Entry<DataMap, DataMapDefaults>> entities = getMapPreferences().entrySet();
    for (Entry<DataMap, DataMapDefaults> entry : entities) {
        StandardPanelComponent dataMapLine = createDataMapLineBy(entry.getKey(), entry.getValue());
        dataMapLine.getDataMapName().setText(dataMapLine.getDataMap().getName());
        BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), dataMapLine);
        builder.bindToTextField(dataMapLine.getSuperclassPackage(), "preferences.superclassPackage").updateView();
        this.view.addDataMapLine(dataMapLine);
    }
    return view;
}
Also used : Entry(java.util.Map.Entry) BindingBuilder(org.apache.cayenne.swing.BindingBuilder) DataMapDefaults(org.apache.cayenne.modeler.pref.DataMapDefaults) DataMap(org.apache.cayenne.map.DataMap)

Example 12 with DataMapDefaults

use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.

the class DataSourceWizard method getConnectionInfoFromPreferences.

private DBConnectionInfo getConnectionInfoFromPreferences() {
    DBConnectionInfo connectionInfo = new DBConnectionInfo();
    DataMapDefaults dataMapDefaults = getProjectController().getDataMapPreferences(getProjectController().getCurrentDataMap());
    connectionInfo.setDbAdapter(dataMapDefaults.getCurrentPreference().get(DB_ADAPTER_PROPERTY, null));
    connectionInfo.setUrl(dataMapDefaults.getCurrentPreference().get(URL_PROPERTY, null));
    connectionInfo.setUserName(dataMapDefaults.getCurrentPreference().get(USER_NAME_PROPERTY, null));
    connectionInfo.setPassword(dataMapDefaults.getCurrentPreference().get(PASSWORD_PROPERTY, null));
    connectionInfo.setJdbcDriver(dataMapDefaults.getCurrentPreference().get(JDBC_DRIVER_PROPERTY, null));
    return connectionInfo;
}
Also used : DataMapDefaults(org.apache.cayenne.modeler.pref.DataMapDefaults) DBConnectionInfo(org.apache.cayenne.modeler.pref.DBConnectionInfo)

Example 13 with DataMapDefaults

use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.

the class DBConnectionAwareAction method saveConnectionInfo.

protected void saveConnectionInfo(DataSourceWizard connectWizard) {
    DataMapDefaults dataMapDefaults = getProjectController().getDataMapPreferences(getProjectController().getCurrentDataMap());
    String dbAdapter = connectWizard.getConnectionInfo().getDbAdapter();
    if (dbAdapter != null) {
        dataMapDefaults.getCurrentPreference().put(DB_ADAPTER_PROPERTY, dbAdapter);
    } else {
        dataMapDefaults.getCurrentPreference().remove(DB_ADAPTER_PROPERTY);
    }
    dataMapDefaults.getCurrentPreference().put(URL_PROPERTY, connectWizard.getConnectionInfo().getUrl());
    dataMapDefaults.getCurrentPreference().put(USER_NAME_PROPERTY, connectWizard.getConnectionInfo().getUserName());
    dataMapDefaults.getCurrentPreference().put(PASSWORD_PROPERTY, connectWizard.getConnectionInfo().getPassword());
    dataMapDefaults.getCurrentPreference().put(JDBC_DRIVER_PROPERTY, connectWizard.getConnectionInfo().getJdbcDriver());
}
Also used : DataMapDefaults(org.apache.cayenne.modeler.pref.DataMapDefaults)

Aggregations

DataMapDefaults (org.apache.cayenne.modeler.pref.DataMapDefaults)13 DataMap (org.apache.cayenne.map.DataMap)8 Entry (java.util.Map.Entry)3 TreeMap (java.util.TreeMap)3 BindingBuilder (org.apache.cayenne.swing.BindingBuilder)3 ArrayList (java.util.ArrayList)2 Preferences (java.util.prefs.Preferences)2 DBConnectionInfo (org.apache.cayenne.modeler.pref.DBConnectionInfo)2 ProjectStatePreferences (org.apache.cayenne.modeler.pref.ProjectStatePreferences)2 CayenneRuntimeException (org.apache.cayenne.CayenneRuntimeException)1 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)1 DataMapEvent (org.apache.cayenne.configuration.event.DataMapEvent)1 ValidationException (org.apache.cayenne.validation.ValidationException)1