Example usage for javax.swing JScrollPane setRowHeaderView

List of usage examples for javax.swing JScrollPane setRowHeaderView

Introduction

In this page you can find the example usage for javax.swing JScrollPane setRowHeaderView.

Prototype

public void setRowHeaderView(Component view) 

Source Link

Document

Creates a row-header viewport if necessary, sets its view and then adds the row-header viewport to the scrollpane.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformQQNormalPlotChart.java

protected void setTable(XYDataset ds) {

    convertor.data2Table(raw_y, transformed_x, "Data", "Transformed Data", row_count);
    //convertor.dataset2Table(dataset);            
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount());
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }//from  w ww  .j a v  a  2s . c o  m

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }

    dataPanel.removeAll();
    JScrollPane dt = new JScrollPane(dataTable);
    dataPanel.add(dt);
    dt.setRowHeaderView(headerTable);
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // don't bring graph to the front
    if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) {
        //   tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel));
    } else {
        dataPanel2.removeAll();
        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Data"));
        JScrollPane dt2 = new JScrollPane(dataTable);
        dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));
        dt2.setRowHeaderView(headerTable);
        dataPanel2.add(dt2);
        JScrollPane st = new JScrollPane(summaryPanel);
        st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
        dataPanel2.add(st);
        st.validate();

        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Mapping"));
        mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
        dataPanel2.add(mapPanel);

        dataPanel2.validate();
    }
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java

protected void setTable(IntervalXYDataset ds, boolean binChanged) {

    convertor.data2Table(raw_x, transformed_x, "Data", "Transformed Data", row_count);
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount());
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }//  ww w .j  a  v a2s .  co m

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }

    dataPanel.removeAll();
    JScrollPane dt = new JScrollPane(dataTable);
    dataPanel.add(dt);
    dt.setRowHeaderView(headerTable);
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // don't bring graph to the front if the bin Size is not changed
    if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) {
        if (binChanged)
            tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel));
    } else {
        dataPanel2.removeAll();
        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Data"));
        JScrollPane dt2 = new JScrollPane(dataTable);
        dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));
        dt2.setRowHeaderView(headerTable);
        dataPanel2.add(dt2);
        JScrollPane st = new JScrollPane(summaryPanel);
        st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
        dataPanel2.add(st);
        st.validate();

        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Mapping"));
        mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
        dataPanel2.add(mapPanel);

        dataPanel2.validate();
    }
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformationFamilyChart.java

protected void setTable(XYDataset ds) {

    //System.out.println("setTable get Called");
    convertor.Power2Table(ds);/*from  w  w  w  .jav a  2s.  co m*/
    //convertor.dataset2Table(dataset);            
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount());
    resetTableColumns(tempDataTable.getColumnCount());

    //System.out.println(tempDataTable.getRowCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }

    dataPanel.removeAll();
    JScrollPane dt = new JScrollPane(dataTable);
    dataPanel.add(dt);
    dt.setRowHeaderView(headerTable);
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // don't bring graph to the front
    if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) {
        //   tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel));
    } else {
        dataPanel2.removeAll();
        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Data"));
        JScrollPane dt2 = new JScrollPane(dataTable);
        dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));
        dt2.setRowHeaderView(headerTable);
        dataPanel2.add(dt2);
        JScrollPane st = new JScrollPane(summaryPanel);
        st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
        dataPanel2.add(st);
        st.validate();

        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Mapping"));
        mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
        dataPanel2.add(mapPanel);

        dataPanel2.validate();
    }
}

From source file:edu.ucla.stat.SOCR.chart.SuperXYZChart.java

