if (file1 == null || !file1.isFile()) {
JOptionPane.showMessageDialog(null, "ReportDefinition DiagramSource4.xml not found on classpath");
return;
}
ReportGenerator gen = ReportGenerator.getInstance();
JFreeReport report1;
try {
report1 = gen.parseReport(file1);
} catch (Exception ioe) {
JOptionPane.showMessageDialog(null, ioe.getMessage(), "Error: " + ioe.getClass().getName(), JOptionPane.ERROR_MESSAGE);
return;
}
if (report1 == null) {
throw new NullPointerException("Damn, is null");
}
report1.setProperty("diagramreport", Translator.getTranslation("Print out of diagrams values"));
report1.setProperty("catagory", Translator.getTranslation("Catagory"));
report1.setProperty("value", Translator.getTranslation("Value"));
report1.setProperty("series", Translator.getTranslation("Series"));
report1.setProperty("dateToday", DateField.getTodaysDateString());
report1.setProperty("company", (String) cc.comboBox.getSelectedItemsSecondaryKey());
report1.setProperty("companytext", Translator.getTranslation("Company"));
AbstractTableModel myData =
new AbstractTableModel() {
//{{{ +getColumnClass(int) : Class
public Class getColumnClass(int c) {
return new String().getClass();
}//}}}
// These methods always need to be implemented.
//{{{ +getColumnCount() : int
public int getColumnCount() {
return 3;
}//}}}
// The default implementations of these methods in
// AbstractTableModel would work, but we can refine them.
//{{{ +getColumnName(int) : String
public String getColumnName(int column) {
switch (column) {
case 0:
return "Series";
case 1:
return "Catagory";
default:
return "Value";
}
}//}}}
//{{{ +getRowCount() : int
public int getRowCount() {
return dataset.getColumnCount() * dataset.getRowCount();
}//}}}
//{{{ +getValueAt(int, int) : Object
public Object getValueAt(int row, int col) {
int calcCol = row % dataset.getColumnCount();
int calcRow = row / dataset.getColumnCount();
Log.log(Log.DEBUG, this, "getvalue " + calcRow + " ; " + calcCol + " ; " + row
+ " ; " + col);
switch (col) {
case 0:
return dataset.getRowKey(calcRow);
case 1:
return dataset.getColumnKey(calcCol);
default:
return DoubleField.ConvertDoubleToLocalizedString(
new Double(dataset.getValue(calcRow, calcCol).doubleValue()));
}
}//}}}
//{{{ +isCellEditable(int, int) : boolean
public boolean isCellEditable(int row, int col) {
return false;
}//}}}
//{{{ +setValueAt(Object, int, int) : void
public void setValueAt(Object aValue, int row, int col) {
}//}}}
};
report1.setData(myData);
try {
PreviewFrame frame1 = new PreviewFrame(report1);
frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame1.pack();
RefineryUtilities.positionFrameRandomly(frame1);