use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class SQLTemplateTabbedView method initController.
private void initController() {
mediator.addQueryDisplayListener(new QueryDisplayListener() {
public void currentQueryChanged(QueryDisplayEvent e) {
initFromModel();
}
});
this.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
lastSelectionIndex = getSelectedIndex();
updateTabs();
}
});
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class SelectQueryTabbedView method initController.
private void initController() {
mediator.addQueryDisplayListener(new QueryDisplayListener() {
public void currentQueryChanged(QueryDisplayEvent e) {
initFromModel();
}
});
this.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
lastSelectionIndex = getSelectedIndex();
updateTabs();
}
});
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class EjbqlTabbedView method initController.
private void initController() {
mediator.addQueryDisplayListener(new QueryDisplayListener() {
public void currentQueryChanged(QueryDisplayEvent e) {
initFromModel();
}
});
this.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
lastSelectionIndex = getSelectedIndex();
updateTabs();
}
});
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class FindAction method jumpToQueryResult.
private static void jumpToQueryResult(QueryDescriptor queryDescriptor, EditorView editor, DataChannelDescriptor domain) {
DataMap map = queryDescriptor.getDataMap();
buildAndSelectTreePath(map, queryDescriptor, editor);
QueryDisplayEvent event = new QueryDisplayEvent(editor.getProjectTreeView(), queryDescriptor, map, domain);
editor.currentQueryChanged(event);
}
use of org.apache.cayenne.modeler.event.QueryDisplayEvent in project cayenne by apache.
the class ProjectTreeView method processSelection.
/**
* Processes node selection regardless of whether a new node was selected, or an
* already selected node was clicked again. Normally called from event listener
* methods.
*/
public void processSelection(TreePath path) {
if (path == null) {
return;
}
DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) path.getLastPathComponent();
Object[] data = getUserObjects(currentNode);
if (data.length == 0) {
// this should clear the right-side panel
DomainDisplayEvent domEvent = new DomainDisplayEvent(this, null);
domEvent.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
mediator.fireDomainDisplayEvent(domEvent);
return;
}
Object obj = data[data.length - 1];
if (obj instanceof DataChannelDescriptor) {
mediator.fireDomainDisplayEvent(new DomainDisplayEvent(this, (DataChannelDescriptor) obj));
} else if (obj instanceof DataMap) {
if (data.length == 2) {
mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(this, (DataMap) obj, (DataChannelDescriptor) mediator.getProject().getRootNode(), (DataNodeDescriptor) data[data.length - 2]));
} else if (data.length == 1) {
mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(this, (DataMap) obj, (DataChannelDescriptor) mediator.getProject().getRootNode()));
}
} else if (obj instanceof DataNodeDescriptor) {
if (data.length == 1) {
mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(this, (DataChannelDescriptor) mediator.getProject().getRootNode(), (DataNodeDescriptor) obj));
}
} else if (obj instanceof Entity) {
EntityDisplayEvent e = new EntityDisplayEvent(this, (Entity) obj);
e.setUnselectAttributes(true);
if (data.length == 3) {
e.setDataMap((DataMap) data[data.length - 2]);
e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
e.setDataNode((DataNodeDescriptor) data[data.length - 3]);
} else if (data.length == 2) {
e.setDataMap((DataMap) data[data.length - 2]);
e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
}
if (obj instanceof ObjEntity) {
mediator.fireObjEntityDisplayEvent(e);
} else if (obj instanceof DbEntity) {
mediator.fireDbEntityDisplayEvent(e);
}
} else if (obj instanceof Embeddable) {
EmbeddableDisplayEvent e = new EmbeddableDisplayEvent(this, (Embeddable) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
mediator.fireEmbeddableDisplayEvent(e);
} else if (obj instanceof Procedure) {
ProcedureDisplayEvent e = new ProcedureDisplayEvent(this, (Procedure) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
mediator.fireProcedureDisplayEvent(e);
} else if (obj instanceof QueryDescriptor) {
QueryDisplayEvent e = new QueryDisplayEvent(this, (QueryDescriptor) obj, (DataMap) data[data.length - 2], (DataChannelDescriptor) mediator.getProject().getRootNode());
mediator.fireQueryDisplayEvent(e);
}
this.scrollPathToVisible(path);
}
Aggregations