Search in sources :

Example 1 with FileDrop

use of dr.app.gui.FileDrop in project beast-mcmc by beast-dev.

the class MapperFrameOld method initializeComponents.

public void initializeComponents() {
    setSize(new java.awt.Dimension(1200, 800));
    mapperPanel = new MapperPanel(this);
    mapperPanel.setBorder(new BorderUIResource.EmptyBorderUIResource(new java.awt.Insets(12, 6, 12, 12)));
    traceTableModel = new TraceTableModel();
    traceTable = new JTable(traceTableModel);
    TableRenderer renderer = new TableRenderer(SwingConstants.LEFT, new Insets(0, 4, 0, 4));
    traceTable.getColumnModel().getColumn(0).setCellRenderer(renderer);
    traceTable.getColumnModel().getColumn(1).setPreferredWidth(50);
    traceTable.getColumnModel().getColumn(1).setCellRenderer(renderer);
    traceTable.getColumnModel().getColumn(2).setPreferredWidth(50);
    traceTable.getColumnModel().getColumn(2).setCellRenderer(renderer);
    traceTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    traceTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent evt) {
            traceTableSelectionChanged();
        }
    });
    scrollPane1 = new JScrollPane(traceTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    ActionPanel actionPanel1 = new ActionPanel(false);
    actionPanel1.setAddAction(getImportAction());
    actionPanel1.setRemoveAction(getRemoveTraceAction());
    getRemoveTraceAction().setEnabled(false);
    JPanel controlPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controlPanel1.add(actionPanel1);
    topPanel = new JPanel(new BorderLayout(0, 0));
    topPanel.setBorder(new BorderUIResource.EmptyBorderUIResource(new java.awt.Insets(0, 0, 6, 0)));
    topPanel.add(new JLabel("Trace Files:"), BorderLayout.NORTH);
    topPanel.add(scrollPane1, BorderLayout.CENTER);
    topPanel.add(controlPanel1, BorderLayout.SOUTH);
    layerTableModel = new LayerTableModel();
    layerTable = new JTable(layerTableModel) {

        //Implement table header tool tips.
        protected JTableHeader createDefaultTableHeader() {
            return new JTableHeader(columnModel) {

                public String getToolTipText(MouseEvent e) {
                    java.awt.Point p = e.getPoint();
                    int index = columnModel.getColumnIndexAtX(p.x);
                    int realIndex = columnModel.getColumn(index).getModelIndex();
                    return columnToolTips[realIndex];
                }
            };
        }
    };
    layerTable.getColumnModel().getColumn(0).setPreferredWidth(150);
    layerTable.getColumnModel().getColumn(0).setCellRenderer(renderer);
    layerTable.getColumnModel().getColumn(1).setPreferredWidth(70);
    layerTable.getColumnModel().getColumn(1).setCellRenderer(renderer);
    //        layerTable.getColumnModel().getColumn(2).setPreferredWidth(70);
    //        layerTable.getColumnModel().getColumn(2).setCellRenderer(renderer);
    //        ComboBoxRenderer comboBoxRenderer = new ComboBoxRenderer(TraceFactory.TraceType.values());
    //        comboBoxRenderer.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    //        layerTable.getColumnModel().getColumn(3).setPreferredWidth(20);
    //        layerTable.getColumnModel().getColumn(3).setCellRenderer(renderer);
    layerTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    layerTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent evt) {
            layerTableSelectionChanged();
        }
    });
    TableEditorStopper.ensureEditingStopWhenTableLosesFocus(layerTable);
    JScrollPane scrollPane2 = new JScrollPane(layerTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    JPanel bottomPanel = new JPanel(new BorderLayout(0, 0));
    bottomPanel.add(new JLabel("Layers:"), BorderLayout.NORTH);
    bottomPanel.add(scrollPane2, BorderLayout.CENTER);
    JPanel leftPanel = new JPanel(new BorderLayout(0, 0));
    leftPanel.setPreferredSize(new Dimension(400, 300));
    splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topPanel, bottomPanel);
    splitPane1.setBorder(null);
    JPanel progressPanel = new JPanel(new BorderLayout(0, 0));
    progressLabel = new JLabel("");
    progressBar = new JProgressBar();
    progressPanel.add(progressLabel, BorderLayout.NORTH);
    progressPanel.add(progressBar, BorderLayout.CENTER);
    progressPanel.setBorder(new BorderUIResource.EmptyBorderUIResource(new java.awt.Insets(6, 0, 0, 0)));
    leftPanel.add(splitPane1, BorderLayout.CENTER);
    leftPanel.add(progressPanel, BorderLayout.SOUTH);
    leftPanel.setBorder(new BorderUIResource.EmptyBorderUIResource(new java.awt.Insets(12, 12, 12, 6)));
    JSplitPane splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPanel, mapperPanel);
    splitPane2.setBorder(null);
    splitPane2.setDividerLocation(350);
    Color focusColor = UIManager.getColor("Focus.color");
    Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor);
    splitPane1.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    new FileDrop(null, splitPane1, focusBorder, new FileDrop.Listener() {

        public void filesDropped(java.io.File[] files) {
            importFiles(files);
        }
    });
    // end FileDrop.Listener
    getContentPane().setLayout(new java.awt.BorderLayout(0, 0));
    getContentPane().add(splitPane2, BorderLayout.CENTER);
    splitPane1.setDividerLocation(2000);
}
Also used : BorderUIResource(javax.swing.plaf.BorderUIResource) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JTableHeader(javax.swing.table.JTableHeader) FileDrop(dr.app.gui.FileDrop) TableRenderer(jam.table.TableRenderer) MapperPanel(dr.app.mapper.application.mapper.MapperPanel) ListSelectionListener(javax.swing.event.ListSelectionListener) ActionPanel(jam.panels.ActionPanel) Border(javax.swing.border.Border) java.awt(java.awt)

