Refine search
@Override public int hashCode() { Class<?> valueType = getValueType(); return getName().hashCode() * ((valueType == null) ? 1 : valueType.hashCode()); }
private JComponent getNumberRenderer(Property<?> property, Node n, boolean hasFocus) throws IllegalAccessException, InvocationTargetException { Object value = property.getValue(); PropertyEditor propEd = property.getPropertyEditor(); if (propEd != null) { try { propEd.setValue(value); value = propEd.getAsText(); } catch (Exception ex) { // no problem here - just leave null tooltip } } JLabel result = new JLabel(value+ "", SwingConstants.RIGHT); if (hasFocus){ result.setBorder(new LineBorder(UIManager.getColor("Tree.selectionBorderColor"), 1));//NOI18N, } return result; }
private void updateButtonState() { // refresh the lookup selectedLookup.lookup(Object.class); if (showingDetails) { detailsButton.setText(NbBundle.getMessage(IndexedEditorPanel.class, "CTL_HideDetails")); } else { detailsButton.setText(NbBundle.getMessage(IndexedEditorPanel.class, "CTL_ShowDetails")); } upButton.setEnabled((moveUp != null) && (moveUp.isEnabled())); downButton.setEnabled((moveDown != null) && (moveDown.isEnabled())); Node[] sn = getExplorerManager().getSelectedNodes(); deleteButton.setEnabled((sn != null) && (sn.length == 1) && (sn[0] != rootNode)); detailsButton.setVisible( (prop != null) && (prop.getPropertyEditor() != null) && (prop.getPropertyEditor().supportsCustomEditor()) ); if (detailsButton.isVisible()) { if (showingDetails) { Mnemonics.setLocalizedText(detailsButton, NbBundle.getMessage(IndexedEditorPanel.class, "CTL_HideDetails")); detailsButton.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(IndexedEditorPanel.class, "ACSD_HideDetails") ); } else { Mnemonics.setLocalizedText(detailsButton, NbBundle.getMessage(IndexedEditorPanel.class, "CTL_ShowDetails")); detailsButton.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(IndexedEditorPanel.class, "ACSD_ShowDetails") ); } detailsButton.setEnabled((sn != null) && (sn.length == 1) && (sn[0] != rootNode)); } }
public PropertyEditor getPropertyEditor() { if (propertyEditorClass != null) { try { return propertyEditorClass.newInstance(); } catch (InstantiationException ex) { Exceptions.printStackTrace(ex); } catch (IllegalAccessException iex) { Exceptions.printStackTrace(iex); } } return super.getPropertyEditor(); }
/** Finds index for property with specified name. * @param name of the property * @return the index or -1 if not found */ private int findIndex(String name) { int s = props.size(); for (int i = 0; i < s; i++) { Node.Property<?> p = props.get(i); if (p.getName().equals(name)) { return i; } } return -1; }
@Override public boolean equals(Object property) { // fix #32845 - check for non-matching types and also for null values // coming in input parameter 'property' if (!(property instanceof Property)) { return false; } Class<?> propValueType = ((Property) property).getValueType(); Class<?> valueType = getValueType(); if (((propValueType == null) && (valueType != null)) || ((propValueType != null) && (valueType == null))) { return false; } return ((Property) property).getName().equals(getName()) && (((propValueType == null) && (valueType == null)) || propValueType.equals(valueType)); }
/** Add a property to this set, replacing any old one with the same name. * @param p the property to add * @return the property with the same name that was replaced, or <code>null</code> for a fresh insertion */ public synchronized Node.Property<?> put(Node.Property<?> p) { int indx = findIndex(p.getName()); Node.Property<?> removed; if (indx != -1) { // replaces the original one removed = props.set(indx, p); } else { // adds this to the end props.add(p); removed = null; } // clears computed array and fires into about change of properties refresh(); return removed; }
/** Add several properties to this set, replacing old ones with the same names. * * @param ar properties to add */ public synchronized void put(Node.Property<?>[] ar) { for (int i = 0; i < ar.length; i++) { Node.Property<?> p = ar[i]; p = ar[i]; int indx = findIndex(p.getName()); if (indx != -1) { // replaces the original one props.set(indx, p); } else { // adds this to the end props.add(p); } } // clears computed array and fires into about change of properties refresh(); }
if (ps[j].getName().equals(name)) { exists = true;
/** It sets name, displayName and short description. * Remembers original. */ public ProxyProperty(Node.Property[] original) { super(original[0].getValueType()); this.original = original; setName(original[0].getName()); setDisplayName(original[0].getDisplayName()); setShortDescription(original[0].getShortDescription()); }
void makeAccessibleCheckBox(JCheckBox box, Property p) { box.getAccessibleContext().setAccessibleName(p.getDisplayName()); box.getAccessibleContext().setAccessibleDescription(p.getShortDescription()); Object mnemonicChar = p.getValue(ATTR_MNEMONIC_CHAR); if ((null != mnemonicChar) && (mnemonicChar.toString().length() > 0)) { box.setMnemonic(mnemonicChar.toString().charAt(0)); } }
String getDisplayNameWithMnemonic( Property p ) { String res = null; Object displayNameWithMnemonic = p.getValue(ATTR_DISPLAY_NAME_WITH_MNEMONIC); if( null !=displayNameWithMnemonic && displayNameWithMnemonic.toString().length() > 0 ) { res = displayNameWithMnemonic.toString(); } else { res = p.getDisplayName(); } return res; }
/** Searches for a named property in a property set */ private static Property findProperty(PropertySet set, String name) { Property[] p = set.getProperties(); for (int i = 0; i < p.length; i++) { if (p[i].getName().equals(name)) { return p[i]; } } return null; }
@Override public boolean equals(Object o) { return o != null && o instanceof Property && getName().equals(((Property)o).getName()); }
public String toString() { StringBuffer sb = new StringBuffer("Inline editor for property "); //NOI18N sb.append(getProperty().getDisplayName()); sb.append(" = "); //NOI18N sb.append(getProperty()); sb.append(" inplace editor="); //NOI18N sb.append(getInplaceEditor()); return sb.toString(); }
@Override public String getColumnName(int column) { assert column < prop.length : column + " must be bellow " + prop.length; if (names [column] == null) { String n = prop[column].getDisplayName (); JLabel l = new JLabel (); Mnemonics.setLocalizedText (l, n); names [column] = l.getText (); } return names [column]; }
/** Setter for property visibleIndex. * @param visibleIndex New value of property visibleIndex. */ public void setVisibleIndex(int visibleIndex) { property.setValue(ATTR_ORDER_NUMBER, new Integer(visibleIndex)); } }