当前位置: 首页>>代码示例>>Java>>正文


Java TreeTableModel类代码示例

本文整理汇总了Java中org.mozilla.javascript.tools.debugger.treetable.TreeTableModel的典型用法代码示例。如果您正苦于以下问题:Java TreeTableModel类的具体用法?Java TreeTableModel怎么用?Java TreeTableModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeTableModel类属于org.mozilla.javascript.tools.debugger.treetable包,在下文中一共展示了TreeTableModel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetTree

import org.mozilla.javascript.tools.debugger.treetable.TreeTableModel; //导入依赖的package包/类
/**
 * Initializes a tree for this tree table.
 */
public JTree resetTree(TreeTableModel treeTableModel) {
    tree = new TreeTableCellRenderer(treeTableModel);

    // Install a tableModel representing the visible rows in the tree.
    super.setModel(new TreeTableModelAdapter(treeTableModel, tree));

    // Force the JTable and JTree to share their row selection models.
    ListToTreeSelectionModelWrapper selectionWrapper = new
        ListToTreeSelectionModelWrapper();
    tree.setSelectionModel(selectionWrapper);
    setSelectionModel(selectionWrapper.getListSelectionModel());

    // Make the tree and table row heights the same.
    if (tree.getRowHeight() < 1) {
        // Metal looks better like this.
        setRowHeight(18);
    }

    // Install the tree editor renderer and editor.
    setDefaultRenderer(TreeTableModel.class, tree);
    setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
    setShowGrid(true);
    setIntercellSpacing(new Dimension(1,1));
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)tree.getCellRenderer();
    r.setOpenIcon(null);
    r.setClosedIcon(null);
    r.setLeafIcon(null);
    return tree;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:35,代码来源:SwingGui.java

示例2: isCellEditable

import org.mozilla.javascript.tools.debugger.treetable.TreeTableModel; //导入依赖的package包/类
/**
 * Returns whether the cell under the coordinates of the mouse
 * in the {@link EventObject} is editable.
 */
public boolean isCellEditable(EventObject e) {
    if (e instanceof MouseEvent) {
        MouseEvent me = (MouseEvent)e;
        // If the modifiers are not 0 (or the left mouse button),
        // tree may try and toggle the selection, and table
        // will then try and toggle, resulting in the
        // selection remaining the same. To avoid this, we
        // only dispatch when the modifiers are 0 (or the left mouse
        // button).
        if (me.getModifiers() == 0 ||
            ((me.getModifiers() & (InputEvent.BUTTON1_MASK|1024)) != 0 &&
             (me.getModifiers() &
              (InputEvent.SHIFT_MASK |
               InputEvent.CTRL_MASK |
               InputEvent.ALT_MASK |
               InputEvent.BUTTON2_MASK |
               InputEvent.BUTTON3_MASK |
               64   | //SHIFT_DOWN_MASK
               128  | //CTRL_DOWN_MASK
               512  | // ALT_DOWN_MASK
               2048 | //BUTTON2_DOWN_MASK
               4096   //BUTTON3_DOWN_MASK
               )) == 0)) {
            int row = rowAtPoint(me.getPoint());
            for (int counter = getColumnCount() - 1; counter >= 0;
                 counter--) {
                if (TreeTableModel.class == getColumnClass(counter)) {
                    MouseEvent newME = new MouseEvent
                        (MyTreeTable.this.tree, me.getID(),
                         me.getWhen(), me.getModifiers(),
                         me.getX() - getCellRect(row, counter, true).x,
                         me.getY(), me.getClickCount(),
                         me.isPopupTrigger());
                    MyTreeTable.this.tree.dispatchEvent(newME);
                    break;
                }
            }
        }
        if (me.getClickCount() >= 3) {
            return true;
        }
        return false;
    }
    if (e == null) {
        return true;
    }
    return false;
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:53,代码来源:SwingGui.java


注:本文中的org.mozilla.javascript.tools.debugger.treetable.TreeTableModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。