use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class CreateQueryAction method fireQueryEvent.
/**
* Fires events when a query was added
*/
public static void fireQueryEvent(Object src, ProjectController mediator, DataChannelDescriptor domain, DataMap dataMap, QueryDescriptor query) {
mediator.fireQueryEvent(new QueryEvent(src, query, MapEvent.ADD, dataMap));
mediator.fireQueryDisplayEvent(new QueryDisplayEvent(src, query, dataMap, domain));
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class ProjectController method removeFromHistory.
private void removeFromHistory(EventObject e) {
int count = controllerStateHistory.size();
List<ControllerState> removeList = new ArrayList<>();
for (int i = 0; i < count; i++) {
ControllerState cs = controllerStateHistory.get(i);
if (cs == null || cs.event == null) {
continue;
}
EventObject csEvent = cs.event;
if (e instanceof EntityEvent && csEvent instanceof EntityDisplayEvent) {
if (((EntityEvent) e).getEntity() == ((EntityDisplayEvent) csEvent).getEntity()) {
removeList.add(cs);
}
} else if (e instanceof EmbeddableEvent && csEvent instanceof EmbeddableDisplayEvent) {
if (((EmbeddableEvent) e).getEmbeddable() == ((EmbeddableDisplayEvent) csEvent).getEmbeddable()) {
removeList.add(cs);
}
} else if (e instanceof ProcedureEvent && csEvent instanceof ProcedureDisplayEvent) {
if (((ProcedureEvent) e).getProcedure() == ((ProcedureDisplayEvent) csEvent).getProcedure()) {
removeList.add(cs);
}
} else if (e instanceof QueryEvent && csEvent instanceof QueryDisplayEvent) {
if (((QueryEvent) e).getQuery() == ((QueryDisplayEvent) csEvent).getQuery()) {
removeList.add(cs);
}
} else if (e instanceof DataMapEvent && csEvent instanceof DataMapDisplayEvent) {
if (((DataMapEvent) e).getDataMap() == ((DataMapDisplayEvent) csEvent).getDataMap()) {
removeList.add(cs);
}
} else if (e instanceof DataNodeEvent && csEvent instanceof DataNodeDisplayEvent) {
if (((DataNodeEvent) e).getDataNode() == ((DataNodeDisplayEvent) csEvent).getDataNode()) {
removeList.add(cs);
}
} else if (e instanceof DomainEvent && csEvent instanceof DomainDisplayEvent) {
if (((DomainEvent) e).getDomain() == ((DomainDisplayEvent) csEvent).getDomain()) {
removeList.add(cs);
}
}
}
for (ControllerState o : removeList) {
controllerStateHistory.remove(o);
}
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class QueryDisplayEventType method fireLastDisplayEvent.
@Override
public void fireLastDisplayEvent() {
DataChannelDescriptor dataChannel = (DataChannelDescriptor) controller.getProject().getRootNode();
if (!dataChannel.getName().equals(preferences.getDomain())) {
return;
}
DataMap dataMap = dataChannel.getDataMap(preferences.getDataMap());
if (dataMap == null) {
return;
}
QueryDescriptor query = dataMap.getQueryDescriptor(preferences.getQuery());
if (query == null) {
return;
}
QueryDisplayEvent queryDisplayEvent = new QueryDisplayEvent(this, query, dataMap, dataChannel);
controller.fireQueryDisplayEvent(queryDisplayEvent);
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent 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.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class QueryType method fireQueryEvent.
/**
* Fires events when a query was added
*/
public static void fireQueryEvent(Object src, ProjectController mediator, DataMap dataMap, QueryDescriptor query) {
mediator.fireQueryEvent(new QueryEvent(src, query, MapEvent.ADD, dataMap));
mediator.fireQueryDisplayEvent(new QueryDisplayEvent(src, query, dataMap, (DataChannelDescriptor) mediator.getProject().getRootNode()));
}
Aggregations