Source Code Cross Referenced for ErrorsViewPanel.java in  » UML » MetaBoss » com » metaboss » applications » designstudio » errorsview » 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 » UML » MetaBoss » com.metaboss.applications.designstudio.errorsview 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.applications.designstudio.errorsview;
016:
017:        import java.awt.BorderLayout;
018:        import java.awt.event.ActionEvent;
019:        import java.util.ArrayList;
020:
021:        import javax.swing.AbstractButton;
022:        import javax.swing.JScrollPane;
023:        import javax.swing.event.ListSelectionEvent;
024:        import javax.swing.event.ListSelectionListener;
025:
026:        import com.metaboss.applications.designstudio.Application;
027:        import com.metaboss.applications.designstudio.BaseAction;
028:        import com.metaboss.applications.designstudio.BaseLogPanel;
029:        import com.metaboss.applications.designstudio.BaseUserObject;
030:        import com.metaboss.applications.designstudio.Application.ObjectChangedEvent;
031:        import com.metaboss.applications.designstudio.Application.OnErrorsFoundEvent;
032:        import com.metaboss.applications.designstudio.Application.OnModelChangedEvent;
033:        import com.metaboss.applications.designstudio.userobjects.ModelUserObject;
034:
035:        /*		Errors view panel class		*/
036:
037:        public class ErrorsViewPanel extends BaseLogPanel {
038:            private boolean mNew = true;
039:            // UI
040:            private ErrorsModel mModel = new ErrorsModel();
041:            private ErrorsTable mErrorsTable = new ErrorsTable(mModel);
042:            // actions
043:            private EditElementAction mEditElementAction = new EditElementAction();
044:            private ErrorInfoAction mErrorInfoAction = new ErrorInfoAction();
045:            private ErrorFilterAction mErrorFilterAction = new ErrorFilterAction();
046:
047:            // constructor
048:            public ErrorsViewPanel() {
049:                super ();
050:
051:                add(mToolBar, BorderLayout.WEST);
052:                add(new JScrollPane(mErrorsTable));
053:
054:                Application
055:                        .addOnErrorsFoundListener(new Application.OnErrorsFoundListener() {
056:                            public void errorsFound(OnErrorsFoundEvent event) {
057:                                loadErrors();
058:                            }
059:                        });
060:                Application
061:                        .addOnModelChangedListener(new Application.OnModelChangedListener() {
062:                            public void modelChanged(OnModelChangedEvent event) {
063:                                if (event.getEventSource() == OnModelChangedEvent.CURRENT_CHANGED)
064:                                    loadErrors();
065:                            }
066:                        });
067:                Application
068:                        .addObjectChanged(new Application.ObjectChangedListener() {
069:                            public void onObjectChanged(ObjectChangedEvent event) {
070:                                switch (event.getEventSource()) {
071:                                case ObjectChangedEvent.ET_SELECTED:
072:                                    if (Application.sErrorElement == null)
073:                                        checkActions();
074:                                    else
075:                                        loadErrors();
076:                                    break;
077:                                }
078:                            }
079:                        });
080:                mErrorsTable.getSelectionModel().addListSelectionListener(
081:                        new ListSelectionListener() {
082:                            public void valueChanged(ListSelectionEvent e) {
083:                                checkActions();
084:                            }
085:                        });
086:                Application
087:                        .addCloseModelListener(new Application.CloseModelListener() {
088:                            public void closeModel(
089:                                    Application.CloseModelEvent event) {
090:                                loadErrors();
091:                            }
092:                        });
093:            }
094:
095:            protected void fillChildControls() {
096:                //???
097:            }
098:
099:            // load model errors
100:            public void loadErrors() {
101:                ModelUserObject lCurrentModelObject = Application
102:                        .getCurrentPackage();
103:                if (lCurrentModelObject != null)
104:                    mModel.loadErrors(lCurrentModelObject.getFileName());
105:                checkActions();
106:                checkErrorsFoundButton();
107:            }
108:
109:            public void setBounds(int x, int y, int width, int height) {
110:                int lOldWidth = getWidth();
111:                super .setBounds(x, y, width, height);
112:
113:                //if (lOldWidth!=width)
114:                //	mErrorsTable.resizeColumns(width-mToolBar.getWidth()-3);	
115:
116:                if (lOldWidth != width) {
117:                    int lWidth = width - mToolBar.getWidth() - 3;
118:                    if (mNew) {
119:                        lWidth -= 25;
120:                        mNew = false;
121:                    }
122:                    mErrorsTable.resizeColumns(lWidth);
123:                }
124:            }
125:
126:            protected void clearContent() {
127:                Application.removeModelErrors(Application.getCurrentPackage());
128:                mModel.clearErrorrs();
129:                checkActions();
130:            }
131:
132:            protected void copyToClipboard() {
133:                String lContenth = "";
134:                for (int i = 0; i < mModel.getRowCount(); i++) {
135:                    String lError = mModel.getErrorInfo(i).mFullDescription
136:                            + "\r\n\r\n";
137:                    lContenth += lError;
138:                }
139:                mInformationPane.setText(lContenth);
140:                super .copyToClipboard();
141:            }
142:
143:            // edit error model element
144:            protected void editModelElement() {
145:                int lRow = mErrorsTable.getSelectedRow();
146:                if (lRow > -1) {
147:                    String lID = mModel.getErrorInfo(lRow).mMofID;
148:                    if (lID != null && lID.length() > 0) {
149:                        BaseUserObject lObject = Application
150:                                .getUserObjectByID(lID);
151:                        if (lObject != null) {
152:                            Application.fireObjectSelect(lObject);
153:                            lObject.getEditAction().run();
154:                        }
155:                    }
156:                }
157:            }
158:
159:            protected void fillActions(ArrayList pList) {
160:                pList.add(mEditElementAction);
161:                pList.add(mErrorInfoAction);
162:                pList.add(mErrorFilterAction);
163:                super .fillActions(pList);
164:            }
165:
166:            // check Actions activity
167:            protected void checkActions() {
168:                int lRow = mErrorsTable.getSelectedRow();
169:                mEditElementAction.setEnabled(lRow > -1);
170:                mErrorInfoAction.setEnabled(lRow > -1);
171:
172:                int lCount = mModel.getRowCount();
173:                mCopyToClipBoardAction.setEnabled(lCount > 0);
174:                mClearAction.setEnabled(lCount > 0);
175:
176:                BaseUserObject lObject = Application.getCurrentUserObject();
177:                mErrorFilterAction.setEnabled(lObject != null
178:                        && Application.getErrorsCount() > 0);
179:            }
180:
181:            protected void viewErrorProperties() {
182:                mErrorsTable.viewErrorProperties();
183:            }
184:
185:            protected AbstractButton getFilterButton() {
186:                for (int i = 0; i < mToolBar.getComponentCount(); i++) {
187:                    if (mToolBar.getComponent(i) instanceof  AbstractButton) {
188:                        AbstractButton lButton = (AbstractButton) mToolBar
189:                                .getComponent(i);
190:                        if (lButton != null
191:                                && lButton.getAction().equals(
192:                                        mErrorFilterAction))
193:                            return lButton;
194:                    }
195:                }
196:                return null;
197:            }
198:
199:            protected void checkErrorsFoundButton() {
200:                AbstractButton lButton = getFilterButton();
201:                if (lButton != null) {
202:                    lButton.setSelected(mErrorFilterAction.isChecked());
203:                    if (lButton.isSelected()) {
204:                        BaseUserObject lObject = Application
205:                                .getCurrentUserObject();
206:                        if (lObject != null)
207:                            Application.setErrorElementID(lObject.getID());
208:                        lButton.setToolTipText("List errors from whole Model");
209:                    } else {
210:                        Application.setErrorElementID(null);
211:                        lButton
212:                                .setToolTipText("List errors from selected Model Element or its children");
213:                    }
214:                }
215:            }
216:
217:            /*		Auxilary classes		*/
218:
219:            public class EditElementAction extends BaseAction {
220:                public EditElementAction() {
221:                    super (
222:                            "Edit Model Element",
223:                            " Edit Model Element, which is a source of the selected error",
224:                            Application.EDIT_ICON);
225:                }
226:
227:                public void actionPerformed(ActionEvent arg0) {
228:                    editModelElement();
229:                }
230:            }
231:
232:            public class ErrorInfoAction extends BaseAction {
233:                public ErrorInfoAction() {
234:                    super ("Error Description",
235:                            "Show full description of the error",
236:                            Application.DESCRIPTION_ICON);
237:                }
238:
239:                public void actionPerformed(ActionEvent arg0) {
240:                    viewErrorProperties();
241:                }
242:            }
243:
244:            public class ErrorFilterAction extends BaseAction {
245:                public ErrorFilterAction() {
246:                    super (
247:                            "Current Element Errors",
248:                            "List errors from selected Model Element or its children",
249:                            Application.ELEMENTERROR_ICON);
250:                    mIsCheck = true;
251:                    mSelectedIcon = Application.MODELERROR_ICON;
252:                    setChecked(Application.sErrorElement != null);
253:                }
254:
255:                public void actionPerformed(ActionEvent arg0) {
256:                    super.actionPerformed(arg0);
257:                    checkErrorsFoundButton();
258:                }
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.