KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > debug > JspTableModel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.debug;
21
22 import org.netbeans.api.debugger.*;
23 import org.netbeans.api.debugger.jpda.*;
24 import org.netbeans.spi.debugger.ui.Constants;
25 import org.netbeans.spi.viewmodel.*;
26 import org.netbeans.modules.web.debug.breakpoints.*;
27
28 /**
29  *
30  * @author Martin Grebac
31  */

32 public class JspTableModel implements TableModel, Constants {
33
34
35     public Object JavaDoc getValueAt (Object JavaDoc row, String JavaDoc columnID) throws UnknownTypeException {
36         if (row instanceof JspLineBreakpoint) {
37             if (columnID.equals (BREAKPOINT_ENABLED_COLUMN_ID))
38                 return Boolean.valueOf (((JspLineBreakpoint) row).isEnabled ());
39         }
40         throw new UnknownTypeException (row);
41     }
42     
43     public boolean isReadOnly (Object JavaDoc row, String JavaDoc columnID) throws UnknownTypeException {
44         throw new UnknownTypeException (row);
45     }
46     
47     public void setValueAt (Object JavaDoc row, String JavaDoc columnID, Object JavaDoc value) throws UnknownTypeException {
48         if (row instanceof JspLineBreakpoint) {
49             if (columnID.equals (BREAKPOINT_ENABLED_COLUMN_ID))
50                 if (((Boolean JavaDoc) value).equals (Boolean.TRUE))
51                     ((Breakpoint) row).enable ();
52                 else
53                     ((Breakpoint) row).disable ();
54         }
55         throw new UnknownTypeException (row);
56     }
57
58
59 // private static String getSessionState (Session s) {
60
// DebuggerEngine e = s.getCurrentEngine ();
61
// JPDADebugger d = JPDADebugger.getJPDADebugger (e);
62
// switch (d.getState ()) {
63
// case JPDADebugger.STATE_DISCONNECTED:
64
// return "Not Running";
65
// case JPDADebugger.STATE_RUNNING:
66
// return "Running";
67
// case JPDADebugger.STATE_STARTING:
68
// return "Starting";
69
// case JPDADebugger.STATE_STOPPED:
70
// return "Stopped";
71
// }
72
// return null;
73
// }
74
//
75
/**
76      * Registers given listener.
77      *
78      * @param l the listener to add
79      */

80     public void addModelListener (ModelListener l) {
81     }
82
83     /**
84      * Unregisters given listener.
85      *
86      * @param l the listener to remove
87      */

88     public void removeModelListener (ModelListener l) {
89     }
90     
91 // private static String getShort (String c) {
92
// int i = c.lastIndexOf ('.');
93
// if (i < 0) return c;
94
// return c.substring (i + 1);
95
// }
96
}
97
Popular Tags