use of org.apache.cayenne.configuration.event.QueryEvent in project cayenne by apache.
the class SQLTemplateMainTab method setEntity.
void setEntity(ObjEntity entity) {
QueryDescriptor template = getQuery();
if (template != null) {
// in case of null entity, set root to DataMap
Object root = entity != null ? entity : mediator.getCurrentDataMap();
template.setRoot(root);
mediator.fireQueryEvent(new QueryEvent(this, template));
}
}
use of org.apache.cayenne.configuration.event.QueryEvent in project cayenne by apache.
the class SelectQueryMainTab method setQueryComment.
private void setQueryComment(String text) {
QueryDescriptor query = getQuery();
if (query == null) {
return;
}
ObjectInfo.putToMetaData(mediator.getApplication().getMetaData(), query, ObjectInfo.COMMENT, text);
mediator.fireQueryEvent(new QueryEvent(this, query));
}
use of org.apache.cayenne.configuration.event.QueryEvent in project cayenne by apache.
the class SelectQueryMainTab method setQueryQualifier.
/**
* Initializes Query qualifier from string.
*/
void setQueryQualifier(String text) {
if (text != null && text.trim().length() == 0) {
text = null;
}
Expression qualifier = createQualifier(text);
// getQuery() is not null if we reached here
getQuery().setQualifier((qualifier));
mediator.fireQueryEvent(new QueryEvent(this, getQuery()));
}
use of org.apache.cayenne.configuration.event.QueryEvent in project cayenne by apache.
the class SelectQueryOrderingTab method removeOrdering.
void removeOrdering() {
int selection = table.getSelectedRow();
if (selection < 0) {
return;
}
OrderingModel model = (OrderingModel) table.getModel();
Ordering ordering = model.getOrdering(selection);
selectQuery.removeOrdering(ordering);
model.fireTableRowsDeleted(selection, selection);
mediator.fireQueryEvent(new QueryEvent(SelectQueryOrderingTab.this, selectQuery));
}
use of org.apache.cayenne.configuration.event.QueryEvent in project cayenne by apache.
the class SelectQueryOrderingTab method addOrdering.
void addOrdering() {
String orderingPath = getSelectedPath();
if (orderingPath == null) {
return;
}
// check if such ordering already exists
for (Ordering ord : selectQuery.getOrderings()) {
if (orderingPath.equals(ord.getSortSpecString())) {
return;
}
}
selectQuery.addOrdering(new Ordering(orderingPath, SortOrder.ASCENDING));
int index = selectQuery.getOrderings().size() - 1;
OrderingModel model = (OrderingModel) table.getModel();
model.fireTableRowsInserted(index, index);
mediator.fireQueryEvent(new QueryEvent(SelectQueryOrderingTab.this, selectQuery));
}
Aggregations