protected void setMixPanel() {
    /*super.setMixPanel();
    return;*//* w  ww  .j  a  va 2  s.co m*/

    dataPanel2.removeAll();
    graphPanel2.removeAll();

    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.add(chartPanel);
    sliderPanel.removeAll();
    /*   sliderPanel.add(new JLabel("Bin Size"));
         sliderPanel.add(this.binSlider);
         sliderPanel.add(new JLabel(":"+this.binSlider.getValue()));*/
    zSlider.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    sliderPanel.add(this.zSlider);
    sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    graphPanel2.add(sliderPanel); // the slider
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformXYScatterChart.java

protected void setTable(XYDataset ds) {

    convertor.Y2Table(raw_x, raw_y, transformed_x, transformed_y, row_count);
    JTable tempDataTable = convertor.getTable();

    resetTableRows(tempDataTable.getRowCount() + 1);
    resetTableColumns(tempDataTable.getColumnCount());

    for (int i = 0; i < tempDataTable.getColumnCount(); i++) {
        columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i));
        //  System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i));
    }/*w  w  w .ja v a  2 s . co  m*/

    columnModel = dataTable.getColumnModel();
    dataTable.setTableHeader(new EditableHeader(columnModel));

    for (int i = 0; i < tempDataTable.getRowCount(); i++)
        for (int j = 0; j < tempDataTable.getColumnCount(); j++) {
            dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j);
        }

    dataPanel.removeAll();
    JScrollPane dt = new JScrollPane(dataTable);
    dataPanel.add(dt);
    dt.setRowHeaderView(headerTable);
    dataTable.setGridColor(Color.gray);
    dataTable.setShowGrid(true);
    dataTable.doLayout();
    // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003
    try {
        dataTable.setDragEnabled(true);
    } catch (Exception e) {
    }

    dataPanel.validate();

    // don't bring graph to the front
    if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) {
        //   tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel));
    } else {
        dataPanel2.removeAll();
        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Data"));
        JScrollPane dt2 = new JScrollPane(dataTable);
        dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));
        dt2.setRowHeaderView(headerTable);
        dataPanel2.add(dt2);
        JScrollPane st = new JScrollPane(summaryPanel);
        st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
        dataPanel2.add(st);
        st.validate();

        dataPanel2.add(new JLabel(" "));
        dataPanel2.add(new JLabel("Mapping"));
        mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
        dataPanel2.add(mapPanel);

        dataPanel2.validate();
    }
}

From source file:AccessibleScrollDemo.java

public AccessibleScrollDemo() {
    //Load the photograph into an image icon.
    ImageIcon david = new ImageIcon("images/youngdad.jpeg");
    david.setDescription("Photograph of David McNabb in his youth.");

    //Create the row and column headers
    columnView = new Rule(Rule.HORIZONTAL, true);
    columnView.setPreferredWidth(david.getIconWidth());
    columnView.getAccessibleContext().setAccessibleName("Column Header");
    columnView.getAccessibleContext()/*from  w  ww  .  ja v  a  2  s  .  com*/
            .setAccessibleDescription("Displays horizontal ruler for " + "measuring scroll pane client.");
    rowView = new Rule(Rule.VERTICAL, true);
    rowView.setPreferredHeight(david.getIconHeight());
    rowView.getAccessibleContext().setAccessibleName("Row Header");
    rowView.getAccessibleContext()
            .setAccessibleDescription("Displays vertical ruler for " + "measuring scroll pane client.");

    //Create the corners
    JPanel buttonCorner = new JPanel();
    isMetric = new JToggleButton("cm", true);
    isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11));
    isMetric.setMargin(new Insets(2, 2, 2, 2));
    isMetric.addItemListener(new UnitsListener());
    isMetric.setToolTipText("Toggles rulers' unit of measure " + "between inches and centimeters.");
    buttonCorner.add(isMetric); //Use the default FlowLayout
    buttonCorner.getAccessibleContext().setAccessibleName("Upper Left Corner");

    String desc = "Fills the corner of a scroll pane " + "with color for aesthetic reasons.";
    Corner lowerLeft = new Corner();
    lowerLeft.getAccessibleContext().setAccessibleName("Lower Left Corner");
    lowerLeft.getAccessibleContext().setAccessibleDescription(desc);

    Corner upperRight = new Corner();
    upperRight.getAccessibleContext().setAccessibleName("Upper Right Corner");
    upperRight.getAccessibleContext().setAccessibleDescription(desc);

    //Set up the scroll pane
    picture = new ScrollablePicture(david, columnView.getIncrement());
    picture.setToolTipText(david.getDescription());
    picture.getAccessibleContext().setAccessibleName("Scroll pane client");

    JScrollPane pictureScrollPane = new JScrollPane(picture);
    pictureScrollPane.setPreferredSize(new Dimension(300, 250));
    pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));

    pictureScrollPane.setColumnHeaderView(columnView);
    pictureScrollPane.setRowHeaderView(rowView);

    pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner);
    pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeft);
    pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRight);

    //Put it in this panel
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(pictureScrollPane);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:edu.ucla.stat.SOCR.chart.SuperHistogramChart.java

/**
* make the show_all panel/*from  w ww . j  av  a 2  s.c o  m*/
*/
protected void setMixPanel() {
    /*super.setMixPanel();
    return;*/

    dataPanel2.removeAll();
    graphPanel2.removeAll();

    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.add(chartPanel);
    sliderPanel.removeAll();
    /*   sliderPanel.add(new JLabel("Bin Size"));
         sliderPanel.add(this.binSlider);
         sliderPanel.add(new JLabel(":"+this.binSlider.getValue()));*/
    binSlider2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    sliderPanel.add(this.binSlider2);
    sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, 100));
    graphPanel2.add(sliderPanel); // the slider
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:com.diversityarrays.kdxplore.curate.fieldview.FieldLayoutViewPanel.java

