当前位置: 首页>>代码示例>>Java>>正文


Java FeatureDescriptor类代码示例

本文整理汇总了Java中java.beans.FeatureDescriptor的典型用法代码示例。如果您正苦于以下问题:Java FeatureDescriptor类的具体用法?Java FeatureDescriptor怎么用?Java FeatureDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FeatureDescriptor类属于java.beans包,在下文中一共展示了FeatureDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getSelection

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/** Internal implementation of getSelection() which returns the selected feature
 *  descriptor whether or not the component has focus. */
public final FeatureDescriptor _getSelection() {
    int i = getSelectedRow();
    FeatureDescriptor result;

    //Check bounds - a change can be fired after the model has been changed, but
    //before the table has received the event and updated itself, in which case
    //you get an AIOOBE
    if (i < getPropertySetModel().getCount()) {
        result = getSheetModel().getPropertySetModel().getFeatureDescriptor(getSelectedRow());
    } else {
        result = null;
    }

    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SheetTable.java

示例2: select

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Select (and start editing) the given property.
 * @param fd
 * @param startEditing
 */
public void select( FeatureDescriptor fd, boolean startEditing ) {
    PropertySetModel psm = getPropertySetModel();
    final int index = psm.indexOf( fd );
    if( index < 0 ) {
        return; //not in our list
    }

    getSelectionModel().setSelectionInterval( index, index );
    if( startEditing && psm.isProperty( index ) ) {
        editCellAt( index, 1, new MouseEvent( SheetTable.this, 0, System.currentTimeMillis(), 0, 0, 0, 1, false) );
        SwingUtilities.invokeLater( new Runnable() {
            @Override
            public void run() {
                SheetCellEditor cellEditor = getEditor();
                if( null != cellEditor ) {
                    InplaceEditor inplace = cellEditor.getInplaceEditor();
                    if( null != inplace && null != inplace.getComponent() ) {
                        inplace.getComponent().requestFocus();
                    }
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:SheetTable.java

示例3: actionPerformed

import java.beans.FeatureDescriptor; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
    int i = getSelectedRow();

    if (i != -1) {
        FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(i);

        if (fd instanceof Property) {
            java.beans.PropertyEditor ped = PropUtils.getPropertyEditor((Property) fd);
            System.err.println(ped.getClass().getName());
        } else {
            System.err.println("PropertySets - no editor"); //NOI18N
        }
    } else {
        System.err.println("No selection"); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SheetTable.java

示例4: createTransferable

import java.beans.FeatureDescriptor; //导入依赖的package包/类
@Override
protected Transferable createTransferable(JComponent c) {
    if (c instanceof SheetTable) {
        SheetTable table = (SheetTable) c;
        FeatureDescriptor fd = table.getSelection();

        if (fd == null) {
            return null;
        }

        String res = fd.getDisplayName();

        if (fd instanceof Node.Property) {
            Node.Property prop = (Node.Property) fd;
            res += ("\t" + PropUtils.getPropertyEditor(prop).getAsText());
        }

        return new SheetTableTransferable(res);
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:SheetTable.java

示例5: toggleExpanded

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Expand or collapse the PropertySet the given property belongs to.
 * @param fd 
 * @since 6.47
 */
protected final void toggleExpanded( FeatureDescriptor fd ) {
    int index = table.getPropertySetModel().indexOf( fd );
    if( index >= 0 ) {
        table.getPropertySetModel().toggleExpanded( index );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:PropertySheet.java

示例6: ModelProperty

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/** Creates a new instance of ModelProperty */
private ModelProperty(PropertyModel pm) {
    super(pm.getPropertyType());
    this.mdl = pm;

    if (mdl instanceof ExPropertyModel) {
        FeatureDescriptor fd = ((ExPropertyModel) mdl).getFeatureDescriptor();
        Boolean result = (Boolean) fd.getValue("canEditAsText"); // NOI18N

        if (result != null) {
            this.setValue("canEditAsText", result);
        }
    }

    //System.err.println(
    //"Created ModelProperty wrapper for mystery PropertyModel " + pm);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ModelProperty.java

示例7: setFeatureDescriptor

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Feature descritor that describes the property. It is feature
 * descriptor so one can plug in PropertyDescritor and also Node.Property
 * which both inherit from FeatureDescriptor
 */
void setFeatureDescriptor(FeatureDescriptor desc) {
    if (desc == null) {
        throw new IllegalArgumentException("Cannot set FeatureDescriptor to null."); //NOI18N
    }

    this.featureDescriptor = desc;

    if (featureDescriptor != null) {
        Object obj = featureDescriptor.getValue(PROP_CHANGE_IMMEDIATE);

        if (obj instanceof Boolean) {
            setChangeImmediate(((Boolean) obj).booleanValue());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:PropertyEnv.java

示例8: readEnv

import java.beans.FeatureDescriptor; //导入依赖的package包/类
void readEnv (FeatureDescriptor desc) {
    if (desc instanceof Node.Property){
        Node.Property prop = (Node.Property)desc;
        editable = prop.canWrite();
        //enh 29294 - support one-line editor & suppression of custom
        //editor
        instructions = (String) prop.getValue ("instructions"); //NOI18N
        oneline = Boolean.TRUE.equals (prop.getValue ("oneline")); //NOI18N
        customEd = !Boolean.TRUE.equals (prop.getValue
            ("suppressCustomEditor")); //NOI18N
    }
    Object obj = desc.getValue(ObjectEditor.PROP_NULL);
    if (Boolean.TRUE.equals(obj)) {
        nullValue = NbBundle.getMessage(StringEditor.class, "CTL_NullValue");
    } else {
        if (obj instanceof String) {
            nullValue = (String)obj;
        } else {
            nullValue = null;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:StringEditor.java

示例9: getFeatureDescriptors

import java.beans.FeatureDescriptor; //导入依赖的package包/类
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
	if (base == null) {
		return null;
	}

	try {
		BeanInfo info = Introspector.getBeanInfo(base.getClass());
		PropertyDescriptor[] pds = info.getPropertyDescriptors();
		for (int i = 0; i < pds.length; i++) {
			pds[i].setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
			pds[i].setValue(TYPE, pds[i].getPropertyType());
		}
		return Arrays.asList((FeatureDescriptor[]) pds).iterator();
	} catch (IntrospectionException e) {
		//
	}

	return null;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:BeanELResolver.java

示例10: getFeatureDescriptors

import java.beans.FeatureDescriptor; //导入依赖的package包/类
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
    if (base == null) {
        return null;
    }

    try {
        BeanInfo info = Introspector.getBeanInfo(base.getClass());
        PropertyDescriptor[] pds = info.getPropertyDescriptors();
        for (int i = 0; i < pds.length; i++) {
            pds[i].setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
            pds[i].setValue(TYPE, pds[i].getPropertyType());
        }
        return Arrays.asList((FeatureDescriptor[]) pds).iterator();
    } catch (IntrospectionException e) {
        //
    }

    return null;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:BeanELResolver.java

示例11: testGetFeatureDescriptors02

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    BeanELResolver resolver = new BeanELResolver();
    ELContext context = new ELContextImpl();

    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(context, new Bean());

    while (result.hasNext()) {
        PropertyDescriptor featureDescriptor = (PropertyDescriptor) result.next();
        Assert.assertEquals(featureDescriptor.getPropertyType(),
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE,
                featureDescriptor.getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:TestBeanELResolver.java

示例12: testGetFeatureDescriptors02

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    MapELResolver mapELResolver = new MapELResolver();
    ELContext context = new ELContextImpl();

    Map<String, String> map = new HashMap<String, String>();
    map.put("key", "value");
    Iterator<FeatureDescriptor> result = mapELResolver
            .getFeatureDescriptors(context, map);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key", featureDescriptor.getDisplayName());
        Assert.assertEquals("key", featureDescriptor.getName());
        Assert.assertEquals("", featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals("key".getClass(),
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE, featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:TestMapELResolver.java

示例13: testGetFeatureDescriptors02

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Tests that a valid FeatureDescriptors are returned.
 */
@Test
public void testGetFeatureDescriptors02() {
    ResourceBundleELResolver resolver = new ResourceBundleELResolver();
    ELContext context = new ELContextImpl();

    ResourceBundle resourceBundle = new TesterResourceBundle(
            new Object[][] { { "key", "value" } });
    @SuppressWarnings("unchecked")
    Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(
            context, resourceBundle);

    while (result.hasNext()) {
        FeatureDescriptor featureDescriptor = result.next();
        Assert.assertEquals("key", featureDescriptor.getDisplayName());
        Assert.assertEquals("key", featureDescriptor.getName());
        Assert.assertEquals("", featureDescriptor.getShortDescription());
        Assert.assertFalse(featureDescriptor.isExpert());
        Assert.assertFalse(featureDescriptor.isHidden());
        Assert.assertTrue(featureDescriptor.isPreferred());
        Assert.assertEquals(String.class,
                featureDescriptor.getValue(ELResolver.TYPE));
        Assert.assertEquals(Boolean.TRUE, featureDescriptor
                .getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:TestResourceBundleELResolver.java

示例14: __addFeatureValues

import java.beans.FeatureDescriptor; //导入依赖的package包/类
/**
 * Add all of the attributes of one FeatureDescriptor to thos
 * of another, replacing any attributes that conflict.
 */
static void __addFeatureValues(
  FeatureDescriptor addingDescriptor,
  FeatureDescriptor destinationDescriptor
  )
{
  Enumeration<String> keys = addingDescriptor.attributeNames();

  if (keys != null)
  {
    while (keys.hasMoreElements())
    {
      String key = keys.nextElement();
      Object value = addingDescriptor.getValue(key);
      destinationDescriptor.setValue(key, value);
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:JavaIntrospector.java

示例15: print

import java.beans.FeatureDescriptor; //导入依赖的package包/类
private static void print(FeatureDescriptor descriptor) {
    String name = descriptor.getName();
    String display = descriptor.getDisplayName();
    String description = descriptor.getShortDescription();
    System.out.println("name: " + name);
    if (!Objects.equals(name, display)) {
        System.out.println("display name: " + display);
    }
    if (!Objects.equals(display, description)) {
        System.out.println("description: " + description.trim());
    }
    print("expert", descriptor.isExpert());
    print("hidden", descriptor.isHidden());
    print("preferred", descriptor.isPreferred());
    TreeMap<String,Object> map = new TreeMap<>();
    Enumeration<String> enumeration = descriptor.attributeNames();
    while (enumeration.hasMoreElements()) {
        String id = enumeration.nextElement();
        Object value = descriptor.getValue(id);
        if (value.getClass().isArray()) {
            TreeSet<String> set = new TreeSet<>();
            int index = 0;
            int length = Array.getLength(value);
            while (index < length) {
                set.add(Array.get(value, index++) + ", " +
                        Array.get(value, index++) + ", " +
                        Array.get(value, index++));
            }
            value = set.toString();
        }
        map.put(id, value);
    }
    for (Entry<String,Object> entry : map.entrySet()) {
        System.out.println(entry.getKey() + ": " + entry.getValue());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:Test4058433.java


注:本文中的java.beans.FeatureDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。