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);
}
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);
}
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);
}
}
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);
}
Aggregations