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.pref;
 import  org.apache.cayenne.validation.ValidationException;

 public class GeneralPreferences extends CayenneController {
     public static final String AUTO_LOAD_PROJECT_PREFERENCE = "autoLoadProject";
     public static final String DELETE_PROMPT_PREFERENCE = "deletePrompt";
     public static final String ENCODING_PREFERENCE = "encoding";
     protected GeneralPreferencesView view;
     protected CayennePreferenceEditor editor;
     protected ObjectBinding saveIntervalBinding;
     protected ObjectBinding encodingBinding;
     protected ObjectBinding deletePromptBinding;
     public GeneralPreferences(PreferenceDialog parentController) {
         this. = new GeneralPreferencesView();
         PreferenceEditor editor = parentController.getEditor();
         if (editor instanceof CayennePreferenceEditor) {
             this. = (CayennePreferenceEditoreditor;
         else {
     public Component getView() {
         return ;
     protected void initBindings() {
         // init model objects
         Domain classGeneratorDomain = .editableInstance(getApplication()
         this. = classGeneratorDomain
         // build child controllers...
         EncodingSelector encodingSelector = new EncodingSelector(this
         // create bindings...
         BindingBuilder builder = new BindingBuilder(
        this. = builder.bindToTextField(.getSaveInterval(),
        this. = builder.bindToProperty(encodingSelector,
        this. = builder.bindToCheckBox(.getDeletePrompt(),
    public double getTimeInterval() {
        return this..getSaveInterval() / 1000.0;
    public void setTimeInterval(double d) {
        int ms = (int) (d * 1000.0);
        if (ms < .) {
            throw new ValidationException(
                    "Time interval is too small, minimum allowed is "
                            + (. / 1000.0));
    public boolean getAutoLoadProject() {
    public void setAutoLoadProject(boolean autoLoadProject) {
    public boolean getDeletePrompt() {
    public void setDeletePrompt(boolean deletePrompt) {
        return ;
New to GrepCode? Check out our FAQ X