org.jdesktop.swingx.treetable.TreeTableModel Java Examples

The following examples show how to use org.jdesktop.swingx.treetable.TreeTableModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtocolTab.java    From aion-germany with GNU General Public License v3.0 6 votes vote down vote up
private JXTreeTable createTreeTable(PacketFormat format) {
	JXTreeTable partsTreeTable = new JXTreeTable(new PacketPartsTreeTableModel(format));
	partsTreeTable.setDefaultEditor(TreeTableModel.class, new TreeTableComboBoxCellEditor(partsTreeTable));
	partsTreeTable.setDefaultEditor(String.class, new TreeTableTextCellEditor(partsTreeTable));
	partsTreeTable.setDefaultEditor(Integer.class, new TreeTableTextCellEditor(partsTreeTable));
	partsTreeTable.setTreeCellRenderer(new PacketPartsTreeRenderer(partsTreeTable, format));
	partsTreeTable.setRootVisible(false);
	partsTreeTable.addTreeExpansionListener(new PacketPartsTreeExpensionListener(partsTreeTable));
	// partsTreeTable.getColumnModel().getColumn(2).setMaxWidth(25);
	// partsTreeTable.getColumnModel().getColumn(3).setMaxWidth(115);
	// partsTreeTable.getColumnModel().getColumn(3).setPreferredWidth(105);
	resizeTreeColumn(partsTreeTable);
	TreeTableComboBoxCellEditor editor = (TreeTableComboBoxCellEditor) partsTreeTable
		.getDefaultEditor(TreeTableModel.class);
	JComboBox<?> combo = editor.getComboBox();
	combo.setRenderer(new IconComboBoxRenderer());
	_partsTreeTable = partsTreeTable;
	return partsTreeTable;
}
 
Example #2
Source File: RowTreeTable.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
private TreeTableNode findNextRow(final String startName,
                                  final boolean wordsOrder) {
    final TreeTableModel model = getTreeTableModel();
    final int cc = getColumnCount();
    final TreeTableNode node = lastFindIndex;
    nextNode();
    if (node == null && lastFindIndex == null)
        return null;
    do {
        if (findRow(startName, wordsOrder, cc, model, lastFindIndex))
            return lastFindIndex;
        if (node == lastFindIndex)
            return null;
        nextNode();
    } while (true);
}
 
Example #3
Source File: RowTreeTable.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
private boolean findRow(final String startName, final boolean wordsOrder,
                        final int cc, final TreeTableModel model, final TreeTableNode node) {
    if (node == null)
        return false;
    if (node.getParent() == null)
        return false;
    for (int j = 0; j < cc; j++) {
        final Object o = model.getValueAt(node, j);
        if (o != null)
            if (isStartSame(o.toString(), startName, wordsOrder))
                return true;
    }
    return false;
}
 
Example #4
Source File: BranchTreeTable.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public BranchTreeTable(TreeTableModel treeModel, BranchView branchView) {
    super(treeModel);
    this.branchView = branchView;
    branch = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/branch-down.png"));
    branchActual = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/branch-actual.png"));
    branchTree = new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/branch-down-right.png"));
}
 
Example #5
Source File: JXTreeTableExt.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void backupExpandedNodes() {
    expandedPaths = new LinkedHashSet<>();

    TreeTableModel treeTableModel = getTreeTableModel();
    TreePath rootPath = new TreePath(treeTableModel.getRoot());
    Enumeration<?> expandedDescendants = getExpandedDescendants(rootPath);

    if (expandedDescendants != null) {
        while (expandedDescendants.hasMoreElements()) {
            expandedPaths.add((TreePath) expandedDescendants.nextElement());
        }
    }
}
 
Example #6
Source File: GPTreeTableBase.java    From ganttproject with GNU General Public License v3.0 4 votes vote down vote up
private TreeTableModel getTableModel() {
  return myTable.getTreeTableModel();
}