Package org.jdesktop.swingx

Examples of org.jdesktop.swingx.JXTree


       
        JComponent painterControlPanel =new JXPanel(new BorderLayout());
        painterControlPanel.add(painterDisplay);
        painterControlPanel.add(createPainterPropertiesPanel(), BorderLayout.SOUTH);
       
        painterDemos = new JXTree();
        painterDemos.setRootVisible(false);
        // PENDING JW: weird sizing in splitpane
        JSplitPane contents = new JSplitPane();
        contents.setDividerLocation(240);
        contents.setContinuousLayout(true);
View Full Code Here


        return new DefaultComboBoxModel(list.getActionMap().allKeys());
    }

    private TreeModel createTreeModel() {
//         return new FileSystemModel();
        return new ActionMapTreeTableModel(new JXTree());
    }
View Full Code Here

        // table = new JXTreeTable(new ActionMapTreeTableModel(new
        // JXTreeTable()));

        list = new JXList(createListModel());

        tree = new JXTree(createTreeModel());

        // control components
        nextButton = new JButton("Find next");
        radioGroup = new JXRadioGroup();
        inputText = new JTextField();
View Full Code Here

*/
public class TreeRolloverProducer extends RolloverProducer {

    @Override
    public void mousePressed(MouseEvent e) {
        JXTree tree = (JXTree) e.getComponent();
        Point mousePoint = e.getPoint();
        int labelRow = tree.getRowForLocation(mousePoint.x, mousePoint.y);
        // default selection
        if (labelRow >= 0)
            return;
        int row = tree.getClosestRowForLocation(mousePoint.x, mousePoint.y);
        Rectangle bounds = tree.getRowBounds(row);
        if (bounds == null) {
            row = -1;
        } else {
            if ((bounds.y + bounds.height < mousePoint.y)
                    || bounds.x > mousePoint.x) {
                row = -1;
            }
        }
        // no hit
        if (row < 0)
            return;
        tree.dispatchEvent(new MouseEvent(tree, e.getID(), e.getWhen(), e
                .getModifiers(), bounds.x + bounds.width - 2, mousePoint.y, e
                .getClickCount(), e.isPopupTrigger(), e.getButton()));
    }
View Full Code Here

