Java Code Examples for java.beans.FeatureDescriptor#getDisplayName()
The following examples show how to use
java.beans.FeatureDescriptor#getDisplayName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SheetTable.java From netbeans with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: EditablePropertyDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
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); } }
Example 3
Source File: Test4058433.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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()); } }
Example 4
Source File: SheetCellRenderer.java From netbeans with Apache License 2.0 | 4 votes |
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; }