use of org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent in project cayenne by apache.
the class CreateProcedureParameterAction method fireProcedureParameterEvent.
/**
* Fires events when an proc parameter was added
*/
static void fireProcedureParameterEvent(Object src, ProjectController mediator, Procedure procedure, ProcedureParameter parameter) {
mediator.fireProcedureParameterEvent(new ProcedureParameterEvent(src, parameter, MapEvent.ADD));
mediator.fireProcedureParameterDisplayEvent(new ProcedureParameterDisplayEvent(src, parameter, procedure, mediator.getCurrentDataMap(), (DataChannelDescriptor) mediator.getProject().getRootNode()));
}
use of org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent 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.modeler.event.ProcedureParameterDisplayEvent in project cayenne by apache.
the class ProcedureParameterTab method processExistingSelection.
public void processExistingSelection(EventObject e) {
if (e instanceof ChangeEvent) {
table.clearSelection();
}
ProcedureParameter[] parameters = new ProcedureParameter[0];
boolean enableUp = false;
boolean enableDown = false;
boolean enableRemoveButton = false;
int selectedRow = table.getSelectedRow();
if (selectedRow >= 0) {
enableRemoveButton = true;
ProcedureParameterTableModel model = (ProcedureParameterTableModel) table.getModel();
int[] sel = table.getSelectedRows();
parameters = new ProcedureParameter[sel.length];
for (int i = 0; i < sel.length; i++) {
parameters[i] = model.getParameter(sel[i]);
}
if (sel.length == 1) {
// scroll table
UIUtil.scrollToSelectedRow(table);
int rowCount = table.getRowCount();
if (rowCount > 1) {
if (selectedRow > 0) {
enableUp = true;
}
if (selectedRow < (rowCount - 1)) {
enableDown = true;
}
}
}
}
removeParameterButton.setEnabled(enableRemoveButton);
moveUp.setEnabled(enableUp);
moveDown.setEnabled(enableDown);
syncButtons();
ProcedureParameterDisplayEvent ppde = new ProcedureParameterDisplayEvent(this, parameters, eventController.getCurrentProcedure(), eventController.getCurrentDataMap(), (DataChannelDescriptor) eventController.getProject().getRootNode());
eventController.fireProcedureParameterDisplayEvent(ppde);
}
use of org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent in project cayenne by apache.
the class FindAction method jumpToProcedureResult.
private static void jumpToProcedureResult(ProcedureParameter parameter, EditorView editor, DataChannelDescriptor domain) {
Procedure procedure = parameter.getProcedure();
DataMap map = procedure.getDataMap();
buildAndSelectTreePath(map, procedure, editor);
ProcedureParameterDisplayEvent event = new ProcedureParameterDisplayEvent(editor.getProjectTreeView(), parameter, procedure, map, domain);
editor.getProcedureView().currentProcedureParameterChanged(event);
editor.getProcedureView().repaint();
}
use of org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent in project cayenne by apache.
the class ProcedureParameterDisplayEventType 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;
}
Procedure procedure = dataMap.getProcedure(preferences.getProcedure());
if (procedure == null) {
return;
}
ProcedureDisplayEvent procedureDisplayEvent = new ProcedureDisplayEvent(this, procedure, dataMap, dataChannel);
controller.fireProcedureDisplayEvent(procedureDisplayEvent);
ProcedureParameter[] procedureParameters = getLastProcedureParameters(procedure);
ProcedureParameterDisplayEvent procedureParameterDisplayEvent = new ProcedureParameterDisplayEvent(this, procedureParameters, procedure, dataMap, dataChannel);
controller.fireProcedureParameterDisplayEvent(procedureParameterDisplayEvent);
}
Aggregations