public ToolTipView() { final OutlineView ov = new OutlineView(); ov.setPropertyColumns("value", "Value"); //NOI18N ov.getOutline().getColumnModel().getColumn(0).setHeaderValue("Name"); //NOI18N ov.getOutline().setRootVisible(true); ov.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(getForeground()), BorderFactory.createEmptyBorder(0, 0, 0, 0))); setLayout(new BorderLayout()); add(ov, BorderLayout.CENTER); }
@Override public void run() { progress.setVisible(false); outlineView.setVisible(true); progress.invalidate(); outlineView.invalidate(); validate(); }
/** Get a node on given point or null if there none*/ private Node getNodeForDrop(Point p) { int row = view.getOutline().rowAtPoint(p); return view.getNodeFromRow(row); }
@Override public void addNotify() { super.addNotify(); if (outlineView == null) { outlineView = new OutlineView(Bundle.CTL_FoundModes()); outlineView.getOutline().setRootVisible(false); tree.add(outlineView); outlineView.setDefaultActionAllowed(false); outlineView.setVisible(false); tree.setMinimumSize(outlineView.getPreferredSize()); } }
@SuppressWarnings("unchecked") private void setupColumns() { view.setPropertyColumns(DiffNode.COLUMN_NAME_STATUS, columnLabels.get(DiffNode.COLUMN_NAME_STATUS)[0], DiffNode.COLUMN_NAME_LOCATION, columnLabels.get(DiffNode.COLUMN_NAME_LOCATION)[0]); view.setPropertyColumnDescription(DiffNode.COLUMN_NAME_STATUS, columnLabels.get(DiffNode.COLUMN_NAME_STATUS)[1]); view.setPropertyColumnDescription(DiffNode.COLUMN_NAME_LOCATION, columnLabels.get(DiffNode.COLUMN_NAME_LOCATION)[1]); view.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DiffFileTreeImpl.class, "ACSN_DiffTable")); // NOI18N view.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DiffFileTreeImpl.class, "ACSD_DiffTable")); // NOI18N view.getOutline().setRenderDataProvider(createRenderProvider()); }
private void showPopup(Point p) { JPopupMenu menu = getPopup(); if (menu != null) { menu.show(view.getOutline(), p.x, p.y); } }
treeModel = new NodeTreeModel(); rowModel = new PropertiesRowModel(); model = createOutlineModel(treeModel, rowModel, nodesColumnLabel); outline = new OutlineViewOutline(model, rowModel); TableQuickSearchSupport tqss = outline.createDefaultTableQuickSearchSupport(); attachQuickSearch(tqss, false, tqss.createSearchPopupMenu()); qsKeyListener = new KeyListener() { @Override hScrollBar = createHorizontalScrollBar(); hScrollBar.setUnitIncrement(10); setLayout(new OutlineScrollLayout()); add(hScrollBar, TREE_HORIZONTAL_SCROLLBAR); setViewportView(outline); setPopupAllowed(true); setRequestFocusEnabled (false); outline.setRequestFocusEnabled(true); java.awt.Color c = javax.swing.UIManager.getColor("Table.background1"); getViewport().setBackground(c); getActionMap().put("org.openide.actions.PopupAction", new PopupAction()); popupFactory = new OutlinePopupFactory(); setDropTarget( DragDropUtilities.dragAndDropEnabled ); defaultTreeActionListener = new DefaultTreeAction (outline); outline.registerKeyboardAction(
@Messages({ "CTL_FileTree.treeColumn.Name=File" }) public FileTreeView () { em = new ExplorerManager(); view = new OutlineView(Bundle.CTL_FileTree_treeColumn_Name()); view.getOutline().setShowHorizontalLines(true); view.getOutline().setShowVerticalLines(false); view.getOutline().setRootVisible(false); view.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); view.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); view.setPopupAllowed(false); view.getOutline().addMouseListener(this); view.getOutline().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put( KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction"); //NOI18N view.getOutline().getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() { //NOI18N @Override public void actionPerformed(ActionEvent e) { showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(view.getOutline())); } }); viewComponent = new ViewContainer(em); viewComponent.add(view, BorderLayout.CENTER); viewComponent.addAncestorListener(this); em.addPropertyChangeListener(this); }
private void initView() { setLayout(new BorderLayout()); outlineView = new OutlineView(nodesColumnName); outlineView.setPropertyColumns(COLUMN_NAMES); final Outline outline = outlineView.getOutline(); outline.setRootVisible(false); DefaultTableCellRenderer decimalTableCellRenderer = new StringDecimalFormatRenderer(); outline.setDefaultRenderer(Double.class, decimalTableCellRenderer); outline.setDefaultRenderer(Float.class, decimalTableCellRenderer); outline.setDefaultRenderer(Node.Property.class, new MetadataOutlineCellRenderer()); final TableColumnModel columnModel = outline.getColumnModel(); columnModel.getColumn(0).setCellRenderer(new MetadataOutlineCellRenderer()); final int[] columnWidths = COLUMN_WIDTHS; for (int i = 0; i < columnModel.getColumnCount(); i++) { columnModel.getColumn(i).setPreferredWidth(columnWidths[i]); } add(outlineView, BorderLayout.CENTER); }
public void jbuttonActionPerformance(ActionEvent ev){ TopComponent findTopComponent = WindowManager.getDefault().findTopComponent("OutlineTopComponent"); // TODO add your handling code here: findTopComponent.setVisible(false); findTopComponent.removeAll(); findTopComponent.setLayout(new BorderLayout()); OutlineView myView2 = new OutlineView("Filename"); Outline outline2 = myView2.getOutline(); findTopComponent.add(myView2, BorderLayout.CENTER); findTopComponent.setVisible(true); findTopComponent.open();findTopComponent.requestActive(); }
@Override public void run() { int width = view.getWidth(); view.getOutline().getColumnModel().getColumn(0).setPreferredWidth(width * 40 / 100); view.getOutline().getColumnModel().getColumn(1).setPreferredWidth(width * 20 / 100); view.getOutline().getColumnModel().getColumn(2).setPreferredWidth(width * 40 / 100); } });
/** Expands the node in the tree. * * @param n node */ public void expandNode(Node n) { if (n == null) { throw new IllegalArgumentException(); } lookupExplorerManager(); TreePath treePath = new TreePath(treeModel.getPathToRoot(VisualizerNode.getVisualizer(null, n))); getOutline().expandPath(treePath); }
projectPane = new OutlineView(); hierarchyPane = new BeanTreeView(); jScrollPane1 = new javax.swing.JScrollPane();
public CreateSiteTemplate(FileObject root, FileObject externalSiteRoot, WizardPanel wp) { this.root = root; this.manager = new ExplorerManager(); this.wp = wp; try { if (externalSiteRoot != null) { ExternalSiteRootNode externalSiteRootNode = new ExternalSiteRootNode(DataObject.find(externalSiteRoot).getNodeDelegate(), externalSiteRoot.isFolder()); manager.setRootContext(new OurFilteredNode(DataObject.find(root).getNodeDelegate(), externalSiteRootNode)); } else { manager.setRootContext(new OurFilteredNode(DataObject.find(root).getNodeDelegate(), root.isFolder())); } } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); } initComponents(); tree = new OutlineView(); tree.setTreeSortable(false); placeholder.setLayout(new BorderLayout()); placeholder.add(tree, BorderLayout.CENTER); nameTextField.getDocument().addDocumentListener(this); fileTextField.getDocument().addDocumentListener(this); fileTextField.setText(new File(System.getProperty("user.home")).getAbsolutePath()); // NOI18N }
int allowedDropActions = view.getAllowedDropActions(dtde.getTransferable()); dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dropAction, allowedDropActions); int row = view.getOutline().rowAtPoint(p); int column = view.getOutline().columnAtPoint(p); log("doDragOver row == " + row + " column == " + column); // NOI18N TreePath tp = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); if (LOGABLE) { log("tp == " + tp); //NOI18N if (!view.getOutline().getLayoutCache().isExpanded(tp)) { log("tree path is not expanded"); // NOI18N TreePath path = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); if( null != path ) { TreePath parentPath = path.getParentPath(); if( null != parentPath ) { int parentRow = view.getOutline().getLayoutCache().getRowForPath(parentPath); dropIndex = row-parentRow; final TreePath path = view.getOutline().getLayoutCache().getPathForRow( view.getOutline().convertRowIndexToModel(row)); boolean expanded = view.getOutline().getLayoutCache().isExpanded(path); if ( ((timer == null) || !timer.isRunning()) && (dropNode != null) && !dropNode.isLeaf()
if (! needToSynchronize ()) { return ; expandSelection(); outline.invalidate(); invalidate(); validate(); Node[] arr = manager.getSelectedNodes (); outline.getSelectionModel().clearSelection(); int firstSelection = -1; for (int i = 0; i < size; i++) { Node n = getNodeFromRow(i); for (int j = 0; j < arr.length; j++) { if ((n != null) && (n.equals(arr[j]))) { JViewport v = getViewport(); if (v != null) { Rectangle rect = outline.getCellRect(firstSelection, 0, true);
private static Node[] getChildren(Node n, OutlineView outlineView, boolean canExpand) { if (outlineView != null) { if (!outlineView.isExpanded(n)) { if (canExpand) { outlineView.expandNode(n); } else { return n.getChildren().getNodes(true); } } return getChildrenInDisplayedOrder(n, outlineView); } else { return n.getChildren().getNodes(true); } }
dtde.getDropAction(), view.getAllowedDropActions(dtde.getTransferable()) ); view.expandNode(dropNode); SwingUtilities.invokeLater(new Runnable() { public void run() {
@Override public void addNotify() { super.addNotify(); ExplorerManager em = ExplorerManager.find(this); em.setRootContext(rootNode); }
@Override public void setModel (T[] nodes, EditorCookie[] editorCookies, Object modelData) { this.editorCookies = editorCookies; this.nodes = nodes; em.setRootContext((Node) modelData); for (T n : nodes) { view.expandNode(toTreeNode(n)); } }