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;
A controller for the class generator dialog.
 public class CodeGeneratorController extends CodeGeneratorControllerBase {
Logger to print stack traces
     private static Log logObj = LogFactory.getLog(ErrorDebugDialog.class);
     protected CodeGeneratorDialog view;
     protected ClassesTabController clessSelector;
     public CodeGeneratorController(CayenneController parent, DataMap dataMap) {
         this. = new ClassesTabController(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.getDefaultClassFilter()
                : PredicateUtils.falsePredicate();
    public void classesSelectedAction() {
        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";
        label = label.concat("; ");
        int sizeEmb = getSelectedEmbeddablesSize();
        if (sizeEmb == 0) {
            label = label + "No embeddables selected";
        else if (sizeEmb == 1) {
            label = label + "One embeddable selected";
        else {
            label =label + sizeEmb + " embeddables selected";
    public void cancelAction() {
    public void generateAction() {
        ClassGenerationAction generator = .getGenerator();
        if (generator != null) {
            try {
                        "Class generation finished");
            catch (Exception e) {
                .error("Error generating classes"e);
                        "Error generating classes - " + e.getMessage());
New to GrepCode? Check out our FAQ X