Example 2 with FileDrop

use of dr.app.gui.FileDrop in project beast-mcmc by beast-dev.

the class BeautiFrame method initializeComponents.

public void initializeComponents() {
    dataPanel = new DataPanel(this, getImportAction(), getDeleteAction());
    tipDatesPanel = new TipDatesPanel(this);
    traitsPanel = new TraitsPanel(this, dataPanel, getImportTraitsAction());
    taxonSetPanel = new TaxonSetPanel(this);
    speciesSetPanel = new SpeciesSetPanel(this);
    siteModelsPanel = new SiteModelsPanel(this, getDeleteAction());
    ancestralStatesPanel = new AncestralStatesPanel(this);
    clockModelsPanel = new ClockModelsPanel(this);
    //        clockModelsPanel = new OldClockModelsPanel(this);
    //        oldTreesPanel = new OldTreesPanel(this);
    treesPanel = new TreesPanel(this, getDeleteAction());
    //        speciesTreesPanel = new SpeciesTreesPanel(this);
    priorsPanel = new PriorsPanel(this, false);
    operatorsPanel = new OperatorsPanel(this);
    mcmcPanel = new MCMCPanel(this);
    int index = 0;
    tabbedPane.addTab(DATA_PARTITIONS, dataPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Import sequence alignments, organize data partitions,<br>" + "link models between partitions and select *BEAST</html>");
    tabbedPane.addTab(TAXON_SETS, taxonSetPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Create and edit sets of taxa which can be used to <br>" + "define times of most recent common ancestors and <br>" + "to keep groups monophyletic.</html>");
    //        tabbedPane.addTab("Species Sets", speciesSetPanel);
    tabbedPane.addTab(TIP_DATES, tipDatesPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Specify sampling dates of tips for use in temporal <br>" + "analyses of measurably evolving populations.</html>");
    tabbedPane.addTab(TRAITS, traitsPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Import and organize continuous and discrete traits <br>" + "for taxa, convert them into data partitions for evolutionary<br>" + "analysis.</html>");
    tabbedPane.addTab(SITE_MODELS, siteModelsPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Select evolutionary models to be used for each data <br>" + "partition including substitution models, codon partitioning<br>" + "and trait evolution models.</html>");
    tabbedPane.addTab(CLOCK_MODELS, clockModelsPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Select relaxed molecular clock models to be used across <br>" + "the tree. Specify sampling of rates.</html>");
    tabbedPane.addTab(TREES, treesPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Select the priors on trees including coalescent models<br>" + "birth-death speciation models and the *BEAST gene tree,<br>" + "species tree options.</html>");
    tabbedPane.addTab(ANCESTRAL_STATES, ancestralStatesPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Select options for sampling ancestral states at specific<br>" + "or all common ancestors, models of counting state changes<br>" + "and models of sequencing error for data partitions.</html>");
    tabbedPane.addTab(PRIORS, priorsPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Specify prior probability distributions on each and every<br>" + "parameter of the current model.</html>");
    tabbedPane.addTab(OPERATORS, operatorsPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Select and adjust the menu of operators that will be used<br>" + "to propose changes to the parameters. Switch off operators<br>" + "on certain parameters to fix them to initial values.</html>");
    tabbedPane.addTab(MCMC, mcmcPanel);
    tabbedPane.setToolTipTextAt(index++, "<html>" + "Specify the details of MCMC sampling. This includes chain<br>" + "length, sampling frequencies, log file names and more.</html>");
    for (int i = 1; i < tabbedPane.getTabCount(); i++) {
        tabbedPane.setEnabledAt(i, false);
    }
    currentPanel = (BeautiPanel) tabbedPane.getSelectedComponent();
    tabbedPane.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            BeautiPanel selectedPanel = (BeautiPanel) tabbedPane.getSelectedComponent();
            if (selectedPanel == dataPanel) {
                dataPanel.selectionChanged();
            } else {
                getDeleteAction().setEnabled(false);
            }
            currentPanel.getOptions(options);
            setAllOptions();
            currentPanel = selectedPanel;
        }
    });
    JPanel basePanel = new JPanel(new BorderLayout(6, 6));
    basePanel.setBorder(new BorderUIResource.EmptyBorderUIResource(new java.awt.Insets(12, 12, 12, 12)));
    //        basePanel.setPreferredSize(new java.awt.Dimension(800, 600));
    getExportAction().setEnabled(false);
    JButton generateButton = new JButton(getExportAction());
    generateButton.putClientProperty("JButton.buttonType", "roundRect");
    JPanel panel2 = new JPanel(new BorderLayout(6, 6));
    panel2.add(statusLabel, BorderLayout.WEST);
    panel2.add(generateButton, BorderLayout.EAST);
    panel2.setMinimumSize(new java.awt.Dimension(10, 10));
    basePanel.add(tabbedPane, BorderLayout.CENTER);
    basePanel.add(panel2, BorderLayout.SOUTH);
    add(basePanel, BorderLayout.CENTER);
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension d = tk.getScreenSize();
    if (d.width < 1000 || d.height < 700) {
        setSize(new java.awt.Dimension(700, 550));
    } else {
        setSize(new java.awt.Dimension(1024, 768));
    }
    if (OSType.isMac()) {
        setMinimumSize(new java.awt.Dimension(640, 480));
    }
    setAllOptions();
    Color focusColor = UIManager.getColor("Focus.color");
    Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor);
    dataPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    new FileDrop(null, dataPanel, focusBorder, new FileDrop.Listener() {

        public void filesDropped(java.io.File[] files) {
            importFiles(files);
        }
    });
// end FileDrop.Listener
}
Also used : AncestralStatesPanel(dr.app.beauti.ancestralStatesPanel.AncestralStatesPanel) PriorsPanel(dr.app.beauti.priorsPanel.PriorsPanel) BorderUIResource(javax.swing.plaf.BorderUIResource) SpeciesSetPanel(dr.app.beauti.taxonsetspanel.SpeciesSetPanel) FileDrop(dr.app.gui.FileDrop) TraitsPanel(dr.app.beauti.traitspanel.TraitsPanel) TipDatesPanel(dr.app.beauti.tipdatepanel.TipDatesPanel) TaxonSetPanel(dr.app.beauti.taxonsetspanel.TaxonSetPanel) MCMCPanel(dr.app.beauti.mcmcpanel.MCMCPanel) OperatorsPanel(dr.app.beauti.operatorspanel.OperatorsPanel) ClockModelsPanel(dr.app.beauti.clockModelsPanel.ClockModelsPanel) ChangeListener(javax.swing.event.ChangeListener) TreesPanel(dr.app.beauti.treespanel.TreesPanel) SiteModelsPanel(dr.app.beauti.siteModelsPanel.SiteModelsPanel) ChangeEvent(javax.swing.event.ChangeEvent) DataPanel(dr.app.beauti.datapanel.DataPanel) Border(javax.swing.border.Border) java.awt(java.awt)

Aggregations

FileDrop (dr.app.gui.FileDrop)2 java.awt (java.awt)2 Border (javax.swing.border.Border)2 BorderUIResource (javax.swing.plaf.BorderUIResource)2 AncestralStatesPanel (dr.app.beauti.ancestralStatesPanel.AncestralStatesPanel)1 ClockModelsPanel (dr.app.beauti.clockModelsPanel.ClockModelsPanel)1 DataPanel (dr.app.beauti.datapanel.DataPanel)1 MCMCPanel (dr.app.beauti.mcmcpanel.MCMCPanel)1 OperatorsPanel (dr.app.beauti.operatorspanel.OperatorsPanel)1 PriorsPanel (dr.app.beauti.priorsPanel.PriorsPanel)1 SiteModelsPanel (dr.app.beauti.siteModelsPanel.SiteModelsPanel)1 SpeciesSetPanel (dr.app.beauti.taxonsetspanel.SpeciesSetPanel)1 TaxonSetPanel (dr.app.beauti.taxonsetspanel.TaxonSetPanel)1 TipDatesPanel (dr.app.beauti.tipdatepanel.TipDatesPanel)1 TraitsPanel (dr.app.beauti.traitspanel.TraitsPanel)1 TreesPanel (dr.app.beauti.treespanel.TreesPanel)1 MapperPanel (dr.app.mapper.application.mapper.MapperPanel)1 ActionPanel (jam.panels.ActionPanel)1 TableRenderer (jam.table.TableRenderer)1 ChangeEvent (javax.swing.event.ChangeEvent)1