Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 package org.apache.cayenne.modeler.dialog.query;
 import  org.apache.cayenne.access.DataDomain;
 import  org.apache.cayenne.project.NamedObjectFactory;
 import  org.apache.cayenne.query.AbstractQuery;
 import  org.apache.cayenne.query.Query;
 import  org.scopemvc.controller.basic.BasicController;
 import  org.scopemvc.core.Control;
 import  org.scopemvc.core.ControlException;

A Scope controller for QueryTypeDialog.

Andrei Adamchik
 public class QueryTypeController extends BasicController {
     public static final String CANCEL_CONTROL = "cayenne.modeler.queryType.cancel.button";
     public static final String CREATE_CONTROL = "cayenne.modeler.queryType.create.button";
     public static final String OBJECT_QUERY_CONTROL = "";
     public static final String SQL_QUERY_CONTROL = "";
     public static final String PROCEDURE_QUERY_CONTROL = "";
     protected ProjectController mediator;
     protected DataMap dataMap;
     protected DataDomain domain;
     protected Query query;
     public QueryTypeController(ProjectController mediator) {
         this. = mediator;
         this. = mediator.getCurrentDataMap();
         this. = mediator.getCurrentDataDomain();
     protected void doHandleControl(Control controlthrows ControlException {
         if (control.matchesID()) {
         else if (control.matchesID()) {
         else if (control.matchesID()) {
             // do nothing... need to match control
         else if (control.matchesID()) {
             // do nothing... need to match control
         else if (control.matchesID()) {
             // do nothing... need to match control

Creates and runs QueryTypeDialog.
     public void startup() {
         setView(new QueryTypeDialog());

Action method that creates a query for the specified query type.
     public void createQuery() {
         QueryTypeModel model = (QueryTypeModelgetModel();
         AbstractQuery query = model.getSelectedQuery();
         if (query == null) {
             // wha?
         // update query...
         String queryName = NamedObjectFactory.createName(Query.class);
        // notify listeners
        .fireQueryEvent(new QueryEvent(thisquery, MapEvent.ADD));
                .fireQueryDisplayEvent(new QueryDisplayEvent(thisquery));
New to GrepCode? Check out our FAQ X