
fluximpl.TwitterActionImplBeanInfo Maven / Gradle / Ivy
The newest version!
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 TwitterAction.
*
* @author [email protected]
*/
public class TwitterActionImplBeanInfo 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;
protected BeanDescriptor bd = new BeanDescriptor(TwitterActionImpl.class);
public TwitterActionImplBeanInfo(BeanDescriptor bd) {
super();
this.bd = bd;
setCategory(bd, ActionImplBeanInfo.NOTIFICATION);
}
public TwitterActionImplBeanInfo() {
super();
bd.setDisplayName("Twitter Action");
bd.setShortDescription("Performs Twitter search or any other Twitter API requests.");
setCategory(bd, ActionImplBeanInfo.NOTIFICATION);
}
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 a small image that represents this JavaBean.
*
* @return A small image that represents this JavaBean.
*/
private Image getSmallImage() {
if (smallImage == null) {
smallImage = loadImage("/TwitterActionImpl_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("/TwitterActionImpl_big.png");
} // if
return bigImage;
} // getBigImage()
public BeanDescriptor getBeanDescriptor() {
return bd;
}
public PropertyDescriptor[] getPropertyDescriptors() {
Vector descriptors = new Vector(Arrays.asList(super.getPropertyDescriptors()));
try {
int order = 10;
descriptors.add(makePropertyDescriptor("consumerKey", "Consumer Key", TwitterActionImpl.class.getName(), "getConsumerKey", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("consumerSecret", "Consumer Secret", TwitterActionImpl.class.getName(), "getConsumerSecret", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("searchQuery", "Search query", TwitterActionImpl.class.getName(), "getSearchQuery", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("oAuthEnabled", "Enable OAuth", TwitterActionImpl.class.getName(), "getOAuthEnabled", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("requestMethod", "Request Method", TwitterActionImpl.class.getName(), "getRequestMethod", true, "fluximpl.RestActionTypeEditor", order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("resourceUrl", "Resource URL", TwitterActionImpl.class.getName(), "getResourceUrl", true, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("count", "Count", TwitterActionImpl.class.getName(), "getCount", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("page", "Page", TwitterActionImpl.class.getName(), "getPage", false, null, order++, false, false, false, false));
descriptors.add(makeIndexedPropertyDescriptor("indexedParameters", "Parameters", TwitterActionImpl.class.getName(), "getIndexedParameters", false, null, order++));
descriptors.add(makePropertyDescriptor("username", "Username", TwitterActionImpl.class.getName(), "getUsername", false, null, order++, false, false, false, false));
descriptors.add(makePropertyDescriptor("password", "Password", TwitterActionImpl.class.getName(), "getPassword", false, null, order, false, false, false, true));
} catch (Exception e) {
e.printStackTrace();
throw new IllegalStateException("Could not create property descriptor.");
} // catch
return descriptors.toArray(new PropertyDescriptor[descriptors.size()]);
}
public void setCategory(BeanDescriptor beanDescriptor, String category) {
beanDescriptor.setValue("category", category);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy