Search in sources :

Example 1 with Node

use of com.evolveum.midpoint.studio.ui.trace.entry.Node in project midpoint-studio by Evolveum.

the class AbstractOpTreePanel method initLayout.

private void initLayout() {
    JBSplitter splitter = new OnePixelSplitter(false);
    add(splitter, BorderLayout.CENTER);
    List<TreeTableColumnDefinition<String, ?>> columns = new ArrayList<>();
    columns.add(new TreeTableColumnDefinition<>("Item", 150, o -> null));
    columns.add(new TreeTableColumnDefinition<>("Variable", 400, o -> null, new ExpansionSensitiveTableCellRenderer()));
    this.variables = MidPointUtils.createTable2(new DefaultTreeTableModel(new DefaultMutableTreeTableNode(), Arrays.asList("Item", "Variable")), MidPointUtils.createTableColumnModel(columns), false);
    this.variables.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.variables.addTreeSelectionListener(this::variablesSelectionChanged);
    this.variables.addHighlighter(new AbstractHighlighter() {

        @Override
        protected Component doHighlight(Component component, ComponentAdapter adapter) {
            int row = adapter.convertRowIndexToModel(adapter.row);
            TreePath pathForRow = variables.getPathForRow(row);
            Node node = (Node) pathForRow.getLastPathComponent();
            if (adapter.isSelected()) {
                component.setBackground(variables.getSelectionBackground());
            } else if (node.getBackgroundColor() == null) {
                component.setBackground(variables.getBackground());
            } else {
                component.setBackground(node.getBackgroundColor());
            }
            return component;
        }
    });
    TableColumn column = this.variables.getColumnModel().getColumn(1);
    column.setCellRenderer(new ExpansionSensitiveTableCellRenderer());
    JComponent mainToolbar = initMainToolbar();
    splitter.setFirstComponent(MidPointUtils.createBorderLayoutPanel(mainToolbar, new JBScrollPane(this.variables), null));
    JPanel left = new BorderLayoutPanel();
    splitter.setSecondComponent(left);
    DefaultActionGroup group = new DefaultActionGroup();
    variablesDisplayAs = new FormatComboboxAction() {

        @Override
        public void setFormat(Format format) {
            super.setFormat(format);
            variableDisplayAsChanged(format);
        }
    };
    group.add(variablesDisplayAs);
    variablesWrapText = new SimpleCheckboxAction("Wrap text") {

        @Override
        public void onStateChange() {
            variablesValue.setLineWrap(isSelected());
            variablesValue.invalidate();
        }
    };
    group.add(variablesWrapText);
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("TraceViewVariablesToolbar", group, true);
    toolbar.setTargetComponent(this);
    left.add(toolbar.getComponent(), BorderLayout.NORTH);
    variablesValue = new JBTextArea();
    left.add(MidPointUtils.borderlessScrollPane(variablesValue), BorderLayout.CENTER);
}
Also used : Arrays(java.util.Arrays) AllIcons(com.intellij.icons.AllIcons) DefaultTreeTableModel(org.jdesktop.swingx.treetable.DefaultTreeTableModel) MidPointProjectNotifier(com.evolveum.midpoint.studio.impl.MidPointProjectNotifier) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction) FormattingContext(com.evolveum.midpoint.studio.impl.trace.FormattingContext) ViewingState(com.evolveum.midpoint.studio.ui.trace.ViewingState) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) ArrayList(java.util.ArrayList) JBTextArea(com.intellij.ui.components.JBTextArea) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) Project(com.intellij.openapi.project.Project) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) Format(com.evolveum.midpoint.studio.impl.trace.Format) ComboBoxAction(com.intellij.openapi.actionSystem.ex.ComboBoxAction) Logger(com.intellij.openapi.diagnostic.Logger) DumbAware(com.intellij.openapi.project.DumbAware) SimpleCheckboxAction(com.evolveum.midpoint.studio.ui.SimpleCheckboxAction) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) AbstractHighlighter(org.jdesktop.swingx.decorator.AbstractHighlighter) TreePath(javax.swing.tree.TreePath) JBSplitter(com.intellij.ui.JBSplitter) TableColumn(javax.swing.table.TableColumn) ComponentAdapter(org.jdesktop.swingx.decorator.ComponentAdapter) MiscUtil(com.evolveum.midpoint.util.MiscUtil) Node(com.evolveum.midpoint.studio.ui.trace.entry.Node) JXTreeTable(org.jdesktop.swingx.JXTreeTable) JBScrollPane(com.intellij.ui.components.JBScrollPane) OpNode(com.evolveum.midpoint.schema.traces.OpNode) MidPointUtils(com.evolveum.midpoint.studio.util.MidPointUtils) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) List(java.util.List) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) NotNull(org.jetbrains.annotations.NotNull) MessageBus(com.intellij.util.messages.MessageBus) MidPointProjectNotifierAdapter(com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter) javax.swing(javax.swing) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) Node(com.evolveum.midpoint.studio.ui.trace.entry.Node) OpNode(com.evolveum.midpoint.schema.traces.OpNode) ArrayList(java.util.ArrayList) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) Format(com.evolveum.midpoint.studio.impl.trace.Format) ComponentAdapter(org.jdesktop.swingx.decorator.ComponentAdapter) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) DefaultTreeTableModel(org.jdesktop.swingx.treetable.DefaultTreeTableModel) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) JBTextArea(com.intellij.ui.components.JBTextArea) TableColumn(javax.swing.table.TableColumn) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) SimpleCheckboxAction(com.evolveum.midpoint.studio.ui.SimpleCheckboxAction) TreePath(javax.swing.tree.TreePath) AbstractHighlighter(org.jdesktop.swingx.decorator.AbstractHighlighter) JBSplitter(com.intellij.ui.JBSplitter) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 2 with Node

