Refine search
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layoutfab); //Outline int size = getResources().getDimensionPixelSize(R.dimen.fab_size); Outline outline = new Outline(); outline.setOval(0, 0, size, size); findViewById(R.id.fab).setOutline(outline); } }
return 0; TreePath tp1 = getLayoutCache().getPathForRow(index1); TreePath tp2 = getLayoutCache().getPathForRow(index2); if (tp1.isDescendant(tp2)) { return -1; if (tp2.isDescendant(tp1)) { return 1; TreePath parent1 = tp1.getParentPath(); TreePath parent2 = tp2.getParentPath(); if (parent1 != null && parent2 != null && parent1.equals(parent2) && getOutlineModel().isLeaf(tp1.getLastPathComponent()) && getOutlineModel().isLeaf(tp2.getLastPathComponent())) { return ascending ? super.compare(rm1, rm2) : - super.compare(rm1, rm2); parent2 = tp2.getParentPath(); int r1 = getLayoutCache().getRowForPath(tp1); int r2 = getLayoutCache().getRowForPath(tp2); Object obj1 = getModel().getValueAt(r1, column); Object obj2 = getModel().getValueAt(r2, column); obj1 = transformValue(obj1); obj2 = transformValue(obj2); if (obj1 == null && obj2 == null) { return 0;
if (isTreeColumnIndex (column) && e instanceof MouseEvent) { MouseEvent me = (MouseEvent) e; TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); if (!getOutlineModel().isLeaf(path.getLastPathComponent())) { int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth(); Insets ins = getInsets(); int nd = path.getPathCount() - (isRootVisible() ? 1 : 2); if (nd < 0) { nd = 0; boolean expanded = getLayoutCache().isExpanded(path); if (!expanded) { getTreePathSupport().expandPath(path); Object ourObject = path.getLastPathComponent(); int cCount = getOutlineModel().getChildCount(ourObject); if (cCount > 0) { Object lastChild = getOutlineModel().getChild(ourObject, cCount - 1); TreePath lastChildPath = path.pathByAddingChild(lastChild); int lastRow = getLayoutCache().getRowForPath(lastChildPath); Rectangle rect = getCellRect(lastRow, 0, true); scrollRectToVisible(rect); getTreePathSupport().collapsePath(path); if( res && isTreeColumnIndex(column) && null != getEditorComponent() ) { configureTreeCellEditor(getEditorComponent(), row, column);
public Node nodeForRow(int row) { int r = outline.convertRowIndexToModel(row); TreePath tp = outline.getLayoutCache().getPathForRow(r); return Visualizer.findNode(tp.getLastPathComponent()); } public String getShortDescription(int column) {
public void actionPerformed(ActionEvent e) { if( getSelectedRowCount() == 1 && isTreeColumnIndex (getSelectedColumn()) ) { int selRow = getSelectedRow(); TreePath selPath = getLayoutCache().getPathForRow(selRow); if( null != selPath && !getOutlineModel().isLeaf(selPath.getLastPathComponent()) ) { boolean expanded = getLayoutCache().isExpanded(selPath); if( expanded && !expand ) { collapsePath(selPath); return; } else if( !expanded && expand ) { expandPath(selPath); return; } } } if( null != origAction ) origAction.actionPerformed(e); } }
private Node getNodeAt( int rowIndex ) { Node result = null; TreePath path = view.getOutline().getOutlineModel().getLayout().getPathForRow(rowIndex); if (path != null) { result = Visualizer.findNode(path.getLastPathComponent()); } return result; }
protected void configureTreeCellEditor( Component editor, int row, int column ) { if( !(editor instanceof JComponent) ) { return; } TreeCellEditorBorder b = new TreeCellEditorBorder(); TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); Object o = getValueAt(row, column); RenderDataProvider rdp = getRenderDataProvider(); b.icon = rdp.getIcon(o); b.nestingDepth = Math.max( 0, path.getPathCount() - (isRootVisible() ? 1 : 2) ); b.isLeaf = getOutlineModel().isLeaf(o); b.isExpanded = getLayoutCache().isExpanded(path); ((JComponent)editor).setBorder(b); }
table, value, isSelected, hasFocus, row, column); Outline tbl = (Outline) table; if (tbl.isTreeColumnIndex(column)) { AbstractLayoutCache layout = tbl.getLayoutCache(); row = tbl.convertRowIndexToModel(row); boolean leaf = tbl.getOutlineModel().isLeaf(value); setLeaf(leaf); setShowHandle(true); boolean expanded = layout.isExpanded(path); setExpanded (expanded); int nd = path.getPathCount() - (tbl.isRootVisible() ? 1 : 2); if (nd < 0) { nd = 0; RenderDataProvider rendata = tbl.getRenderDataProvider(); Icon icon = null; if (rendata != null) { } else { setBackground (isSelected ? tbl.getSelectionBackground() : tbl.getBackground()); } else { setForeground (isSelected ? tbl.getSelectionForeground() : tbl.getForeground());
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()
mdl = DefaultOutlineModel.createOutlineModel(treeModel, new ProfileRowModel(), true, "Resource"); final OutlineMouseAdapter mouseAdapter = new OutlineMouseAdapter(); resultsOutline.addMouseListener(mouseAdapter); resultsOutline.addMouseMotionListener(mouseAdapter); resultsOutline.setVisible(true); resultsOutline.setRootVisible(false); resultsOutline.setModel(mdl); TableColumnModel columnModel = resultsOutline.getColumnModel(); Color backColor = resultsOutline.getBackground(); nodeColumn0.setNestedComparator(new DefaultMutableTreeNodeComparator(nodeColumn0)); nodeColumn0.setCellRenderer(new NodeRenderer(backColor)); resultsOutline.setDefaultRenderer(Object.class, new NodeRenderer(backColor)); resultsOutline.setShowHorizontalLines(false); resultsOutline.setShowVerticalLines(true); resultsOutline.setGridColor(TreeUtils.getDarkerColor(backColor)); resultsOutline.setAutoCreateColumnsFromModel(false); resultsOutline.setColumnSorted(modelIndex, true, 1);
@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); }
@NbBundle.Messages("LBL_DiffView.TreeColumnLabel=Revision") public DiffTreeTable(SearchHistoryPanel master) { super(Bundle.LBL_DiffView_TreeColumnLabel()); this.master = master; getOutline().setShowHorizontalLines(true); getOutline().setShowVerticalLines(false); getOutline().setRootVisible(false); setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); setupColumns(); getOutline().setRenderDataProvider( new NoLeafIconRenderDataProvider( getOutline().getRenderDataProvider() ) ); }
protected void setModel(Robot rootGroup){ myRobot = rootGroup; myRowModel = new RobotTreeRowModel(); myTreeModel = new RobotTreeModel(rootGroup); OutlineModel mdl = DefaultOutlineModel.createOutlineModel(myTreeModel, myRowModel); myRobotTreeOutline.setRootVisible(true); myRobotTreeOutline.setModel(mdl); myRobotTreeOutline.setRenderDataProvider(new JointTreeRenderer()); jScrollPane1.setViewportView(myRobotTreeOutline); }
@Override public void run() { outline.tableChanged(new TableModelEvent(outline.getModel(), 0, outline.getRowCount())); } });
public AbstractListViewTable(String nodeColumnName) { super(nodeColumnName); setDragSource(false); setDropTarget(false); setAllowedDragActions(DnDConstants.ACTION_NONE); setAllowedDropActions(DnDConstants.ACTION_NONE); final Outline outline = getOutline(); outline.setRootVisible(false); outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); outline.getTableHeader().setReorderingAllowed(false); outline.setRootVisible(false); ETableColumnModel colModel = (ETableColumnModel) getOutline().getColumnModel(); TableColumn firstColumn = colModel.getColumn(0); ETableColumn col = (ETableColumn) firstColumn; col.setNestedComparator(new Comparator<Node>() { @Override public int compare(Node o1, Node o2) { return o1.getName().compareTo(o2.getName()); } }); }
/** * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { Point mousePoint = e.getPoint(); int colIndex = resultsOutline.columnAtPoint(mousePoint); int rowIndex = resultsOutline.rowAtPoint(mousePoint); int colModelIndex = resultsOutline.convertColumnIndexToModel(resultsOutline.columnAtPoint(mousePoint)); if (colModelIndex == OutlineColumn.IDENTIFICATION_COUNT.ordinal() + 1) { DirectoryComparableLong count = (DirectoryComparableLong) resultsOutline .getValueAt(rowIndex, colIndex); if (count != null && count.getSource() != null && count.getSource() > 1) { int rowModelIndex = resultsOutline.convertRowIndexToModel(rowIndex); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) mdl.getValueAt(rowModelIndex, 0); ProfileResourceNode node = (ProfileResourceNode) treeNode.getUserObject(); multiIdentificationDialog.showDialog(node); } } } }
Outline outline = new Outline(); outline.setRootVisible(true); outline.setModel(outlineModel); frame.getContentPane().add(new JScrollPane(outline));
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); }
outline.setShowGrid(false); outline.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); outline.setModel(DefaultOutlineModel.createOutlineModel(treeModel, rowModel)); outline.getColumnModel().getColumn(1).setMinWidth(150); dataProvider.setForegroundVisitor(new XSColorVisitor(filter)); dataProvider.setFontStyleVisitor(new XSFontStyleVisitor(filter)); outline.setRenderDataProvider(dataProvider);