Source Code Cross Referenced for ProblemsPanel.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » logpane » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport.gui.logpane 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ProblemsPanel.java
003:         *
004:         * Created on February 27, 2007, 10:55 AM
005:         */
006:
007:        package it.businesslogic.ireport.gui.logpane;
008:
009:        import it.businesslogic.ireport.compiler.ErrorLocator;
010:        import it.businesslogic.ireport.compiler.xml.SourceLocation;
011:        import it.businesslogic.ireport.gui.JReportFrame;
012:        import it.businesslogic.ireport.gui.MainFrame;
013:        import it.businesslogic.ireport.gui.event.ReportFrameActivatedEvent;
014:        import it.businesslogic.ireport.gui.event.ReportFrameActivatedListener;
015:        import it.businesslogic.ireport.util.I18n;
016:        import it.businesslogic.ireport.util.LanguageChangedEvent;
017:        import it.businesslogic.ireport.util.LanguageChangedListener;
018:        import javax.swing.JTabbedPane;
019:        import javax.swing.SwingUtilities;
020:        import javax.swing.table.DefaultTableModel;
021:
022:        /**
023:         *
024:         * @author  gtoffoli
025:         */
026:        public class ProblemsPanel extends javax.swing.JPanel implements 
027:                ReportFrameActivatedListener {
028:
029:            private ErrorLocator errorLocator = null;
030:
031:            /** Creates new form ProblemsPanel */
032:            public ProblemsPanel() {
033:                initComponents();
034:                errorLocator = new ErrorLocator();
035:                jTable1.getColumnModel().getColumn(0).setMinWidth(20);
036:                jTable1.getColumnModel().getColumn(0).setMaxWidth(20);
037:                jTable1.getColumnModel().getColumn(0).setPreferredWidth(20);
038:
039:                jTable1.getColumnModel().getColumn(0).setCellRenderer(
040:                        new ProblemIconTableCellRenderer());
041:                jTable1.getColumnModel().getColumn(1).setPreferredWidth(300);
042:                jTable1.getColumnModel().getColumn(2).setPreferredWidth(150);
043:                jTable1.getColumnModel().getColumn(3).setPreferredWidth(550);
044:
045:                MainFrame.getMainInstance().addReportFrameActivatedListener(
046:                        this );
047:                setName(I18n.getFormattedString("problems",
048:                        "Problems ({0,number})",
049:                        new Object[] { new Integer(0) }));
050:
051:                I18n
052:                        .addOnLanguageChangedListener(new LanguageChangedListener() {
053:                            public void languageChanged(LanguageChangedEvent evt) {
054:                                applyI18n();
055:                            }
056:                        });
057:
058:            }
059:
060:            public void updateProblemsList() {
061:                JReportFrame rf = MainFrame.getMainInstance()
062:                        .getActiveReportFrame();
063:
064:                if (rf != null) {
065:                    setProblems(rf.getReportProblems());
066:                } else {
067:                    DefaultTableModel dtm = (DefaultTableModel) jTable1
068:                            .getModel();
069:                    dtm.setRowCount(0);
070:                }
071:                this .updateUI();
072:            }
073:
074:            public void setProblems(java.util.List problems) {
075:                DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
076:                dtm.setRowCount(0);
077:                for (int i = 0; i < problems.size(); ++i) {
078:                    ProblemItem pi = (ProblemItem) problems.get(i);
079:                    addProblem(pi);
080:                }
081:
082:                updateName();
083:            }
084:
085:            public void addProblem(ProblemItem pi) {
086:                String pWhere = pi.getWhere();
087:                String location = "";
088:                if (pi.getProblemReference() != null
089:                        && pi.getProblemReference() instanceof  SourceLocation) {
090:                    SourceLocation sl = (SourceLocation) pi
091:                            .getProblemReference();
092:                    location = I18n
093:                            .getFormattedString(
094:                                    "LineColumn",
095:                                    "Line {0,number,integer}, Column {1,number,integer}",
096:                                    new Object[] {
097:                                            new Integer(sl.getLineNumber()),
098:                                            new Integer(sl.getColumnNumber()) });
099:                }
100:                DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel();
101:                dtm.addRow(new Object[] { pi, pi.getDescription(), location,
102:                        pWhere });
103:            }
104:
105:            /** This method is called from within the constructor to
106:             * initialize the form.
107:             * WARNING: Do NOT modify this code. The content of this method is
108:             * always regenerated by the Form Editor.
109:             */
110:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
111:            private void initComponents() {
112:                java.awt.GridBagConstraints gridBagConstraints;
113:
114:                jScrollPane1 = new javax.swing.JScrollPane();
115:                jTable1 = new javax.swing.JTable();
116:
117:                setLayout(new java.awt.GridBagLayout());
118:
119:                jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
120:                jTable1.setModel(new javax.swing.table.DefaultTableModel(
121:                        new Object[][] {
122:
123:                        }, new String[] { " ", "Description", "Location",
124:                                "Element" }) {
125:                    Class[] types = new Class[] { java.lang.Object.class,
126:                            java.lang.String.class, java.lang.Object.class,
127:                            java.lang.Object.class };
128:                    boolean[] canEdit = new boolean[] { false, false, false,
129:                            false };
130:
131:                    public Class getColumnClass(int columnIndex) {
132:                        return types[columnIndex];
133:                    }
134:
135:                    public boolean isCellEditable(int rowIndex, int columnIndex) {
136:                        return canEdit[columnIndex];
137:                    }
138:                });
139:                jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
140:                    public void mouseClicked(java.awt.event.MouseEvent evt) {
141:                        jTable1MouseClicked(evt);
142:                    }
143:                });
144:
145:                jScrollPane1.setViewportView(jTable1);
146:
147:                gridBagConstraints = new java.awt.GridBagConstraints();
148:                gridBagConstraints.gridx = 0;
149:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
150:                gridBagConstraints.weightx = 1.0;
151:                gridBagConstraints.weighty = 1.0;
152:                add(jScrollPane1, gridBagConstraints);
153:
154:            }// </editor-fold>//GEN-END:initComponents
155:
156:            private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
157:
158:                System.out.flush();
159:                if (evt.getClickCount() == 2
160:                        && SwingUtilities.isLeftMouseButton(evt)) {
161:
162:                    if (jTable1.getSelectedRow() >= 0) {
163:                        ProblemItem pi = (ProblemItem) jTable1.getValueAt(
164:                                jTable1.getSelectedRow(), 0);
165:                        errorLocator.parseError(pi.getWhere(), pi
166:                                .getDescription());
167:                    }
168:                }
169:            }//GEN-LAST:event_jTable1MouseClicked
170:
171:            public void reportFrameActivated(ReportFrameActivatedEvent evt) {
172:                if (evt.getReportFrame() != null) {
173:                    setProblems(evt.getReportFrame().getReportProblems());
174:                } else {
175:                    DefaultTableModel dtm = (DefaultTableModel) jTable1
176:                            .getModel();
177:                    dtm.setRowCount(0);
178:                }
179:
180:                errorLocator.setJReportFrame(evt.getReportFrame());
181:            }
182:
183:            public void updateName() {
184:                setName(I18n.getFormattedString("problems",
185:                        "Problems ({0,number})", new Object[] { new Integer(
186:                                jTable1.getRowCount()) }));
187:
188:                if (this .getParent() != null
189:                        && this .getParent() instanceof  JTabbedPane) {
190:                    JTabbedPane tp = (JTabbedPane) this .getParent();
191:                    try {
192:
193:                        if (jTable1.getRowCount() > 0) {
194:                            tp.setIconAt(1,
195:                                    ProblemIconTableCellRenderer.errorIcon);
196:                            tp.setTitleAt(1, "<html><font color=\"red\">"
197:                                    + getName());
198:                        } else {
199:                            tp.setIconAt(1, null);
200:                            tp.setTitleAt(1, getName());
201:                        }
202:
203:                    } catch (Exception ex) {
204:
205:                    }
206:                }
207:            }
208:
209:            public void applyI18n() {
210:                jTable1.getColumnModel().getColumn(1).setHeaderValue(
211:                        I18n.getString("problemsPanel.table.description",
212:                                "Description"));
213:                jTable1.getColumnModel().getColumn(2).setHeaderValue(
214:                        I18n.getString("problemsPanel.table.location",
215:                                "JRXML location"));
216:                jTable1.getColumnModel().getColumn(3).setHeaderValue(
217:                        I18n.getString("problemsPanel.table.object", "Object"));
218:            }
219:
220:            // Variables declaration - do not modify//GEN-BEGIN:variables
221:            private javax.swing.JScrollPane jScrollPane1;
222:            private javax.swing.JTable jTable1;
223:            // End of variables declaration//GEN-END:variables
224:
225:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.