Package simtools.ui

Examples of simtools.ui.SourceTree


                conflictsOK = false;
                final JList list = new JList(clm);
                list.setCellRenderer(new ConflictListCellRenderer());
                JButton changeSourceAlias;
                JPanel treePane = new JPanel(new BorderLayout());
                final SourceTree st = SourceTree.getFromPool("PropertiesPanel0");
                treePane.add(new JScrollPane(st), BorderLayout.CENTER);
                JPanel bpanel = new JPanel(new GridLayout(1, 1));
                bpanel.add(changeSourceAlias = new JButton(resources.getString("changeSourceAlias")));
                treePane.add(bpanel, BorderLayout.SOUTH);
                JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(list), treePane);
                list.setVisibleRowCount(10);
                JPanel bbox = new JPanel(new FlowLayout());
                final JButton bok;
                bbox.add(bok = new JButton("OK"));
                // bbox.add(bcancel = new JButton("Cancel"));
                final JDialog dialog = new JDialog(JSynoptic.gui.getOwner(), resources
                        .getString("conflictResolutionDialog"), true);
                dialog.getContentPane().add(pane, BorderLayout.CENTER);
                dialog.getContentPane().add(bbox, BorderLayout.SOUTH);
                bok.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        conflictsOK = true;
                        dialog.setVisible(false);
                    }
                });
                /*
                 * bcancel.addActionListener(new ActionListener() { public void
                 * actionPerformed(ActionEvent e) { conflictsOK = false;
                 * dialog.hide(); } });
                 */
                changeSourceAlias.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Object o = st.getSelectedSourceOrCollection();
                        if (!(o instanceof DataSource)) {
                            return;
                        }
                        VariableConflict vc = (VariableConflict) list.getSelectedValue();
                        ((DataSource) o).getInformation().alias = vc.var;
                        list.repaint();
                        if (clm.resolved()) {
                            bok.setEnabled(true);
                        }
                        TreeNode tn = (TreeNode) (st.getSelectionPath().getLastPathComponent());
                        ((DefaultTreeModel) (st.getModel())).nodeChanged(tn);
                    }
                });
                st.addTreeSelectionListener(new TreeSelectionListener() {
                    public void valueChanged(TreeSelectionEvent e) {
                        Object o = st.getSelectedSourceOrCollection();
                        if ((o instanceof DataSource) && e.isAddedPath()) {
                            VariableConflict vc = (VariableConflict) list.getSelectedValue();
                            vc.ds = (DataSource) o;
                            list.repaint();
                            if (clm.resolved()) {
                                bok.setEnabled(true);
                            }
                            TreeNode tn = (TreeNode) (st.getSelectionPath().getLastPathComponent());
                            ((DefaultTreeModel) (st.getModel())).nodeChanged(tn);
                        }
                    }
                });
                list.addListSelectionListener(new ListSelectionListener() {
                    public void valueChanged(ListSelectionEvent e) {
                        Object sel = list.getSelectedValue();
                        if (sel == null) {
                            return;
                        }
                        st.setSelectedValue(((VariableConflict) sel).ds); // call
                        // the
                        // tree
                        // selection
                        // listener
                        // in
View Full Code Here


        });
        dstree.getSourceTree().addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
   boolean isMyEvent = false;
                if (e.getSource() instanceof SourceTree) {
                    SourceTree st = (SourceTree) e.getSource();
                    if (st.getParent() == dstree.getScrollPane().getViewport()) {
                        isMyEvent = true;
                    }
                }
                if (!isMyEvent) {
                    return;
View Full Code Here

TOP

Related Classes of simtools.ui.SourceTree

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.