Search in sources :

Example 6 with JBLayeredPane

use of com.intellij.ui.components.JBLayeredPane in project android by JetBrains.

the class DataReducerVisualTest method createLayeredSelection.

private JLayeredPane createLayeredSelection(JComponent host) {
    JBLayeredPane layeredPane = new JBLayeredPane();
    layeredPane.add(host);
    layeredPane.add(mySelection);
    layeredPane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            JLayeredPane host = (JLayeredPane) e.getComponent();
            if (host != null) {
                Dimension dim = host.getSize();
                for (Component c : host.getComponents()) {
                    c.setBounds(0, 0, dim.width, dim.height);
                }
            }
        }
    });
    return layeredPane;
}
Also used : JBLayeredPane(com.intellij.ui.components.JBLayeredPane) ComponentEvent(java.awt.event.ComponentEvent) ComponentAdapter(java.awt.event.ComponentAdapter)

Example 7 with JBLayeredPane

use of com.intellij.ui.components.JBLayeredPane in project android by JetBrains.

the class FlameGraphVisualTest method createMockTimeline.

private JLayeredPane createMockTimeline() {
    JBLayeredPane timelinePane = new JBLayeredPane() {

        @Override
        public Dimension getMaximumSize() {
            Dimension max = super.getMaximumSize();
            max.height = getPreferredSize().height;
            return max;
        }
    };
    timelinePane.add(mAxis);
    timelinePane.add(mLineChart);
    timelinePane.add(mSelector);
    timelinePane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            JLayeredPane host = (JLayeredPane) e.getComponent();
            if (host != null) {
                Dimension dim = host.getSize();
                for (Component c : host.getComponents()) {
                    if (c instanceof AxisComponent) {
                        AxisComponent axis = (AxisComponent) c;
                        switch(axis.getOrientation()) {
                            case LEFT:
                            case BOTTOM:
                            case RIGHT:
                            case TOP:
                                axis.setBounds(AXIS_SIZE, dim.height - AXIS_SIZE, dim.width - AXIS_SIZE * 2, AXIS_SIZE);
                                break;
                        }
                    } else {
                        c.setBounds(AXIS_SIZE, AXIS_SIZE, dim.width - AXIS_SIZE * 2, dim.height - AXIS_SIZE * 2);
                    }
                }
            }
        }
    });
    timelinePane.setPreferredSize(new Dimension(Integer.MAX_VALUE, 100));
    return timelinePane;
}
Also used : JBLayeredPane(com.intellij.ui.components.JBLayeredPane)

Example 8 with JBLayeredPane

use of com.intellij.ui.components.JBLayeredPane in project android by JetBrains.

the class ThreadCallsVisualTest method createMockTimeline.

private JLayeredPane createMockTimeline() {
    JBLayeredPane timelinePane = new JBLayeredPane() {

        @Override
        public Dimension getMaximumSize() {
            Dimension max = super.getMaximumSize();
            max.height = getPreferredSize().height;
            return max;
        }
    };
    timelinePane.add(mAxis);
    timelinePane.add(mLineChart);
    timelinePane.add(mSelector);
    timelinePane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            JLayeredPane host = (JLayeredPane) e.getComponent();
            if (host != null) {
                Dimension dim = host.getSize();
                for (Component c : host.getComponents()) {
                    if (c instanceof AxisComponent) {
                        AxisComponent axis = (AxisComponent) c;
                        switch(axis.getOrientation()) {
                            case LEFT:
                            case BOTTOM:
                            case RIGHT:
                            case TOP:
                                axis.setBounds(AXIS_SIZE, dim.height - AXIS_SIZE, dim.width - AXIS_SIZE * 2, AXIS_SIZE);
                                break;
                        }
                    } else {
                        c.setBounds(AXIS_SIZE, AXIS_SIZE, dim.width - AXIS_SIZE * 2, dim.height - AXIS_SIZE * 2);
                    }
                }
            }
        }
    });
    timelinePane.setPreferredSize(new Dimension(Integer.MAX_VALUE, 100));
    return timelinePane;
}
Also used : JBLayeredPane(com.intellij.ui.components.JBLayeredPane)

Example 9 with JBLayeredPane

use of com.intellij.ui.components.JBLayeredPane in project android by JetBrains.

the class ThreadsSegment method setCenterContent.

@Override
protected void setCenterContent(@NotNull JPanel panel) {
    JLayeredPane centerPane = new JBLayeredPane();
    JScrollPane scrollPane = new JBScrollPane(mThreadsList);
    centerPane.add(scrollPane);
    centerPane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            JLayeredPane host = (JLayeredPane) e.getComponent();
            if (host != null) {
                Dimension dim = host.getSize();
                for (Component c : host.getComponents()) {
                    c.setBounds(0, 0, dim.width, dim.height);
                }
            }
        }
    });
    panel.add(centerPane, BorderLayout.CENTER);
}
Also used : JBLayeredPane(com.intellij.ui.components.JBLayeredPane) ComponentEvent(java.awt.event.ComponentEvent) LegendComponent(com.android.tools.adtui.LegendComponent) AnimatedComponent(com.android.tools.adtui.AnimatedComponent) JBScrollPane(com.intellij.ui.components.JBScrollPane) ComponentAdapter(java.awt.event.ComponentAdapter)

Aggregations

JBLayeredPane (com.intellij.ui.components.JBLayeredPane)9 EditorFragmentComponent (com.intellij.codeInsight.hint.EditorFragmentComponent)3 Activatable (com.intellij.util.ui.update.Activatable)3 UiNotifyConnector (com.intellij.util.ui.update.UiNotifyConnector)3 DropTarget (java.awt.dnd.DropTarget)3 DropTargetAdapter (java.awt.dnd.DropTargetAdapter)3 DropTargetDragEvent (java.awt.dnd.DropTargetDragEvent)3 DropTargetDropEvent (java.awt.dnd.DropTargetDropEvent)3 ComponentAdapter (java.awt.event.ComponentAdapter)3 ComponentEvent (java.awt.event.ComponentEvent)3 AnimatedComponent (com.android.tools.adtui.AnimatedComponent)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 JBPanel (com.intellij.ui.components.JBPanel)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 Override (java.lang.Override)1