List of usage examples for javax.swing JTable getColumnCount
@BeanProperty(bound = false) public int getColumnCount()
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.SingleCellStatisticsController.java
/** * Initialize main view./*w w w .j a v a 2 s . com*/ */ private void initMainView() { // the view is kept in the parent controllers AnalysisPanel analysisPanel = singleCellAnalysisController.getAnalysisPanel(); analysisPanel.getConditionList().setModel(new DefaultListModel()); // customize tables analysisPanel.getStatTable().getTableHeader().setReorderingAllowed(false); analysisPanel.getStatTable().getTableHeader().setReorderingAllowed(false); analysisPanel.getComparisonTable().setFillsViewportHeight(true); analysisPanel.getComparisonTable().setFillsViewportHeight(true); // init binding groupsBindingList = ObservableCollections.observableList(new ArrayList<SingleCellAnalysisGroup>()); JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE, groupsBindingList, analysisPanel.getAnalysisGroupList()); bindingGroup.addBinding(jListBinding); // fill in combo box List<Double> significanceLevels = new ArrayList<>(); for (SignificanceLevel significanceLevel : SignificanceLevel.values()) { significanceLevels.add(significanceLevel.getValue()); } ObservableList<Double> significanceLevelsBindingList = ObservableCollections .observableList(significanceLevels); JComboBoxBinding jComboBoxBinding = SwingBindings.createJComboBoxBinding( AutoBinding.UpdateStrategy.READ_WRITE, significanceLevelsBindingList, analysisPanel.getSignLevelComboBox()); bindingGroup.addBinding(jComboBoxBinding); bindingGroup.bind(); // add the NONE (default) correction method // when the none is selected, CellMissy does not correct for multiple hypotheses analysisPanel.getCorrectionComboBox().addItem("none"); // fill in combo box: get all the correction methods from the factory Set<String> correctionBeanNames = MultipleComparisonsCorrectionFactory.getInstance() .getCorrectionBeanNames(); correctionBeanNames.stream().forEach((correctionBeanName) -> { analysisPanel.getCorrectionComboBox().addItem(correctionBeanName); }); // do the same for the statistical tests Set<String> statisticsCalculatorBeanNames = StatisticsTestFactory.getInstance() .getStatisticsCalculatorBeanNames(); statisticsCalculatorBeanNames.stream().forEach((testName) -> { analysisPanel.getStatTestComboBox().addItem(testName); }); //significance level to 0.05 analysisPanel.getSignLevelComboBox().setSelectedIndex(1); // add parameters to perform analysis on analysisPanel.getParameterComboBox().addItem("cell speed"); analysisPanel.getParameterComboBox().addItem("cell direct"); /** * Add a group to analysis */ analysisPanel.getAddGroupButton().addActionListener((ActionEvent e) -> { // from selected conditions make a new group and add it to the list addGroupToAnalysis(); }); /** * Remove a Group from analysis */ analysisPanel.getRemoveGroupButton().addActionListener((ActionEvent e) -> { // remove the selected group from list removeGroupFromAnalysis(); }); /** * Execute a Mann Whitney Test on selected Analysis Group */ analysisPanel.getPerformStatButton().addActionListener((ActionEvent e) -> { int selectedIndex = analysisPanel.getAnalysisGroupList().getSelectedIndex(); String statisticalTestName = analysisPanel.getStatTestComboBox().getSelectedItem().toString(); String param = analysisPanel.getParameterComboBox().getSelectedItem().toString(); // check that an analysis group is being selected if (selectedIndex != -1) { SingleCellAnalysisGroup selectedGroup = groupsBindingList.get(selectedIndex); // compute statistics computeStatistics(selectedGroup, statisticalTestName, param); // show statistics in tables showSummary(selectedGroup); // set the correction combobox to the one already chosen analysisPanel.getCorrectionComboBox().setSelectedItem(selectedGroup.getCorrectionMethodName()); if (selectedGroup.getCorrectionMethodName().equals("none")) { // by default show p-values without adjustment showPValues(selectedGroup, false); } else { // show p values with adjustement showPValues(selectedGroup, true); } } else { // ask user to select a group singleCellAnalysisController.showMessage("Please select a group to perform analysis on.", "You must select a group first", JOptionPane.INFORMATION_MESSAGE); } }); /** * Refresh p value table with current selected significance of level */ analysisPanel.getSignLevelComboBox().addActionListener((ActionEvent e) -> { if (analysisPanel.getSignLevelComboBox().getSelectedIndex() != -1) { String statisticalTest = analysisPanel.getStatTestComboBox().getSelectedItem().toString(); Double selectedSignLevel = (Double) analysisPanel.getSignLevelComboBox().getSelectedItem(); SingleCellAnalysisGroup selectedGroup = groupsBindingList .get(analysisPanel.getAnalysisGroupList().getSelectedIndex()); boolean isAdjusted = !selectedGroup.getCorrectionMethodName().equals("none"); singleCellStatisticsAnalyzer.detectSignificance(selectedGroup, statisticalTest, selectedSignLevel, isAdjusted); boolean[][] significances = selectedGroup.getSignificances(); JTable pValuesTable = analysisPanel.getComparisonTable(); for (int i = 1; i < pValuesTable.getColumnCount(); i++) { pValuesTable.getColumnModel().getColumn(i) .setCellRenderer(new PValuesTableRenderer(new DecimalFormat("#.####"), significances)); } pValuesTable.repaint(); } }); /** * Apply correction for multiple comparisons: choose the algorithm! */ analysisPanel.getCorrectionComboBox().addActionListener((ActionEvent e) -> { int selectedIndex = analysisPanel.getAnalysisGroupList().getSelectedIndex(); if (selectedIndex != -1) { SingleCellAnalysisGroup selectedGroup = groupsBindingList.get(selectedIndex); String correctionMethod = analysisPanel.getCorrectionComboBox().getSelectedItem().toString(); // if the correction method is not "NONE" if (!correctionMethod.equals("none")) { // adjust p values singleCellStatisticsAnalyzer.correctForMultipleComparisons(selectedGroup, correctionMethod); // show p - values with the applied correction showPValues(selectedGroup, true); } else { // if selected correction method is "NONE", do not apply correction and only show normal p-values showPValues(selectedGroup, false); } } }); /** * Perform statistical test: choose the test!! */ analysisPanel.getPerformStatButton().addActionListener((ActionEvent e) -> { // get the selected test to be executed String selectedTest = analysisPanel.getStatTestComboBox().getSelectedItem().toString(); String param = analysisPanel.getParameterComboBox().getSelectedItem().toString(); // analysis group int selectedIndex = analysisPanel.getAnalysisGroupList().getSelectedIndex(); if (selectedIndex != -1) { SingleCellAnalysisGroup selectedGroup = groupsBindingList.get(selectedIndex); computeStatistics(selectedGroup, selectedTest, param); } }); //multiple comparison correction: set the default correction to none analysisPanel.getCorrectionComboBox().setSelectedIndex(0); analysisPanel.getStatTestComboBox().setSelectedIndex(0); analysisPanel.getParameterComboBox().setSelectedIndex(0); }
From source file:edu.ucla.stat.SOCR.chart.SuperYIntervalChartA.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w . j av a2s .c om public void resetExample() { isDemo = true; dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.YIntervalDataset2TableA(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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); // 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(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w. j a v a2 s .c o m public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); // resetTable(); 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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); //updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.demo.DotChart.java
public void resetExample() { // System.out.println("resetExample get called"); XYDataset dataset = createDataset1(true); // JFreeChart chart = createChart1(dataset); // chartPanel1 = new ChartPanel(chart, false); XYDataset dataset1 = createDataset1(true); JFreeChart chart1 = createChart1(dataset1); BoxAndWhiskerCategoryDataset dataset2 = createDataset2(true); JFreeChart chart2 = createChart2(dataset2); chartPanel1 = new ChartPanel(chart1, false); chartPanel1.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y * 2 / 3)); chartPanel2 = new ChartPanel(chart2, false); chartPanel2.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y / 3)); this.setChart(); hasExample = true;/* ww w. ja va 2s .co m*/ // System.out.println("row_count="+row_count); // System.out.println("raw+x="+raw_x[0]); convertor.Y2Table(raw_x, row_count); //convertor.dataset2Table(dataset); 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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_Stat_Raw_Vertical.java
/** * reset dataTable to default (demo data), and refesh chart *//*from w w w . j a va 2 s.c o m*/ public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.valueList2Table_vertical(values_storage, SERIES_COUNT, CATEGORY_COUNT); JTable tempDataTable = convertor.getTable(); // resetTable(); 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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping //addButtonDependent(); setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart.java
/** * reset dataTable to default (demo data), and refesh chart *///from w ww . j a v a 2s . co m public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; // convertor.dataset2Table((TimeSeriesCollection)dataset); 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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w . j a v a 2 s .c o m public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(tempDataTable.getColumnCount() + 1); 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperBoxAndWhiskerChart_Vertical.java
/** * reset dataTable to default (demo data), and refesh chart */// w w w . ja v a 2 s. c om public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.valueList2Table_vertical(values_storage, SERIES_COUNT, CATEGORY_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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); updateStatus(url); }
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)); }//from w w 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.SuperBoxAndWhiskerChart.java
/** * reset dataTable to default (demo data), and refesh chart *//* ww w . j a v a2 s.c o m*/ public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.valueList2Table(values_storage, SERIES_COUNT, CATEGORY_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)); } 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(); dataPanel.add(new JScrollPane(dataTable)); 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(); // do the mapping setMapping(); updateStatus(url); }