visualweb.websvcmgr/test/unit/src/org/netbeans/modules/websvc/manager/test/DialogDisplayerNotifier.java
author Jesse Glick <jglick@netbeans.org>
Wed, 23 Mar 2011 16:50:27 -0400
changeset 3213 c85dcf71e424
permissions -rw-r--r--
Tests at least should compile now.
     1 /*
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3  *
     4  * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
     5  *
     6  * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
     7  * Other names may be trademarks of their respective owners.
     8  *
     9  * The contents of this file are subject to the terms of either the GNU
    10  * General Public License Version 2 only ("GPL") or the Common
    11  * Development and Distribution License("CDDL") (collectively, the
    12  * "License"). You may not use this file except in compliance with the
    13  * License. You can obtain a copy of the License at
    14  * http://www.netbeans.org/cddl-gplv2.html
    15  * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    16  * specific language governing permissions and limitations under the
    17  * License.  When distributing the software, include this License Header
    18  * Notice in each file and include the License file at
    19  * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    20  * particular file as subject to the "Classpath" exception as provided
    21  * by Oracle in the GPL Version 2 section of the License file that
    22  * accompanied this code. If applicable, add the following below the
    23  * License Header, with the fields enclosed by brackets [] replaced by
    24  * your own identifying information:
    25  * "Portions Copyrighted [year] [name of copyright owner]"
    26  * 
    27  * Contributor(s):
    28  * 
    29  * Portions Copyrighted 2007 Sun Microsystems, Inc.
    30  */
    31 
    32 package org.netbeans.modules.websvc.manager.test;
    33 
    34 import java.awt.Dialog;
    35 import java.util.LinkedList;
    36 import org.openide.DialogDescriptor;
    37 import org.openide.DialogDisplayer;
    38 import org.openide.NotifyDescriptor;
    39 
    40 /**
    41  *
    42  * @author quynguyen
    43  */
    44 public class DialogDisplayerNotifier extends DialogDisplayer {
    45     private LinkedList<WebServiceManagerListener> listeners = new LinkedList<WebServiceManagerListener>();
    46     
    47     public void addListener(WebServiceManagerListener listener) {
    48         listeners.add(listener);
    49     }
    50     
    51     public void removeListener(WebServiceManagerListener listener) {
    52         listeners.remove(listener);
    53     }
    54     
    55     public void removeAllListeners() {
    56         listeners.clear();
    57     }
    58     
    59     @Override
    60     public Object notify(NotifyDescriptor descriptor) {
    61         for (WebServiceManagerListener listener : listeners) {
    62             listener.eventFired(new WebServiceManagerEvent((String)descriptor.getMessage()));
    63         }
    64         return NotifyDescriptor.OK_OPTION;
    65     }
    66 
    67     @Override
    68     public Dialog createDialog(DialogDescriptor descriptor) {
    69         return null;
    70     }
    71 
    72 }