List of usage examples for javax.swing.table TableModel setValueAt
public void setValueAt(Object aValue, int rowIndex, int columnIndex);
columnIndex
and rowIndex
to aValue
. From source file:org.datacleaner.widgets.result.AbstractCrosstabResultSwingRenderer.java
protected void valueCell(Object value, final ResultProducer drillToDetailResultProducer, TableModel tableModel, int row, int col, boolean headersIncluded, Alignment alignment) { final Object resultValue; ActionListener action = null; if (drillToDetailResultProducer != null) { final StringBuilder sb = new StringBuilder("Detailed result for ["); sb.append(getLabelText(value));//from w w w .j av a 2s .c o m sb.append(" ("); final String cat1; if (headersIncluded) { cat1 = tableModel.getColumnName(col); } else { cat1 = tableModel.getValueAt(0, col).toString(); } sb.append(cat1).append(", "); final String cat2 = tableModel.getValueAt(row, 0).toString(); sb.append(cat2); sb.append(")]"); action = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _drillToDetailsCallback.drillToDetails(sb.toString(), drillToDetailResultProducer); } }; resultValue = createActionableValuePanel(value, alignment, action, IMAGE_PATH_DRILL_TO_DETAIL); } else { resultValue = getLabelText(value); } tableModel.setValueAt(resultValue, row, col); }
From source file:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
private void setCountValue(final ValueCountingAnalyzerResult result, final TableModel model, int i, final ValueFrequency vc) { final String value = vc.getName(); final int count = vc.getCount(); final boolean hasAnnotation; final boolean isNullValue = value == null || LabelUtils.NULL_LABEL.equals(value); final boolean isUnexpectedValues = LabelUtils.UNEXPECTED_LABEL.equals(value); final boolean isBlank = "".equals(value) || LabelUtils.BLANK_LABEL.equals(value); if (count == 0) { hasAnnotation = false;/*from w w w. ja v a2s.c om*/ } else { if (isNullValue) { hasAnnotation = result.hasAnnotatedRows(null); } else if (isUnexpectedValues) { hasAnnotation = result.hasAnnotatedRows(null); } else if (isBlank) { hasAnnotation = result.hasAnnotatedRows(""); } else { hasAnnotation = result.hasAnnotatedRows(value); } } if (hasAnnotation) { ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent action) { String title = "Detailed results for [" + value + "]"; List<AnalyzerResult> results = new ArrayList<AnalyzerResult>(); final AnnotatedRowsResult annotatedRows; if (isNullValue) { annotatedRows = result.getAnnotatedRowsForNull(); } else if (isUnexpectedValues) { annotatedRows = result.getAnnotatedRowsForUnexpectedValues(); } else if (isBlank) { annotatedRows = result.getAnnotatedRowsForValue(""); } else { annotatedRows = result.getAnnotatedRowsForValue(value); } results.add(annotatedRows); DetailsResultWindow window = new DetailsResultWindow(title, results, _windowContext, _rendererFactory); window.setVisible(true); } }; DCPanel panel = AbstractCrosstabResultSwingRenderer.createActionableValuePanel(count, Alignment.LEFT, action, IconUtils.ACTION_DRILL_TO_DETAIL); model.setValueAt(panel, i, 1); } else { model.setValueAt(count, i, 1); } }
From source file:org.eobjects.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
private void setCountValue(final ValueCountingAnalyzerResult result, final TableModel model, int i, final ValueFrequency vc) { final String value = vc.getName(); final int count = vc.getCount(); final boolean hasAnnotation; final boolean isNullValue = value == null || LabelUtils.NULL_LABEL.equals(value); final boolean isUnexpectedValues = LabelUtils.UNEXPECTED_LABEL.equals(value); final boolean isBlank = "".equals(value) || LabelUtils.BLANK_LABEL.equals(value); if (count == 0) { hasAnnotation = false;/* w w w . ja v a 2s .c om*/ } else { if (isNullValue) { hasAnnotation = result.hasAnnotatedRows(null); } else if (isUnexpectedValues) { hasAnnotation = result.hasAnnotatedRows(null); } else if (isBlank) { hasAnnotation = result.hasAnnotatedRows(""); } else { hasAnnotation = result.hasAnnotatedRows(value); } } if (hasAnnotation) { ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent action) { String title = "Detailed results for [" + value + "]"; List<AnalyzerResult> results = new ArrayList<AnalyzerResult>(); final AnnotatedRowsResult annotatedRows; if (isNullValue) { annotatedRows = result.getAnnotatedRowsForNull(); } else if (isUnexpectedValues) { annotatedRows = result.getAnnotatedRowsForUnexpectedValues(); } else if (isBlank) { annotatedRows = result.getAnnotatedRowsForValue(""); } else { annotatedRows = result.getAnnotatedRowsForValue(value); } results.add(annotatedRows); DetailsResultWindow window = new DetailsResultWindow(title, results, _windowContext, _rendererFactory); window.setVisible(true); } }; DCPanel panel = AbstractCrosstabResultSwingRenderer.createActionableValuePanel(count, Alignment.LEFT, action, AbstractCrosstabResultSwingRenderer.IMAGE_PATH_DRILL_TO_DETAIL); model.setValueAt(panel, i, 1); } else { model.setValueAt(count, i, 1); } }
From source file:fll.web.FullTournamentTest.java
/** * Simulate entering subjective scores by pulling them out of testDataConn. * /*w ww. ja v a 2 s. com*/ * @param testDataConn Where to get the test data from * @param challengeDocument the challenge descriptor * @throws SQLException * @throws SAXException * @throws InterruptedException */ private void enterSubjectiveScores(final Connection testDataConn, final ChallengeDescription description, final Tournament sourceTournament, final Path outputDirectory) throws SQLException, IOException, MalformedURLException, ParseException, SAXException, InterruptedException { final Path subjectiveZip = outputDirectory .resolve(sanitizeFilename(sourceTournament.getName()) + "_subjective-data.fll"); IntegrationTestUtils.downloadFile(new URL(TestUtils.URL_ROOT + "admin/subjective-data.fll"), "application/zip", subjectiveZip); final SubjectiveFrame subjective = new SubjectiveFrame(); subjective.load(subjectiveZip.toFile()); // insert scores into zip for (final ScoreCategory subjectiveElement : description.getSubjectiveCategories()) { final String category = subjectiveElement.getName(); final String title = subjectiveElement.getTitle(); // find appropriate table model final TableModel tableModel = subjective.getTableModelForTitle(title); Assert.assertNotNull(tableModel); final int teamNumberColumn = findColumnByName(tableModel, "TeamNumber"); Assert.assertTrue("Can't find TeamNumber column in subjective table model", teamNumberColumn >= 0); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found team number column at " + teamNumberColumn); } try (final PreparedStatement prep = testDataConn .prepareStatement("SELECT * FROM " + category + " WHERE Tournament = ?")) { prep.setInt(1, sourceTournament.getTournamentID()); try (final ResultSet rs = prep.executeQuery()) { while (rs.next()) { final int teamNumber = rs.getInt("TeamNumber"); // find row number in table int rowIndex = -1; for (int rowIdx = 0; rowIdx < tableModel.getRowCount(); ++rowIdx) { final Object teamNumberRaw = tableModel.getValueAt(rowIdx, teamNumberColumn); Assert.assertNotNull(teamNumberRaw); final int value = Utilities.NUMBER_FORMAT_INSTANCE.parse(teamNumberRaw.toString()) .intValue(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Checking if " + teamNumber + " equals " + value + " raw: " + teamNumberRaw + "? " + (value == teamNumber) + " rowIdx: " + rowIdx + " numRows: " + tableModel.getRowCount()); } if (value == teamNumber) { rowIndex = rowIdx; break; } } Assert.assertTrue("Can't find team " + teamNumber + " in subjective table model", rowIndex >= 0); if (rs.getBoolean("NoShow")) { // find column for no show final int columnIndex = findColumnByName(tableModel, "No Show"); Assert.assertTrue("Can't find No Show column in subjective table model", columnIndex >= 0); tableModel.setValueAt(Boolean.TRUE, rowIndex, columnIndex); } else { for (final AbstractGoal goalElement : subjectiveElement.getGoals()) { if (!goalElement.isComputed()) { final String goalName = goalElement.getName(); final String goalTitle = goalElement.getTitle(); // find column index for goal and call set final int columnIndex = findColumnByName(tableModel, goalTitle); Assert.assertTrue( "Can't find " + goalTitle + " column in subjective table model", columnIndex >= 0); final int value = rs.getInt(goalName); tableModel.setValueAt(Integer.valueOf(value), rowIndex, columnIndex); } } } // not NoShow } // foreach score } // try ResultSet } // try PreparedStatement } // foreach category subjective.save(); // upload scores IntegrationTestUtils.loadPage(selenium, TestUtils.URL_ROOT + "admin/index.jsp"); final WebElement fileInput = selenium.findElement(By.name("subjectiveFile")); fileInput.sendKeys(subjectiveZip.toAbsolutePath().toString()); selenium.findElement(By.id("uploadSubjectiveFile")).click(); Assert.assertFalse(IntegrationTestUtils.isElementPresent(selenium, By.id("error"))); Assert.assertTrue(IntegrationTestUtils.isElementPresent(selenium, By.id("success"))); }
From source file:com.mirth.connect.client.ui.ChannelSetup.java
private void waitForPreviousCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_waitForPreviousCheckboxActionPerformed currentChannel.getDestinationConnectors().get(destinationTable.getSelectedModelIndex()) .setWaitForPrevious(waitForPreviousCheckbox.isSelected()); TableModel model = destinationTable.getModel(); int rowCount = model.getRowCount(); int colNum = destinationTable.getColumnModelIndex(DESTINATION_CHAIN_COLUMN_NAME); boolean waitForPrevious = waitForPreviousCheckbox.isSelected(); for (int i = destinationTable.getSelectedModelIndex(); i < rowCount; i++) { Integer chain = (Integer) model.getValueAt(i, colNum); chain += (waitForPrevious) ? -1 : 1; model.setValueAt(chain, i, colNum); }/* w ww.ja v a 2 s . c om*/ }
From source file:app.RunApp.java
/** * Action for Clear button from principal tab * //from ww w.ja v a 2 s . c o m * @param evt Event * @param jtable Table */ private void buttonClearActionPerformedPrincipal(java.awt.event.ActionEvent evt, JTable jtable) { TableModel tmodel = jtable.getModel(); for (int i = 0; i < tmodel.getRowCount(); i++) { tmodel.setValueAt(Boolean.FALSE, i, 2); } clearTableMetricsPrincipal(); }
From source file:app.RunApp.java
/** * Action for None button from principal tab * /* w ww .j av a 2 s. c o m*/ * @param evt Event * @param jtable Table */ private void buttonNoneActionPerformedPrincipal(java.awt.event.ActionEvent evt, JTable jtable) { TableModel tmodel = jtable.getModel(); for (int i = 0; i < tmodel.getRowCount(); i++) { tmodel.setValueAt(Boolean.FALSE, i, 2); } jtable.setModel(tmodel); jtable.repaint(); }
From source file:app.RunApp.java
/** * Action for None button from multiple datasets tab * /*from w w w . j av a 2 s . c o m*/ * @param evt Event * @param jtable Table */ private void buttonNoneActionPerformedMulti(java.awt.event.ActionEvent evt, JTable jtable) { TableModel tmodel = jtable.getModel(); for (int i = 0; i < tmodel.getRowCount(); i++) { tmodel.setValueAt(Boolean.FALSE, i, 1); } jtable.setModel(tmodel); jtable.repaint(); }
From source file:app.RunApp.java
/** * Action for All button from principal tab * //from w ww. j a v a 2 s. c o m * @param evt Event * @param jtable Table */ private void buttonAllActionPerformedPrincipal(java.awt.event.ActionEvent evt, JTable jtable) { TableModel tmodel = jtable.getModel(); for (int i = 0; i < tmodel.getRowCount(); i++) { tmodel.setValueAt(Boolean.TRUE, i, 2); } jtable.setModel(tmodel); jtable.repaint(); }
From source file:app.RunApp.java
/** * Action for All button from multiple datasets tab * /*w w w .j av a 2 s. com*/ * @param evt Event * @param jtable Table */ private void buttonAllActionPerformedMulti(java.awt.event.ActionEvent evt, JTable jtable) { TableModel tmodel = jtable.getModel(); for (int i = 0; i < tmodel.getRowCount(); i++) { tmodel.setValueAt(Boolean.TRUE, i, 1); } jtable.setModel(tmodel); jtable.repaint(); }