Search in sources :

Example 1 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project buck by facebook.

the class BuckToolWindowFactory method createBuildInfoPanel.

private JComponent createBuildInfoPanel(Project project) {
    Tree result = new Tree(BuckUIManager.getInstance(project).getTreeModel());
    result.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            Tree tree = (Tree) e.getComponent();
            int selRow = tree.getRowForLocation(e.getX(), e.getY());
            TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
            if (selRow != -1 && e.getClickCount() == 2) {
                TreeNode node = (TreeNode) selPath.getLastPathComponent();
                if (node.isLeaf()) {
                    BuckTreeNodeDetail buckNode = (BuckTreeNodeDetail) node;
                    if (buckNode instanceof BuckTreeNodeDetailError) {
                        BuckToolWindowFactory.this.handleClickOnError((BuckTreeNodeDetailError) buckNode);
                    }
                }
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    });
    result.setCellRenderer(new BuckTreeCellRenderer());
    result.setShowsRootHandles(false);
    result.setRowHeight(0);
    JBScrollPane treeView = new JBScrollPane(result);
    return treeView;
}
Also used : MouseListener(java.awt.event.MouseListener) MouseEvent(java.awt.event.MouseEvent) TreePath(javax.swing.tree.TreePath) TreeNode(javax.swing.tree.TreeNode) Tree(com.intellij.ui.treeStructure.Tree) BuckTreeNodeDetailError(com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetailError) BuckTreeCellRenderer(com.facebook.buck.intellij.ideabuck.ui.tree.renderers.BuckTreeCellRenderer) JBScrollPane(com.intellij.ui.components.JBScrollPane) BuckTreeNodeDetail(com.facebook.buck.intellij.ideabuck.ui.tree.BuckTreeNodeDetail)

Example 2 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class SelectorBasedResponseHandler method getConfigurationComponent.

@NotNull
@Override
public JComponent getConfigurationComponent(@NotNull Project project) {
    FileType fileType = getResponseType().getSelectorFileType();
    HighlightedSelectorsTable table = new HighlightedSelectorsTable(fileType, project, getSelectors());
    return new JBScrollPane(table);
}
Also used : FileType(com.intellij.openapi.fileTypes.FileType) JBScrollPane(com.intellij.ui.components.JBScrollPane) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class AssociationsEditor method initUI.

private void initUI() {
    myComponent = new JPanel(new BorderLayout());
    mySplitter = new JBSplitter("AssociationsEditor.dividerProportion", 0.3f);
    myComponent.add(mySplitter, BorderLayout.CENTER);
    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.setBorder(IdeBorderFactory.createTitledBorder("Project XSLT Files", false, new Insets(0, 0, 0, 0)));
    myTree = new Tree();
    myTree.setRootVisible(false);
    myTree.setShowsRootHandles(false);
    leftPanel.add(new JBScrollPane(myTree), BorderLayout.CENTER);
    mySplitter.setFirstComponent(leftPanel);
    myList = new JBList();
    myList.setCellRenderer(new MyCellRenderer());
    myList.setMinimumSize(new Dimension(120, 200));
    myList.getEmptyText().setText("No associated files");
    JPanel rightPanel = ToolbarDecorator.createDecorator(myList).addExtraAction(AnActionButton.fromAction(new AddAssociationActionWrapper())).addExtraAction(AnActionButton.fromAction(new RemoveAssociationAction())).disableUpDownActions().disableAddAction().disableRemoveAction().createPanel();
    UIUtil.addBorder(rightPanel, IdeBorderFactory.createTitledBorder("Associated Files", false, new Insets(0, 0, 0, 0)));
    mySplitter.setSecondComponent(rightPanel);
}
Also used : Tree(com.intellij.ui.treeStructure.Tree) JBList(com.intellij.ui.components.JBList) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 4 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project azure-tools-for-java by Microsoft.

the class SparkSubmissionContentPanel method addConfigurationLineItem.

