| // |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| |
| = DevFaqPropertySheetEditors |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqPropertySheetEditors |
| :description: Apache NetBeans wiki DevFaqPropertySheetEditors |
| :toc: left |
| :toc-title: |
| :syntax: true |
| |
| === How do I change the default behavior of PropertySheet editors? |
| |
| *Issue:* How do I specify the kind of renderer which will represent the look of property value cell (in the same manner as it usually does for JTable)? For example, I want a string property not to be shown in grey if it's not editable. |
| |
| *Solution:* If you specify a custom inplace editor it will also be used for rendering. |
| |
| -- |
| |
| *Issue:* How can I provide a new kind of inplace editor? For example, I want to have a property which should be shown at Property Sheet like a combo-box or a spinner control. |
| |
| *Solution:* See the docs for the link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/propertysheet/InplaceEditor.html[InplaceEditor] interface. |
| |
| -- |
| |
| *Issue:* How do I specify that a value is not editable in-place? |
| |
| *Solution:* Provide a custom inplace editor that provides a disabled component for the inplace editor. Or mark it non-editable, but supply a custom editor that does edit it. |
| |
| -- |
| |
| *Issue:* How do I specify that a property has a custom editor? |
| |
| *Solution:* See the docs for the link:http://java.sun.com/j2se/1.5.0/docs/api/java/beans/PropertyEditor.html[PropertyEditor] interface. |
| |
| -- |
| |
| *Issue:* How can I copy text from a non-editable property? |
| |
| *Solution:* If the non-editable property has a Custom editor ('...' button) you can easily use Ctrl+c on content of a Custom editor. If the non-editable property doesn't have a Custom editor you can select property cell and press Ctrl+c, but whole line is copied (property name and value). |
| |
| -- |
| |
| *Issue:* How do I access the Node the property belongs to? |
| |
| *Solution:* |
| |
| [source,java] |
| ---- |
| |
| class MyEditor implements ExPropertyEditor { |
| PropertyEnv env; |
| |
| public void attachEnv(e) { |
| env = e; |
| } |
| |
| public void anyMethod() { |
| Object[] arr = env.getBeans(); |
| // now arr contains either the real bean objects if invoked on Object |
| // or it contains Node that the properties belong to |
| } |
| } |
| ---- |
| |
| === Apache Migration Information |
| |
| The content in this page was kindly donated by Oracle Corp. to the |
| Apache Software Foundation. |
| |
| This page was exported from link:http://wiki.netbeans.org/DevFaqPropertySheetEditors[http://wiki.netbeans.org/DevFaqPropertySheetEditors] , |
| that was last modified by NetBeans user JPESKA |
| on 2011-12-20T12:49:48Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed. |