Search in sources :

Example 1 with TreeTableColumnDefinition

use of com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition 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 TreeTableColumnDefinition

use of com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition in project midpoint-studio by Evolveum.

the class OpPerformancePanel method initLayout.

private void initLayout() {
    JBSplitter split = new OnePixelSplitter(false);
    List<TreeTableColumnDefinition<Map.Entry<PerformanceCategory, PerformanceCategoryInfo>, ?>> categoryColumns = new ArrayList<>();
    categoryColumns.add(new TreeTableColumnDefinition<>("Category", 200, o -> o.getKey().getLabel()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Total #", 50, o -> o.getValue().getTotalCount()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Total time", 70, o -> formatTime(o.getValue().getTotalTime())));
    categoryColumns.add(new TreeTableColumnDefinition<>("Own #", 50, o -> o.getValue().getOwnCount()));
    categoryColumns.add(new TreeTableColumnDefinition<>("Own time", 70, o -> formatTime(o.getValue().getOwnTime())));
    this.category = new JBTable(new ListTableModel(categoryColumns, new ArrayList<>()));
    split.setFirstComponent(new JBScrollPane(category));
    List<TreeTableColumnDefinition<SingleOperationPerformanceInformationType, ?>> operationColumns = new ArrayList<>();
    operationColumns.add(new TreeTableColumnDefinition<>("Operation", 500, o -> o.getName()));
    operationColumns.add(new TreeTableColumnDefinition<>("Count", 50, o -> o.getInvocationCount()));
    operationColumns.add(new TreeTableColumnDefinition<>("Total time", 100, o -> formatTime(o.getTotalTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Min", 50, o -> formatTime(o.getMinTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Max", 50, o -> formatTime(o.getMaxTime())));
    operationColumns.add(new TreeTableColumnDefinition<>("Avg", 50, o -> formatTime(o.getTotalTime() / o.getInvocationCount())));
    this.operation = new JBTable(new ListTableModel<>(operationColumns, new ArrayList<>()));
    split.setSecondComponent(new JBScrollPane(operation));
    add(split, BorderLayout.CENTER);
}
Also used : MidPointUtils.formatTime(com.evolveum.midpoint.studio.util.MidPointUtils.formatTime) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) MidPointProjectNotifier(com.evolveum.midpoint.studio.impl.MidPointProjectNotifier) JBSplitter(com.intellij.ui.JBSplitter) JBScrollPane(com.intellij.ui.components.JBScrollPane) ArrayList(java.util.ArrayList) OpNode(com.evolveum.midpoint.schema.traces.OpNode) java.awt(java.awt) JBTable(com.intellij.ui.table.JBTable) List(java.util.List) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) SingleOperationPerformanceInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleOperationPerformanceInformationType) Map(java.util.Map) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo) Comparator(java.util.Comparator) MessageBus(com.intellij.util.messages.MessageBus) MidPointProjectNotifierAdapter(com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter) ListTableModel(com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) ArrayList(java.util.ArrayList) PerformanceCategoryInfo(com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) JBTable(com.intellij.ui.table.JBTable) ListTableModel(com.evolveum.midpoint.studio.ui.trace.singleOp.model.ListTableModel) PerformanceCategory(com.evolveum.midpoint.schema.traces.PerformanceCategory) JBSplitter(com.intellij.ui.JBSplitter) Map(java.util.Map) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 3 with TreeTableColumnDefinition

use of com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition in project midpoint-studio by Evolveum.

the class TraceLensContextPanel method initLayout.

private void initLayout() {
    label = new JLabel(LABEL_DEFAULT_TEXT);
    label.setBorder(JBUI.Borders.empty(5));
    add(label, BorderLayout.NORTH);
    List<TreeTableColumnDefinition> columns = new ArrayList<>();
    columns.add(new TreeTableColumnDefinition<String, String>("Item", 200, o -> null));
    columns.add(new TreeTableColumnDefinition<String, String>("Old", 100, o -> null));
    columns.add(new TreeTableColumnDefinition<String, String>("Current", 100, o -> null));
    columns.add(new TreeTableColumnDefinition<String, String>("New", 100, o -> null));
    this.table = MidPointUtils.createTable(new DefaultTreeTableModel(new DefaultMutableTreeTableNode(), Arrays.asList("Item", "Old", "Current", "New")), null);
    add(new JBScrollPane(table), BorderLayout.CENTER);
    JComponent toolbar = initMainToolbar();
    add(toolbar, BorderLayout.NORTH);
}
Also used : Arrays(java.util.Arrays) AllIcons(com.intellij.icons.AllIcons) DefaultTreeTableModel(org.jdesktop.swingx.treetable.DefaultTreeTableModel) MidPointProjectNotifier(com.evolveum.midpoint.studio.impl.MidPointProjectNotifier) LensContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.LensContextType) PrismNode(com.evolveum.midpoint.studio.ui.trace.lens.PrismNode) ClockworkTraceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClockworkTraceType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ActionManager(com.intellij.openapi.actionSystem.ActionManager) ArrayList(java.util.ArrayList) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) JBUI(com.intellij.util.ui.JBUI) Project(com.intellij.openapi.project.Project) Logger(com.intellij.openapi.diagnostic.Logger) LensContextNode(com.evolveum.midpoint.studio.ui.trace.lens.LensContextNode) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) 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) List(java.util.List) MessageBus(com.intellij.util.messages.MessageBus) MidPointProjectNotifierAdapter(com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) javax.swing(javax.swing) TreeTableColumnDefinition(com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition) ArrayList(java.util.ArrayList) DefaultTreeTableModel(org.jdesktop.swingx.treetable.DefaultTreeTableModel) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Aggregations

OpNode (com.evolveum.midpoint.schema.traces.OpNode)3 MidPointProjectNotifier (com.evolveum.midpoint.studio.impl.MidPointProjectNotifier)3 MidPointProjectNotifierAdapter (com.evolveum.midpoint.studio.impl.MidPointProjectNotifierAdapter)3 TreeTableColumnDefinition (com.evolveum.midpoint.studio.ui.TreeTableColumnDefinition)3 JBScrollPane (com.intellij.ui.components.JBScrollPane)3 MessageBus (com.intellij.util.messages.MessageBus)3 BorderLayoutPanel (com.intellij.util.ui.components.BorderLayoutPanel)3 java.awt (java.awt)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 MidPointUtils (com.evolveum.midpoint.studio.util.MidPointUtils)2 AllIcons (com.intellij.icons.AllIcons)2 Logger (com.intellij.openapi.diagnostic.Logger)2 Project (com.intellij.openapi.project.Project)2 JBSplitter (com.intellij.ui.JBSplitter)2 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)2 Arrays (java.util.Arrays)2 javax.swing (javax.swing)2 PerformanceCategory (com.evolveum.midpoint.schema.traces.PerformanceCategory)1 PerformanceCategoryInfo (com.evolveum.midpoint.schema.traces.PerformanceCategoryInfo)1