private void addConfigurationLineItem() {
    JLabel jobConfigurationLabel = new JLabel("Job configurations");
    add(jobConfigurationLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));
    String[] columns = { "Key", "Value", "" };
    jobConfigurationTable = new JBTable();
    Dimension jobConfigurationTableSize = new Dimension(320, 100);
    jobConfigurationTable.setPreferredScrollableViewportSize(jobConfigurationTableSize);
    jobConfigurationTable.setSurrendersFocusOnKeystroke(true);
    jobConfigurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jobConfigurationTable.setColumnSelectionAllowed(true);
    JBScrollPane scrollPane = new JBScrollPane(jobConfigurationTable);
    jobConfigurationTable.setFillsViewportHeight(true);
    scrollPane.setMinimumSize(jobConfigurationTableSize);
    jobConfigurationTable.addPropertyChangeListener((evt) -> {
        if ((evt.getPropertyName().equals("tableCellEditor") || evt.getPropertyName().equals("model")) && jobConfigurationTable.getModel() instanceof SubmissionTableModel) {
            SubmissionTableModel model = (SubmissionTableModel) jobConfigurationTable.getModel();
            setVisibleForFixedErrorMessageLabel(ErrorMessageLabelTag.JobConfiguration.ordinal(), false);
            SparkSubmissionJobConfigCheckResult result = model.getFirstCheckResults();
            if (result != null) {
                setStatusForMessageLabel(ErrorMessageLabelTag.JobConfiguration.ordinal(), true, result.getMessaqge(), result.getStatus() == SparkSubmissionJobConfigCheckStatus.Warning);
            }
        }
    });
    add(scrollPane, new GridBagConstraints(1, displayLayoutCurrentRow, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, 0), 0, 0));
    JButton loadJobConfigurationButton = new JButton("...");
    loadJobConfigurationButton.setPreferredSize(selectedArtifactTextField.getButton().getPreferredSize());
    FixedSizeButton loadJobConfigurationFixedSizeButton = new FixedSizeButton(loadJobConfigurationButton);
    add(loadJobConfigurationFixedSizeButton, new GridBagConstraints(2, displayLayoutCurrentRow, 0, 1, 0, 0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(margin, margin / 2, 0, margin), 0, 0));
    loadJobConfigurationFixedSizeButton.setToolTipText("Load Spark config from property file");
    loadJobConfigurationFixedSizeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
            fileChooserDescriptor.setTitle("Select Spark property file");
            VirtualFile chooseFile = FileChooser.chooseFile(fileChooserDescriptor, null, null);
            if (chooseFile != null) {
                submitModel.loadJobConfigMapFromPropertyFile(chooseFile.getCanonicalPath());
            }
        }
    });
    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()] = new JLabel();
    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()].setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()].setVisible(false);
    add(errorMessageLabels[ErrorMessageLabelTag.JobConfiguration.ordinal()], new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, margin, 0, margin), 0, 0));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ActionEvent(java.awt.event.ActionEvent) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) JBTable(com.intellij.ui.table.JBTable) ActionListener(java.awt.event.ActionListener) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 5 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class CustomizePluginsStepPanel method createScrollPane.

static JBScrollPane createScrollPane(JPanel gridPanel) {
    JBScrollPane scrollPane = new JBScrollPane(gridPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    // to disallow resetting border on LaF change
    scrollPane.setBorder(JBUI.Borders.empty());
    return scrollPane;
}
Also used : JBScrollPane(com.intellij.ui.components.JBScrollPane)

Aggregations

JBScrollPane (com.intellij.ui.components.JBScrollPane)67 Tree (com.intellij.ui.treeStructure.Tree)12 JBList (com.intellij.ui.components.JBList)11 Nullable (org.jetbrains.annotations.Nullable)10 ActionEvent (java.awt.event.ActionEvent)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 MouseEvent (java.awt.event.MouseEvent)8 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)7 List (java.util.List)7 ListSelectionEvent (javax.swing.event.ListSelectionEvent)7 NotNull (org.jetbrains.annotations.NotNull)7 ListSelectionListener (javax.swing.event.ListSelectionListener)6 JBTable (com.intellij.ui.table.JBTable)5 java.awt (java.awt)5 Map (java.util.Map)5 javax.swing (javax.swing)5 TreePath (javax.swing.tree.TreePath)5 Project (com.intellij.openapi.project.Project)4 ComboBox (com.intellij.openapi.ui.ComboBox)4 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)4