Search in sources :

Example 1 with AbstractOpTreeTableNode

use of com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode in project midpoint-studio by Evolveum.

the class OpTreePanel method initMain.

private JComponent initMain() {
    for (TraceTreeViewColumn column : TraceTreeViewColumn.values()) {
        columnDefinitions.add(new TreeTableColumnDefinition<>(column));
    }
    opTreeTableModel = new OpTreeTableModel(columnDefinitions, rootOpNode);
    traceTreeTable = MidPointUtils.createTable2(opTreeTableModel, MidPointUtils.createTableColumnModel(columnDefinitions), false);
    traceTreeTable.addHighlighter(new AbstractHighlighter() {

        @Override
        protected Component doHighlight(Component component, ComponentAdapter adapter) {
            int row = adapter.convertRowIndexToModel(adapter.row);
            TreePath pathForRow = traceTreeTable.getPathForRow(row);
            AbstractOpTreeTableNode node = (AbstractOpTreeTableNode) pathForRow.getLastPathComponent();
            OpNode opNode = node.getUserObject();
            if (opNode != null) {
                // fixme hack
                AbstractOpNodePresentation<?> presentation = (AbstractOpNodePresentation<?>) opNode.getPresentation();
                if (adapter.isSelected()) {
                    component.setBackground(traceTreeTable.getSelectionBackground());
                } else {
                    Color backgroundColor = presentation.getBackgroundColor();
                    if (backgroundColor != null) {
                        component.setBackground(backgroundColor);
                    } else {
                        component.setBackground(traceTreeTable.getBackground());
                    }
                }
            }
            return component;
        }
    });
    traceTreeTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    traceTreeTable.addTreeSelectionListener(this::traceTreeTableSelectionChanged);
    JPanel panel = new BorderLayoutPanel();
    JComponent toolbar = initMainToolbar();
    panel.add(toolbar, BorderLayout.NORTH);
    panel.add(new JBScrollPane(traceTreeTable), BorderLayout.CENTER);
    return panel;
}
Also used : AbstractOpNodePresentation(com.evolveum.midpoint.studio.ui.trace.presentation.AbstractOpNodePresentation) OpTreeTableModel(com.evolveum.midpoint.studio.ui.trace.mainTree.model.OpTreeTableModel) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) TreePath(javax.swing.tree.TreePath) AbstractHighlighter(org.jdesktop.swingx.decorator.AbstractHighlighter) AbstractOpTreeTableNode(com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode) TraceTreeViewColumn(com.evolveum.midpoint.studio.ui.trace.lens.TraceTreeViewColumn) OpNode(com.evolveum.midpoint.schema.traces.OpNode) ComponentAdapter(org.jdesktop.swingx.decorator.ComponentAdapter) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 2 with AbstractOpTreeTableNode

use of com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode in project midpoint-studio by Evolveum.

the class OpTreePanel method setChildrenVisible.

private void setChildrenVisible(boolean deep) {
    List<TreePath> selectedPaths = getSelectedPaths();
    for (TreePath selectedPath : selectedPaths) {
        AbstractOpTreeTableNode selectedTreeNode = (AbstractOpTreeTableNode) selectedPath.getLastPathComponent();
        OpNode selectedOpNode = selectedTreeNode.getUserObject();
        assert selectedOpNode != null;
        for (OpNode child : selectedOpNode.getChildren()) {
            setNodeVisible(child, true, deep);
        }
    }
    updateLinksAndRefresh(selectedPaths);
}
Also used : TreePath(javax.swing.tree.TreePath) AbstractOpTreeTableNode(com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode) OpNode(com.evolveum.midpoint.schema.traces.OpNode)

Example 3 with AbstractOpTreeTableNode

use of com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode in project midpoint-studio by Evolveum.

the class OpTreePanel method selectedTraceNodeChange.

public void selectedTraceNodeChange(TreePath path) {
    if (path != null) {
        AbstractOpTreeTableNode node = (AbstractOpTreeTableNode) path.getLastPathComponent();
        notifier.selectedTraceNodeChange(node != null ? node.getUserObject() : null);
    } else {
        notifier.selectedTraceNodeChange(null);
    }
}
Also used : AbstractOpTreeTableNode(com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode)

Example 4 with AbstractOpTreeTableNode

use of com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode in project midpoint-studio by Evolveum.

the class OpTreePanel method hideSelected.

private void hideSelected(boolean deep) {
    List<TreePath> selectedPaths = getSelectedPaths();
    for (TreePath selectedPath : selectedPaths) {
        AbstractOpTreeTableNode selectedTreeNode = (AbstractOpTreeTableNode) selectedPath.getLastPathComponent();
        OpNode selectedOpNode = selectedTreeNode.getUserObject();
        assert selectedOpNode != null;
        setNodeVisible(selectedOpNode, false, deep);
    }
    updateLinksAndRefresh(getParentPaths(selectedPaths));
}
Also used : TreePath(javax.swing.tree.TreePath) AbstractOpTreeTableNode(com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode) OpNode(com.evolveum.midpoint.schema.traces.OpNode)

Aggregations

AbstractOpTreeTableNode (com.evolveum.midpoint.studio.ui.trace.mainTree.model.AbstractOpTreeTableNode)4 OpNode (com.evolveum.midpoint.schema.traces.OpNode)3 TreePath (javax.swing.tree.TreePath)3 TraceTreeViewColumn (com.evolveum.midpoint.studio.ui.trace.lens.TraceTreeViewColumn)1 OpTreeTableModel (com.evolveum.midpoint.studio.ui.trace.mainTree.model.OpTreeTableModel)1 AbstractOpNodePresentation (com.evolveum.midpoint.studio.ui.trace.presentation.AbstractOpNodePresentation)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 BorderLayoutPanel (com.intellij.util.ui.components.BorderLayoutPanel)1 AbstractHighlighter (org.jdesktop.swingx.decorator.AbstractHighlighter)1 ComponentAdapter (org.jdesktop.swingx.decorator.ComponentAdapter)1