Esempio n. 1
0
  void initialize() {
    BeanTreeView left;
    left = new BeanTreeView();
    left.setRootVisible(false);

    PropertySheetView right;
    right = new PropertySheetView();
    right.setDescriptionAreaVisible(false);

    JSplitPane splitPane;
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
    splitPane.setResizeWeight(0.4);
    splitPane.setDividerSize(3);

    setTitle("Splunk Explorer");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().add(splitPane);

    // Place the window in a convenient position
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = screenSize.width / 2;
    int height = screenSize.height / 2;
    setSize(width, height);
    setLocation(width / 2, height / 2);
  }
 public PersonViewerTopComponent() {
   initComponents();
   setName(Bundle.CTL_PersonViewerTopComponent());
   setToolTipText(Bundle.HINT_PersonViewerTopComponent());
   setLayout(new BorderLayout());
   BeanTreeView btv = new BeanTreeView();
   btv.setRootVisible(false);
   add(btv, BorderLayout.CENTER);
   em.setRootContext(new AbstractNode(Children.create(new PersonChildFactory(), true)));
   associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
 }
Esempio n. 3
0
  /** Creates new form BrowseFolders */
  public BrowseFolders(SourceGroup[] folders, boolean showFiles) {
    initComponents();
    this.folders = folders;
    this.showFiles = showFiles;
    manager = new ExplorerManager();
    AbstractNode rootNode = new AbstractNode(new SourceGroupsChildren(folders));
    manager.setRootContext(rootNode);

    // Create the templates view
    BeanTreeView btv = new BeanTreeView();
    btv.setRootVisible(false);
    btv.setSelectionMode(javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION);
    btv.setBorder(SAMPLE_SCROLL_PANE.getBorder());
    btv.getAccessibleContext()
        .setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_SelectFile"));
    folderPanel.add(btv, java.awt.BorderLayout.CENTER);
  }
Esempio n. 4
0
 public ZIPExplorer() {
   setName(Bundle.CTL_ZIPTopComponent());
   setToolTipText(Bundle.HINT_ZIPTopComponent());
   setLayout(new BorderLayout());
   Node rootNode = new AbstractNode(Children.create(new ZIPChildFactory(), false));
   rootNode.setDisplayName("Root");
   BeanTreeView btv = new BeanTreeView();
   btv.setRootVisible(false);
   add(btv, BorderLayout.CENTER);
   ActionMap map = this.getActionMap();
   map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(mgr));
   map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(mgr));
   map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(mgr));
   map.put("delete", ExplorerUtils.actionDelete(mgr, true)); // or false
   mgr.setRootContext(rootNode);
   associateLookup(ExplorerUtils.createLookup(mgr, map));
 }
 @Override
 public void addNotify() {
   super.addNotify();
   if (nodeChangeListener == null) {
     nodeChangeListener = new NodeChangeListener();
   }
   manager.addPropertyChangeListener(nodeChangeListener);
   manager.setRootContext(getRootContext());
   treeView.expandAll();
 }
  public SpecSelectionComponent(boolean showSystemOnly) {
    this.tree = new BeanTreeView();
    this.em = new ExplorerManager();
    this.selectionListener = new SelectionListener();
    this.specification = newProperty(SPECIFICATION_PROPERTY, null);
    this.icon = newProperty(ICON_PROPERTY, null);

    tree.setRootVisible(false);
    tree.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    DecoratedNode root =
        new DecoratedNode(
            new DummyWsNode(WorkspaceFactory.getInstance().getActiveWorkspace(), SPECS_ID),
            showSystemOnly ? ItemWsNodeFilter.SYSTEM_ONLY : Predicates.<Node>alwaysTrue());
    for (DecoratedNode o : root.breadthFirstIterable()) {
      o.setPreferredActionDecorator(DecoratedNode.PreferredAction.DO_NOTHING);
    }

    em.setRootContext(root);

    setLayout(new BorderLayout());
    add(tree, BorderLayout.CENTER);
    setPreferredSize(new Dimension(225, 300));

    em.addVetoableChangeListener(selectionListener);
    addPropertyChangeListener(
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            String p = evt.getPropertyName();
            if (p.equals(SPECIFICATION_PROPERTY)) {
              onSpecificationChange();
            }
          }
        });
  }
  private void initUserComponents() {
    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    treeView.setPopupAllowed(false);

    java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 11);
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(treeView, gridBagConstraints);
    jLblTreeView.setLabelFor(treeView.getViewport().getView());
    treeView
        .getAccessibleContext()
        .setAccessibleName(
            NbBundle.getMessage(
                DefaultClientSelectionPanel.class, "ACSD_AvailableWebServicesTree"));
    treeView
        .getAccessibleContext()
        .setAccessibleDescription(
            NbBundle.getMessage(
                DefaultClientSelectionPanel.class, "ACSD_AvailableWebServicesTree"));
  }
  /** the constructor */
  private DirectoryTreeTopComponent() {
    initComponents();

    // only allow one item to be selected at a time
    ((BeanTreeView) jScrollPane1).setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    // remove the close button
    putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
    setName(NbBundle.getMessage(DirectoryTreeTopComponent.class, "CTL_DirectoryTreeTopComponent"));
    setToolTipText(
        NbBundle.getMessage(DirectoryTreeTopComponent.class, "HINT_DirectoryTreeTopComponent"));

    subscribeToChangeEvents();
    associateLookup(ExplorerUtils.createLookup(em, getActionMap()));

    this.pcs = new PropertyChangeSupport(this);

    // set the back & forward list and also disable the back & forward button
    this.backList = new LinkedList<>();
    this.forwardList = new LinkedList<>();
    backButton.setEnabled(false);
    forwardButton.setEnabled(false);
  }