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 java.awt.Frame;
 import java.util.Map;
A controller for editing Modeler preferences.

Andrus Adamchik
 public class PreferenceDialog extends CayenneController {
     public static final String GENERAL_KEY = "General";
     public static final String DATA_SOURCES_KEY = "Local DataSources";
     public static final String CLASS_PATH_KEY = "ClassPath";
     public static final String TEMPLATES_KEY = "Templates";
     private static final String[] preferenceMenus = new String[] {
     protected PreferenceDialogView view;
     protected Map detailControllers;
     protected PreferenceEditor editor;
     public PreferenceDialog(CayenneController parent) {
         Window parentView = (Window) SwingUtilities.getAncestorOfClass(
         this. = (parentView instanceof Dialog) ? new PreferenceDialogView(
                 (DialogparentView) : new PreferenceDialogView((FrameparentView);
         this. = new HashMap();
         // editor must be configured before startup for "showDetailViewAction()" to work
         this. = new CayenneModelerPreferenceEditor();
     protected void initBindings() {
         final JList list = .getList();
         list.addListSelectionListener(new ListSelectionListener() {
             public void valueChanged(ListSelectionEvent e) {
                 Object selection = list.getSelectedValue();
                 if (selection != null) {
             public void actionPerformed(ActionEvent e) {
            public void actionPerformed(ActionEvent e) {
    public void cancelAction() {
    public void savePreferencesAction() {
        // update

Configures preferences dialog to display an editor for a local DataSource with specified name.
    public void showDataSourceEditorAction(Object dataSourceKey) {
        // this will install needed controller
    public void startupAction(String key) {
        if (key == null) {
            key = ;
    protected void configure() {
        // init known panels
        registerPanel(new GeneralPreferences(this));
        registerPanel(new TemplatePreferences(this));
        // view.getSplit().setDividerLocation(150);
        // show
    protected void registerPanel(String nameCayenneController panelController) {
        .getDetailPanel().add(panelController.getView(), name);
    public Component getView() {
        return ;
    public PreferenceEditor getEditor() {
        return ;
New to GrepCode? Check out our FAQ X