Search in sources :

Example 41 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project sonarqube by SonarSource.

the class ScannerReportViewerApp method initialize.

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
    // If Nimbus is not available, you can set the GUI to another look and feel.
    }
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    splitPane = new JSplitPane();
    frame.getContentPane().add(splitPane, BorderLayout.CENTER);
    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setPreferredSize(new Dimension(500, 7));
    splitPane.setRightComponent(tabbedPane);
    componentDetailsTab = new JScrollPane();
    tabbedPane.addTab("Component details", null, componentDetailsTab, null);
    componentEditor = new JEditorPane();
    componentDetailsTab.setViewportView(componentEditor);
    sourceTab = new JScrollPane();
    tabbedPane.addTab("Source", null, sourceTab, null);
    sourceEditor = createSourceEditor();
    sourceEditor.setEditable(false);
    sourceTab.setViewportView(sourceEditor);
    textLineNumber = createTextLineNumber();
    sourceTab.setRowHeaderView(textLineNumber);
    highlightingTab = new JScrollPane();
    tabbedPane.addTab("Highlighting", null, highlightingTab, null);
    highlightingEditor = new JEditorPane();
    highlightingTab.setViewportView(highlightingEditor);
    symbolTab = new JScrollPane();
    tabbedPane.addTab("Symbol references", null, symbolTab, null);
    symbolEditor = new JEditorPane();
    symbolTab.setViewportView(symbolEditor);
    coverageTab = new JScrollPane();
    tabbedPane.addTab("Coverage", null, coverageTab, null);
    coverageEditor = new JEditorPane();
    coverageTab.setViewportView(coverageEditor);
    duplicationTab = new JScrollPane();
    tabbedPane.addTab("Duplications", null, duplicationTab, null);
    duplicationEditor = new JEditorPane();
    duplicationTab.setViewportView(duplicationEditor);
    testsTab = new JScrollPane();
    tabbedPane.addTab("Tests", null, testsTab, null);
    testsEditor = new JEditorPane();
    testsTab.setViewportView(testsEditor);
    issuesTab = new JScrollPane();
    tabbedPane.addTab("Issues", null, issuesTab, null);
    issuesEditor = new JEditorPane();
    issuesTab.setViewportView(issuesEditor);
    externalIssuesTab = new JScrollPane();
    tabbedPane.addTab("External Issues", null, externalIssuesTab, null);
    externalIssuesEditor = new JEditorPane();
    externalIssuesTab.setViewportView(externalIssuesEditor);
    measuresTab = new JScrollPane();
    tabbedPane.addTab("Measures", null, measuresTab, null);
    measuresEditor = new JEditorPane();
    measuresTab.setViewportView(measuresEditor);
    scmTab = new JScrollPane();
    tabbedPane.addTab("SCM", null, scmTab, null);
    scmEditor = new JEditorPane();
    scmTab.setViewportView(scmEditor);
    activeRuleTab = new JScrollPane();
    tabbedPane.addTab("Active Rules", null, activeRuleTab, null);
    activeRuleEditor = new JEditorPane();
    activeRuleTab.setViewportView(activeRuleEditor);
    adHocRuleTab = new JScrollPane();
    tabbedPane.addTab("Add Hoc Rules", null, adHocRuleTab, null);
    adHocRuleEditor = new JEditorPane();
    adHocRuleTab.setViewportView(adHocRuleEditor);
    qualityProfileTab = new JScrollPane();
    tabbedPane.addTab("Quality Profiles", null, qualityProfileTab, null);
    qualityProfileEditor = new JEditorPane();
    qualityProfileTab.setViewportView(qualityProfileEditor);
    pluginTab = new JScrollPane();
    tabbedPane.addTab("Plugins", null, pluginTab, null);
    pluginEditor = new JEditorPane();
    pluginTab.setViewportView(pluginEditor);
    cpdTextBlocksTab = new JScrollPane();
    tabbedPane.addTab("CPD Text Blocks", null, cpdTextBlocksTab, null);
    cpdTextBlocksEditor = new JEditorPane();
    cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);
    significantCodeTab = new JScrollPane();
    tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
    significantCodeEditor = new JEditorPane();
    significantCodeTab.setViewportView(significantCodeEditor);
    metadataTab = new JScrollPane();
    tabbedPane.addTab("Metadata", null, metadataTab, null);
    metadataEditor = new JEditorPane();
    metadataTab.setViewportView(metadataEditor);
    treeScrollPane = new JScrollPane();
    treeScrollPane.setPreferredSize(new Dimension(200, 400));
    splitPane.setLeftComponent(treeScrollPane);
    componentTree = new JTree();
    componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {

        {
        }
    }));
    treeScrollPane.setViewportView(componentTree);
    componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    componentTree.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
            if (node == null) {
                // Nothing is selected.
                return;
            }
            frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
            updateDetails((Component) node.getUserObject());
            frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    });
    frame.pack();
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeSelectionListener(javax.swing.event.TreeSelectionListener) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) IOException(java.io.IOException) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) Component(org.sonar.scanner.protocol.output.ScannerReport.Component)

Aggregations

LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)41 IOException (java.io.IOException)7 JPanel (javax.swing.JPanel)6 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)6 Dimension (java.awt.Dimension)5 JFrame (javax.swing.JFrame)5 JLabel (javax.swing.JLabel)4 BorderLayout (java.awt.BorderLayout)3 File (java.io.File)3 JFileChooser (javax.swing.JFileChooser)3 Color (java.awt.Color)2 FlowLayout (java.awt.FlowLayout)2 GridLayout (java.awt.GridLayout)2 JButton (javax.swing.JButton)2 JTextField (javax.swing.JTextField)2 PropertiesPreferences (com.igormaznitsa.mindmap.swing.panel.utils.PropertiesPreferences)1 MessagesService (com.igormaznitsa.sciareto.notifications.MessagesService)1 PrinterPlugin (com.igormaznitsa.sciareto.plugins.services.PrinterPlugin)1 MainFrame (com.igormaznitsa.sciareto.ui.MainFrame)1 SplashScreen (com.igormaznitsa.sciareto.ui.UiUtils.SplashScreen)1