
fluximpl.UntarFileActionImplBeanInfo Maven / Gradle / Ivy
package fluximpl;
import java.awt.*;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.PropertyDescriptor;
import java.util.Arrays;
import java.util.Vector;
/**
* BeanInfo for UntarFileAction.
*
* @author [email protected]
*/
public class UntarFileActionImplBeanInfo extends ActionImplBeanInfo {
/**
* A small image for this custom action to be displayed in the Flux GUI.
*/
private Image smallImage;
/**
* A large image for this custom action to be displayed in the Flux GUI.
*/
private Image bigImage;
/**
* This BeanInfo needs a BeanDescriptor.
*/
protected BeanDescriptor bd = new BeanDescriptor(UntarFileActionImpl.class);
/**
* This BeanInfo needs a BeanDescriptor.
*/
public UntarFileActionImplBeanInfo(BeanDescriptor bd) {
super();
this.bd = bd;
setCategory(bd, ActionImplBeanInfo.FILE);
} // constructor
/**
* This BeanInfo needs a BeanDescriptor.
*/
public UntarFileActionImplBeanInfo() {
// setup bean descriptor in constructor
super();
bd.setDisplayName("Untar File Action");
bd.setShortDescription("Untars a specified tar file.");
setCategory(bd, ActionImplBeanInfo.FILE);
} // constructor
public void setCategory(BeanDescriptor beanDescriptor, String category) {
beanDescriptor.setValue("category", category);
}
/**
* Returns this BeanInfo's BeanDescriptor.
*
* @return This BeanInfo's BeanDescriptor.
*/
public BeanDescriptor getBeanDescriptor() {
return bd;
} // getBeanDescriptor()
/**
* You can change the icon associated with your custom action/trigger here.
*/
public Image getIcon(int type) {
if (type == BeanInfo.ICON_COLOR_16x16) {
return getSmallImage();
} // if
if (type == BeanInfo.ICON_COLOR_32x32) {
return getBigImage();
} // if
return null;
} // getIcon()
/**
* Returns all JavaBean descriptors described by this BeanInfo.
*
* @return All JavaBean descriptors described by this BeanInfo.
*/
public PropertyDescriptor[] getPropertyDescriptors() {
Vector descriptors = new Vector(Arrays.asList(super.getPropertyDescriptors()));
try {
int order = 10;
descriptors.add(makePropertyDescriptor("source", "Source File", UntarFileActionImpl.class.getName(), "getSource", true, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("destination", "Destination Directory", UntarFileActionImpl.class.getName(), "getDestination", true, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("overwriteEnabled", "Overwrite", UntarFileActionImpl.class.getName(), "isOverwriteEnabled", false, null, order++, false, false, false, false));
descriptors.add(makeIndexedPropertyDescriptor("indexedIncludePatterns", "File Include Pattern", UntarFileActionImpl.class.getName(), "getIndexedIncludePatterns", false, null, order++));
descriptors.add(makeIndexedPropertyDescriptor("indexedExcludePatterns", "File Exclude Pattern", UntarFileActionImpl.class.getName(), "getIndexedExcludePatterns", false, null, order++));
} catch (Exception e) {
e.printStackTrace();
throw new IllegalStateException("Could not create property descriptor.");
} // catch
return descriptors.toArray(new PropertyDescriptor[descriptors.size()]);
} // getPropertyDescriptors()
/**
* Returns a small image that represents this JavaBean.
*
* @return A small image that represents this JavaBean.
*/
private Image getSmallImage() {
if (smallImage == null) {
smallImage = loadImage("/UntarFileActionImpl_small.png");
} // if
return smallImage;
} // getSmallImage()
/**
* Returns a large image that represents this JavaBean.
*
* @return A large image that represents this JavaBean.
*/
private Image getBigImage() {
if (bigImage == null) {
bigImage = loadImage("/UntarFileActionImpl_big.png");
} // if
return bigImage;
} // getBigImage()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy