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.codegen;
 import  org.apache.cayenne.gen.DefaultClassGenerator;
A controller for the class generator dialog.

Andrus Adamchik
     protected CodeGeneratorDialog view;
     public CodeGeneratorController(CayenneController parent, DataMap dataMap) {
         this. = new EntitiesTabController(this);
         this. = new GeneratorTabController(this);
     public Component getView() {
         return ;
     public void startup() {
         // show dialog even on empty DataMap, as custom generation may still take
         // advantage of it
     protected void initBindings() {
         BindingBuilder builder = new BindingBuilder(
         builder.bindToAction(.getCancelButton(), "cancelAction()");
         builder.bindToAction(.getGenerateButton(), "generateAction()");
     public void generatorSelectedAction() {
         Predicate predicate = controller != null
                 ? controller.getDefaultEntityFilter()
                 : PredicateUtils.falsePredicate();
     public void entitySelectedAction() {
        int size = getSelectedEntitiesSize();
        String label;
        if (size == 0) {
            label = "No entities selected";
        else if (size == 1) {
            label = "One entity selected";
        else {
            label = size + " entities selected";
    public void cancelAction() {
    public void generateAction() {
        DefaultClassGenerator generator = .getGenerator();
        if (generator != null) {
            try {
                        "Class generation finished");
            catch (Exception e) {
                        "Error generating classes - " + e.getMessage());
New to GrepCode? Check out our FAQ X