private void initEditor() { try { Object val = getValue(); Class cls = val == null ? getValueClass() : val.getClass(); cellEditor = editorMap.get(cls); if (cellEditor != null) { return; } if (cls.isEnum()) { JComboBox comboBox = new JComboBox(cls.getEnumConstants()); cellEditor = new DefaultCellEditor(comboBox); return; } for (Class class1 : assignableClasses) { if (class1.isAssignableFrom(cls)) { cellEditor = editorMap.get(class1); return; } } editor = java.beans.PropertyEditorManager.findEditor(cls); if (editor != null && editor.supportsCustomEditor()) { cellEditor = new PropertyEditorAdapter(editor, this); return; } System.out.println("Warning no editor found for property '" + name + "' with class " + cls); } catch (Exception e) { e.printStackTrace(); } }
@Override public boolean supportsCustomEditor() { return ed.supportsCustomEditor(); } }
/** * {@inheritDoc} */ @Override public boolean supportsCustomEditor() { return delegate.supportsCustomEditor(); }
/** * @return true if supports a custom editor */ @Override public boolean supportsCustomEditor() { return editor.supportsCustomEditor(); }
public boolean supportsCustomEditor() { return pe.supportsCustomEditor(); }
public double getWeightOf( PropertyEditor pe ){ if( pe==null )return -99; synchronized(sync){ Double w = propertyEditorWeightMap.get(pe); if( w!=null )return w; if( pe.supportsCustomEditor() )return 2; return 1; } }
public TreeTableWrapEditor( PropertyEditor pe ){ if (pe== null) { throw new IllegalArgumentException("pe==null"); } this.pe = pe; if( !pe.supportsCustomEditor() ){ textField = new JTextField(); } }
@Override public boolean supportsCustomEditor() { if (true) return true; return getPropertyEditor().supportsCustomEditor(); } }
@Override public void setValue(Object o) { if ((null != o) && (null != editor) && editor.supportsCustomEditor()) { editor.setValue(o); String val = editor.getAsText(); if( null == val ) val = ""; setText(val); } else { setText((o != null) ? o.toString() : ""); //NOI18N } }
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)); } }
protected void checkSupportsCustomEditor() { assertThat( editor.supportsCustomEditor(), is( equalTo( false ) ) ); }
public Component getTableCellEditorComponent( final JTable table, final Object value, final boolean isSelected, final int row, final int column ) { propertyEditor.setValue( value ); if ( propertyEditor.supportsCustomEditor() ) { usingCustomEditor = true; return propertyEditor.getCustomEditor(); } else { final String[] tags = propertyEditor.getTags(); if ( tags != null ) { usingCustomEditor = false; usingTags = true; tagsCellEditor.setModel( new DefaultComboBoxModel( tags ) ); tagsCellEditor.setSelectedItem( propertyEditor.getAsText() ); return tagsCellEditor; } else { usingCustomEditor = false; usingTags = false; defaultCellEditor.setText( propertyEditor.getAsText() ); return defaultCellEditor; } } }
public static Object getCustomPropertyEditor(PropertyEditor editor, Class<?> componentClass) { if (editor instanceof GenericPropertyEditor) { GenericPropertyEditor genericEditor = (GenericPropertyEditor) editor; if (genericEditor.supportsCustomEditor(componentClass)) { return genericEditor.getCustomEditor(componentClass); } } if (componentClass != java.awt.Component.class) { return null; } return editor.supportsCustomEditor() ? editor.getCustomEditor() : null; }
(prop != null) && (prop.getPropertyEditor() != null) && (prop.getPropertyEditor().supportsCustomEditor()) ); if (detailsButton.isVisible()) {
/** * Tries to determine a view for the editor. * * @param editor the editor to get the view for * @return the view, null if failed to determine one */ public static JComponent findView(PropertyEditor editor) { JComponent result; result = null; if (editor.supportsCustomEditor() && editor.isPaintable()) { result = new PropertyPanel(editor); } else if (editor.supportsCustomEditor() && (editor.getCustomEditor() instanceof JComponent)) { result = (JComponent) editor.getCustomEditor(); } else if (editor.getTags() != null) { result = new PropertyValueSelector(editor); } else if (editor.getAsText() != null) { result = new PropertyText(editor); } return result; } }
/** * Tries to determine a view for the editor. * * @param editor the editor to get the view for * @return the view, null if failed to determine one */ public static JComponent findView(PropertyEditor editor) { JComponent result; result = null; if (editor.supportsCustomEditor() && editor.isPaintable()) { result = new PropertyPanel(editor); } else if (editor.supportsCustomEditor() && (editor.getCustomEditor() instanceof JComponent)) { result = (JComponent) editor.getCustomEditor(); } else if (editor.getTags() != null) { result = new PropertyValueSelector(editor); } else if (editor.getAsText() != null) { result = new PropertyText(editor); } return result; } }
private boolean openCustomEditor(ActionEvent e) { if (getSelectedRowCount() != 1 || getSelectedColumnCount() != 1) { return false; } int row = getSelectedRow(); if (row < 0) return false; int column = getSelectedColumn(); if (column < 0) return false; Object o = getValueAt(row, column); if (!(o instanceof Node.Property)) { return false; } Node.Property p = (Node.Property) o; if (!Boolean.TRUE.equals(p.getValue("suppressCustomEditor"))) { //NOI18N PropertyPanel panel = new PropertyPanel(p); @SuppressWarnings("deprecation") PropertyEditor ed = panel.getPropertyEditor(); if ((ed != null) && ed.supportsCustomEditor()) { Action act = panel.getActionMap().get("invokeCustomEditor"); //NOI18N if (act != null) { act.actionPerformed(null); return true; } } } return false; } }
if (ped.supportsCustomEditor() && !propRequestsSuppressButton) { realEditor = inplaceEditor.getComponent();
public Component getCustomEditor() { // initialize the value setValue(designProperty.getValue()); // No delegate - most likely this editor was configured as the property editor if (delegatePropertyEditor == null) { customEditor = new TabbedDataBindingPanelAdapter(this, designProperty, (Class[]) designProperty.getPropertyDescriptor().getValue(BINDING_PANEL_CLASS_NAMES), true); } else { // Delegate present - create custom editor component using binding panel and custom editor component supplied delegate property editor Component delegateCustomEditorComponent = null; if (delegatePropertyEditor.supportsCustomEditor()) { delegateCustomEditorComponent = delegatePropertyEditor.getCustomEditor(); } customEditor = new TabbedDataBindingPanelWrapper(this, designProperty, (Class[]) designProperty.getPropertyDescriptor().getValue(BINDING_PANEL_CLASS_NAMES), true, delegateCustomEditorComponent); } return customEditor; }
private Component getEditorComponentNoCell(PropertyEditor editor, Class type, boolean editable) { CellEditorComponent comp = null; if (editor.supportsCustomEditor()) { if (editable || ReflectUtils.isTypeMutable(type)) { comp = new PropertyEditorToCellEditor(editor); } else { // if this is, for example, an uneditable Integer, // we only want to show a simple label. comp = new TextBasedViewComponent(editor, this); } } else { if (editable) { if (editor.getTags() != null) { comp = new ObjectChoiceComboPanel(editor, type, editable, (PropertyValueControl) this, (Container) this); } else { try { value = this.getBoundValue(); } catch (Throwable e) { printStackTrace(e); } comp = new TextBasedInputComponent(editor, type, this, value); } } else { comp = new TextBasedViewComponent(editor, this); } } Component compC = comp.getCustomEditor(); compC.setPreferredSize(MAX_TEXTWIDTH); return compC; }