~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to openide/explorer/src/org/openide/explorer/propertysheet/EditorPropertyDisplayer.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
/*
 
42
 * EditorPropertyDisplayer_java
 
43
 *
 
44
 * Created on 18 October 2003, 16:36
 
45
 */
 
46
package org.openide.explorer.propertysheet;
 
47
 
 
48
import org.openide.nodes.Node.Property;
 
49
import org.openide.util.Utilities;
 
50
 
 
51
import java.awt.Color;
 
52
import java.awt.Component;
 
53
import java.awt.Dimension;
 
54
import java.awt.EventQueue;
 
55
import java.awt.Image;
 
56
import java.awt.KeyboardFocusManager;
 
57
import java.awt.event.FocusEvent;
 
58
import java.awt.event.KeyEvent;
 
59
 
 
60
import java.beans.FeatureDescriptor;
 
61
import java.beans.PropertyEditor;
 
62
 
 
63
import java.lang.ref.WeakReference;
 
64
 
 
65
import javax.swing.*;
 
66
 
 
67
 
 
68
/** An implementation of PropertyDisplayer_Inline which replicates the inline
 
69
 * editor mode of PropertyPanel.  This class is a base class which is simply
 
70
 * responsible for finding and embedding the correct inline editor - it contains
 
71
 * no code for actually updating the value or anything such.  That code is in
 
72
 * EditablePropertyDisplayer, to improve readability and maintainability.
 
73
 *
 
74
 * @author  Tim Boudreau
 
75
 */
 
