00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 package ikayaki.gui;
00025
00026 import com.intellij.uiDesigner.core.GridConstraints;
00027 import com.intellij.uiDesigner.core.GridLayoutManager;
00028 import com.intellij.uiDesigner.core.Spacer;
00029 import ikayaki.MeasurementValue;
00030 import ikayaki.Project;
00031 import ikayaki.util.ComponentPrinter;
00032
00033 import javax.swing.*;
00034 import javax.swing.table.AbstractTableModel;
00035 import javax.swing.table.TableColumnModel;
00036 import javax.swing.table.TableModel;
00037 import java.awt.*;
00038 import java.awt.event.ActionEvent;
00039 import java.awt.event.ActionListener;
00040 import java.text.DateFormat;
00041 import java.text.NumberFormat;
00042 import java.util.Date;
00043 import java.util.LinkedList;
00044 import java.util.Queue;
00045 import java.util.Vector;
00046
00053 public class PrintPanel extends JPanel {
00054
00055 private JDialog creator;
00056 private Project project;
00057
00058 private JPanel contentPane;
00059
00063 private JPanel printedPanel;
00064
00065 private JPanel controlPanel;
00066 private JPanel plot1Panel;
00067 private JPanel plot2Panel;
00068 private JPanel plot3Panel;
00069 private JPanel plot4Panel;
00070 private AbstractPlot plot1;
00071 private AbstractPlot plot2;
00072 private AbstractPlot plot3;
00073 private AbstractPlot plot4;
00074
00075 private JTable sequenceTable;
00076 private TableModel sequenceTableModel;
00077 private JScrollPane scrollPane;
00078
00079 private JLabel operator;
00080 private JLabel volume;
00081 private JLabel mass;
00082 private JLabel header;
00083 private JLabel latitude;
00084 private JLabel susceptibility;
00085 private JLabel longitude;
00086 private JLabel strike;
00087 private JLabel dip;
00088 private JLabel qValue;
00089 private JLabel density;
00090
00091 private JButton print;
00092 private JButton cancel;
00093
00097 private Vector<AbstractPlot> plots = new Vector<AbstractPlot>();
00098
00099 public PrintPanel(JDialog creator, Project project, boolean printDirectly) {
00100 if (project == null) {
00101 throw new NullPointerException();
00102 }
00103 this.creator = creator;
00104 this.project = project;
00105
00106 $$$setupUI$$$();
00107
00108 NumberFormat nf = NumberFormat.getInstance();
00109 nf.setGroupingUsed(false);
00110
00111
00112 header.setText(project.getName() + " (" + project.getType() + " Project)");
00113 header.setFont(header.getFont().deriveFont(Font.BOLD));
00114 operator.setText(project.getProperty(Project.OPERATOR_PROPERTY, "") + " / " +
00115 project.getProperty(Project.DATE_PROPERTY, DateFormat.getDateInstance().format(new Date())));
00116 nf.setMaximumFractionDigits(1);
00117 nf.setMinimumFractionDigits(1);
00118 try {
00119 double d = Double.parseDouble(project.getProperty(Project.LATITUDE_PROPERTY, "0.0"));
00120 latitude.setText(nf.format(d));
00121 } catch (NumberFormatException e) {
00122 latitude.setText("");
00123 }
00124 try {
00125 double d = Double.parseDouble(project.getProperty(Project.LONGITUDE_PROPERTY, "0.0"));
00126 longitude.setText(nf.format(d));
00127 } catch (NumberFormatException e) {
00128 longitude.setText("");
00129 }
00130 strike.setText(nf.format(project.getStrike()));
00131 dip.setText(nf.format(project.getDip()));
00132 nf.setMinimumFractionDigits(3);
00133 nf.setMaximumFractionDigits(3);
00134 mass.setText(project.getMass() > 0 ? nf.format(project.getMass()) + " g" : "");
00135 volume.setText(project.getVolume() > 0 ? nf.format(project.getVolume()) + " cm\u00B3" : "");
00136 nf.setMinimumFractionDigits(0);
00137 nf.setMaximumFractionDigits(0);
00138 susceptibility.setText(
00139 project.getSusceptibility() > 0 ? nf.format(project.getSusceptibility()) + "E-6 SI" : "");
00140
00141
00142
00143 if (project.getStep(0) != null) {
00144
00145 Double mag = project.getValue(0, MeasurementValue.MAGNETIZATION);
00146 if (mag != null) {
00147 nf.setMinimumFractionDigits(2);
00148 nf.setMaximumFractionDigits(2);
00149 double q = 25.13 * mag / project.getSusceptibility();
00150 qValue.setText(nf.format(q));
00151 } else {
00152 qValue.setText("");
00153 }
00154 }
00155 if (project.getMass() > 0 && project.getVolume() > 0) {
00156 nf.setMinimumFractionDigits(3);
00157 nf.setMaximumFractionDigits(3);
00158 double d = project.getMass() / project.getVolume();
00159 density.setText(nf.format(d) + " g/cm\u00B3");
00160 } else {
00161 density.setText("");
00162 }
00163
00164
00165 sequenceTableModel = new PrintSequenceTableModel(project);
00166 sequenceTable.setModel(sequenceTableModel);
00167 sequenceTable.getTableHeader().setReorderingAllowed(false);
00168 sequenceTable.getTableHeader().setResizingAllowed(false);
00169 sequenceTable.setDefaultRenderer(StyledWrapper.class, new StyledTableCellRenderer());
00170 sequenceTable.setBorder(BorderFactory.createMatteBorder(sequenceTable.getIntercellSpacing().height,
00171 sequenceTable.getIntercellSpacing().width, 0, 0, sequenceTable.getGridColor()));
00172 updateColumns();
00173
00174
00175 plot1 = new IntensityPlot();
00176 plot2 = new StereoPlot();
00177 plots.add(plot1);
00178 plots.add(plot2);
00179 plot1Panel.setLayout(new BorderLayout());
00180 plot2Panel.setLayout(new BorderLayout());
00181 plot3Panel.setLayout(new BorderLayout());
00182 plot4Panel.setLayout(new BorderLayout());
00183 plot1Panel.add(plot1, "Center");
00184 plot2Panel.add(plot2, "Center");
00185
00186
00187 plot1Panel.setPreferredSize(new Dimension(200, 200));
00188 plot2Panel.setPreferredSize(new Dimension(200, 200));
00189
00190 for (Plot plot : plots) {
00191 plot.reset();
00192 if (project != null) {
00193 for (int i = 0; i < project.getSteps(); i++) {
00194 plot.add(project.getStep(i));
00195 }
00196 }
00197 }
00198
00199
00200 setLayout(new BorderLayout());
00201 add(contentPane, BorderLayout.CENTER);
00202 setMinimumSize(new Dimension(500, 700));
00203
00204
00205 setOpaque(printedPanel, false);
00206 printedPanel.getParent().setBackground(Color.WHITE);
00207
00208
00209 print.addActionListener(new ActionListener() {
00210 public void actionPerformed(ActionEvent e) {
00211 closeDialog();
00212 ComponentPrinter.printComponent(getPrintedDocument(), PrintPanel.this.project.getName());
00213 }
00214 });
00215 cancel.addActionListener(new ActionListener() {
00216 public void actionPerformed(ActionEvent e) {
00217 closeDialog();
00218 }
00219 });
00220
00221
00222 if (printDirectly) {
00223 SwingUtilities.invokeLater(new Runnable() {
00224 public void run() {
00225 print.doClick();
00226 }
00227 });
00228 }
00229 }
00230
00234 private static void setOpaque(JComponent container, boolean opaque) {
00235 Queue<Component> components = new LinkedList<Component>();
00236 components.add(container);
00237 Component component = null;
00238 while ((component = components.poll()) != null) {
00239 if (component instanceof JComponent) {
00240 ((JComponent) component).setOpaque(opaque);
00241 }
00242 if (component instanceof Container) {
00243 for (Component c : ((Container) component).getComponents()) {
00244 components.add(c);
00245 }
00246 }
00247 }
00248 }
00249
00255 public JPanel getPrintedDocument() {
00256 return printedPanel;
00257 }
00258
00262 private void closeDialog() {
00263 if (creator != null) {
00264 creator.setVisible(false);
00265 }
00266 }
00267
00271 private void updateColumns() {
00272 TableColumnModel columnModel = sequenceTable.getColumnModel();
00273 for (int col = 0; col < columnModel.getColumnCount(); col++) {
00274
00275 int width = 20;
00276 Component comp;
00277 for (int row = 0; row < sequenceTable.getRowCount(); row++) {
00278 comp = sequenceTable.getCellRenderer(row, col).getTableCellRendererComponent(sequenceTable,
00279 sequenceTable.getValueAt(row, col), false, false, row, col);
00280 width = Math.max(width, comp.getPreferredSize().width);
00281 }
00282 columnModel.getColumn(col).setPreferredWidth(width);
00283 }
00284 }
00285
00286 {
00287
00288
00289
00290 $$$setupUI$$$();
00291 }
00292
00297 private void $$$setupUI$$$() {
00298 contentPane = new JPanel();
00299 contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(11, 11, 11, 11), -1, -1));
00300 final JPanel panel1 = new JPanel();
00301 panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
00302 contentPane.add(panel1,
00303 new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00304 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00305 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00306 panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
00307 scrollPane = new JScrollPane();
00308 scrollPane.setHorizontalScrollBarPolicy(31);
00309 scrollPane.setVerticalScrollBarPolicy(22);
00310 panel1.add(scrollPane,
00311 new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00312 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
00313 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null));
00314 printedPanel = new JPanel();
00315 printedPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, 16));
00316 scrollPane.setViewportView(printedPanel);
00317 final JPanel panel2 = new JPanel();
00318 panel2.setLayout(new GridLayoutManager(5, 7, new Insets(0, 0, 0, 0), 4, 4));
00319 printedPanel.add(panel2,
00320 new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00321 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00322 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00323 header = new JLabel();
00324 header.setText("New Project");
00325 panel2.add(header,
00326 new GridConstraints(0, 2, 1, 5, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00327 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00328 final JLabel label1 = new JLabel();
00329 label1.setText("Operator / Date:");
00330 panel2.add(label1,
00331 new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00332 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00333 final JLabel label2 = new JLabel();
00334 label2.setText("Mass (grams):");
00335 panel2.add(label2,
00336 new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00337 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00338 final JLabel label3 = new JLabel();
00339 label3.setText("Volume (cm³):");
00340 panel2.add(label3,
00341 new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00342 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00343 operator = new JLabel();
00344 operator.setText("N/A");
00345 panel2.add(operator,
00346 new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00347 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00348 volume = new JLabel();
00349 volume.setText("N/A");
00350 panel2.add(volume,
00351 new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00352 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00353 mass = new JLabel();
00354 mass.setText("N/A");
00355 panel2.add(mass,
00356 new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00357 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00358 susceptibility = new JLabel();
00359 susceptibility.setText("N/A");
00360 panel2.add(susceptibility,
00361 new GridConstraints(3, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00362 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00363 final JLabel label4 = new JLabel();
00364 label4.setText("Susceptibility:");
00365 panel2.add(label4,
00366 new GridConstraints(3, 2, 1, 2, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00367 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00368 final JLabel label5 = new JLabel();
00369 label5.setText("Latitude:");
00370 panel2.add(label5,
00371 new GridConstraints(1, 2, 1, 2, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00372 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00373 latitude = new JLabel();
00374 latitude.setText("N/A");
00375 panel2.add(latitude,
00376 new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00377 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00378 final JLabel label6 = new JLabel();
00379 label6.setText("Longitude:");
00380 panel2.add(label6,
00381 new GridConstraints(2, 2, 1, 2, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00382 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00383 longitude = new JLabel();
00384 longitude.setText("N/A");
00385 panel2.add(longitude,
00386 new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00387 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00388 final JLabel label7 = new JLabel();
00389 label7.setText("Density:");
00390 panel2.add(label7,
00391 new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00392 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00393 density = new JLabel();
00394 density.setText("N/A");
00395 panel2.add(density,
00396 new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00397 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00398 final JLabel label8 = new JLabel();
00399 label8.setText("Q:");
00400 panel2.add(label8,
00401 new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00402 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00403 qValue = new JLabel();
00404 qValue.setText("N/A");
00405 panel2.add(qValue,
00406 new GridConstraints(4, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00407 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00408 final JLabel label9 = new JLabel();
00409 label9.setText("Strike:");
00410 panel2.add(label9,
00411 new GridConstraints(1, 5, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00412 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00413 strike = new JLabel();
00414 strike.setText("N/A");
00415 panel2.add(strike,
00416 new GridConstraints(1, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00417 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00418 final JLabel label10 = new JLabel();
00419 label10.setText("Dip:");
00420 panel2.add(label10,
00421 new GridConstraints(2, 5, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
00422 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00423 dip = new JLabel();
00424 dip.setText("N/A");
00425 panel2.add(dip,
00426 new GridConstraints(2, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
00427 GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00428 sequenceTable = new JTable();
00429 sequenceTable.setEnabled(false);
00430 sequenceTable.setPreferredScrollableViewportSize(new Dimension(-1, -1));
00431 printedPanel.add(sequenceTable,
00432 new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00433 GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null));
00434 final JPanel panel3 = new JPanel();
00435 panel3.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), 8, 8));
00436 printedPanel.add(panel3,
00437 new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00438 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00439 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00440 plot2Panel = new JPanel();
00441 panel3.add(plot2Panel,
00442 new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_BOTH,
00443 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00444 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00445 plot4Panel = new JPanel();
00446 panel3.add(plot4Panel,
00447 new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_BOTH,
00448 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00449 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00450 plot1Panel = new JPanel();
00451 panel3.add(plot1Panel,
00452 new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_BOTH,
00453 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00454 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00455 plot3Panel = new JPanel();
00456 panel3.add(plot3Panel,
00457 new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_BOTH,
00458 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00459 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
00460 controlPanel = new JPanel();
00461 controlPanel.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 4, 0), -1, -1));
00462 contentPane.add(controlPanel,
00463 new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
00464 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00465 GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00466 print = new JButton();
00467 print.setText("Print");
00468 controlPanel.add(print,
00469 new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
00470 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00471 GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00472 cancel = new JButton();
00473 cancel.setText("Cancel");
00474 controlPanel.add(cancel,
00475 new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
00476 GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
00477 GridConstraints.SIZEPOLICY_FIXED, null, null, null));
00478 final Spacer spacer1 = new Spacer();
00479 controlPanel.add(spacer1,
00480 new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
00481 GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null));
00482 }
00483
00489 private class PrintSequenceTableModel extends AbstractTableModel {
00490
00491 private StyledWrapper wrapper = new StyledWrapper();
00492
00493 private MeasurementSequenceTableModel model;
00494
00495 public PrintSequenceTableModel(Project project) {
00496 model = new MeasurementSequenceTableModel();
00497 model.setProject(project);
00498 wrapper.horizontalAlignment = SwingConstants.TRAILING;
00499 }
00500
00501 public int getRowCount() {
00502 if (model.getProject().isSequenceEditEnabled()) {
00503 return model.getRowCount();
00504 } else {
00505 return model.getRowCount() + 1;
00506 }
00507 }
00508
00509 public int getColumnCount() {
00510 return model.getColumnCount();
00511 }
00512
00513 @Override public Class<?> getColumnClass(int columnIndex) {
00514 return StyledWrapper.class;
00515 }
00516
00517 public Object getValueAt(int rowIndex, int columnIndex) {
00518 if (rowIndex == 0) {
00519 wrapper.value = model.getColumnName(columnIndex);
00520 return wrapper;
00521 } else {
00522 Object obj = model.getValueAt(rowIndex - 1, columnIndex);
00523 if (obj instanceof StyledWrapper) {
00524 StyledWrapper wrapper = (StyledWrapper) obj;
00525 obj = wrapper.value;
00526 }
00527 wrapper.value = obj;
00528 return wrapper;
00529 }
00530 }
00531 }
00532 }