use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class ProcedureQueryView method initFromModel.
/**
* Updates the view from the current model state. Invoked when a currently displayed
* query is changed.
*/
void initFromModel() {
QueryDescriptor query = mediator.getCurrentQuery();
if (query == null || !QueryDescriptor.PROCEDURE_QUERY.equals(query.getType())) {
setVisible(false);
return;
}
properties.setEnabled(true);
name.setText(query.getName());
comment.setText(getQueryComment(query));
// init root choices and title label..
// - ProcedureQuery supports Procedure roots
// TODO: now we only allow roots from the current map,
// since query root is fully resolved during map loading,
// making it impossible to reference other DataMaps.
DataMap map = mediator.getCurrentDataMap();
Procedure[] roots = map.getProcedures().toArray(new Procedure[0]);
if (roots.length > 1) {
Arrays.sort(roots, Comparators.getDataMapChildrenComparator());
}
DefaultComboBoxModel<Procedure> model = new DefaultComboBoxModel<>(roots);
model.setSelectedItem(query.getRoot());
queryRoot.setModel(model);
properties.initFromModel(query);
setVisible(true);
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class ProcedureParameterErrorMsg method displayField.
public void displayField(ProjectController mediator, JFrame frame) {
Object object = super.validationFailure.getSource();
DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
ProcedureParameter procedureParameter = (ProcedureParameter) object;
Procedure procedure = procedureParameter.getProcedure();
DataMap map = procedure.getDataMap();
// Race condition between the two events...?
// first display the stored procedure
// for whatever reason, other validators do not require this step
// (E.g. DbAttributeErrorMsg)
ProcedureDisplayEvent procedureEvent = new ProcedureDisplayEvent(frame, procedure, map, domain);
procedureEvent.setTabReset(true);
mediator.fireProcedureDisplayEvent(procedureEvent);
// now show the failed parameter
ProcedureParameterDisplayEvent event = new ProcedureParameterDisplayEvent(frame, procedureParameter, procedure, map, domain);
event.setTabReset(true);
mediator.fireProcedureParameterDisplayEvent(event);
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class QueryErrorMsg method displayField.
public void displayField(ProjectController mediator, JFrame frame) {
Object object = super.validationFailure.getSource();
DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
QueryDescriptor query = (QueryDescriptor) object;
DataMap map = query.getDataMap();
QueryDisplayEvent event = new QueryDisplayEvent(frame, query, map, domain);
mediator.fireQueryDisplayEvent(event);
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class DataMapView method setClientSupport.
void setClientSupport(boolean flag) {
DataMap dataMap = eventController.getCurrentDataMap();
if (dataMap == null) {
return;
}
if (dataMap.isClientSupported() != flag) {
dataMap.setClientSupported(flag);
toggleClientProperties(flag);
eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
}
}
use of org.apache.cayenne.map.DataMap in project cayenne by apache.
the class DataMapView method setDefaultSchema.
void setDefaultSchema(String newSchema) {
DataMap dataMap = eventController.getCurrentDataMap();
if (dataMap == null) {
return;
}
if (newSchema != null && newSchema.trim().length() == 0) {
newSchema = null;
}
String oldSchema = dataMap.getDefaultSchema();
if (Util.nullSafeEquals(newSchema, oldSchema)) {
return;
}
dataMap.setDefaultSchema(newSchema);
eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
}
Aggregations