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-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.merge.builtin.visualizer;
import java.beans.*;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
/**
* BeanInfo for graphical merge visualizer.
*
* @author Martin Entlicher
*/
public class GraphicalMergeVisualizerBeanInfo extends SimpleBeanInfo {
/**
* Gets the bean's BeanDescriptor s.
*
* @return BeanDescriptor describing the editable
* properties of this bean. May return null if the
* information should be obtained by automatic analysis.
*/
public BeanDescriptor getBeanDescriptor() {
return new BeanDescriptor(GraphicalMergeVisualizer.class);
}
/**
* Gets the bean's PropertyDescriptor s.
*
* @return An array of PropertyDescriptors describing the editable
* properties supported by this bean. May return null if the
* information should be obtained by automatic analysis.
*
* If a property is indexed, then its entry in the result array will
* belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
* A client of getPropertyDescriptors can use "instanceof" to check
* if a given PropertyDescriptor is an IndexedPropertyDescriptor.
*/
public PropertyDescriptor[] getPropertyDescriptors() {
PropertyDescriptor[] desc;
try {
PropertyDescriptor colorUnresolvedConflict = new PropertyDescriptor("colorUnresolvedConflict", GraphicalMergeVisualizer.class);
colorUnresolvedConflict.setDisplayName (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "PROP_colorUnresolvedConflict"));
colorUnresolvedConflict.setShortDescription (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "HINT_colorUnresolvedConflict"));
PropertyDescriptor colorResolvedConflict = new PropertyDescriptor("colorResolvedConflict", GraphicalMergeVisualizer.class);
colorResolvedConflict.setDisplayName (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "PROP_colorResolvedConflict"));
colorResolvedConflict.setShortDescription (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "HINT_colorResolvedConflict"));
PropertyDescriptor colorOtherConflict = new PropertyDescriptor("colorOtherConflict", GraphicalMergeVisualizer.class);
colorOtherConflict.setDisplayName (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "PROP_colorOtherConflict"));
colorOtherConflict.setShortDescription (NbBundle.getMessage(GraphicalMergeVisualizerBeanInfo.class, "HINT_colorOtherConflict"));
desc = new PropertyDescriptor[] { colorUnresolvedConflict, colorResolvedConflict, colorOtherConflict };
} catch (IntrospectionException ex) {
org.openide.ErrorManager.getDefault().notify(ex);
desc = null;
}
return desc;
}
/**
* A bean may have a "default" property that is the property that will
* mostly commonly be initially chosen for update by human's who are
* customizing the bean.
* @return Index of default property in the PropertyDescriptor array
* returned by getPropertyDescriptors.
* Returns -1 if there is no default property.
*/
public int getDefaultPropertyIndex() {
return 0;
}
/**
* This method returns an image object that can be used to
* represent the bean in toolboxes, toolbars, etc. Icon images
* will typically be GIFs, but may in future include other formats.
*
* Beans aren't required to provide icons and may return null from
* this method.
*
* There are four possible flavors of icons (16x16 color,
* 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
* support a single icon we recommend supporting 16x16 color.
*
* We recommend that icons have a "transparent" background
* so they can be rendered onto an existing background.
*
* @param iconKind The kind of icon requested. This should be
* one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
* ICON_MONO_16x16, or ICON_MONO_32x32.
* @return An image object representing the requested icon. May
* return null if no suitable icon is available.
*/
public java.awt.Image getIcon(int iconKind) {
switch (iconKind) {
case ICON_COLOR_16x16:
return Utilities.loadImage("org/netbeans/modules/merge/builtin/visualizer/mergeModeIcon.gif"); // NOI18N
}
return null;
}
}
|