alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */



package org.netbeans.modules.javacvs.customizers;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import org.netbeans.modules.javacvs.commands.FileSystemCommand;
import org.netbeans.modules.javacvs.CvsCommand;
import org.netbeans.modules.javacvs.commands.FileSystemCommandImpl;
import org.netbeans.modules.javacvs.commands.FsGlobalOptionsImpl;
import org.netbeans.modules.javacvs.FsGlobalOptions;


/** 
 * @author mkleint
 */
public class CustomizerPropChangeSupport  {
    
    public static final String PROPERTY_CVS_COMMAND_LINE = "Command_line_Equivalent"; //NOI18N
    public static final String PROPERTY_GLOBAL_COMMAND_LINE = "Global_Command_line_Equivalent"; //NOI18N
    
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private java.beans.Customizer custom;
    private FileSystemCommand outerClass = null;
    private String oldVal = null;
    
    
    /** Creates new AbstractWizardPanel */
    public CustomizerPropChangeSupport(java.beans.Customizer custom) {
        this.custom = custom;
        
    }
    
    
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
  
    public void firePropertyChange(CvsCommand command) {
        if (command instanceof FileSystemCommandImpl) {
            FileSystemCommand outerClass = ((FileSystemCommandImpl)command).getOuterClassInstance();
            String newVal = outerClass.getCVSCommand();
            if (oldVal == null) {
                oldVal = ""; //NOI18N
            }
            firePropertyChange(PROPERTY_CVS_COMMAND_LINE, oldVal, newVal);
            oldVal = newVal;
        }
    }
    
    public void firePropertyChange(FsGlobalOptions global) {
        if (global instanceof FsGlobalOptionsImpl) {
            FsGlobalOptionsImpl gl = ((FsGlobalOptionsImpl)global);
            String newVal =  gl.getCVSArguments();
            if (oldVal == null) {
                oldVal = ""; //NOI18N
            }
            firePropertyChange(PROPERTY_GLOBAL_COMMAND_LINE, oldVal, newVal);
            oldVal = newVal;
        }
    }
  
    public void firePropertyChange(String str, Object obj, Object obj2) {
        PropertyChangeEvent event = new PropertyChangeEvent(custom, str , obj, obj2);
        changeSupport.firePropertyChange(event);
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.