use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.
the class ProjectController method getDataMapPreferences.
/**
* Returns preferences object for the current DataMap. If no preferences
* exist for the current DataMap, a new Preferences object is created. If no
* DataMap is currently selected, an exception is thrown. An optional
* nameSuffix allows to address more than one defaults instance for a single
* DataMap.
*/
public DataMapDefaults getDataMapPreferences(String nameSuffix) {
DataMap map = getCurrentDataMap();
if (map == null) {
throw new CayenneRuntimeException("No DataMap selected");
}
Preferences pref;
if (nameSuffix == null || nameSuffix.length() == 0) {
pref = getPreferenceForDataDomain().node("DataMap").node(map.getName());
} else {
pref = getPreferenceForDataDomain().node("DataMap").node(map.getName()).node(nameSuffix);
}
return (DataMapDefaults) application.getCayenneProjectPreferences().getProjectDetailObject(DataMapDefaults.class, pref);
}
use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.
the class ClientModeController 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;
}
use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.
the class ClientModeController method createDefaults.
protected void createDefaults() {
TreeMap<DataMap, DataMapDefaults> map = new TreeMap<DataMap, DataMapDefaults>();
ArrayList<DataMap> dataMaps = (ArrayList<DataMap>) getParentController().getDataMaps();
for (DataMap dataMap : dataMaps) {
DataMapDefaults preferences = getApplication().getFrameController().getProjectController().getDataMapPreferences(this.getClass().getName().replace(".", "/"), dataMap);
preferences.setSuperclassPackage("");
preferences.updateSuperclassPackage(dataMap, true);
map.put(dataMap, preferences);
if (getOutputPath() == null) {
setOutputPath(preferences.getOutputPath());
}
}
setMapPreferences(map);
}
use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.
the class CustomModeController method createView.
protected GeneratorControllerPanel createView() {
this.view = new CustomModePanel();
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;
}
use of org.apache.cayenne.modeler.pref.DataMapDefaults in project cayenne by apache.
the class CustomModeController method createDefaults.
protected void createDefaults() {
TreeMap<DataMap, DataMapDefaults> map = new TreeMap<DataMap, DataMapDefaults>();
Collection<DataMap> dataMaps = getParentController().getDataMaps();
for (DataMap dataMap : dataMaps) {
DataMapDefaults preferences;
preferences = getApplication().getFrameController().getProjectController().getDataMapPreferences(this.getClass().getName().replace(".", "/"), dataMap);
preferences.setSuperclassPackage("");
preferences.updateSuperclassPackage(dataMap, false);
map.put(dataMap, preferences);
if (getOutputPath() == null) {
setOutputPath(preferences.getOutputPath());
}
}
setMapPreferences(map);
preferencesUpdater = new CustomPreferencesUpdater(map);
}
Aggregations