Lines 1-11
Link Here
|
1 |
/* |
1 |
/* |
2 |
* Sun Public License Notice |
2 |
* Sun Public License Notice |
3 |
* |
3 |
* |
4 |
* The contents of this file are subject to the Sun Public License |
4 |
* The contents of this file are subject to the Sun Public License |
5 |
* Version 1.0 (the "License"). You may not use this file except in |
5 |
* Version 1.0 (the "License"). You may not use this file except in |
6 |
* compliance with the License. A copy of the License is available at |
6 |
* compliance with the License. A copy of the License is available at |
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
Lines 16-96
Link Here
|
16 |
import java.awt.*; |
16 |
import java.awt.*; |
17 |
import java.awt.datatransfer.*; |
17 |
import java.awt.datatransfer.*; |
18 |
import java.awt.event.*; |
18 |
import java.awt.event.*; |
|
|
19 |
import java.awt.geom.Area; |
20 |
import java.awt.geom.Rectangle2D; |
19 |
import java.beans.*; |
21 |
import java.beans.*; |
20 |
import java.lang.reflect.Method; |
22 |
import java.lang.reflect.Method; |
|
|
23 |
import java.util.*; |
21 |
|
24 |
|
22 |
import javax.swing.*; |
25 |
import javax.swing.*; |
|
|
26 |
import javax.swing.border.*; |
23 |
import javax.swing.event.*; |
27 |
import javax.swing.event.*; |
|
|
28 |
import javax.swing.plaf.metal.MetalLookAndFeel; |
29 |
import javax.swing.text.JTextComponent; |
24 |
|
30 |
|
25 |
import org.openide.ErrorManager; |
31 |
import org.openide.ErrorManager; |
26 |
import org.openide.actions.*; |
32 |
import org.openide.actions.*; |
27 |
import org.openide.awt.SplittedPanel; |
|
|
28 |
import org.openide.util.HelpCtx; |
33 |
import org.openide.util.HelpCtx; |
29 |
import org.openide.util.NbBundle; |
34 |
import org.openide.util.NbBundle; |
30 |
import org.openide.util.Mutex; |
|
|
31 |
import org.openide.util.WeakListener; |
32 |
import org.openide.nodes.Node; |
35 |
import org.openide.nodes.Node; |
33 |
import org.openide.nodes.NodeAdapter; |
36 |
import org.openide.nodes.Node.PropertySet; |
34 |
import org.openide.nodes.NodeListener; |
|
|
35 |
import org.openide.nodes.NodeOperation; |
36 |
import org.openide.util.Lookup; |
37 |
import org.openide.util.Lookup; |
37 |
import org.openide.util.RequestProcessor; |
38 |
import org.openide.util.RequestProcessor; |
38 |
|
|
|
39 |
/** |
39 |
/** |
40 |
* Implements a "property sheet" for a set of selected beans. |
40 |
* Implements a property sheet for a set of nodes. |
41 |
* |
41 |
* |
42 |
* <P> |
42 |
* <strong>Note that this class should be final, but for backward compatibility, |
43 |
* <TABLE BORDER COLS=3 WIDTH=100%> |
43 |
* cannot be. Subclassing this class is strongly discouraged</strong> |
44 |
* <TR><TH WIDTH=15%>Property<TH WIDTH=15%>Property Type<TH>Description |
44 |
* |
45 |
* <TR><TD> <code>paintingStyle</code> <TD> <code>int</code> <TD> style of painting properties ({@link #ALWAYS_AS_STRING}, {@link #STRING_PREFERRED}, {@link #PAINTING_PREFERRED}) |
45 |
* @author Tim Boudreau, Jan Jancura, Jaroslav Tulach |
46 |
* <TR><TD> <code>currentPage</code> <TD> <code>int</code> <TD> currently showed page (e.g. properties, expert, events) |
46 |
* @version 2.0, Jan 6, 2003 |
47 |
* <TR><TD> <code>expert</code> <TD> <code>boolean</code> <TD> expert mode as in the JavaBeans specifications |
47 |
*/ |
48 |
* </TABLE> |
|
|
49 |
* |
50 |
* @author Jan Jancura, Jaroslav Tulach |
51 |
* @version 1.23, Sep 07, 1998 |
52 |
*/ |
53 |
public class PropertySheet extends JPanel { |
48 |
public class PropertySheet extends JPanel { |
54 |
/** generated Serialized Version UID */ |
49 |
/** generated Serialized Version UID */ |
55 |
static final long serialVersionUID = -7698351033045864945L; |
50 |
static final long serialVersionUID = -7698351033045864945L; |
56 |
|
51 |
|
57 |
|
|
|
58 |
// public constants ........................................................ |
52 |
// public constants ........................................................ |
59 |
|
53 |
|
60 |
/** Property giving current sorting mode. */ |
54 |
/** Deprecated - no code outside the property sheet should be interested |
|
|
55 |
* in how items are sorted. |
56 |
*@deprecated Relic of the original property sheet implementation, will never be fired. */ |
61 |
public static final String PROPERTY_SORTING_MODE = "sortingMode"; // NOI18N |
57 |
public static final String PROPERTY_SORTING_MODE = "sortingMode"; // NOI18N |
62 |
/** Property giving current value color. */ |
58 |
/** Property giving current value color. |
|
|
59 |
*@deprecated Relic of the original property sheet implementation, will never be fired. */ |
63 |
public static final String PROPERTY_VALUE_COLOR = "valueColor"; // NOI18N |
60 |
public static final String PROPERTY_VALUE_COLOR = "valueColor"; // NOI18N |
64 |
/** Property giving current disabled property color. */ |
61 |
/** Property giving current disabled property color. |
|
|
62 |
*@deprecated Relic of the original property sheet implementation, , will never be fired. */ |
65 |
public static final String PROPERTY_DISABLED_PROPERTY_COLOR = "disabledPropertyColor"; // NOI18N |
63 |
public static final String PROPERTY_DISABLED_PROPERTY_COLOR = "disabledPropertyColor"; // NOI18N |
66 |
/** Property with the current page index. */ |
64 |
/** Property with the current page index. |
|
|
65 |
*@deprecated Relic of the original property sheet implementation, , will never be fired.*/ |
67 |
public static final String PROPERTY_CURRENT_PAGE = "currentPage"; // NOI18N |
66 |
public static final String PROPERTY_CURRENT_PAGE = "currentPage"; // NOI18N |
68 |
/** Property for "plastic" mode. */ // NOI18N |
67 |
/** Property for plastic mode. |
|
|
68 |
*@deprecated Relic of the original property sheet implementation, , will never be fired. */ |
69 |
public static final String PROPERTY_PLASTIC = "plastic"; // NOI18N |
69 |
public static final String PROPERTY_PLASTIC = "plastic"; // NOI18N |
70 |
/** Property for the painting style. */ |
70 |
/** Property for the painting style. |
|
|
71 |
*@deprecated Relic of the original property sheet implementation, will never be fired. */ |
71 |
public static final String PROPERTY_PROPERTY_PAINTING_STYLE = "propertyPaintingStyle"; // NOI18N |
72 |
public static final String PROPERTY_PROPERTY_PAINTING_STYLE = "propertyPaintingStyle"; // NOI18N |
72 |
/** Property for whether only writable properties should be displayed. */ |
73 |
/** Property for whether only writable properties should be displayed. |
|
|
74 |
*@deprecated Relic of the original property sheet implementation, will never be fired.*/ |
73 |
public static final String PROPERTY_DISPLAY_WRITABLE_ONLY = "displayWritableOnly"; // NOI18N |
75 |
public static final String PROPERTY_DISPLAY_WRITABLE_ONLY = "displayWritableOnly"; // NOI18N |
74 |
|
76 |
|
75 |
/** Constant for showing properties as a string always. */ |
77 |
/** Constant for showing properties as a string always. |
|
|
78 |
*@deprecated Relic of the original property sheet implementation, useless. */ |
76 |
public static final int ALWAYS_AS_STRING = 1; |
79 |
public static final int ALWAYS_AS_STRING = 1; |
77 |
/** Constant for preferably showing properties as string. */ |
80 |
/** Constant for preferably showing properties as string. |
|
|
81 |
*@deprecated Relic of the original property sheet implementation, does useless. */ |
78 |
public static final int STRING_PREFERRED = 2; |
82 |
public static final int STRING_PREFERRED = 2; |
79 |
/** Constant for preferably painting property values. */ |
83 |
/** Constant for preferably painting property values. |
|
|
84 |
*@deprecated Relic of the original property sheet implementation, does useless. */ |
80 |
public static final int PAINTING_PREFERRED = 3; |
85 |
public static final int PAINTING_PREFERRED = 3; |
81 |
|
86 |
|
82 |
/** Constant for unsorted sorting mode. */ |
87 |
/** Constant for unsorted sorting mode. */ |
83 |
public static final int UNSORTED = 0; |
88 |
public static final int UNSORTED = 0; |
84 |
/** Constant for by-name sorting mode. */ |
89 |
/** Constant for by-name sorting mode. */ |
85 |
public static final int SORTED_BY_NAMES = 1; |
90 |
public static final int SORTED_BY_NAMES = 1; |
86 |
/** Constant for by-type sorting mode. */ |
91 |
/** Constant for by-type sorting mode. */ |
87 |
public static final int SORTED_BY_TYPES = 2; |
92 |
public static final int SORTED_BY_TYPES = 2; |
88 |
|
|
|
89 |
/** Init delay for second change of the selected nodes. */ |
90 |
private static final int INIT_DELAY = 70; |
91 |
|
92 |
/** Maximum delay for repeated change of the selected nodes. */ |
93 |
private static final int MAX_DELAY = 350; |
94 |
|
93 |
|
95 |
/** Icon for the toolbar. |
94 |
/** Icon for the toolbar. |
96 |
* @deprecated Presumably noone uses this variable. If you want to customize |
95 |
* @deprecated Presumably noone uses this variable. If you want to customize |
Lines 123-262
Link Here
|
123 |
*/ |
122 |
*/ |
124 |
static protected Icon iCustomize; |
123 |
static protected Icon iCustomize; |
125 |
|
124 |
|
126 |
static final String PROP_HAS_CUSTOMIZER = "hasCustomizer"; // NOI18N |
125 |
/** Action command/input map key for popup menu invocation action */ |
127 |
static final String PROP_PAGE_HELP_ID = "pageHelpID"; // NOI18N |
126 |
private static final String ACTION_INVOKE_POPUP = "invokePopup"; //NOI18N |
|
|
127 |
|
128 |
/** Action command/input map key for help invocation action */ |
129 |
private static final String ACTION_INVOKE_HELP = "invokeHelp"; //NOI18N |
130 |
|
131 |
/** Init delay for second change of the selected nodes. */ |
132 |
private static final int INIT_DELAY = 70; |
133 |
|
134 |
/** Maximum delay for repeated change of the selected nodes. */ |
135 |
private static final int MAX_DELAY = 350; |
136 |
|
128 |
|
137 |
|
129 |
private static String getString(String key) { |
138 |
private static String getString(String key) { |
130 |
return NbBundle.getBundle(PropertySheet.class).getString(key); |
139 |
return NbBundle.getBundle(PropertySheet.class).getString(key); |
131 |
} |
140 |
} |
132 |
|
141 |
|
133 |
/** Remember the position of the splitter. This is used when the property window is re-used for another node */ |
142 |
private int sortingMode = UNSORTED; |
134 |
private int savedSplitterPosition = SplittedPanel.FIRST_PREFERRED; |
|
|
135 |
|
136 |
// private variables for visual controls ........................................... |
137 |
|
138 |
private transient JTabbedPane pages; |
139 |
private transient EmptyPanel emptyPanel; |
140 |
|
143 |
|
141 |
private transient int pageIndex = 0; |
|
|
142 |
|
143 |
private transient ChangeListener tabListener = |
144 |
new ChangeListener () { |
145 |
public void stateChanged (ChangeEvent e) { |
146 |
int index = pages.getSelectedIndex (); |
147 |
|
148 |
setCurrentPage (index); |
149 |
} |
150 |
}; |
151 |
private Node activeNode; |
152 |
private NodeListener activeNodeListener; |
153 |
private boolean displayWritableOnly; |
154 |
private int propertyPaintingStyle; |
155 |
private int sortingMode; |
156 |
private boolean plastic; |
157 |
private Color disabledPropertyColor; |
158 |
private Color valueColor; |
159 |
|
160 |
// init ............................................................................. |
161 |
|
162 |
public PropertySheet() { |
144 |
public PropertySheet() { |
163 |
setLayout (new BorderLayout ()); |
145 |
init(); |
|
|
146 |
initActions(); |
147 |
} |
148 |
|
149 |
private void initActions() { |
150 |
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( |
151 |
KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.ALT_MASK), |
152 |
ACTION_INVOKE_POPUP); |
153 |
getActionMap().put(ACTION_INVOKE_POPUP, invokePopupAction); |
164 |
|
154 |
|
165 |
boolean problem = false; |
155 |
getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( |
|
|
156 |
KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), ACTION_INVOKE_HELP); |
157 |
getActionMap().put(ACTION_INVOKE_HELP, getHelpAction()); |
158 |
getHelpAction().setEnabled(false); |
159 |
} |
160 |
|
161 |
public void addNotify() { |
162 |
super.addNotify(); |
163 |
getTable().addMouseListener(listener); |
164 |
js.addMouseListener(listener); |
165 |
addMouseListener(listener); |
166 |
getTable().getInputMap().put( |
167 |
KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.ALT_MASK), |
168 |
ACTION_INVOKE_POPUP); |
169 |
getTable().getActionMap().put(ACTION_INVOKE_POPUP, invokePopupAction); |
170 |
setEmpty(true); |
171 |
} |
172 |
|
173 |
public void reshape (int x, int y, int w, int h) { |
174 |
Rectangle r = getBounds(); |
175 |
super.reshape (x, y, w, h); |
176 |
if ((x != r.x) && (y != r.y) && (w != r.width) && (h != r.height)) { |
177 |
if (infoPanel != null) { |
178 |
infoPanel.setDividerLocation ( |
179 |
Math.max (getHeight() - 60, getHeight() - infoPanel.getBottomComponent().getPreferredSize().height)); |
180 |
} |
181 |
} |
182 |
} |
183 |
|
184 |
public void removeNotify() { |
185 |
getTable().removeMouseListener(listener); |
186 |
js.removeMouseListener(listener); |
187 |
removeMouseListener(listener); |
188 |
//Clear the static reference to this property sheet |
189 |
SheetMenu.getDefault().clear(); |
190 |
getTable().getInputMap().put( |
191 |
KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.ALT_DOWN_MASK), |
192 |
null); |
193 |
getTable().getActionMap().put(ACTION_INVOKE_POPUP, null); |
194 |
if (pclistener != null) { |
195 |
getPCListener().detach(); |
196 |
} |
197 |
super.removeNotify(); |
198 |
} |
199 |
|
200 |
private JScrollPane js; |
201 |
private JViewport viewport; |
202 |
private void init() { |
203 |
showDesc = PropUtils.shouldShowDescription (); |
204 |
setLayout(new BorderLayout()); |
205 |
setBorder(null); |
206 |
setNodes (new Node[0]); |
207 |
js = new JScrollPane(); |
208 |
viewport = new MarginViewport(); |
209 |
js.setViewport(viewport); |
210 |
viewport.setView(getTable()); |
211 |
js.setBackground(table.getBackground()); |
212 |
viewport.setBackground(table.getBackground()); |
213 |
setBackground(table.getBackground()); |
214 |
js.setBorder(null); |
215 |
js.getViewport().setBorder(null); |
216 |
table.setBorder(null); |
217 |
js.setName("PropertySheetScrollPane"); //NOI18N |
218 |
js.getViewport().setName("PropertySheetScrollPaneViewport"); //NOI18N |
219 |
setDescriptionVisible (showDesc); |
220 |
setMinimumSize(new Dimension(100, 50)); |
166 |
try { |
221 |
try { |
167 |
Class c = Class.forName("org.openide.explorer.propertysheet.PropertySheet$PropertySheetSettingsInvoker"); // NOI18N |
222 |
setSortingMode (PropUtils.getSavedSortOrder()); |
168 |
Runnable r = (Runnable)c.newInstance(); |
223 |
} catch (PropertyVetoException e) { |
169 |
current.set(this); |
224 |
//do nothing |
170 |
r.run(); |
|
|
171 |
} catch (Exception e) { |
172 |
problem = true; |
173 |
} catch (LinkageError le) { |
174 |
problem = true; |
175 |
} |
176 |
if (problem) { |
177 |
// set defaults without P ropertySheetSettings |
178 |
displayWritableOnly = false; |
179 |
propertyPaintingStyle = PAINTING_PREFERRED; |
180 |
sortingMode = SORTED_BY_NAMES; |
181 |
plastic = false; |
182 |
disabledPropertyColor = UIManager.getColor("textInactiveText"); |
183 |
valueColor = new Color (0, 0, 128); |
184 |
} |
225 |
} |
|
|
226 |
} |
227 |
|
228 |
boolean showDesc; |
229 |
|
230 |
boolean isDescriptionVisible() { |
231 |
return infoPanel != null; |
232 |
} |
233 |
|
234 |
void setDescriptionVisible(boolean val) { |
235 |
if (val) { |
236 |
infoPanel = createDescriptionComponent(); |
237 |
synchronized (getTreeLock()) { |
238 |
remove(js); |
239 |
infoPanel.setTopComponent(js); |
240 |
add(infoPanel, BorderLayout.CENTER); |
241 |
infoPanel.setDividerLocation ( |
242 |
Math.max (getHeight() - 60, getHeight() - infoPanel.getBottomComponent().getPreferredSize().height)); |
243 |
} |
244 |
} else { |
245 |
synchronized (getTreeLock()) { |
246 |
if (infoPanel != null) { |
247 |
remove(infoPanel); |
248 |
infoPanel.removeMouseListener (listener); |
249 |
infoPanel = null; |
250 |
} |
251 |
add(js, BorderLayout.CENTER); |
252 |
} |
253 |
} |
254 |
revalidate(); |
255 |
repaint(); |
256 |
//Viewport doesn't revalidate if description doesn't change |
257 |
PropUtils.saveShowDescription (val); |
258 |
} |
185 |
|
259 |
|
186 |
pages = new HelpAwareJTabbedPane (); |
260 |
public void requestFocus() { |
187 |
pages.getAccessibleContext().setAccessibleName(getString("ACS_PropertySheetTabs")); |
261 |
if (getTable().getParent() != null) { |
188 |
pages.getAccessibleContext().setAccessibleDescription(getString("ACSD_PropertySheetTabs")); |
262 |
getTable().requestFocus(); |
189 |
pages.addChangeListener(tabListener); |
263 |
} else { |
190 |
emptyPanel = new EmptyPanel (getString ("CTL_NoProperties")); |
264 |
super.requestFocus(); |
191 |
pages.setTabPlacement (JTabbedPane.BOTTOM); |
265 |
} |
192 |
// add (emptyPanel, BorderLayout.CENTER); |
|
|
193 |
|
194 |
PropertySheetToolbar p = new PropertySheetToolbar(this); |
195 |
p.setBorder (UIManager.getBorder ("Toolbar.border")); |
196 |
addPropertyChangeListener(p); |
197 |
add (p, BorderLayout.NORTH); |
198 |
|
199 |
|
200 |
// setNodes(new Node[0]); |
201 |
|
202 |
setPreferredSize(new Dimension(280, 300)); |
203 |
} |
266 |
} |
204 |
|
267 |
|
205 |
/** Overridden to provide a larger preferred size if the default font |
268 |
JSplitPane infoPanel = null; |
206 |
* is larger, for locales that require this. */ |
269 |
private JSplitPane createDescriptionComponent() { |
207 |
public Dimension getPreferredSize() { |
270 |
final DescriptionPanel thePanel = new DescriptionPanel(); |
208 |
//issue 34157, bad sizing/split location for Chinese locales that require |
271 |
final JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
209 |
//a larger default font size |
272 |
jsp.setUI (PropUtils.createSplitPaneUI()); |
210 |
Dimension result = super.getPreferredSize(); |
273 |
jsp.setResizeWeight(1); |
211 |
int fontsize = |
274 |
if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { |
212 |
javax.swing.UIManager.getFont ("Tree.font").getSize(); //NOI18N |
275 |
jsp.setDividerSize(7); |
213 |
if (fontsize > 11) { |
276 |
} else { |
214 |
int factor = fontsize - 11; |
277 |
jsp.setDividerSize(4); |
215 |
result.height += 15 * factor; |
278 |
} |
216 |
result.width += 50 * factor; |
279 |
|
217 |
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); |
280 |
//Set up a listener to notice when the selected property has changed |
218 |
if (result.height > screen.height) { |
281 |
getTable().addChangeListener(new ChangeListener() { |
219 |
result.height = screen.height -30; |
282 |
public void stateChanged(ChangeEvent e) { |
|
|
283 |
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); |
284 |
Component c = kfm.getPermanentFocusOwner(); |
285 |
if (c == null) { |
286 |
//XXX strange nb-specific problem - all focus changes |
287 |
//first cause a focus event on null. Winsys rewrite should fix. |
288 |
return; |
220 |
} |
289 |
} |
221 |
if (result.width > screen.width) { |
290 |
|
222 |
result.width = screen.width -30; |
291 |
if (c != getTable()) { |
|
|
292 |
if (thePanel.isAncestorOf(c)) { |
293 |
//don't change the text if focus goes to the description panel |
294 |
return; |
295 |
} |
296 |
} |
297 |
if ((thePanel.getParent() == null) || (jsp.getParent() == null)) { |
298 |
//if the panel is gone, it's been hidden - rmeove the listener |
299 |
getTable().removeChangeListener(this); |
223 |
} |
300 |
} |
224 |
} else { |
301 |
FeatureDescriptor fd = getTable().getSelection(); |
225 |
result.width += 20; |
302 |
|
226 |
result.height +=20; |
303 |
//Use the current node description if there's no other description |
|
|
304 |
//to display |
305 |
String ttl; |
306 |
String description = ""; //NOI18N |
307 |
if (fd == null) { |
308 |
thePanel.setDescription(fallbackTitle, fallbackDescription); |
309 |
return; |
310 |
} else { |
311 |
ttl = fd.getDisplayName(); |
312 |
description = fd.getShortDescription(); |
313 |
currHelpID = (String) fd.getValue("helpID"); |
314 |
getHelpAction().setEnabled(getHelpAction().hasContext() |
315 |
|| currHelpID != null); |
316 |
|
317 |
if (ttl == null) ttl = fd.getName(); |
318 |
if (description == null || description.equals(ttl)) { |
319 |
description = NbBundle.getMessage( |
320 |
PropertySheet.class, |
321 |
"CTL_NO_DESCRIPTION"); //NOI18N |
322 |
} |
323 |
} |
324 |
thePanel.setDescription (ttl, description); |
325 |
} |
326 |
}); |
327 |
if (getTable().hasFocus()) { |
328 |
FeatureDescriptor fd = getTable().getSelection(); |
329 |
if (fd != null) { |
330 |
thePanel.setDescription (fd.getDisplayName(), fd.getShortDescription()); |
227 |
} |
331 |
} |
228 |
return result; |
332 |
} else { |
|
|
333 |
thePanel.setDescription (fallbackTitle, fallbackDescription); |
229 |
} |
334 |
} |
230 |
static ThreadLocal current = new ThreadLocal(); |
335 |
thePanel.addMouseListener (listener); |
231 |
|
336 |
thePanel.setHelpAction(getHelpAction()); |
232 |
/** Reference to PropertySheetSettings are separated here.*/ |
337 |
jsp.setBottomComponent(thePanel); |
233 |
private static class PropertySheetSettingsInvoker implements Runnable { |
338 |
jsp.setBorder(null); |
234 |
// constructor avoid IllegalAccessException during creating new instance |
339 |
return jsp; |
235 |
public PropertySheetSettingsInvoker() {} |
340 |
} |
236 |
|
341 |
|
237 |
public void run() { |
342 |
String currHelpID = null; |
238 |
PropertySheet instance = (PropertySheet)current.get(); |
343 |
private HelpAction helpAction=null; |
239 |
current.set(null); |
344 |
//Package private - SheetMenu will use it |
240 |
if (instance == null) { |
345 |
HelpAction getHelpAction() { |
241 |
throw new IllegalStateException(); |
346 |
if (helpAction == null) { |
242 |
} |
347 |
helpAction = new HelpAction(); |
243 |
PropertySheetSettings pss = PropertySheetSettings.getDefault(); |
|
|
244 |
instance.displayWritableOnly = pss.getDisplayWritableOnly(); |
245 |
instance.propertyPaintingStyle = pss.getPropertyPaintingStyle(); |
246 |
instance.sortingMode = pss.getSortingMode(); |
247 |
instance.plastic = pss.getPlastic(); |
248 |
instance.disabledPropertyColor = pss.getDisabledPropertyColor(); |
249 |
instance.valueColor = pss.getValueColor(); |
250 |
} |
348 |
} |
|
|
349 |
return helpAction; |
251 |
} |
350 |
} |
252 |
|
351 |
|
|
|
352 |
/**Set the nodes explored by this property sheet. |
353 |
* @param nodes nodes to be explored or null to clear the sheet |
354 |
*/ |
355 |
public void setNodes(final Node[] nodes) { |
356 |
setHelperNodes (nodes); |
357 |
} |
358 |
|
253 |
/** |
359 |
/** |
254 |
* Set the nodes explored by this property sheet. |
360 |
* Set the nodes explored by this property sheet. |
255 |
* |
361 |
* |
256 |
* @param nodes nodes to be explored |
362 |
* @param nodes nodes to be explored |
257 |
*/ |
363 |
*/ |
258 |
public void setNodes (Node[] nodes) { |
364 |
private void doSetNodes (Node[] nodes) { |
259 |
setHelperNodes (nodes); |
365 |
if (nodes == null || nodes.length == 0) { |
|
|
366 |
getTable().getPropertySetModel().setPropertySets(null); |
367 |
setEmpty(true); |
368 |
return; |
369 |
} |
370 |
final Node n = (nodes.length == 1) ? nodes[0] : new ProxyNode(nodes); |
371 |
setCurrentNode(n); |
260 |
} |
372 |
} |
261 |
|
373 |
|
262 |
// delayed setting nodes (partly impl issue 27781) |
374 |
// delayed setting nodes (partly impl issue 27781) |
Lines 289-300
Link Here
|
289 |
if (scheduleTask == null) { |
401 |
if (scheduleTask == null) { |
290 |
scheduleTask = RequestProcessor.getDefault ().post (new Runnable () { |
402 |
scheduleTask = RequestProcessor.getDefault ().post (new Runnable () { |
291 |
public void run () { |
403 |
public void run () { |
292 |
Node[] nodes = getHelperNodes (); |
404 |
final Node[] nodes = getHelperNodes (); |
|
|
405 |
/* |
293 |
final Node n = (nodes.length == 1) ? nodes[0] : |
406 |
final Node n = (nodes.length == 1) ? nodes[0] : |
294 |
(nodes.length==0 ? null : new ProxyNode (nodes)); |
407 |
(nodes.length==0 ? null : new ProxyNode (nodes)); |
|
|
408 |
*/ |
295 |
SwingUtilities.invokeLater (new Runnable () { |
409 |
SwingUtilities.invokeLater (new Runnable () { |
296 |
public void run () { |
410 |
public void run () { |
297 |
setCurrentNode (n); |
411 |
doSetNodes (nodes); |
298 |
} |
412 |
} |
299 |
}); |
413 |
}); |
300 |
} |
414 |
} |
Lines 313-412
Link Here
|
313 |
return scheduleTask; |
427 |
return scheduleTask; |
314 |
} |
428 |
} |
315 |
|
429 |
|
316 |
// end of delayed |
430 |
// end of delayed |
317 |
|
431 |
|
|
|
432 |
/** Description to display when no property is selected */ |
433 |
private String fallbackDescription = ""; //NOI18N |
434 |
/** Title to display when no property is selected */ |
435 |
private String fallbackTitle = ""; //NOI18N |
436 |
/** Flag true if the property set was empty or the node was null */ |
437 |
boolean empty = false; |
438 |
private void setEmpty(boolean val) { |
439 |
empty = val; |
440 |
} |
318 |
|
441 |
|
319 |
/** |
442 |
private boolean getEmpty() { |
320 |
* Set property paint mode. |
443 |
return empty; |
321 |
* @param style one of {@link #ALWAYS_AS_STRING}, {@link #STRING_PREFERRED}, or {@link #PAINTING_PREFERRED} |
444 |
} |
322 |
*/ |
445 |
boolean usingTabs=false; |
323 |
public void setPropertyPaintingStyle (int style) { |
446 |
/** This has to be called from the AWT thread. */ |
324 |
if (style == propertyPaintingStyle) return; |
447 |
//hmm, does it still? Probably this should be thread-safe. |
|
|
448 |
private void setCurrentNode(Node node) { |
449 |
// getTable().setNode (node); |
450 |
PropertySetModel psm = getTable().getPropertySetModel(); |
451 |
Node.PropertySet[] ps = node.getPropertySets(); |
452 |
//bloc below copied from original impl - is this common/needed? |
453 |
if (ps == null) { |
454 |
// illegal node behavior => log warning about it |
455 |
ErrorManager.getDefault().log(ErrorManager.WARNING, |
456 |
"Node "+ node +": getPropertySets() returns null!"); // NOI18N |
457 |
ps = new Node.PropertySet[] {}; |
458 |
//Prepare the reusable model/env's node |
459 |
ReusablePropertyEnv.NODE = node; |
460 |
} |
461 |
|
462 |
boolean empty = ps.length == 0; |
463 |
usingTabs = checkForTabs(ps); |
464 |
setEmpty(empty); |
465 |
if (usingTabs) { |
466 |
ps = getTabbedPane().getCurrentPropertySets(); |
467 |
} |
468 |
|
469 |
fallbackTitle = node.getDisplayName(); |
470 |
fallbackDescription = (String)node.getValue("nodeDescription"); // NOI18N |
471 |
if (fallbackDescription == null) { |
472 |
fallbackDescription = node.getShortDescription(); |
473 |
} |
474 |
if (fallbackDescription == null || fallbackDescription.equals(fallbackTitle)) { |
475 |
fallbackDescription = NbBundle.getMessage(PropertySheet.class, |
476 |
"CTL_NO_DESCRIPTION"); //NOI18N |
477 |
} |
325 |
|
478 |
|
326 |
int oldVal = propertyPaintingStyle; |
479 |
if (node != null) { |
327 |
propertyPaintingStyle = style; |
480 |
getPCListener().attach(node); |
328 |
firePropertyChange(PROPERTY_PROPERTY_PAINTING_STYLE, new Integer(oldVal), new Integer(style)); |
481 |
} |
|
|
482 |
// if (empty) repaint (); |
483 |
getHelpAction().setProvider(node); |
484 |
//If using tabs, the tab pane model setSelectedIndex will do this for us |
485 |
psm.setPropertySets(ps); |
486 |
viewport.revalidate(); |
487 |
viewport.repaint(); |
329 |
} |
488 |
} |
330 |
|
489 |
|
331 |
/** |
490 |
|
332 |
* Get property paint mode. |
491 |
/**Deprecated, does nothing. |
333 |
* |
492 |
* @param style one of {@link #ALWAYS_AS_STRING}, {@link #STRING_PREFERRED}, or {@link #PAINTING_PREFERRED} |
|
|
493 |
* @deprected Relic of the original property sheet implementation. Does nothing.*/ |
494 |
public void setPropertyPaintingStyle(int style) { |
495 |
} |
496 |
|
497 |
/**Deprecated, returns no meaningful value. |
334 |
* @return the mode |
498 |
* @return the mode |
335 |
* @see #setPropertyPaintingStyle |
499 |
* @see #setPropertyPaintingStyle |
336 |
*/ |
500 |
* @deprected Relic of the original property sheet implementation. Does nothing. */ |
337 |
public int getPropertyPaintingStyle () { |
501 |
public int getPropertyPaintingStyle() { |
338 |
return propertyPaintingStyle; |
502 |
return 0; |
339 |
} |
503 |
} |
340 |
|
504 |
|
341 |
/** |
505 |
/**Set the sorting mode. |
342 |
* Set the sorting mode. |
506 |
* @param sortingMode one of {@link #UNSORTED}, {@link #SORTED_BY_NAMES}, {@link #SORTED_BY_TYPES} */ |
343 |
* |
507 |
public void setSortingMode(int sortingMode) throws PropertyVetoException { |
344 |
* @param sortingMode one of {@link #UNSORTED}, {@link #SORTED_BY_NAMES}, {@link #SORTED_BY_TYPES} |
508 |
try { |
345 |
*/ |
509 |
getTable().getPropertySetModel().setComparator(PropUtils.getComparator(sortingMode)); |
346 |
public void setSortingMode (int sortingMode) throws PropertyVetoException { |
510 |
this.sortingMode = sortingMode; |
347 |
if (this.sortingMode == sortingMode) return; |
511 |
if (infoPanel == null) { |
348 |
|
512 |
revalidate(); |
349 |
int oldVal = this.sortingMode; |
513 |
repaint(); |
350 |
this.sortingMode = sortingMode; |
514 |
} |
351 |
firePropertyChange(PROPERTY_SORTING_MODE, new Integer(oldVal), new Integer(sortingMode)); |
515 |
PropUtils.putSortOrder (sortingMode); |
|
|
516 |
} catch (IllegalArgumentException iae) { |
517 |
throw new PropertyVetoException( |
518 |
NbBundle.getMessage( |
519 |
PropertySheet.class, "EXC_Unknown_sorting_mode"), |
520 |
new PropertyChangeEvent(this, PROPERTY_SORTING_MODE, new Integer(0), new Integer(sortingMode)) |
521 |
); //NOI18N |
522 |
} |
352 |
} |
523 |
} |
353 |
|
524 |
|
354 |
/** |
525 |
/**Get the sorting mode. |
355 |
* Get the sorting mode. |
|
|
356 |
* |
357 |
* @return the mode |
526 |
* @return the mode |
358 |
* @see #setSortingMode |
527 |
* @see #setSortingMode */ |
359 |
*/ |
528 |
public int getSortingMode() { |
360 |
public int getSortingMode () { |
|
|
361 |
return sortingMode; |
529 |
return sortingMode; |
362 |
} |
530 |
} |
363 |
|
531 |
|
364 |
/** |
532 |
private SheetTable table = new SheetTable(); |
365 |
* Set the currently selected page. |
533 |
/** Get the table this property sheet displays. Package private to |
366 |
* |
534 |
* enable unit tests on the table. */ |
|
|
535 |
SheetTable getTable() { |
536 |
return table; |
537 |
} |
538 |
|
539 |
/** Deprecated. Does nothing. |
367 |
* @param index index of the page to select |
540 |
* @param index index of the page to select |
|
|
541 |
* @deprected Relic of the original property sheet implementation. Does nothing. |
368 |
*/ |
542 |
*/ |
369 |
public void setCurrentPage (int index) { |
543 |
public void setCurrentPage(int index) { |
370 |
if (pageIndex == index) |
|
|
371 |
return; |
372 |
pageIndex = index; |
373 |
if (index < 0) |
374 |
return; |
375 |
|
376 |
if (index != pages.getSelectedIndex ()) { |
377 |
pages.setSelectedIndex (index); |
378 |
} |
379 |
|
380 |
int selected = pages.getSelectedIndex(); |
381 |
if (selected >= 0) { |
382 |
Component comp = pages.getComponentAt(selected); |
383 |
if (comp instanceof PropertySheetTab) { |
384 |
((PropertySheetTab)comp).ensurePaneCreated(); |
385 |
} |
386 |
} |
387 |
firePropertyChange(PROP_PAGE_HELP_ID, null, null); |
388 |
} |
389 |
|
390 |
/** |
391 |
* Set the currently selected page. |
392 |
* |
393 |
* @param str name of the tab to select |
394 |
*/ |
395 |
public boolean setCurrentPage (String str) { |
396 |
int index = pages.indexOfTab (str); |
397 |
if (index < 0) return false; |
398 |
setCurrentPage (index); |
399 |
return true; |
400 |
} |
544 |
} |
401 |
|
545 |
|
402 |
/** |
546 |
/**Deprecated. Does nothing. |
403 |
* Get the currently selected page. |
547 |
* @param str name of the tab to select |
404 |
* @return index of currently selected page |
548 |
* @deprected Relic of the original property sheet implementation. Does nothing.*/ |
405 |
*/ |
549 |
public boolean setCurrentPage(String str) { |
406 |
public int getCurrentPage () { |
550 |
return false; |
407 |
return pages.getSelectedIndex (); |
|
|
408 |
} |
551 |
} |
409 |
|
552 |
|
|
|
553 |
/**Deprecated. Does nothing. |
554 |
* @return index of currently selected page |
555 |
* @deprected Relic of the original property sheet implementation. Does nothing. */ |
556 |
public int getCurrentPage() { |
557 |
// return pages.getSelectedIndex (); |
558 |
return 0; |
559 |
} |
560 |
/* |
410 |
String getPageHelpID() { |
561 |
String getPageHelpID() { |
411 |
if (isAncestorOf(pages)) { |
562 |
if (isAncestorOf(pages)) { |
412 |
Component comp = pages.getSelectedComponent(); |
563 |
Component comp = pages.getSelectedComponent(); |
Lines 419-783
Link Here
|
419 |
} |
570 |
} |
420 |
return null; |
571 |
return null; |
421 |
} |
572 |
} |
422 |
|
573 |
*/ |
423 |
/** |
574 |
|
424 |
* Set whether buttons in sheet should be plastic. |
575 |
/**Deprecated. Does nothing. |
425 |
* @param plastic true if so |
576 |
* @param plastic true if so |
426 |
*/ |
577 |
* @deprected Relic of the original property sheet implementation. Display of properties |
427 |
public void setPlastic (boolean plastic) { |
578 |
* is handled by the look and feel. |
428 |
if (this.plastic == plastic) return; |
579 |
*/ |
429 |
this.plastic = plastic; |
580 |
public void setPlastic(boolean plastic) { |
430 |
firePropertyChange(PROPERTY_PLASTIC, |
|
|
431 |
plastic ? Boolean.FALSE:Boolean.TRUE, |
432 |
plastic ? Boolean.TRUE:Boolean.FALSE); |
433 |
} |
581 |
} |
434 |
|
582 |
|
435 |
/** |
583 |
/**Test whether buttons in sheet are plastic. |
436 |
* Test whether buttons in sheet are plastic. |
584 |
* @return <code>true</code> if so |
437 |
* @return <code>true</code> if so |
585 |
* @deprected Relic of the original property sheet implementation. Does nothing.*/ |
438 |
*/ |
586 |
public boolean getPlastic() { |
439 |
public boolean getPlastic () { |
587 |
return false; |
440 |
return plastic; |
|
|
441 |
} |
588 |
} |
442 |
|
589 |
|
443 |
/** |
590 |
/**Deprecated. Does nothing. |
444 |
* Set the foreground color of values. |
591 |
* @param color the new color |
445 |
* @param color the new color |
592 |
* @deprected Relic of the original property sheet implementation. Display of properties |
446 |
*/ |
593 |
* is handled by the look and feel. */ |
447 |
public void setValueColor (Color color) { |
594 |
public void setValueColor(Color color) { |
448 |
if (valueColor.equals(color)) return; |
|
|
449 |
|
450 |
Color oldVal = valueColor; |
451 |
valueColor = color; |
452 |
firePropertyChange(PROPERTY_VALUE_COLOR, oldVal, color); |
453 |
} |
595 |
} |
454 |
|
596 |
|
455 |
/** |
597 |
/**Deprecated. Does nothing. |
456 |
* Get the foreground color of values. |
598 |
* @deprected Relic of the original property sheet implementation. Display of properties |
457 |
* @return the color |
599 |
* is handled by the look and feel. |
458 |
*/ |
600 |
* @return the color */ |
459 |
public Color getValueColor() { |
601 |
public Color getValueColor() { |
460 |
return valueColor; |
602 |
return Color.BLACK; |
461 |
} |
603 |
} |
462 |
|
604 |
|
463 |
/** |
605 |
/**Deprecated. Does nothing. |
464 |
* Set the foreground color of disabled properties. |
606 |
* @deprected Relic of the original property sheet implementation. Does nothing. |
465 |
* @param color the new color |
607 |
* @param color the new color */ |
466 |
*/ |
608 |
public void setDisabledPropertyColor(Color color) { |
467 |
public void setDisabledPropertyColor (Color color) { |
|
|
468 |
if (disabledPropertyColor.equals(color)) return; |
469 |
|
470 |
Color oldVal = disabledPropertyColor; |
471 |
disabledPropertyColor = color; |
472 |
|
473 |
firePropertyChange(PROPERTY_DISABLED_PROPERTY_COLOR, oldVal, color); |
474 |
} |
475 |
|
476 |
/** |
477 |
* Get the foreground color of disabled properties. |
478 |
* @return the color |
479 |
*/ |
480 |
public Color getDisabledPropertyColor () { |
481 |
return disabledPropertyColor; |
482 |
} |
483 |
|
484 |
/** |
485 |
* Set whether only writable properties are displayed. |
486 |
* @param b <code>true</code> if this is desired |
487 |
*/ |
488 |
public void setDisplayWritableOnly (boolean b) { |
489 |
if (displayWritableOnly == b) return; |
490 |
displayWritableOnly = b; |
491 |
firePropertyChange(PROPERTY_DISPLAY_WRITABLE_ONLY, |
492 |
b ? Boolean.FALSE:Boolean.TRUE, |
493 |
b ? Boolean.TRUE:Boolean.FALSE); |
494 |
} |
609 |
} |
495 |
|
610 |
|
496 |
/** |
611 |
/**Deprecated. Does not return a meaningful value. |
497 |
* Test whether only writable properties are currently displayed. |
612 |
* @deprected Relic of the original property sheet implementation. Display of properties |
498 |
* @return <code>true</code> if so |
613 |
* is handled by the look and feel. |
499 |
*/ |
614 |
* @return the color */ |
500 |
public boolean getDisplayWritableOnly () { |
615 |
public Color getDisabledPropertyColor() { |
501 |
return displayWritableOnly; |
616 |
return Color.GRAY; |
502 |
} |
617 |
} |
503 |
|
618 |
|
504 |
void setSavedPosition (int savedPostion) { |
619 |
/**Deprecated. Does nothing. |
505 |
savedSplitterPosition = savedPostion; |
620 |
* @param b <code>true</code> if this is desired |
|
|
621 |
* @deprected Relic of the original property sheet implementation. Does nothing.*/ |
622 |
public void setDisplayWritableOnly(boolean b) { |
506 |
} |
623 |
} |
507 |
|
624 |
|
508 |
int getSavedPosition () { |
625 |
/**Deprecated. Does not return a meaningful value. |
509 |
return savedSplitterPosition; |
626 |
* @deprected Relic of the original property sheet implementation. Does nothing. |
|
|
627 |
* @return <code>true</code> if so */ |
628 |
public boolean getDisplayWritableOnly() { |
629 |
return false; |
510 |
} |
630 |
} |
511 |
|
|
|
512 |
// private helper methods .................................................................... |
513 |
|
631 |
|
514 |
private final String detachFromNode () { |
632 |
|
515 |
String result = null; |
633 |
private final class HelpAction extends AbstractAction { |
516 |
if (activeNode != null) { |
634 |
private HelpCtx ctx; |
517 |
activeNode.removeNodeListener( activeNodeListener ); |
635 |
public HelpAction() { |
518 |
attached = false; |
636 |
super(NbBundle.getMessage(PropertySheet.class, |
519 |
Node.PropertySet [] oldP = activeNode.getPropertySets(); |
637 |
"CTL_Help")); |
520 |
if (oldP == null) { |
638 |
} |
521 |
// illegal node behavior => log warning about it |
639 |
|
522 |
ErrorManager.getDefault ().log (ErrorManager.WARNING, |
640 |
public void setProvider(HelpCtx.Provider provider) { |
523 |
"Node "+activeNode+": getPropertySets() returns null!"); // NOI18N |
641 |
this.ctx = provider.getHelpCtx(); |
524 |
oldP = new Node.PropertySet[] {}; |
642 |
setEnabled(hasContext()); |
525 |
} |
643 |
} |
526 |
if ((pageIndex >= 0) && (pageIndex < oldP.length)) { |
644 |
|
527 |
result = oldP[pageIndex].getDisplayName(); |
645 |
public boolean hasContext() { |
|
|
646 |
return (ctx != null) && (ctx != HelpCtx.DEFAULT_HELP); |
647 |
} |
648 |
|
649 |
public void actionPerformed(ActionEvent e) { |
650 |
if (ctx == null) { |
651 |
Toolkit.getDefaultToolkit().beep(); |
652 |
return; |
528 |
} |
653 |
} |
529 |
|
654 |
|
530 |
for (int i = 0, tabCount = pages.getTabCount(); i < tabCount; i++) { |
655 |
try { |
531 |
((PropertySheetTab)pages.getComponentAt(i)).detachPropertyChangeListener(); |
656 |
//Copied from original property sheet implementation |
|
|
657 |
Class c = ((ClassLoader)Lookup.getDefault().lookup( |
658 |
ClassLoader.class)).loadClass( |
659 |
"org.netbeans.api.javahelp.Help"); // NOI18N |
660 |
|
661 |
Object o = Lookup.getDefault().lookup(c); |
662 |
if (o != null) { |
663 |
Method m = c.getMethod("showHelp", // NOI18N |
664 |
new Class[] {HelpCtx.class}); |
665 |
HelpCtx toInvoke = currHelpID != null ? |
666 |
new HelpCtx(currHelpID) : ctx; |
667 |
m.invoke(o, new Object[] {toInvoke}); |
668 |
return; |
669 |
} |
670 |
} catch (ClassNotFoundException cnfe) { |
671 |
// ignore - maybe javahelp module is not installed, not so strange |
672 |
} catch (Exception ee) { |
673 |
ee.printStackTrace(); |
674 |
// potentially more serious |
675 |
ErrorManager.getDefault().notify( |
676 |
ErrorManager.INFORMATIONAL, ee); |
532 |
} |
677 |
} |
533 |
pages.removeAll(); |
678 |
// Did not work. |
|
|
679 |
Toolkit.getDefaultToolkit().beep(); |
534 |
} |
680 |
} |
535 |
return result; |
|
|
536 |
} |
681 |
} |
537 |
|
682 |
|
538 |
public void addNotify () { |
683 |
|
539 |
super.addNotify(); |
684 |
final Action sortNamesAction = new AbstractAction( |
540 |
if (activeNode != null) { |
685 |
NbBundle.getMessage(PropertySheet.class, "CTL_AlphaSort")) { |
541 |
if (!attached) { |
686 |
public void actionPerformed(ActionEvent ae) { |
542 |
attachToNode (activeNode); |
687 |
try { |
543 |
createPages(); |
688 |
setSortingMode(SORTED_BY_NAMES); |
544 |
if (storedTab != null) { |
689 |
} catch (PropertyVetoException pve) { |
545 |
navToCorrectPage (storedTab); |
690 |
//can't happen |
546 |
storedTab = null; |
|
|
547 |
} else { |
548 |
if (pages.getTabCount() > 0) { |
549 |
String first = pages.getTitleAt(0); |
550 |
navToCorrectPage (first); |
551 |
} else { |
552 |
add (emptyPanel, BorderLayout.CENTER); |
553 |
} |
554 |
} |
555 |
} |
691 |
} |
556 |
} else { |
|
|
557 |
remove (pages); |
558 |
add (emptyPanel, BorderLayout.CENTER); |
559 |
} |
692 |
} |
|
|
693 |
}; |
694 |
|
695 |
final Action unsortedAction = new AbstractAction( |
696 |
NbBundle.getMessage(PropertySheet.class, "CTL_NoSort")) { |
697 |
public void actionPerformed(ActionEvent ae) { |
698 |
try { |
699 |
setSortingMode(UNSORTED); |
700 |
} catch (PropertyVetoException pve) { |
701 |
//can't happen |
702 |
} |
703 |
} |
704 |
}; |
705 |
|
706 |
final Action invokePopupAction = new AbstractAction(ACTION_INVOKE_POPUP) { |
707 |
public void actionPerformed(ActionEvent ae) { |
708 |
if (!isEnabled()) return; |
709 |
SheetMenu sm = SheetMenu.getDefault(); |
710 |
sm.show(PropertySheet.this, 0, 0); |
711 |
} |
712 |
public boolean isEnabled() { |
713 |
return !Boolean.TRUE.equals(getClientProperty("disablePopup")); |
714 |
} |
715 |
}; |
716 |
|
717 |
MouseListener listener = new MouseAdapter() { |
718 |
public void mousePressed(MouseEvent e) { |
719 |
maybeShowPopup(e); |
720 |
} |
721 |
|
722 |
public void mouseReleased(MouseEvent e) { |
723 |
maybeShowPopup(e); |
724 |
} |
725 |
|
726 |
private void maybeShowPopup(MouseEvent e) { |
727 |
if (e.isPopupTrigger()) { |
728 |
SheetMenu.getDefault().show(e.getComponent(), |
729 |
e.getX(), e.getY()); |
730 |
} |
731 |
} |
732 |
}; |
733 |
|
734 |
final Action showDescriptionAction = new AbstractAction( |
735 |
NbBundle.getMessage(PropertySheet.class, "CTL_ShowDescription" )) { |
736 |
public void actionPerformed(ActionEvent ae) { |
737 |
setDescriptionVisible(!isDescriptionVisible()); |
738 |
} |
739 |
}; |
740 |
|
741 |
|
742 |
///Everything below here is stuff depended on by components that are going away, |
743 |
//so the whole thing will build. |
744 |
|
745 |
/** @deprecated Relic of the original property sheet implementation. Returns |
746 |
* no useful value. */ |
747 |
public int getSavedPosition() { |
748 |
return 20; |
560 |
} |
749 |
} |
561 |
|
750 |
|
562 |
private String storedTab = null; |
751 |
/** @deprecated Relic of the original property sheet implementation. Returns |
563 |
public void removeNotify() { |
752 |
* no useful value. */ |
564 |
if (attached) storedTab = detachFromNode(); |
753 |
public void setSavedPosition(int value) {} |
565 |
super.removeNotify(); |
754 |
|
|
|
755 |
/** @deprecated Relic of the original property sheet implementation. Returns |
756 |
* no useful value. */ |
757 |
public void invokeCustomAction(){} |
758 |
|
759 |
/** @deprecated Relic of the original property sheet implementation. Returns |
760 |
* no useful value. */ |
761 |
void invokeCustomization() {} |
762 |
|
763 |
/** @deprecated Relic of the original property sheet implementation. */ |
764 |
void invokeHelp() { |
765 |
getHelpAction().actionPerformed( |
766 |
new ActionEvent(this, 0, null)); |
566 |
} |
767 |
} |
567 |
|
768 |
|
568 |
private boolean attached=false; |
769 |
private SheetPCListener pclistener = null; |
569 |
private final void attachToNode (Node node) { |
770 |
private SheetPCListener getPCListener() { |
570 |
//XXX There is probably no reason to be using WeakListener here - |
771 |
if (pclistener == null) { |
571 |
//attach and detach occasions are well-defined unless two threads |
772 |
pclistener = new SheetPCListener(); |
572 |
//enter setCurrentNode concurrently. Test for this added to |
|
|
573 |
//setCurrentNode to determine if there are really cases of this |
574 |
// activeNodeListener = WeakListener.node (new ActiveNodeListener(), |
575 |
// activeNode); |
576 |
if (activeNodeListener == null) { |
577 |
activeNodeListener = new ActiveNodeListener(); |
578 |
} |
579 |
activeNode.addNodeListener(activeNodeListener); |
580 |
attached = true; |
581 |
} |
582 |
|
583 |
private final void createPages () { |
584 |
Node.PropertySet [] propsets = activeNode.getPropertySets(); |
585 |
if (propsets == null) { |
586 |
// illegal node behavior => log warning about it |
587 |
ErrorManager.getDefault ().log (ErrorManager.WARNING, |
588 |
"Node "+activeNode+": getPropertySets() returns null!"); // NOI18N |
589 |
propsets = new Node.PropertySet[] {}; |
590 |
} |
591 |
|
592 |
for (int i = 0, n = propsets.length; i < n; i++) { |
593 |
Node.PropertySet set = propsets[i]; |
594 |
|
595 |
if (set.isHidden()) |
596 |
continue; |
597 |
|
598 |
pages.addTab(set.getDisplayName(), |
599 |
null, |
600 |
new PropertySheetTab(set, activeNode, this), |
601 |
set.getShortDescription() |
602 |
); |
603 |
} |
773 |
} |
|
|
774 |
return pclistener; |
604 |
} |
775 |
} |
605 |
|
776 |
|
606 |
private final void navToCorrectPage (String selectedTabName) { |
777 |
private final class SheetPCListener implements |
607 |
if (isAncestorOf(emptyPanel)) { |
778 |
PropertyChangeListener { |
608 |
remove(emptyPanel); |
779 |
|
609 |
} |
780 |
/** Cache the current node locally only in the listener */ |
610 |
add(pages, BorderLayout.CENTER); |
781 |
private Node currNode=null; |
611 |
if (selectedTabName != null) { |
782 |
/** Attach to a node, detaching from the last one if non-null. */ |
612 |
setCurrentPage(selectedTabName); |
783 |
public void attach(Node n) { |
613 |
} |
784 |
if (currNode != n) { |
614 |
|
785 |
if ((currNode != null)) { |
615 |
int selected = pages.getSelectedIndex(); |
786 |
currNode.removePropertyChangeListener(this); |
616 |
if (selected >= 0) { |
787 |
} |
617 |
Component comp = pages.getComponentAt(selected); |
788 |
if (n != null) { |
618 |
if (comp instanceof PropertySheetTab) { |
789 |
n.addPropertyChangeListener(this); |
619 |
((PropertySheetTab)comp).ensurePaneCreated(); |
|
|
620 |
} |
790 |
} |
|
|
791 |
currNode = n; |
621 |
} |
792 |
} |
622 |
} |
|
|
623 |
|
624 |
/** This has to be called from the AWT thread. */ |
625 |
private void setCurrentNode(Node node) { |
626 |
if (activeNode == node) |
627 |
return; |
628 |
|
629 |
//if this should only be called from the AWT thread, enforce it |
630 |
if (!(SwingUtilities.isEventDispatchThread())) { |
631 |
throw new IllegalStateException |
632 |
("Current node for propertysheet set from off the AWT thread: " //NOI18N |
633 |
+ Thread.currentThread()); |
634 |
} |
793 |
} |
635 |
|
|
|
636 |
String selectedTabName = detachFromNode(); |
637 |
|
794 |
|
638 |
activeNode = node; |
795 |
public void detach() { |
639 |
if (getParent() == null) { |
796 |
if (currNode != null) { |
640 |
return; |
797 |
currNode.removePropertyChangeListener(this); |
|
|
798 |
//clear the reference |
799 |
currNode = null; |
800 |
} |
641 |
} |
801 |
} |
642 |
|
802 |
|
643 |
if (activeNode != null) { |
803 |
public void propertyChange(PropertyChangeEvent evt) { |
644 |
attachToNode (activeNode); |
804 |
String nm = evt.getPropertyName(); |
645 |
createPages(); |
805 |
if (Node.PROP_PROPERTY_SETS.equals(nm)) { |
646 |
if (pages.getTabCount() > 0) { |
806 |
Node n = (Node) evt.getSource(); |
647 |
navToCorrectPage(selectedTabName); |
807 |
setCurrentNode(n); |
|
|
808 |
} else if (Node.PROP_COOKIE.equals(nm) || |
809 |
//weed out frequently abused property changes |
810 |
Node.PROP_ICON.equals(nm) || |
811 |
Node.PROP_PARENT_NODE.equals(nm) || |
812 |
Node.PROP_OPENED_ICON.equals(nm) || |
813 |
Node.PROP_LEAF.equals(nm)) { |
814 |
ErrorManager.getDefault().log(ErrorManager.WARNING, |
815 |
"The following property was fired by Node " + //NOI18N |
816 |
evt.getSource() + ": " + nm + ". This should be fired" //NOI18N |
817 |
+ " only to Node listeners, not general property change" //NOI18N |
818 |
+ " listeners"); //NOI18N |
819 |
return; |
820 |
} else if (isDescriptionVisible() && ( |
821 |
Node.PROP_DISPLAY_NAME.equals(nm) || |
822 |
Node.PROP_SHORT_DESCRIPTION.equals(nm))) { |
823 |
Node n = (Node) evt.getSource(); |
824 |
fallbackTitle = n.getDisplayName(); |
825 |
fallbackDescription = n.getShortDescription(); |
826 |
repaint(); |
648 |
} else { |
827 |
} else { |
649 |
if (isAncestorOf(pages)) { |
828 |
if (evt.getSource() == null) { |
650 |
remove(pages); |
829 |
//Trigger rebuilding the entire list of properties, probably |
651 |
add(emptyPanel, BorderLayout.CENTER); |
830 |
//one has been added or removed |
|
|
831 |
setCurrentNode(currNode); |
652 |
} |
832 |
} |
|
|
833 |
getTable().repaint(); |
834 |
|
653 |
} |
835 |
} |
654 |
} else { |
836 |
} |
655 |
if (isAncestorOf(pages)) { |
837 |
} |
656 |
remove(pages); |
838 |
|
657 |
add(emptyPanel, BorderLayout.CENTER); |
839 |
private boolean forceTabs = Boolean.getBoolean("netbeans.ps.forcetabs"); //XXX debug |
|
|
840 |
private boolean neverTabs = Boolean.getBoolean("netbeans.ps.nevertabs"); //XXX debug |
841 |
private boolean checkForTabs(PropertySet[] ps) { |
842 |
boolean needTabs = forceTabs ? ps.length > 1: neverTabs ? false : false; |
843 |
//Since the common case is no tabs, it's actually faster to iterate |
844 |
//once to check and not do all the calculations to produce a list |
845 |
//of tabs for nothing. |
846 |
if (!neverTabs) { //XXX debug |
847 |
for (int i=0; (i < ps.length) && !needTabs; i++) { |
848 |
needTabs |= ps[i].getValue("tabName") != null; //NOI18N |
658 |
} |
849 |
} |
659 |
} |
850 |
} |
660 |
revalidate(); |
|
|
661 |
repaint(); |
662 |
|
851 |
|
663 |
if (activeNode != null && activeNode.hasCustomizer()) { |
852 |
if (needTabs) { |
664 |
firePropertyChange(PROP_HAS_CUSTOMIZER, null, Boolean.TRUE); |
853 |
TreeMap map = new TreeMap(PropUtils.getTabListComparator()); |
|
|
854 |
for (int i=0; i < ps.length; i++) { |
855 |
String tab; |
856 |
if (forceTabs) { |
857 |
tab = ps[i].getDisplayName(); //XXX debug |
858 |
} else { |
859 |
tab = (String) ps[i].getValue("tabName"); //NOI18N |
860 |
if (tab == null) { |
861 |
tab = PropUtils.basicPropsTabName(); |
862 |
} |
863 |
} |
864 |
java.util.List l = (java.util.List) map.get(tab); |
865 |
if (l == null) { |
866 |
l = new ArrayList(ps.length); |
867 |
map.put(tab, l); |
868 |
} |
869 |
l.add(ps[i]); |
870 |
} |
871 |
getTabbedPane().setTabs(map); |
872 |
synchronized (getTreeLock()) { |
873 |
remove(js); |
874 |
if (js.getParent() != pane) { |
875 |
pane.add(js, 0); |
876 |
} |
877 |
if (isDescriptionVisible()) { |
878 |
infoPanel.setTopComponent(pane); |
879 |
} else { |
880 |
add(pane, BorderLayout.CENTER); |
881 |
} |
882 |
} |
665 |
} else { |
883 |
} else { |
666 |
firePropertyChange(PROP_HAS_CUSTOMIZER, null, Boolean.FALSE); |
884 |
if ((js.getParent() != this) && (js.getParent() != infoPanel)) { |
|
|
885 |
synchronized (getTreeLock()) { |
886 |
if (pane != null) { |
887 |
remove(pane); |
888 |
pane.clear(); |
889 |
} |
890 |
if (isDescriptionVisible()) { |
891 |
infoPanel.setTopComponent(js); |
892 |
} else { |
893 |
add(js, BorderLayout.CENTER); |
894 |
} |
895 |
setBackground(getTable().getBackground()); |
896 |
} |
897 |
} |
667 |
} |
898 |
} |
668 |
firePropertyChange(PROP_PAGE_HELP_ID, null, null); |
899 |
return needTabs; |
669 |
} |
|
|
670 |
|
671 |
/** |
672 |
* Invokes the customization on the currently selected Node (JavaBean). |
673 |
*/ |
674 |
void invokeCustomization () { |
675 |
NodeOperation.getDefault().customize(activeNode); |
676 |
} |
900 |
} |
677 |
|
901 |
|
678 |
/** Show help on the selected tab. |
902 |
private SheetTabbedPane pane = null; |
679 |
*/ |
903 |
private SheetTabbedPane getTabbedPane() { |
680 |
void invokeHelp() { |
904 |
if (pane == null) { |
681 |
HelpCtx h = new HelpCtx(getPageHelpID()); |
905 |
//XXX use a weak reference here? |
682 |
// Awkward but should work. Copied from NbTopManager.showHelp. |
906 |
pane = new SheetTabbedPane(); |
683 |
try { |
907 |
pane.setTabPlacement(pane.TOP); |
684 |
Class c = ((ClassLoader)Lookup.getDefault().lookup(ClassLoader.class)).loadClass("org.netbeans.api.javahelp.Help"); // NOI18N |
908 |
pane.setTabLayoutPolicy(pane.SCROLL_TAB_LAYOUT); |
685 |
Object o = Lookup.getDefault().lookup(c); |
909 |
} |
686 |
if (o != null) { |
910 |
return pane; |
687 |
Method m = c.getMethod("showHelp", new Class[] {HelpCtx.class}); // NOI18N |
911 |
} |
688 |
m.invoke(o, new Object[] {h}); |
912 |
|
689 |
return; |
913 |
private static Insets emptyInsets = null; |
|
|
914 |
final class SheetTabbedPane extends JTabbedPane { |
915 |
Map tabs; |
916 |
private boolean inserting=false; |
917 |
public SheetTabbedPane() { |
918 |
setModel(new TabSelectionModel()); |
919 |
} |
920 |
|
921 |
public void insertTab(String title, Icon icon, Component component, String tip, int index) { |
922 |
inserting = true; |
923 |
try { |
924 |
super.insertTab(title, icon, component, tip, index); |
925 |
} finally { |
926 |
inserting = false; |
690 |
} |
927 |
} |
691 |
} catch (ClassNotFoundException cnfe) { |
928 |
} |
692 |
// ignore - maybe javahelp module is not installed, not so strange |
929 |
|
693 |
} catch (Exception e) { |
930 |
public Insets getInsets() { |
694 |
// potentially more serious |
931 |
if (emptyInsets == null) { |
695 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
932 |
emptyInsets = new Insets(0,0,0,0); |
696 |
} |
|
|
697 |
// Did not work. |
698 |
Toolkit.getDefaultToolkit().beep(); |
699 |
} |
700 |
|
701 |
private class ActiveNodeListener extends NodeAdapter { |
702 |
int id; |
703 |
ActiveNodeListener() {} |
704 |
public void propertyChange(PropertyChangeEvent evt) { |
705 |
if (evt.getSource() != activeNode) { |
706 |
return; |
707 |
} |
933 |
} |
708 |
if (evt.getPropertyName() == null |
934 |
return emptyInsets; |
709 |
|| Node.PROP_PROPERTY_SETS.equals(evt.getPropertyName())) |
935 |
} |
710 |
{ |
936 |
|
711 |
// force refresh of the whole sheet, must be done in AWT event |
937 |
private String[] tabNames=null; |
712 |
// thread |
938 |
public String getTitleAt(int index) { |
713 |
|
939 |
if (tabNames == null) { |
714 |
Mutex.EVENT.readAccess(new Runnable() { |
940 |
tabNames = new String[tabs.keySet().size()]; |
715 |
public void run() { |
941 |
tabNames = (String[]) tabs.keySet().toArray(tabNames); |
716 |
String selectedTabName = null; |
942 |
} |
717 |
if (activeNode != null) { |
943 |
return tabNames[index]; |
718 |
Node.PropertySet [] oldP = activeNode.getPropertySets(); |
944 |
} |
719 |
if (oldP == null) { |
945 |
|
720 |
// illegal node behavior => log warning about it |
946 |
public void setTabs(Map m) { |
721 |
ErrorManager.getDefault ().log (ErrorManager.WARNING, |
947 |
String previous = null; |
722 |
"Node "+activeNode+": getPropertySets() returns null!"); // NOI18N |
948 |
if (getModel().getSelectedIndex() != -1) { |
723 |
oldP = new Node.PropertySet[] {}; |
949 |
previous = getTitleAt(getModel().getSelectedIndex()); |
724 |
} |
950 |
} |
725 |
if ((pageIndex >= 0) && (pageIndex < oldP.length)) { |
951 |
int idx=-1; |
726 |
selectedTabName = oldP[pageIndex].getDisplayName(); |
952 |
synchronized (getTreeLock()) { |
|
|
953 |
this.tabs = m; |
954 |
tabNames = null; |
955 |
setTabCount(m.keySet().size()); |
956 |
if (js.getParent() != this) { |
957 |
add(js); |
958 |
//return to the last chosen tab if present |
959 |
if ((previous != null) && |
960 |
m.keySet().contains(previous)) { |
961 |
for (int i=0; i < getTabCount(); i++) { |
962 |
if (previous.equals(getTitleAt(i))) { |
963 |
idx = i; |
964 |
break; |
727 |
} |
965 |
} |
728 |
} |
966 |
} |
729 |
|
|
|
730 |
Node old = activeNode; |
731 |
setCurrentNode(null); |
732 |
setCurrentNode(old); |
733 |
|
734 |
if (selectedTabName != null) { |
735 |
setCurrentPage(selectedTabName); |
736 |
} |
737 |
} |
967 |
} |
738 |
}); |
968 |
} |
|
|
969 |
} |
970 |
//Must set the selected index outside the AWT tree lock. |
971 |
if (idx != -1) { |
972 |
getModel().setSelectedIndex(idx); |
973 |
} |
974 |
setSelectedComponent(js); |
975 |
getLayout().layoutContainer(this); |
976 |
} |
977 |
|
978 |
public void clear() { |
979 |
tabs.clear(); |
980 |
tabs = null; |
981 |
} |
982 |
|
983 |
public PropertySet[] getCurrentPropertySets() { |
984 |
int idx = getModel().getSelectedIndex(); |
985 |
if ((idx == -1) || (tabs == null)) { |
986 |
return new PropertySet[0]; |
987 |
} else { |
988 |
java.util.List l = (java.util.List) tabs.get(getTitleAt(idx)); |
989 |
PropertySet[] result = new PropertySet[l.size()]; |
990 |
return (PropertySet[]) l.toArray(result); |
991 |
} |
992 |
} |
993 |
|
994 |
private void setTabCount(int count) { |
995 |
int ct = getTabCount(); |
996 |
while (getTabCount() < count) { |
997 |
addTab(null, null); |
998 |
} |
999 |
while (getTabCount() > count-1) { |
1000 |
remove(getTabCount() -1); |
1001 |
} |
1002 |
} |
1003 |
|
1004 |
public boolean isFocusCycleRoot() { |
1005 |
return true; |
1006 |
} |
1007 |
|
1008 |
class TabSelectionModel extends DefaultSingleSelectionModel { |
1009 |
public void setSelectedIndex(int i) { |
1010 |
if (inserting) return; |
1011 |
super.setSelectedIndex(i); |
1012 |
getTable().getPropertySetModel().setPropertySets( |
1013 |
getCurrentPropertySets()); |
739 |
} |
1014 |
} |
740 |
} |
1015 |
} |
741 |
} |
1016 |
} |
742 |
|
1017 |
|
743 |
|
1018 |
/** UI design requires that the gray margin descend to the bottom of the |
744 |
/** JTabbedPane subclass which has a getHelpCtx method that will be |
1019 |
* containing scrollpane. Margin should only be painted if a comparator is |
745 |
* understood by HelpCtx.findHelp. |
1020 |
* present on the table's model. Only way to do this is to have a custom |
746 |
*/ |
1021 |
* JViewport that paints the margin */ |
747 |
private static final class HelpAwareJTabbedPane extends JTabbedPane implements HelpCtx.Provider { |
1022 |
class MarginViewport extends JViewport { |
748 |
|
1023 |
public MarginViewport() { |
749 |
public HelpAwareJTabbedPane () { |
1024 |
//XXX experimental - try to reduce render costs using offscreen |
750 |
// XXX(-ttran) experimental code, needs cleanup before release |
1025 |
//image for painting |
751 |
|
1026 |
setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); |
752 |
if (Boolean.getBoolean("netbeans.scrolling.tabs")) { |
1027 |
} |
753 |
boolean jdk14 = org.openide.modules.Dependency.JAVA_SPEC.compareTo(new org.openide.modules.SpecificationVersion("1.4")) >= 0; |
1028 |
public void paint(Graphics g) { |
754 |
if (jdk14) { |
1029 |
super.paint(g); |
755 |
try { |
1030 |
if (table != null) { |
756 |
java.lang.reflect.Method method = getClass().getMethod("setTabLayoutPolicy", new Class[] {Integer.TYPE}); |
1031 |
if (table.getHeight() <= 1) { |
757 |
method.invoke(this, new Object[] {new Integer(1)}); |
1032 |
g.setColor(PropUtils.getShadowColor()); |
758 |
} catch(NoSuchMethodException nme) { |
1033 |
String s = NbBundle.getMessage(PropertySheet.class, |
759 |
} catch(SecurityException se) { |
1034 |
"CTL_NoProperties"); //NOI18N |
760 |
} catch(IllegalAccessException iae) { |
1035 |
g.setFont(getFont()); |
761 |
} catch(IllegalArgumentException iare) { |
1036 |
int i = g.getFontMetrics().stringWidth(s); |
762 |
} catch(java.lang.reflect.InvocationTargetException ite) { |
1037 |
int w = getWidth(); |
|
|
1038 |
if (w > i) { |
1039 |
int txtX = (w - i) / 2; |
1040 |
int txtY = getHeight() / 3; |
1041 |
g.drawString(s, txtX, txtY); |
1042 |
} |
1043 |
} else if (!empty) { |
1044 |
if (PropUtils.shouldDrawMargin(getTable().getPropertySetModel())) { |
1045 |
int y = table.getHeight(); |
1046 |
if (y < js.getHeight()) { |
1047 |
int x = 0; |
1048 |
int w = PropUtils.getMarginWidth(); |
1049 |
int h = js.getHeight() - y; |
1050 |
if (g.hitClip(x,y,w,h)) { |
1051 |
g.setColor(PropUtils.getSetRendererColor()); |
1052 |
g.fillRect(x, y, w, h); |
1053 |
} |
1054 |
} |
763 |
} |
1055 |
} |
764 |
} |
1056 |
} |
765 |
} |
1057 |
} |
766 |
} |
1058 |
} |
767 |
|
1059 |
} |
768 |
/** Gets HelpCtx for currently selected tab, retrieved from |
1060 |
/** Overridden to return true - otherwise when an editor with focus |
769 |
* <code>Node.PropertySet</code> <em>getValue("helpID")</em> method. |
1061 |
* is closed, focus goes to an apparently random component. */ |
770 |
* @see PropertySheetTab#getHelpID */ |
1062 |
public boolean isFocusCycleRoot() { |
771 |
public HelpCtx getHelpCtx () { |
1063 |
return true; |
772 |
Component comp = getSelectedComponent(); |
1064 |
} |
773 |
if(comp instanceof PropertySheetTab) { |
1065 |
/* |
774 |
String helpID = ((PropertySheetTab)comp).getHelpID(); |
1066 |
//an attempt at killing some borders with optimized painting |
775 |
if(helpID != null) { |
1067 |
Rectangle2D scratch = new Rectangle2D.Double(); |
776 |
return new HelpCtx(helpID); |
1068 |
public void paint (Graphics g) { |
777 |
} |
1069 |
if (infoPanel != null) { |
|
|
1070 |
Shape s = g.getClip(); |
1071 |
Area a; |
1072 |
if (s != null) { |
1073 |
a = new Area (s); |
1074 |
} else { |
1075 |
scratch.setRect (0,0,getWidth(),getHeight()); |
1076 |
a = new Area (scratch); |
778 |
} |
1077 |
} |
779 |
|
1078 |
Point p = infoPanel.getLocation(); |
780 |
return HelpCtx.findHelp(getParent()); |
1079 |
scratch.setRect (-2, p.y + infoPanel.getDividerLocation(), |
|
|
1080 |
p.x+1, infoPanel.getDividerSize()+2); |
1081 |
System.out.println(scratch); |
1082 |
a.subtract(new Area(scratch)); |
1083 |
scratch.setRect (p.x + infoPanel.getWidth(), p.y + infoPanel.getDividerLocation(), |
1084 |
getWidth() - (p.x + infoPanel.getWidth()), infoPanel.getDividerSize()+2); |
1085 |
System.out.println(scratch); |
1086 |
a.subtract(new Area(scratch)); |
1087 |
g.setClip (a); |
1088 |
super.paint (g); |
1089 |
} else { |
1090 |
super.paint (g); |
781 |
} |
1091 |
} |
782 |
} |
1092 |
} */ |
783 |
} |
1093 |
} |