當前位置: 首頁>>代碼示例>>Java>>正文


Java FeatureDescriptor.getDisplayName方法代碼示例

本文整理匯總了Java中java.beans.FeatureDescriptor.getDisplayName方法的典型用法代碼示例。如果您正苦於以下問題:Java FeatureDescriptor.getDisplayName方法的具體用法?Java FeatureDescriptor.getDisplayName怎麽用?Java FeatureDescriptor.getDisplayName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.beans.FeatureDescriptor的用法示例。


在下文中一共展示了FeatureDescriptor.getDisplayName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

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

示例3: valueChanged

import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
public void valueChanged(PropertyEditor editor) {
    failed = false;

    try {
        //                System.err.println("ValueChanged - new value " + editor.getValue());
        if (getInplaceEditor() != null) {
            setEnteredValue(getProperty().getValue());
        } else {
            //Handle case where our parent PropertyPanel is no longer showing, but
            //the custom editor we invoked still is.  Issue 38004
            PropertyModel mdl = (modelRef != null) ? modelRef.get() : null;

            if (mdl != null) {
                FeatureDescriptor fd = null;

                if (mdl instanceof ExPropertyModel) {
                    fd = ((ExPropertyModel) mdl).getFeatureDescriptor();
                }

                String title = null;

                if (fd != null) {
                    title = fd.getDisplayName();
                }

                failed = PropUtils.updateProp(mdl, editor, title); //XXX
            }
        }
    } catch (Exception e) {
        throw (IllegalStateException) new IllegalStateException("Problem setting entered value from custom editor").initCause(e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:EditablePropertyDisplayer.java

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

示例5: _mergeFeatureDescriptors

import java.beans.FeatureDescriptor; //導入方法依賴的package包/類
/**
 * Merge information from two FeatureDescriptors into a third
 * FeatureDescriptor.
 * The merged hidden and expert flags are formed by or-ing the values.
 * In the event of other conflicts, the second argument
 * <code>primaryDescriptor</code> is given priority over the first argument
 * <code>secondaryDescriptor</code>.
 * <p>
 * @param secondaryDescriptor  The lower priority FeatureDescriptor
 * @param primaryDescriptor  The higher priority FeatureDescriptor
 * @param mergedDescriptor The FeatureDescriptor to merge the information
 *                         into.
 */
private static void _mergeFeatureDescriptors(
  FeatureDescriptor secondaryDescriptor,
  FeatureDescriptor primaryDescriptor,
  FeatureDescriptor mergedDescriptor
  )
{
  // merge the expert property
  mergedDescriptor.setExpert(secondaryDescriptor.isExpert() |
                             primaryDescriptor.isExpert());

  // merge the hidden property
  mergedDescriptor.setHidden(secondaryDescriptor.isHidden() |
                             primaryDescriptor.isHidden());

  // the primary's name is the merged name
  mergedDescriptor.setName(primaryDescriptor.getName());


  //
  // Merge the short description
  //
  String shortDescription = primaryDescriptor.getShortDescription();

  if (shortDescription == null)
  {
    shortDescription = primaryDescriptor.getShortDescription();
  }

  mergedDescriptor.setShortDescription(shortDescription);


  //
  // Merge the display name
  //
  String displayName = primaryDescriptor.getDisplayName();

  if (displayName == null)
  {
    displayName = primaryDescriptor.getDisplayName();
  }

  mergedDescriptor.setDisplayName(displayName);

  //
  // merge in the Feature values, merging in the secondary descriptor's
  // attributes first, so that any of the primary descriptor's attributes
  // that conflict can override them.
  //
  __addFeatureValues(secondaryDescriptor, mergedDescriptor);
  __addFeatureValues(primaryDescriptor, mergedDescriptor);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:65,代碼來源:JavaIntrospector.java


注:本文中的java.beans.FeatureDescriptor.getDisplayName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。