本文整理汇总了Java中org.jdesktop.swingx.JXTreeTable类的典型用法代码示例。如果您正苦于以下问题:Java JXTreeTable类的具体用法?Java JXTreeTable怎么用?Java JXTreeTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JXTreeTable类属于org.jdesktop.swingx包,在下文中一共展示了JXTreeTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeTableModelAdapter
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
public TreeTableModelAdapter(JXTreeTable treeTable, HierarchicalDatasource datasource, List<Table.Column> columns,
boolean autoRefresh) {
this.treeTable = treeTable;
this.treeDelegate = createTreeModelAdapter(datasource, autoRefresh);
this.tableDelegate = new TableModelAdapter(datasource, columns, autoRefresh);
collectionChangeListener = e -> {
Object root1 = getRoot();
// Fixes #1160
JXTreeTableExt impl = (JXTreeTableExt) TreeTableModelAdapter.this.treeTable;
impl.setAutoCreateColumnsFromModel(false);
impl.backupExpandedNodes();
for (DataChangeListener changeListener : changeListeners) {
changeListener.beforeChange(true);
}
modelSupport.fireTreeStructureChanged(root1 == null ? null : new TreePath(root1));
};
//noinspection unchecked
datasource.addCollectionChangeListener(new WeakCollectionChangeListener(datasource, collectionChangeListener));
}
示例2: applyFont
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
@Override
protected void applyFont(JTable table, Font font) {
JXTreeTable treeTable = (JXTreeTable) table;
if (treeTable.getModel() != null && impl != null) {
int hierarchicalColumn = treeTable.getHierarchicalColumn();
TableCellRenderer cellRenderer = treeTable.getCellRenderer(0, hierarchicalColumn);
if (cellRenderer instanceof DesktopAbstractTable.StylingCellRenderer) {
cellRenderer = ((DesktopAbstractTable.StylingCellRenderer) cellRenderer).getDelegate();
}
if (cellRenderer instanceof JXTree) {
// default JXTreeTable renderer for hierarchical column is JXTree
((JXTree) cellRenderer).setFont(font);
}
}
super.applyFont(table, font);
}
示例3: startViewer
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
protected void startViewer(final ViewProcessor viewProcessor) {
final UserPrincipal user = UserPrincipal.getLocalUser();
final ViewClient viewClient = viewProcessor.createViewClient(user);
final PortfolioTreeTableModel treeTableModel = buildTreeTableModel();
viewClient.setResultListener(treeTableModel);
viewClient.attachToViewProcess(viewProcessor.getConfigSource().getSingle(ViewDefinition.class, "Equity Portfolio View", VersionCorrection.LATEST).getUniqueId(),
ExecutionOptions.infinite(MarketData.live()));
getMainFrame().setTitle("OpenGamma Viewer");
final JXTreeTable treeTable = new JXTreeTable(treeTableModel);
treeTable.setName("table");
treeTable.setRootVisible(true);
treeTable.setFillsViewportHeight(true);
treeTable.setAutoResizeMode(JXTreeTable.AUTO_RESIZE_ALL_COLUMNS);
treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
final JScrollPane scrollPane = new JScrollPane(treeTable);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(scrollPane, BorderLayout.CENTER);
final JPanel topLevelPanel = new JPanel(new BorderLayout());
topLevelPanel.add(panel, BorderLayout.CENTER);
show(topLevelPanel);
}
示例4: testToolTipManagerTreeTableTreeRenderer
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* Issue #790-swingx: rendering comps must not be registered with the tooltip manager.
*
* Here: TreeTableCellRenderer (the tree used for rendering the hierarchical
* column)
*
*/
@Test
public void testToolTipManagerTreeTableTreeRenderer() {
JXTreeTable treeTable = new JXTreeTable(new ComponentTreeTableModel(new JXPanel()));
// core row conversion is lenient than ol' swingx
// PENDING JW: raise an issue about JXTreeTable not being sortable
// (remove the default auto-createRowSorter)
treeTable.setRootVisible(true);
JComponent label = (JComponent) treeTable.prepareRenderer(treeTable.getCellRenderer(0, 0), 0, 0);
String tip = "some tip";
PropertyChangeReport report = new PropertyChangeReport();
label.addPropertyChangeListener(report);
label.setToolTipText(tip);
TestUtils.assertPropertyChangeEvent(report, JComponent.TOOL_TIP_TEXT_KEY, null, tip);
assertToolTipManagerNotRegistered(label);
}
示例5: interactiveDropOnHierachicalColumnBlinks
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* Issue #766-swingx: drop image is blinking over hierarchical column.
*
* Core bug: <a
* href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6700748">#6700748</a>
*
* Hacks around, use one or other:
* - the usual performance optimization (override validate etc to do nothing)
* - rendering component return false on isVisible
*/
public void interactiveDropOnHierachicalColumnBlinks() {
JXTreeTable xTable = new JXTreeTable(new ComponentTreeTableModel(
new JXFrame()));
installTransferHandler(xTable);
xTable.putClientProperty(JXTreeTable.DROP_HACK_FLAG_KEY, Boolean.TRUE);
xTable.expandAll();
xTable.setVisibleColumnCount(10);
JXFrame frame = wrapWithScrollingInFrame(xTable,
"TreeTable hierarchical: blink on drop over?");
JTextField textField = new JTextField(
"drag me over hierarchical column ..");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
frame.setVisible(true);
}
示例6: interactiveTreeTableRollover
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
public void interactiveTreeTableRollover() {
final JXTreeTable table = new JXTreeTable(treeTableModel);
final CompoundHighlighter compoundHighlighter = new CompoundHighlighter(foregroundHighlighter);
table.setHighlighters(compoundHighlighter);
JXFrame frame = wrapWithScrollingInFrame(table, "TreeTable with rollover");
Action toggleAction = new AbstractAction("toggle foreground/background") {
boolean isBackground;
public void actionPerformed(ActionEvent e) {
if (isBackground) {
compoundHighlighter.addHighlighter(foregroundHighlighter);
compoundHighlighter.removeHighlighter(backgroundHighlighter);
} else {
compoundHighlighter.addHighlighter(backgroundHighlighter);
compoundHighlighter.removeHighlighter(foregroundHighlighter);
}
isBackground = !isBackground;
}
};
addAction(frame, toggleAction);
frame.setVisible(true);
}
示例7: interactiveTreeTableStringValueComponent
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* Issue ??-swingx: TreeTable doesn't return correct string value for hierarchical column.
*
* This is probably a variant of not using the table's renderer (at least I expect it
* to be solved then at the latest). In the meantime, might want to do something special
* for the hierarchical column?
*/
public void interactiveTreeTableStringValueComponent() {
TreeTableModel model = new ComponentTreeTableModel(new JXFrame());
JXTreeTable treeTable = new JXTreeTable(model);
treeTable.setRootVisible(true);
treeTable.expandAll();
LOG.info(treeTable.getStringAt(3, 0));
// treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
JXTree tree = new JXTree(model);
// tree.setCellRenderer(new DefaultTreeRenderer(sv));
HighlightPredicate predicate = new PatternPredicate("null", 0, PatternPredicate.ALL);
ColorHighlighter hl = new ColorHighlighter(predicate, null, Color.RED);
treeTable.addHighlighter(hl);
tree.addHighlighter(hl);
JXFrame frame = wrapWithScrollingInFrame( treeTable, "string rep in hierarchical column");
show(frame);
}
示例8: interactiveTreeStringValueComponent
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* Issue ??-swingx: TreeTable doesn't return correct string value for hierarchical column.
*
* This is probably a variant of not using the table's renderer (at least I expect it
* to be solved then at the latest). In the meantime, might want to do something special
* for the hierarchical column?
*/
public void interactiveTreeStringValueComponent() {
TreeTableModel model = new ComponentTreeTableModel(new JXFrame());
JXTreeTable treeTable = new JXTreeTable(model);
treeTable.setRootVisible(true);
treeTable.expandAll();
LOG.info(treeTable.getStringAt(3, 0));
// treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
JXTree tree = new JXTree(model);
// tree.setCellRenderer(new DefaultTreeRenderer(sv));
HighlightPredicate predicate = new PatternPredicate("null", 0, PatternPredicate.ALL);
ColorHighlighter hl = new ColorHighlighter(predicate, null, Color.RED);
treeTable.addHighlighter(hl);
tree.addHighlighter(hl);
JXFrame frame = wrapWithScrollingInFrame( tree, "string rep in hierarchical column");
show(frame);
}
示例9: showActionMaps
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
public static void showActionMaps() {
System.out.println("\nActionMap keys for JXTable\n===================");
showActionMap(new JXTable());
System.out.println("\nActionMap keys for JXEditorPane\n==================");
showActionMap(new JXEditorPane());
System.out.println("\nActionMap keys for an HTML JXEditorPane\n==================");
showActionMap(new JXEditorPane("text/html", ""));
System.out.println("\nActionMap keys for JXTree\n====================");
showActionMap(new JXTree());
System.out.println("\nActionMap keys for JXTreeTable\n====================");
showActionMap(new JXTreeTable());
}
示例10: initComponents
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
private void initComponents() {
treeTable = new JXTreeTable();
treeTable.setName("componentTreeTable");
add(new JScrollPane(treeTable));
JComponent control = new JXPanel();
refreshButton = new JButton();
refreshButton.setName("refreshButton");
expandButton = new JButton();
expandButton.setName("expandTreeTableButton");
collapseButton = new JButton();
collapseButton.setName("collapseTreeTableButton");
// control.add(refreshButton);
control.add(expandButton);
control.add(collapseButton);
add(control, BorderLayout.SOUTH);
}
示例11: CheckTreeTableManager
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
public CheckTreeTableManager(JXTreeTable treeTable) {
this.treetable = treeTable;
this.tree = (JTree) treeTable.getCellRenderer(0, 0);
selectionModel = new CheckTreeSelectionModel(tree.getModel());
tree.setCellRenderer(new DefaultTreeRenderer(new CheckTreeCellProvider(selectionModel)));
treeTable.addMouseListener(this);
selectionModel.addTreeSelectionListener(this);
}
示例12: TableRowHeader
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
public TableRowHeader(final JXTreeTable table, final QualifierModel model) {
super(new TableRowHeaderModel(table));
this.table = table;
this.model = model;
// ((RowTreeTable) table).setHeader(this);
m = preferredHeaderWidth();
setFixedCellHeight(table.getRowHeight());
setFixedCellWidth(m);
setCellRenderer(renderer);
setSelectionModel(table.getSelectionModel());
table.getModel().addTableModelListener(listener);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
final int index = locationToIndex(e.getPoint());
if (index >= 0) {
final Row row = (Row) getModel().getElementAt(index);
if (row != null) {
TableRowHeader.this.model.setSelectedRow(row,
!TableRowHeader.this.model.isChecked(row));
TableRowHeader.this.repaint();
}
}
}
});
}
示例13: initComponents
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
@Override
protected void initComponents() {
final Box box = Box.createVerticalBox();
jTable = new JXTreeTable(new Model());
// jTable.setPreferredScrollableViewportSize(new Dimension(600, 70));
jTable.setFillsViewportHeight(true);
// Create the scroll pane and add the table to it.
final JScrollPane scrollPane = new JScrollPane(jTable);
nastavVlastnostiSloupcu();
box.add(scrollPane);
add(box);
}
示例14: interactiveColumnShading
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* columm shading (was: hierarchicalColumnHighlighter)
*
*/
public void interactiveColumnShading() {
JXTreeTable treeTable = new JXTreeTable(new FileSystemModel());
// simulate hierarchicalColumnHighlighter
int hierarchicalColumn = 0;
for (int i = 0; i < treeTable.getColumnCount(); i++) {
if (treeTable.isHierarchical(i)) {
hierarchicalColumn = i;
break;
}
}
treeTable.addHighlighter(new ShadingColorHighlighter(new ColumnHighlightPredicate(hierarchicalColumn)));
showWithScrollingInFrame(treeTable, "hierarchical column");
}
示例15: interactiveTreeTableSimpleStripingUI
import org.jdesktop.swingx.JXTreeTable; //导入依赖的package包/类
/**
* Simple ui-striping.
*
*/
public void interactiveTreeTableSimpleStripingUI() {
JXTreeTable table = new JXTreeTable(new FileSystemModel());
table.setVisibleRowCount(table.getRowCount() + 3);
table.addHighlighter(HighlighterFactory.createSimpleStriping());
showWithScrollingInFrame(table, "Simple ui striping");
}