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 http://www.apache.org/licenses/LICENSE-2.0 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.util;
 
 import java.awt.Frame;
 
 
 import  org.scopemvc.view.awt.AWTUtilities;

Superclass of CayenneModeler dialogs. Adds support for popping hyperlinks in the default system browser.
 
 public class CayenneDialog extends JDialog implements HyperlinkListener {
 
     public CayenneDialog() throws HeadlessException {
         super();
     }
 
     public CayenneDialog(Frame ownerthrows HeadlessException {
         super(owner);
     }
 
     public CayenneDialog(Frame ownerboolean modalthrows HeadlessException {
         super(ownermodal);
     }
 
     public CayenneDialog(Frame ownerString titlethrows HeadlessException {
         super(ownertitle);
     }
 
     public CayenneDialog(Frame ownerString titleboolean modal)
         throws HeadlessException {
         super(ownertitlemodal);
     }
 
     public CayenneDialog(
         Frame owner,
         String title,
         boolean modal,
         GraphicsConfiguration gc) {
         super(ownertitlemodalgc);
     }
 
     public CayenneDialog(Dialog ownerthrows HeadlessException {
         super(owner);
     }
 
     public CayenneDialog(Dialog ownerboolean modalthrows HeadlessException {
         super(ownermodal);
     }
 
     public CayenneDialog(Dialog ownerString titlethrows HeadlessException {
         super(ownertitle);
     }
 
     public CayenneDialog(Dialog ownerString titleboolean modal)
         throws HeadlessException {
         super(ownertitlemodal);
     }
 
     public CayenneDialog(
         Dialog owner,
         String title,
         boolean modal,
         GraphicsConfiguration gc)
        throws HeadlessException {
        super(ownertitlemodalgc);
    }
    public CayenneDialog(CayenneModelerFrame frameString titleboolean modal) {
        super(frametitlemodal);
    }

    
Makes dialog closeable when ESC button is clicked.
    protected void initCloseOnEscape() {
        // make dialog closable on escape
        // TODO: Note that if a dialog contains subcomponents
        // that use ESC for their own purposes (like editable JTable or JComboBox),
        // this code will still close the dialog  (e.g. not just an expanded 
        // ComboBox). To fix it see this advise (Swing is Fun!!):
        //
        //   http://www.eos.dk/pipermail/swing/2001-June/000789.html
        KeyStroke escReleased = KeyStroke.getKeyStroke(., 0, true);
        ActionListener closeAction = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (CayenneDialog.this.isVisible()) {
                    // dispatch window closing event
                    WindowEvent windowClosing =
                        new WindowEvent(CayenneDialog.this.);
                    CayenneDialog.super.processWindowEvent(windowClosing);
                }
            }
        };
            closeAction,
            escReleased,
            .);
    }

    
Centers this dialog relative to the parent Window
    public void centerWindow() {
        AWTUtilities.centreOnWindow(getParentEditor(), this);
    }
        return (CayenneModelerFramesuper.getParent();
    }

    
Opens hyperlink in the default browser.
    public void hyperlinkUpdate(HyperlinkEvent event) {
        if (event.getEventType() == ..) {
            BrowserControl.displayURL(event.getURL().toExternalForm());
        }
    }

    
Returns current CayenneModeler mediator.
    public ProjectController getMediator() {
        return Application.getInstance().getFrameController().getProjectController();
    }
    protected void dialogInit() {
        super.dialogInit();
        initCloseOnEscape();
    }
New to GrepCode? Check out our FAQ X