76
class EditorPropertyDisplayer extends JComponent implements PropertyDisplayer_Inline {
 
77
    private Property prop = null;
 
78
    private InplaceEditor inplace = null;
 
79
    private JComponent inner = null;
 
80
    private int radioButtonMax = 0;
 
81
    private boolean showCustomEditorButton = true;
 
82
    private boolean tableUI = false;
 
83
    private boolean useLabels = true;
 
84
    private PropertyEnv env = null;
 
85
    private boolean radioBoolean = false;
 
86
    protected WeakReference<PropertyModel> modelRef = null;
 
87
    protected boolean inReplaceInner = false;
 
88
    private InplaceEditorFactory factory1 = null;
 
89
    private InplaceEditorFactory factory2 = null;
 
90
    private ReusablePropertyEnv reusableEnv = new ReusablePropertyEnv(); //XXX supply from PP?
 
91
 
 
92
    /** Creates a new instance of EditorPropertyDisplayer */
 
93
    public EditorPropertyDisplayer(Property p) {
 
94
        this(p, null);
 
95
    }
 
96
 
 
97
    EditorPropertyDisplayer(Property p, PropertyModel mdl) {
 
98
        if (p == null) {
 
99
            throw new NullPointerException("Property may not be null"); //NOI18N
 
100
        }
 
101
 
 
102
        this.prop = p;
 
103
 
 
104
        if (mdl != null) {
 
105
            modelRef = new WeakReference<PropertyModel>(mdl);
 
106
        }
 
107
    }
 
108
 
 
109
    public void addNotify() {
 
110
        try {
 
111
            if (inner == null) {
 
112
                replaceInner();
 
113
            }
 
114
        } finally {
 
115
            super.addNotify();
 
116
        }
 
117
    }
 
118
 
 
119
    protected void processFocusEvent(FocusEvent fe) {
 
120
        super.processFocusEvent(fe);
 
121
 
 
122
        if ((fe.getID() == FocusEvent.FOCUS_GAINED) && (inner != null)) {
 
123
            inner.requestFocus();
 
124
        }
 
125
    }
 
126
 
 
127
    public void removeNotify() {
 
128
        super.removeNotify();
 
129
        setInplaceEditor(null);
 
130
        reusableEnv.clear();
 
131
    }
 
132
 
 
133
    public final Component getComponent() {
 
134
        return this;
 
135
    }
 
136
 
 
137
    public final Property getProperty() {
 
138
        return prop;
 
139
    }
 
140
 
 
141
    public final int getRadioButtonMax() {
 
142
        return radioButtonMax;
 
143
    }
 
144
 
 
145
    public final boolean isShowCustomEditorButton() {
 
146
        boolean result = showCustomEditorButton;
 
147
 
 
148
        if (getProperty() != null) {
 
149
            Boolean explicit = (Boolean) getProperty().getValue("suppressCustomEditor"); //NOI18N
 
150
 
 
151
            if (explicit != null) {
 
152
                result = !explicit.booleanValue();
 
153
            }
 
154
        }
 
155
 
 
156
        return result;
 
157
    }
 
158
 
 
159
    public final boolean isTableUI() {
 
160
        return tableUI;
 
161
    }
 
162
 
 
163
    public final void refresh() {
 
164
        if (isDisplayable()) {
 
165
            replaceInner();
 
166
        }
 
167
    }
 
168
 
 
169
    public final boolean isUseLabels() {
 
170
        return useLabels;
 
171
    }
 
172
 
 
173
    public final void setRadioButtonMax(int max) {
 
174
        if (max != radioButtonMax) {
 
175
            int old = radioButtonMax;
 
176
            boolean needChange = false;
 
177
 
 
178
            if (inplace != null) {
 
179
                InplaceEditor innermost = PropUtils.findInnermostInplaceEditor(inplace);
 
180
 
 
181
                if (innermost instanceof JComboBox || innermost instanceof RadioInplaceEditor) {
 
182
                    PropertyEditor ped = innermost.getPropertyEditor();
 
183
                    int tagCount = (ped.getTags() == null) ? (-1) : ped.getTags().length;
 
184
                    needChange = (old <= tagCount) != (max <= tagCount);
 
185
                }
 
186
            }
 
187
 
 
188
            radioButtonMax = max;
 
189
 
 
190
            if (needChange && (inner != null)) {
 
191
                replaceInner();
 
192
                firePropertyChange("preferredSize", null, null); //NOI18N
 
193
            }
 
194
        }
 
195
    }
 
196
 
 
197
    public final void setShowCustomEditorButton(boolean val) {
 
198
        //If the property descriptor explicitly says it does not
 
199
        //want a custom editor button, this overrides anything set on
 
200
        //the PropertyPanel.
 
201
        if (getProperty() != null) {
 
202
            Property p = getProperty();
 
203
            Boolean explicit = (Boolean) p.getValue("suppressCustomEditor"); //NOI18N
 
204
 
 
205
            if (explicit != null) {
 
206
                val = explicit.booleanValue();
 
207
                System.err.println("Found explicit value: " + val);
 
208
            }
 
209
        }
 
210
 
 
211
        if (showCustomEditorButton != val) {
 
212
            showCustomEditorButton = val;
 
213
            replaceInner();
 
214
        }
 
215
    }
 
216
 
 
217
    public final void setTableUI(boolean val) {
 
218
        if (val != tableUI) {
 
219
            tableUI = val;
 
220
            replaceInner();
 
221
        }
 
222
    }
 
223
 
 
224
    public final void setUseLabels(boolean useLabels) {
 
225
        if (useLabels != this.useLabels) {
 
226
            boolean needChange = false;
 
227
 
 
228
            if (isShowing()) {
 
229
                InplaceEditor innermost = PropUtils.findInnermostInplaceEditor(inplace);
 
230
 
 
231
                needChange = (innermost instanceof RadioInplaceEditor || innermost instanceof JCheckBox);
 
232
            }
 
233
 
 
234
            this.useLabels = useLabels;
 
235
 
 
236
            if (needChange && (inner != null)) {
 
237
                replaceInner();
 
238
            }
 
239
        }
 
240
    }
 
241
 
 
242
    public final void requestFocus() {
 
243
        if (inner != null) {
 
244
            inner.requestFocus();
 
245
        } else {
 
246
            super.requestFocus();
 
247
        }
 
248
    }
 
249
 
 
250
    public final Dimension getPreferredSize() {
 
251
        Dimension result;
 
252
 
 
253
        if (inner == null) {
 
254
            //Use the renderer infrastructure to do it if we're not initialized
 
255
            result = new RendererPropertyDisplayer(getProperty()).getRenderer(this).getPreferredSize();
 
256
        } else {
 
257
            result = inner.getPreferredSize();
 
258
        }
 
259
 
 
260
        return result;
 
261
    }
 
262
 
 
263
    public final boolean requestFocusInWindow() {
 
264
        boolean result;
 
265
 
 
266
        if (inner != null) {
 
267
            result = inner.requestFocusInWindow();
 
268
        } else {
 
269
            result = super.requestFocusInWindow();
 
270
        }
 
271
 
 
272
        return result;
 
273
    }
 
274
 
 
275
    private final void installInner(JComponent c) {
 
276
        synchronized (getTreeLock()) {
 
277
            if (inner != null) {
 
278
                remove(inner);
 
279
            }
 
280
 
 
281
            inner = c;
 
282
 
 
283
            if (inner != null) {
 
284
                c.setBounds(0, 0, getWidth(), getHeight());
 
285
                add(c);
 
286
            }
 
287
        }
 
288
    }
 
289
 
 
290
    protected final void replaceInner() {
 
291
        inReplaceInner = true;
 
292
 
 
293
        try {
 
294
            Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
 
295
            boolean hadFocus = isEnabled() &&
 
296
                ((focusOwner == this) || isAncestorOf(focusOwner) ||
 
297
                ((getInplaceEditor() != null) && getInplaceEditor().isKnownComponent(focusOwner)));
 
298
 
 
299
            //Figure out if a combo popup was open, so we can re-open it.
 
300
            //If we're processing a mouse event, close it because that's
 
301
            //the normal behavior of a popup.  We want arrow keyboard events
 
302
            //to not trigger closing of the popup if they caused a change
 
303
            //to a value that is marked as invalid
 
304
            boolean wasComboPopup = hadFocus && focusOwner instanceof JComboBox &&
 
305
                ((JComboBox) focusOwner).isPopupVisible() &&
 
306
                (EventQueue.getCurrentEvent() instanceof KeyEvent &&
 
307
                ((((KeyEvent) EventQueue.getCurrentEvent()).getKeyCode() == KeyEvent.VK_UP) ||
 
308
                (((KeyEvent) EventQueue.getCurrentEvent()).getKeyCode() == KeyEvent.VK_DOWN)));
 
309
 
 
310
            //            System.err.println("REPLACE INNER - " + prop.getDisplayName() + " focus:" + hadFocus);
 
311
            if (hadFocus) {
 
312
                //We don't want focus to jump to another component and back
 
313
                KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
 
314
            }
 
315
 
 
316
            setInplaceEditor(createInplaceEditor());
 
317
 
 
318
            if (hadFocus) {
 
319
                requestFocus();
 
320
 
 
321
                //At this point the focus owner is still null, the event is queued - 
 
322
                if (wasComboPopup) {
 
323
                    //We have to let the request focus on the event queue get
 
324
                    //processed before this can be done, or the component will
 
325
                    //not yet be laid out and the popup will be 1 pixel wide
 
326
                    SwingUtilities.invokeLater(
 
327
                        new Runnable() {
 
328
                            public void run() {
 
329
                                InplaceEditor ied = getInplaceEditor();
 
330
                                ied = PropUtils.findInnermostInplaceEditor(ied);
 
331
 
 
332
                                JComponent c = ied.getComponent();
 
333
 
 
334
                                if (c instanceof JComboBox && c.isShowing()) {
 
335
                                    ((JComboBox) c).showPopup();
 
336
                                }
 
337
                            }
 
338
                        }
 
339
                    );
 
340
                }
 
341
            }
 
342
 
 
343
            revalidate();
 
344
            repaint();
 
345
        } catch (Exception e) {
 
346
            e.printStackTrace();
 
347
        } finally {
 
348
            inReplaceInner = false;
 
349
        }
 
350
    }
 
351
 
 
352
    protected final JComponent getInner() {
 
353
        return inner;
 
354
    }
 
355
 
 
356
    protected void setInplaceEditor(InplaceEditor ed) {
 
357
        if (inplace != ed) {
 
358
            if (inplace != null) {
 
359
                inplace.clear();
 
360
            }
 
361
 
 
362
            inplace = ed;
 
363
 
 
364
            if (ed == null) {
 
365
                installInner(null);
 
366
            } else {
 
367
                JComponent comp = inplace.getComponent();
 
368
                prepareComponent(inplace);
 
369
                installInner(comp);
 
370
            }
 
371
        }
 
372
    }
 
373
 
 
374
    public void setEnabled(boolean b) {
 
375
        if (inner != null) {
 
376
            inner.setEnabled(b);
 
377
        }
 
378
 
 
379
        super.setEnabled(b);
 
380
    }
 
381
 
 
382
    public void setBackground(Color c) {
 
383
        super.setBackground(c);
 
384
 
 
385
        if (inner != null) {
 
386
            if ((inplace != null) && inplace.supportsTextEntry()) {
 
387
                inner.setBackground(PropUtils.getTextFieldBackground());
 
388
            } else {
 
389
                inner.setBackground(c);
 
390
            }
 
391
        }
 
392
    }
 
393
 
 
394
    public void setForeground(Color c) {
 
395
        super.setForeground(c);
 
396
 
 
397
        if (inner != null) {
 
398
            if ((inplace != null) && inplace.supportsTextEntry()) {
 
399
                inner.setForeground(PropUtils.getTextFieldForeground());
 
400
            } else {
 
401
                inner.setForeground(c);
 
402
            }
 
403
        }
 
404
    }
 
405
 
 
406
    protected void prepareComponent(InplaceEditor inplace) {
 
407
        InplaceEditor innermost = PropUtils.findInnermostInplaceEditor(inplace);
 
408
        JComponent comp = innermost.getComponent();
 
409
 
 
410
        if (!isTableUI() && inplace.supportsTextEntry()) {
 
411
            comp.setBackground(PropUtils.getTextFieldBackground());
 
412
            comp.setForeground(PropUtils.getTextFieldForeground());
 
413
        } else {
 
414
            comp.setBackground(getBackground());
 
415
 
 
416
            if (!isEnabled() || !prop.canWrite()) {
 
417
                comp.setForeground(UIManager.getColor("textInactiveText"));
 
418
            } else {
 
419
                comp.setForeground(getForeground());
 
420
            }
 
421
        }
 
422
 
 
423
        if( comp instanceof ComboInplaceEditor )
 
424
            comp.setEnabled( isEnabled() && getPropertyEnv().isEditable() );
 
425
        else
 
426
            comp.setEnabled(isEnabled() && PropUtils.checkEnabled(this, inplace.getPropertyEditor(), getPropertyEnv()));
 
427
    }
 
428
 
 
429
    @SuppressWarnings("deprecation")
 
430
    public void reshape(int x, int y, int w, int h) {
 
431
        if (inner != null) {
 
432
            inner.setBounds(0, 0, w, h);
 
433
        }
 
434
 
 
435
        super.reshape(x, y, w, h);
 
436
    }
 
437
 
 
438
    protected void setPropertyEnv(PropertyEnv env) {
 
439
        this.env = env;
 
440
    }
 
441
 
 
442
    public final PropertyEnv getPropertyEnv() {
 
443
        return env;
 
444
    }
 
445
 
 
446
    protected final InplaceEditor getInplaceEditor() {
 
447
        return inplace;
 
448
    }
 
449
 
 
450
    protected void configureButtonPanel(ButtonPanel bp) {
 
451
    }
 
452
 
 
453
    /** Basically some hacks to acquire the underlying property descriptor in
 
454
     * the case of a wrapper.  This is here because some property editors will
 
455
     * cast the result of PropertyEnv.getFeatureDescriptor() as a specific
 
456
     * implementation type, so even if we're wrapping a property model, we
 
457
     * still need to make sure we're returning the class they expect.  */
 
458
    static final FeatureDescriptor findFeatureDescriptor(PropertyDisplayer pd) {
 
459
        if (pd instanceof EditorPropertyDisplayer) {
 
460
            //Issue 38004, more gunk to ensure we get the right feature
 
461
            //descriptor
 
462
            EditorPropertyDisplayer epd = (EditorPropertyDisplayer) pd;
 
463
 
 
464
            if (epd.modelRef != null) {
 
465
                PropertyModel pm = epd.modelRef.get();
 
466
 
 
467
                if (pm instanceof ExPropertyModel) {
 
468
                    FeatureDescriptor fd = ((ExPropertyModel) pm).getFeatureDescriptor();
 
469
 
 
470
                    if (fd != null) {
 
471
                        return fd;
 
472
                    }
 
473
                }
 
474
            }
 
475
        }
 
476
 
 
477
        Property p = pd.getProperty();
 
478
 
 
479
        if (p instanceof ModelProperty) {
 
480
            return ((ModelProperty) p).getFeatureDescriptor();
 
481
        } else if (p instanceof ModelProperty.DPMWrapper) {
 
482
            return ((ModelProperty.DPMWrapper) p).getFeatureDescriptor();
 
483
        } else {
 
484
            return p;
 
485
        }
 
486
    }
 
487
 
 
488
    private InplaceEditor createInplaceEditor() {
 
489
        PropertyEnv env = new PropertyEnv();
 
490
        env.setFeatureDescriptor(findFeatureDescriptor(this));
 
491
 
 
492
        InplaceEditor result;
 
493
 
 
494
        //Get the real inplace editor
 
495
        InplaceEditor innermost = result = factory(this).getInplaceEditor(getProperty(), env, true);
 
496
 
 
497
        //        System.err.println("  CREATE INPLACE EDITOR - INNERMOST IS " + innermost);
 
498
        //See if it should be embedded in an instance of ButtonPanel to show
 
499
        //the custom editor button
 
500
        if (isShowCustomEditorButton() && innermost.getPropertyEditor().supportsCustomEditor()) {
 
501
            ButtonPanel bp = new ButtonPanel();
 
502
            bp.setInplaceEditor(innermost);
 
503
 
 
504
            //            System.err.println("  wrapping in a buttonpanel");
 
505
            configureButtonPanel(bp);
 
506
            result = bp;
 
507
        }
 
508
 
 
509
        Icon ic = null;
 
510
 
 
511
        //See if there's an icon to display, either invalid state or
 
512
        //a property-specified icon
 
513
        if (env.getState() == env.STATE_INVALID) {
 
514
            ic = new ImageIcon(Utilities.loadImage("org/openide/resources/propertysheet/invalid.gif")); //NOI18N
 
515
        } else if (getProperty().getValue("valueIcon") != null) { //NOI18N
 
516
 
 
517
            Object o = getProperty().getValue("valueIcon"); //NOI18N
 
518
 
 
519
            if (o instanceof Image) {
 
520
                ic = new ImageIcon((Image) o);
 
521
            } else {
 
522
                ic = (Icon) o;
 
523
            }
 
524
        }
 
525
 
 
526
        //If we have an icon, use an IconPanel to display it
 
527
        if (ic != null) {
 
528
            IconPanel iconPanel = new IconPanel();
 
529
            iconPanel.setIcon(ic);
 
530
            iconPanel.setInplaceEditor(result);
 
531
 
 
532
            //            System.err.println("  wrapping in an IconPanel");
 
533
            result = iconPanel;
 
534
        }
 
535
 
 
536
        setPropertyEnv(env);
 
537
 
 
538
        return result;
 
539
    }
 
540
 
 
541
    private InplaceEditorFactory factory(PropertyDisplayer_Inline inline) {
 
542
        InplaceEditorFactory result;
 
543
 
 
544
        if (inline.isTableUI()) {
 
545
            if (factory1 == null) {
 
546
                factory1 = new InplaceEditorFactory(inline.isTableUI(), inline.getReusablePropertyEnv());
 
547
            }
 
548
 
 
549
            result = factory1;
 
550
        } else {
 
551
            if (factory2 == null) {
 
552
                factory2 = new InplaceEditorFactory(inline.isTableUI(), inline.getReusablePropertyEnv());
 
553
            }
 
554
 
 
555
            result = factory2;
 
556
        }
 
557
 
 
558
        result.setUseRadioBoolean(inline.isRadioBoolean());
 
559
        result.setRadioButtonMax(inline.getRadioButtonMax());
 
560
        result.setUseLabels(inline.isUseLabels());
 
561
 
 
562
        return result;
 
563
    }
 
564
 
 
565
    public boolean isTitleDisplayed() {
 
566
        if (isUseLabels()) {
 
567
            InplaceEditor inp = null;
 
568
 
 
569
            if (inplace != null) {
 
570
                inp = inplace;
 
571
            } else {
 
572
                inp = createInplaceEditor();
 
573
            }
 
574
 
 
575
            InplaceEditor most = PropUtils.findInnermostInplaceEditor(inp);
 
576
 
 
577
            return (most instanceof RadioInplaceEditor || most instanceof CheckboxInplaceEditor);
 
578
        }
 
579
 
 
580
        return false;
 
581
    }
 
582
 
 
583
    public boolean isRadioBoolean() {
 
584
        return radioBoolean;
 
585
    }
 
586
 
 
587
    public void setRadioBoolean(boolean b) {
 
588
        radioBoolean = b;
 
589
    }
 
590
 
 
591
    public ReusablePropertyEnv getReusablePropertyEnv() {
 
592
        return reusableEnv;
 
593
    }
 
594
 
 
595
    static final Object[] findBeans(PropertyDisplayer pd) {
 
596
        Object[] result = null;
 
597
 
 
598
        if (pd instanceof EditorPropertyDisplayer) {
 
599
            //Issue 38132, fiendish evil to support PropertyEnv.getBeans()
 
600
            EditorPropertyDisplayer epd = (EditorPropertyDisplayer) pd;
 
601
 
 
602
            if (epd.modelRef != null) {
 
603
                PropertyModel pm = epd.modelRef.get();
 
604
 
 
605
                if (pm instanceof ExPropertyModel) {
 
606
                    result = ((ExPropertyModel) pm).getBeans();
 
607
                }
 
608
            }
 
609
        }
 
610
 
 
611
        if (result == null) {
 
612
            Property p = pd.getProperty();
 
613
 
 
614
            if (p instanceof ModelProperty) {
 
615
                result = ((ModelProperty) p).getBeans();
 
616
            } else if (p instanceof ModelProperty.DPMWrapper) {
 
617
                result = ((ModelProperty.DPMWrapper) p).getBeans();
 
618
            } else {
 
619
                if (
 
620
                    pd instanceof EditorPropertyDisplayer &&
 
621
                        ((EditorPropertyDisplayer) pd).getParent() instanceof PropertyPanel
 
622
                ) {
 
623
                    result = ((PropertyPanel) ((EditorPropertyDisplayer) pd).getParent()).getBeans();
 
624
                } else if (
 
625
                    pd instanceof RendererPropertyDisplayer &&
 
626
                        ((RendererPropertyDisplayer) pd).getParent() instanceof PropertyPanel
 
627
                ) {
 
628
                    result = ((PropertyPanel) ((RendererPropertyDisplayer) pd).getParent()).getBeans();
 
629
                }
 
630
            }
 
631
        }
 
632
 
 
633
        return result;
 
634
    }
 
635
}