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); } }
/** Get the object that will be passed to the RowModel to fetch values * for the given row. * @param row The row we need the tree node for */ private Object getNodeForRow(int row) { return getOutlineModel().getValueAt(row, 0); }
/** Convenience getter for the proxied model's user-supplied TableModel (in * practice, an instance of ProxyTableModel driven by the tree model and a * RowModel) */ private TableModel getTableModel() { return getModel().getTableModel(); }
public void addTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.addTreeExpansionListener(l); }
@Override public String getShortDescription(int column) { return outline.getOutlineModel().getColumnName(column); }
public void removeTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.removeTreeExpansionListener(l); }
private void init() { initialized = true; setDefaultRenderer(Object.class, new DefaultOutlineCellRenderer()); ActionMap am = getActionMap(); //make rows expandable with left/rigt arrow keys Action a = am.get("selectNextColumn"); //NOI18N am.put("selectNextColumn", new ExpandAction(true, a)); //NOI18N a = am.get("selectPreviousColumn"); //NOI18N am.put("selectPreviousColumn", new ExpandAction(false, a)); //NOI18N }
/** Get the TreePathSupport object which manages path expansion for this * Outline. */ TreePathSupport getTreePathSupport () { OutlineModel mdl = getOutlineModel(); if (mdl != null) { return mdl.getTreePathSupport(); } else { return null; } }
public void setOutline(Outline outline) { if (this.outline != null) { this.outline.removeMouseListener(otu); this.outline.removeMouseMotionListener(otu); } this.outline = outline; outline.addMouseListener(otu); outline.addMouseMotionListener(otu); }
/** Get the layout cache which manages layout data for the Outline. * <strong>Under no circumstances directly call the methods on the * layout cache which change the expanded state - such changes will not * be propagated into the table model, and will leave the model and * its layout in inconsistent states. Any calls that affect expanded * state must go through <code>getTreePathSupport()</code>.</strong> */ public final AbstractLayoutCache getLayoutCache () { OutlineModel mdl = getOutlineModel(); if (mdl != null) { return mdl.getLayout(); } else { return null; } }
/** Expand a tree path */ public void expandPath (TreePath path) { getTreePathSupport().expandPath (path); }
public boolean isVisible (TreePath path) { if (getTreePathSupport() != null) { return getTreePathSupport().isVisible(path); } return false; }
public Object getValueAt(int rowIndex, int columnIndex) { Object node = getNodeForRow(rowIndex); return rowmodel.getValueFor(node, columnIndex); }
public boolean isCellEditable(int rowIndex, int columnIndex) { Object node = getNodeForRow(rowIndex); return rowmodel.isCellEditable (node, columnIndex); }
/** Convenience getter for the proxied model's TreePathSupport */ private TreePathSupport getTreePathSupport() { return getModel().getTreePathSupport(); }
/** Convenience getter for the proxied model's user-supplied TreeModel */ private TreeModel getTreeModel() { return getModel().getTreeModel(); }
@Override public boolean isHidingAllowed() { return getModelIndex() != 0; } @Override
/** Create an OutlineModel using the supplied tree model and row model, * specifying if it is a large-model tree */ public static OutlineModel createOutlineModel(TreeModel treeModel, RowModel rowModel, boolean isLargeModel, String nodesColumnLabel) { return new DefaultOutlineModel (treeModel, rowModel, isLargeModel, nodesColumnLabel); }
public String getShortDescription(int column) { return outline.getOutlineModel().getColumnName(column); } public void propertyChange(PropertyChangeEvent evt) {