Search in sources :

Example 1 with MapperPanel

use of dr.app.mapper.application.mapper.MapperPanel 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)

Aggregations

FileDrop (dr.app.gui.FileDrop)1 MapperPanel (dr.app.mapper.application.mapper.MapperPanel)1 ActionPanel (jam.panels.ActionPanel)1 TableRenderer (jam.table.TableRenderer)1 java.awt (java.awt)1 Border (javax.swing.border.Border)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 BorderUIResource (javax.swing.plaf.BorderUIResource)1 JTableHeader (javax.swing.table.JTableHeader)1