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


Java FeatureDescriptor.getValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: __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

示例4: 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

示例5: getCustomRenderer

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
private TableCellRenderer getCustomRenderer( int row ) {
    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);

    if (fd instanceof PropertySet)
        return null;

    Object res = fd.getValue( "custom.cell.renderer"); //NOI18N
    if( res instanceof TableCellRenderer ) {
        prepareCustomEditor( res );
        return ( TableCellRenderer ) res;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SheetTable.java

示例6: getCustomEditor

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
private TableCellEditor getCustomEditor( int row ) {
    FeatureDescriptor fd = getPropertySetModel().getFeatureDescriptor(row);

    if (fd instanceof PropertySet)
        return null;

    Object res = fd.getValue( "custom.cell.editor"); //NOI18N
    if( res instanceof TableCellEditor ) {
        prepareCustomEditor( res );
        return ( TableCellEditor ) res;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SheetTable.java

示例7: checkEditBoolean

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
/** In the case that an edit request is made on a boolean checkbox property, an
 *  edit request should simply toggle its state without instantiating a custom
 *  editor component.  Returns true if the state was toggled, in which case the
 *  editor instantiation portion of editCellAt() should be aborted  */
boolean checkEditBoolean(int row) {
    FeatureDescriptor fd = getSheetModel().getPropertySetModel().getFeatureDescriptor(row);

    if (fd != null && fd.getValue("stringValues") != null) {
        return false; //NOI18N
    }

    Property p = (fd instanceof Property) ? (Property) fd : null;

    if (p != null) {
        Class c = p.getValueType();

        //only do this if the property is supplying no special values for
        //the tags - if it is, we are using the radio button renderer
        if ((c == Boolean.class) || (c == boolean.class)) {
            if (!isCellEditable(row, 1)) {
                return true;
            }

            //Okay, try to toggle it
            try {
                Boolean b = null;

                //get the current value
                try {
                    Object value = p.getValue();
                    if( value instanceof Boolean ) {
                        b = (Boolean) value;
                    } else {
                        //150048 - somebody has sneaked in a wrong value
                        return false;
                    }
                } catch (ProxyNode.DifferentValuesException dve) {
                    //If we're represeting conflicting multi-selected 
                    //properties, we'll make them both true when we toggle
                    b = Boolean.FALSE;
                }

                if (isEditing()) {
                    removeEditor();
                }

                changeSelection(row, 1, false, false);

                //Toggle the value
                Boolean newValue = ((b == null) || Boolean.FALSE.equals(b)) ? Boolean.TRUE : Boolean.FALSE;
                p.setValue(newValue);

                //Force an event so we'll repaint
                /*
                tableChanged(new TableModelEvent (getSheetModel(), row,
                    row, 1, TableModelEvent.UPDATE));
                 */
                paintRow(row);

                return true;
            } catch (Exception ex) {
                //Something wrong, log it
                Exceptions.printStackTrace(ex);
            }
        }
    }

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

示例8: getTableCellRendererComponent

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(
    JTable table, Object value, boolean selected, boolean hasFocus, int row, int column
) {
    FeatureDescriptor fd = (FeatureDescriptor) value;
    Component result;

    //Use selection color for both columns
    selected |= (hasFocus && (table.getSelectedRow() == row));

    if (fd == null || fd instanceof PropertySet) {
        //#118372 - don't return null, SynthLaF asks for some properties from 
        //the renderer component under JDK1.6_05
        return new JLabel();
    } else {
        if (column == 0) {
            String txt = ((Property) fd).getHtmlDisplayName();
            boolean isHtml = txt != null;

            if (!isHtml) {
                txt = fd.getDisplayName();
            }

            JLabel lbl = htmlLabel;

            HtmlRenderer.Renderer ren = (HtmlRenderer.Renderer) lbl;

            ren.setHtml(isHtml);

            lbl.setText(txt);

            if (selected) {
                lbl.setBackground(table.getSelectionBackground());
                lbl.setForeground(table.getSelectionForeground());
            } else {
                lbl.setBackground(table.getBackground());
                lbl.setForeground(table.getForeground());
            }

            lbl.setOpaque(selected);

            if (includeMargin) {
                lbl.setBorder(
                    BorderFactory.createMatteBorder(0, PropUtils.getMarginWidth() + 2, 0, 0, lbl.getBackground())
                );
            } else {
                lbl.setBorder(
                    BorderFactory.createMatteBorder(0, PropUtils.getTextMargin(), 0, 0, lbl.getBackground())
                );
            }

            //Support for name marking with icon requested by form editor
            Object o = fd.getValue("nameIcon"); //NOI18N

            if (o instanceof Icon) {
                lbl.setIcon((Icon) o);
            } else if (o instanceof Image) {
                lbl.setIcon(new ImageIcon((Image) o));
            } else {
                lbl.setIcon(null);
            }

            result = lbl;
        } else {
            result = factory().getRenderer((Property) fd);

            if (selected) {
                result.setBackground(table.getSelectionBackground());
                result.setForeground(table.getSelectionForeground());
            } else {
                result.setBackground(table.getBackground());
                result.setForeground(table.getForeground());
            }

            ((JComponent) result).setOpaque(selected);
        }
    }

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

示例9: attachEnv

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
public void attachEnv (PropertyEnv env) {
    FeatureDescriptor d = env.getFeatureDescriptor ();
    if (d instanceof Node.Property) {
        canWrite = ((Node.Property)d).canWrite ();
    }
    
    Object o;
    Image imgs [] = null;
    Integer vals [] = null;
    String descs [] = null;
    
    o = d.getValue (PROP_IMAGES);
    if (o instanceof Image []) {
        imgs = (Image [])o;
    }
    o = d.getValue (PROP_VALUES);
    if (o instanceof Integer []) {
        vals = (Integer [])o;
    }
    o = d.getValue (PROP_DESCRIPTIONS);
    if (o instanceof String []) {
        descs = (String [])o;
    }
    
    if (imgs != null && vals != null) {
        int length = length = imgs.length;

        if(vals.length < length)  {
            length = vals.length;
        }

        if (descs != null && descs.length < length) {
            length = descs.length;
        }

        images = new Image [length];
        values = new Integer [length];
        descriptions = new String [length];

        for (int i = 0; i < length; i++) {
            images [i] = imgs [i];
            values [i] = vals [i];
            descriptions [i] = descs == null ? vals [i].toString () : descs [i];
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:ListImageEditor.java

示例10: test

import java.beans.FeatureDescriptor; //导入方法依赖的package包/类
private static void test(Object expected, FeatureDescriptor fd) {
    System.out.println(fd.getName());
    Object actual = fd.getValue("transient"); // NON-NLS: the attribute name
    if ((actual == null) ? (expected != null) : !actual.equals(expected))
        throw new Error("expected " + expected + " value, but actual value is " + actual);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:Test4935607.java


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