use of com.evolveum.midpoint.studio.ui.trace.entry.Node in project midpoint-studio by Evolveum.

the class OpDetailsTreePanel method updateModel.

@Override
void updateModel(OpNode node) {
    super.updateModel(node);
    Node result;
    Node trace;
    if (node != null) {
        result = new ResultNode(node);
        trace = createTraceNodeTreatingExceptions(node);
    } else {
        result = TextNode.create("Result", "", null);
        trace = TextNode.create("Trace", "", null);
    }
    DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode();
    root.add(result);
    root.add(trace);
    updateTreeModel(root);
    applySelection(null);
}
Also used : ResultNode(com.evolveum.midpoint.studio.ui.trace.entry.ResultNode) OpNode(com.evolveum.midpoint.schema.traces.OpNode) TextNode(com.evolveum.midpoint.studio.ui.trace.entry.TextNode) TraceNode(com.evolveum.midpoint.studio.ui.trace.entry.TraceNode) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) ResultNode(com.evolveum.midpoint.studio.ui.trace.entry.ResultNode) Node(com.evolveum.midpoint.studio.ui.trace.entry.Node) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode)

Example 3 with Node

use of com.evolveum.midpoint.studio.ui.trace.entry.Node in project midpoint-studio by Evolveum.

the class AbstractOpTreePanel method variableDisplayAsChanged.

private void variableDisplayAsChanged(Format format) {
    ListSelectionModel ext = variables.getSelectionModel();
    int[] indices = ext.getSelectedIndices();
    if (indices == null || indices.length == 0) {
        applySelection(null);
    }
    TreeTableNode node = (TreeTableNode) variables.getPathForRow(indices[0]).getLastPathComponent();
    if (node instanceof Node) {
        applySelection((Node) node);
    } else {
        applySelection(null);
    }
}
Also used : DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) Node(com.evolveum.midpoint.studio.ui.trace.entry.Node) OpNode(com.evolveum.midpoint.schema.traces.OpNode)

Example 4 with Node

use of com.evolveum.midpoint.studio.ui.trace.entry.Node in project midpoint-studio by Evolveum.

the class AbstractOpTreePanel method variablesSelectionChanged.

private void variablesSelectionChanged(TreeSelectionEvent e) {
    TreePath path = e.getNewLeadSelectionPath();
    TreeTableNode node = path != null ? (TreeTableNode) path.getLastPathComponent() : null;
    Node obj = null;
    if (node instanceof Node) {
        obj = (Node) node;
    }
    applySelection(obj);
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) TreeTableNode(org.jdesktop.swingx.treetable.TreeTableNode) Node(com.evolveum.midpoint.studio.ui.trace.entry.Node) OpNode(com.evolveum.midpoint.schema.traces.OpNode)

Aggregations

OpNode (com.evolveum.midpoint.schema.traces.OpNode)4 Node (com.evolveum.midpoint.studio.ui.trace.entry.Node)4 DefaultMutableTreeTableNode (org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode)4 TreePath (javax.swing.tree.TreePath)2 TreeTableNode (org.jdesktop.swingx.treetable.TreeTableNode)2 MidPointProjectNotifier (com.evolveum.midpoint.studio.impl.MidPointProjectNotifier)1 MidPointProjectNotifierAdapter (com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter)1 Format (com.evolveum.midpoint.studio.impl.trace.Format)1 FormattingContext (com.evolveum.midpoint.studio.impl.trace.FormattingContext)1 SimpleCheckboxAction (com.evolveum.midpoint.studio.ui.SimpleCheckboxAction)1 TreeTableColumnDefinition (com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition)1 ViewingState (com.evolveum.midpoint.studio.ui.trace.ViewingState)1 ResultNode (com.evolveum.midpoint.studio.ui.trace.entry.ResultNode)1 TextNode (com.evolveum.midpoint.studio.ui.trace.entry.TextNode)1 TraceNode (com.evolveum.midpoint.studio.ui.trace.entry.TraceNode)1 MidPointUtils (com.evolveum.midpoint.studio.util.MidPointUtils)1 MiscUtil (com.evolveum.midpoint.util.MiscUtil)1 AllIcons (com.intellij.icons.AllIcons)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 CheckboxAction (com.intellij.openapi.actionSystem.ex.CheckboxAction)1