| // |
| // 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. |
| // |
| |
| = DevFaqExplorerViewsInMantisse |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqExplorerViewsInMantisse |
| :description: Apache NetBeans wiki DevFaqExplorerViewsInMantisse |
| :toc: left |
| :toc-title: |
| :syntax: true |
| |
| == How can I design explorer views in Mantisse GUI editor? |
| |
| There is an open RFE [1] to include explorer views in the GUI designer palettes by default, but until it is implemented, you can follow the following procedure. (digested from the mailing list) |
| |
| === Add explorer views to palette manually |
| |
| As suggested in several articles [2]/[3], adding the .jar |
| file to the palette exposes the containers. Here the exact procedure to add the containers to the palette |
| |
| 1. Right click in the Matisse palette |
| 2. "Add from JAR..." |
| 3. Navigate to the org-openide-explorer.jar file, click "Next". On my system this is C:\Program\ Files\NetBeans\8.0.1\platform\modules\org-openide-explorer.jar |
| 4. Select available components, "Next" |
| 5. Select the destination palette category in which to add the explorer containers, "Finish" |
| |
| After all that, the containers are all listed in the palette. |
| |
| === More explanations |
| |
| (originally by Eirik Bakke) |
| |
| I use explorer views in matisse all the time. You can add them to the |
| matisse palette (via Palette Manager) or add any arbitrary class, |
| including your own, using the "Beans->Add Bean" icon in the palette. If |
| you make your own JComponents, they have to conform to the JavaBean |
| conventions, i.e. have a public no-arg constructor. |
| |
| For explorer views to work correctly, there must be an |
| ExplorerManager.Provider in the component hierarchy. I use a simple custom |
| JPanel for this purpose, see |
| link:https://gist.github.com/anonymous/402e6d9956a77feaac60[https://gist.github.com/anonymous/402e6d9956a77feaac60] (feel free to use). |
| This "ExplorerManagerProviderPanel" can also be added to the hierarchy |
| using Matisse. |
| |
| [source,java] |
| ---- |
| |
| import javax.swing.ActionMap; |
| import javax.swing.JPanel; |
| import javax.swing.text.DefaultEditorKit; |
| import org.openide.explorer.ExplorerManager; |
| import org.openide.explorer.ExplorerUtils; |
| import org.openide.util.Lookup; |
| |
| public class ExplorerManagerProviderPanel extends JPanel |
| implements ExplorerManager.Provider, Lookup.Provider |
| { |
| private final ExplorerManager explorerManager = new ExplorerManager(); |
| private final Lookup lookup; |
| |
| public ExplorerManagerProviderPanel() { |
| ActionMap map = this.getActionMap(); |
| map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(explorerManager)); |
| map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(explorerManager)); |
| map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(explorerManager)); |
| map.put("delete", ExplorerUtils.actionDelete(explorerManager, true)); |
| lookup = ExplorerUtils.createLookup(explorerManager, map); |
| } |
| |
| @Override |
| public final ExplorerManager getExplorerManager() { |
| return explorerManager; |
| } |
| @Override |
| public final Lookup getLookup() { |
| return lookup; |
| } |
| } |
| ---- |
| |
| === Resources |
| |
| [1] link:https://netbeans.org/bugzilla/show_bug.cgi?id=20851[https://netbeans.org/bugzilla/show_bug.cgi?id=20851] |
| |
| [2] link:https://netbeans.org/projects/platform/lists/dev/archive/2008-01/message/370[https://netbeans.org/projects/platform/lists/dev/archive/2008-01/message/370] |
| |
| [3] link:http://netbeansrcp.wordpress.com/2009/04/01/adding-explorer-components-into-the-netbeans-palette/[http://netbeansrcp.wordpress.com/2009/04/01/adding-explorer-components-into-the-netbeans-palette/] |
| |
| === 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/DevFaqExplorerViewsInMantisse[http://wiki.netbeans.org/DevFaqExplorerViewsInMantisse] , |
| that was last modified by NetBeans user Markiewb |
| on 2014-11-23T11:36:09Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed. |