                .getClickCount(), e.isPopupTrigger(), e.getButton()));
    }

    @Override
    protected void updateRolloverPoint(JComponent component, Point mousePoint) {
        JXTree tree = (JXTree) component;
        int row = tree.getClosestRowForLocation(mousePoint.x, mousePoint.y);
        Rectangle bounds = tree.getRowBounds(row);
        if (bounds == null) {
            row = -1;
        } else {
            if ((bounds.y + bounds.height < mousePoint.y)
                    || bounds.x > mousePoint.x) {
View Full Code Here

        final ViolationTableModel violationTableModel = new ViolationTableModel();

        final JTabbedPane tabbedPane = new JTabbedPane();
        final JXTable violationsTable = new JXTable(violationTableModel);
        final SonarTreeModel treeModel = new SonarTreeModel(true);
        final JXTree violationsTree = new JXTree(treeModel);
        violationsTree.setShowsRootHandles(true);
        final AnAction displayDescriptionAction = new DisplayDescriptionAction(violationsTree);

        TreeSelectionListener mySelectionListener = new TreeSelectionListener() {
            @Override
            public void valueChanged(TreeSelectionEvent e) {
                if (e.getNewLeadSelectionPath() == null)
                    return;
                Object selection = e.getNewLeadSelectionPath().getLastPathComponent();
                if (selection instanceof SonarTreeModel.ViolationLabel) {
                    final SonarTreeModel.ViolationLabel violationLabel = (SonarTreeModel.ViolationLabel) selection;
                    if (violationLabel.getLine() != null) {
                        DataManager.getInstance().getDataContextFromFocus().doWhenDone(new AsyncResult.Handler<DataContext>() {
                            @Override
                            public void run(DataContext dataContext) {
                                OpenFileDescriptor descriptor = new OpenFileDescriptor(project, violationLabel.getVirtualFile(), violationLabel.getLine() - 1, 0);
                                descriptor.navigate(false);
                            }
                        });
                    }
                }
            }
        };
        downloadRules();
        violationsTree.getSelectionModel().addTreeSelectionListener(mySelectionListener);
        violationsTree.setEditable(false);
        violationsTree.setCellRenderer(cellRenderer);
        violationsTree.setRootVisible(false);
        if (LastInspectionResult.getInstance().getViolations() != null)
            treeModel.setViolations(LastInspectionResult.getInstance().getViolations());
        violationsTable.addHighlighter(new ToolTipHighlighter(HighlightPredicate.IS_TEXT_TRUNCATED));
        violationsTable.setFillsViewportHeight(true);

        violationsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        violationsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

        violationsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
                if (!listSelectionModel.isSelectionEmpty()) {
                    Integer selectionIndex = listSelectionModel.getMinSelectionIndex();
                    final Violation violation = violationTableModel.getViolation(violationsTable.convertRowIndexToModel(selectionIndex));

                    if (violation.getLine() != null) {
                        DataManager.getInstance().getDataContextFromFocus().doWhenDone(new AsyncResult.Handler<DataContext>() {
                            @Override
                            public void run(DataContext dataContext) {
                                OpenFileDescriptor descriptor = new OpenFileDescriptor(project, violationTableModel.getCurrentVirtualFile(), violation.getLine() - 1, 0);
                                descriptor.navigate(false);
                            }
                        });
                    }
                }
            }
        });

        SonarTreeModel localTreeModel = new SonarTreeModel(false);
        final JXTree localViolationsTree = new JXTree(localTreeModel);
        localViolationsTree.setShowsRootHandles(true);
        localViolationsTree.getSelectionModel().addTreeSelectionListener(mySelectionListener);
        localViolationsTree.setCellRenderer(cellRenderer);
        localViolationsTree.setRootVisible(false);
        final JScrollPane scrollPane = new JScrollPane(localViolationsTree);
        JScrollPane scrollPaneTree = new JScrollPane(violationsTree);
        tabbedPane.addTab("Current file", scrollPane);
        tabbedPane.addTab("Last inspection", scrollPaneTree);
        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gridBagConstraintsScrollPane = new GridBagConstraints();
        gridBagConstraintsScrollPane.gridx = 0;
        gridBagConstraintsScrollPane.gridy = 1;
        gridBagConstraintsScrollPane.gridwidth = 10;
        gridBagConstraintsScrollPane.gridheight = 10;
        gridBagConstraintsScrollPane.fill = GridBagConstraints.BOTH;
        gridBagConstraintsScrollPane.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsScrollPane.weightx = 1;
        gridBagConstraintsScrollPane.weighty = 10;
        panel.add(tabbedPane, gridBagConstraintsScrollPane);

        GridBagConstraints gridBagConstraintsLoading = new GridBagConstraints();
        gridBagConstraintsLoading.gridx = 0;
        gridBagConstraintsLoading.gridy = 0;
        gridBagConstraintsLoading.gridwidth = 1;
        gridBagConstraintsLoading.gridheight = 1;
        gridBagConstraintsLoading.fill = GridBagConstraints.BOTH;
        gridBagConstraintsLoading.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsLoading.weightx = 0;
        gridBagConstraintsLoading.weighty = 0;
        this.loadingLabel = new JXBusyLabel();
        final DefaultActionGroup group = new DefaultActionGroup();
        ToggleAction groupFilesAction = new ToggleAction() {
            private boolean state = true;

            @Override
            public boolean isSelected(AnActionEvent e) {
                return state;
            }

            @Override
            public void setSelected(AnActionEvent e, boolean state) {
                this.state = state;
                treeModel.setGroupFiles(state);
            }
        };
        groupFilesAction.getTemplatePresentation().setText("Group files");
        group.add(groupFilesAction);
        group.add(displayDescriptionAction);
        panel.add(this.loadingLabel, gridBagConstraintsLoading);
        PopupHandler.installPopupHandler(violationsTree, group, ActionPlaces.UNKNOWN, ActionManager.getInstance());
        final DefaultActionGroup tableTreeChoiceGroup = new DefaultActionGroup();
        final DefaultActionGroup localTreeActionGroup = new DefaultActionGroup();
        ToggleAction tableTreeChoice = new ToggleAction() {
            private boolean state = true;

            @Override
            public boolean isSelected(AnActionEvent e) {
                return state;
            }

            @Override
            public void setSelected(AnActionEvent e, boolean state) {
                this.state = state;
                scrollPane.setViewportView(state ? localViolationsTree : violationsTable);
            }

            @Override
            public void update(AnActionEvent e) {
                super.update(e);
            }
        };
        tableTreeChoice.getTemplatePresentation().setText("Tree view");
        tableTreeChoiceGroup.add(tableTreeChoice);
        localTreeActionGroup.add(tableTreeChoice);
        AnAction localDisplayDescriptionAction = new DisplayDescriptionAction(localViolationsTree);
        localTreeActionGroup.add(localDisplayDescriptionAction);
        PopupHandler.installPopupHandler(localViolationsTree, localTreeActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());
        PopupHandler.installPopupHandler(violationsTable, tableTreeChoiceGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());


        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(panel, "", false);
        toolWindow.getContentManager().addContent(content);

        SonarProjectComponent projectComponent = project.getComponent(SonarProjectComponent.class);
        ToolWindowModel toolWindowModel = new ToolWindowModel(project, violationTableModel, localTreeModel, projectComponent.getSonarCache());
        projectComponent.setToolWindowModel(toolWindowModel);
        LastInspectionResult.getInstance().addListener(new ViolatationChangedListener() {
            @Override
            public void violationChanged(Map<VirtualFile, List<Violation>> violations) {
                treeModel.setViolations(violations);
            }
        });
        violationsTree.addMouseListener(new TreeMousePressedListener(violationsTree, displayDescriptionAction));
        localViolationsTree.addMouseListener(new TreeMousePressedListener(localViolationsTree, localDisplayDescriptionAction));


        projectComponent.getSonarCache().addLoadingFileListener(this);
    }
View Full Code Here

        try {
            this.setTitle("Mensuração Florestal");

            splMain = new JSplitPane();
            scrNavigator = new JScrollPane();
            treeNavigator = new JXTree();
            stbMain = new JXStatusBar();
            desktop = new MDIDeskTopPane();
            setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

            splMain.setDividerSize(4);
View Full Code Here

        initTestStepPopUpActions();
        testStepPopUp.addSeparator();
        testStepPopUp.add(new ShowOnlineHelpAction(HelpUrls.RESPONSE_ASSERTIONS_HELP_URL));

        treeModel = new SecurityScanTree(securityTest, new SecurityTreeRootNode(securityTest));
        securityTestTree = new JXTree(treeModel);
        securityTestTree.putClientProperty("JTree.lineStyle", "None");
        securityTestTree.setUI(new CustomTreeUI());
        securityTestTree.setRootVisible(false);
        securityTestTree.setLargeModel(true);
        cellRender = new SecurityTreeCellRender();
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.JXTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.