@SuppressWarnings("unchecked")
public FieldLayoutViewPanel(@SuppressWarnings("rawtypes") MutableComboBoxModel comboBoxModel,
        JCheckBox alwaysOnTopOption, CurationData cd, CurationTableModel ctm, SelectedValueStore svs,
        PlotCellChoicesPanel pccp, JPopupMenu popuMenu, Font fontForResizeControls, Action curationHelpAction,
        MessagePrinter mp, Closure<String> selectionClosure, CurationContext curationContext,
        CurationMenuProvider curationMenuProvider,

        FieldLayoutTableModel fieldLayoutTableModel, CellSelectableTable fieldLayoutTable,
        FieldViewSelectionModel fvsm,/*from  w  w w .j a  va2s. c  o  m*/

        JButton undockButton) {
    super(new BorderLayout());

    this.traitInstanceCombo.setModel(comboBoxModel);
    this.curationData = cd;
    this.messagePrinter = mp;
    this.selectionClosure = selectionClosure;
    this.curationTableModel = ctm;

    this.fieldLayoutTableModel = fieldLayoutTableModel;
    this.fieldLayoutTable = fieldLayoutTable;
    this.fieldViewSelectionModel = fvsm;

    traitInstanceCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Object item = comboBoxModel.getSelectedItem();
            if (item instanceof TraitInstance) {
                TraitInstance ti = (TraitInstance) item;
                plotCellRenderer.setActiveInstance(ti);
            }
        }
    });

    rhtm = new RowHeaderTableModel(true, fieldLayoutTable, rowRemovable) {
        public String getRowLabel(int rowIndex) {
            int yCoord = FieldLayoutUtil.convertRowIndexToYCoord(rowIndex, trial,
                    fieldLayoutTableModel.getFieldLayout());
            return String.valueOf(yCoord);
        }
    };
    rowHeaderTable = new RowHeaderTable(SwingConstants.CENTER, false, fieldLayoutTable, rowRemovable, rhtm,
            RowHeaderTable.createDefaultColumnModel("X/Y")) {
        public String getMarkerIndexName(int viewRow) {
            return "MIN-" + viewRow; //$NON-NLS-1$
        }
    };
    rhtTableRowResizer = new TableRowResizer(rowHeaderTable, true);

    curationData.addCurationDataChangeListener(plotActivationListener);

    curationTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            fieldLayoutTable.repaint();
        }
    });
    plotCellRenderer = new PlotCellRenderer(plotAttributeProvider, curationTableModel);

    TraitInstanceCellRenderer tiCellRenderer = new TraitInstanceCellRenderer(
            curationData.getTraitColorProvider(), instanceNameProvider);
    traitInstanceCombo.setRenderer(tiCellRenderer);
    traitInstanceCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateActiveTraitInstance();
        }
    });
    traitInstanceCombo.getModel().addListDataListener(new ListDataListener() {
        @Override
        public void intervalRemoved(ListDataEvent e) {
            updateActiveTraitInstance();
        }

        @Override
        public void intervalAdded(ListDataEvent e) {
            updateActiveTraitInstance();
        }

        @Override
        public void contentsChanged(ListDataEvent e) {
            updateActiveTraitInstance();
        }
    });

    this.trial = curationData.getTrial();
    this.plotCellChoicesPanel = pccp;

    for (TraitInstance t : curationData.getTraitInstances()) {
        String id = InstanceIdentifierUtil.getInstanceIdentifier(t);
        traitById.put(id, t);
    }

    //      fieldViewSelectionModel = new FieldViewSelectionModel(
    //            fieldLayoutTable, 
    //            fieldLayoutTableModel, 
    //            svs);
    fieldLayoutTable.setSelectionModel(fieldViewSelectionModel);

    plotCellRenderer.setCurationData(curationData);
    plotCellRenderer.setSelectionModel(fieldViewSelectionModel);

    plotCellChoicesPanel.addPlotCellChoicesListener(plotCellChoicesListener);

    fieldLayoutTableModel.setTrial(trial);

    // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE
    fieldLayoutTable.setAutoCreateRowSorter(false);
    JScrollPane fieldTableScrollPane = new JScrollPane(fieldLayoutTable);

    if (undockButton != null) {
        fieldTableScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, undockButton);
    }
    fieldTableScrollPane.setRowHeaderView(rowHeaderTable);
    ChangeListener scrollBarChangeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            fireRefreshRequired();
        }
    };
    fieldTableScrollPane.getVerticalScrollBar().getModel().addChangeListener(scrollBarChangeListener);
    fieldTableScrollPane.getHorizontalScrollBar().getModel().addChangeListener(scrollBarChangeListener);

    fieldLayoutTable.setRowHeaderTable(rowHeaderTable);

    //      fieldLayoutTable.setComponentPopupMenu(popuMenu);

    initFieldLayoutTable();

    Map<Integer, Plot> plotById = new HashMap<>();
    FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(),
            trial.getPlotIdentSummary(), curationData.getPlots(), plotById);

    KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId,
            plotIdLayout.xsize, plotIdLayout.ysize);
    kdxFieldLayout.warning = plotIdLayout.warning;

    for (int y = 0; y < plotIdLayout.ysize; ++y) {
        for (int x = 0; x < plotIdLayout.xsize; ++x) {
            Integer id = plotIdLayout.cells[y][x];
            if (id != null) {
                Plot plot = plotById.get(id);
                kdxFieldLayout.store_xy(plot, x, y);
            }
        }
    }
    fieldLayoutTableModel.setFieldLayout(kdxFieldLayout);

    if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) {
        warningMessage.setText(kdxFieldLayout.warning);
    } else {
        warningMessage.setText(""); //$NON-NLS-1$
    }

    changeVisitOrderAction.putValue(Action.SMALL_ICON, KDClientUtils.getIcon(kdxFieldLayout.imageId));

    List<Component> components = new ArrayList<>();
    components.add(alwaysOnTopOption);

    Collections.addAll(components, new JButton(changeVisitOrderAction), new JButton(curationHelpAction),
            traitInstanceCombo);
    Box resizeControls = KDClientUtils.createResizeControls(fieldLayoutTable, fontForResizeControls,
            components.toArray(new Component[components.size()]));
    resizeCombo = KDClientUtils.findResizeCombo(resizeControls);

    if (RunMode.getRunMode().isDeveloper()) {
        new FieldLayoutViewPanel.DebugSettings(resizeControls, messagePrinter);
    }

    JPanel fieldPanel = new JPanel(new BorderLayout());

    //      if (useSeparator) {
    //         SeparatorPanel separator = GuiUtil.createLabelSeparator("Field Layout:", resizeControls);
    //         fieldPanel.add(separator, BorderLayout.NORTH);
    //         fieldPanel.add(fieldTableScrollPane, BorderLayout.CENTER);
    //      }
    //      else {
    fieldPanel.add(resizeControls, BorderLayout.NORTH);
    fieldPanel.add(fieldTableScrollPane, BorderLayout.CENTER);
    //      }

    //      splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
    //            plotCellChoicesPanel,
    //            fieldPanel);
    //      splitPane.setResizeWeight(0.0);
    //      splitPane.setOneTouchExpandable(true);

    add(warningMessage, BorderLayout.NORTH);
    add(fieldPanel, BorderLayout.CENTER);
    //      splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
    //            plotCellChoicesPanel,
    //            fieldPanel);
    //      splitPane.setResizeWeight(0.0);
    //      splitPane.setOneTouchExpandable(true);
    //      
    //      add(warningMessage, BorderLayout.NORTH);
    //      add(splitPane, BorderLayout.CENTER);

    fieldLayoutTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent me) {
            if (SwingUtilities.isRightMouseButton(me) && 1 == me.getClickCount()) {
                me.consume();

                List<Plot> plots = getSelectedPlots();

                List<TraitInstance> checkedInstances = new ArrayList<>();
                for (int index = traitInstanceCombo.getItemCount(); --index >= 1;) {
                    Object item = traitInstanceCombo.getItemAt(index);
                    if (item instanceof TraitInstance) {
                        checkedInstances.add((TraitInstance) item);
                    }
                }

                TraitInstance ti = fieldViewSelectionModel.getActiveTraitInstance(true);
                List<PlotOrSpecimen> plotSpecimens = new ArrayList<>();
                plotSpecimens.addAll(plots);
                curationMenuProvider.showFieldViewToolMenu(me, plotSpecimens, ti, checkedInstances);
            }
        }
    });
}

From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java

protected void setTablePane() {
    dataPanel.removeAll();//  w  ww  .  jav  a2s .c  o  m

    JScrollPane st = new JScrollPane(layoutResults());
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dt, st);
    container.setContinuousLayout(true);
    container.setDividerLocation(0.8);
    dataPanel.add(container);

    dataPanel.validate();

}

From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java

protected void setMixPanel() {
    dataPanel2.removeAll();//from   w ww. j  a  va2 s  .co m
    graphPanel2.removeAll();

    if (chartPaneltest != null) {
        chartPaneltest.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
        graphPanel2.add(chartPaneltest);
        graphPanel2.validate();
    }

    dataPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y));

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));

    JScrollPane st = new JScrollPane(layoutResults());

    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);

    //dt.setPreferredSize(new Dimension(CHART_SIZE_X*2/3, CHART_SIZE_Y/2));
    JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dt, st);
    container.setMinimumSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2));
    container.setContinuousLayout(true);
    container.setDividerLocation(0.7);
    dataPanel2.add(container);

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(mapPanel);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(dataPanel2, BorderLayout.CENTER);
    mixPanel.validate();
}