Lines 45-50
Link Here
|
45 |
import java.awt.Image; |
45 |
import java.awt.Image; |
46 |
import java.awt.event.ActionListener; |
46 |
import java.awt.event.ActionListener; |
47 |
import java.io.IOException; |
47 |
import java.io.IOException; |
|
|
48 |
import java.lang.annotation.ElementType; |
49 |
import java.lang.annotation.Retention; |
50 |
import java.lang.annotation.RetentionPolicy; |
51 |
import java.lang.annotation.Target; |
48 |
import java.util.ArrayList; |
52 |
import java.util.ArrayList; |
49 |
import java.util.Collections; |
53 |
import java.util.Collections; |
50 |
import java.util.HashMap; |
54 |
import java.util.HashMap; |
Lines 288-298
Link Here
|
288 |
|
292 |
|
289 |
/** |
293 |
/** |
290 |
* Interface for creation of Customizer categories and their respective UI panels. |
294 |
* Interface for creation of Customizer categories and their respective UI panels. |
291 |
* Implementations are to be registered in System FileSystem via module layers. Used by the |
295 |
* Used by {@link ProjectCustomizer#createCustomizerDialog(String,Lookup,String,ActionListener,HelpCtx)}. |
292 |
* {@link ProjectCustomizer#createCustomizerDialog(String,Lookup,String,ActionListener,HelpCtx)} |
296 |
* <p>The panel/category created by the provider can get notified that the customizer got |
293 |
* The panel/category created by the provider can get notified that the customizer got |
297 |
* closed by setting an <code>ActionListener</code> to |
294 |
* closed by setting an <code>ActionListener</code> to |
|
|
295 |
* {@link ProjectCustomizer.Category#setOkButtonListener}. |
298 |
* {@link ProjectCustomizer.Category#setOkButtonListener}. |
|
|
299 |
* <p>Implementations can be registered using {@link Registration}. |
300 |
* Otherwise they can be manually registered in a tree structure in the system filesystem. |
296 |
* UI Component can be defined for category folder that is represented as node with subnodes in the category |
301 |
* UI Component can be defined for category folder that is represented as node with subnodes in the category |
297 |
* tree of project customizer. The file that defines the instance class in layer for such category |
302 |
* tree of project customizer. The file that defines the instance class in layer for such category |
298 |
* must be named {@code Self}. Such a provider will not have the {@link #createCategory} method called |
303 |
* must be named {@code Self}. Such a provider will not have the {@link #createCategory} method called |
Lines 322-327
Link Here
|
322 |
* for the project type you want to integrate your panel into. |
327 |
* for the project type you want to integrate your panel into. |
323 |
*/ |
328 |
*/ |
324 |
JComponent createComponent (Category category, Lookup context ); |
329 |
JComponent createComponent (Category category, Lookup context ); |
|
|
330 |
|
331 |
/** |
332 |
* Used to register customizer panels. |
333 |
* There are three ways this annotation can be used: |
334 |
* <ol> |
335 |
* <li>Register a "leaf" panel with no children. |
336 |
* {@link #category} can be omitted for a top-level panel; |
337 |
* if specified, the panel is placed in the named subcategory. |
338 |
* {@link #categoryLabel} should not be specified. |
339 |
* The annotation must be placed on a class or factory method implementing {@link CompositeCategoryProvider}. |
340 |
* <li>Register a category folder with no panel. |
341 |
* {@link #category} must be specified; the last path component is the |
342 |
* folder being defined, and any previous components are parent folders. |
343 |
* {@link #categoryLabel} must be specified. |
344 |
* The annotation must be placed on some package declaration (in {@code package-info.java}). |
345 |
* <li>Register a category folder also with its own panel (i.e. {@code Self}). |
346 |
* {@link #category} and {@link #categoryLabel} must be specified as for #2, |
347 |
* but the annotation must be on a provider implementation as for #1. |
348 |
* </ol> |
349 |
* To represent hierarchies of panels, the {@link #category} of a #1 can |
350 |
* match the {@link #category} of a #2 or #3, and the {@link #category} of a #2 or #3 |
351 |
* preceding the last {@code /} can match the {@link #category} of another #2 or #3. |
352 |
* <p>Multiple registrations may be made in one place using {@link Registrations}. |
353 |
* @since XXX |
354 |
*/ |
355 |
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PACKAGE}) |
356 |
@Retention(RetentionPolicy.SOURCE) |
357 |
@interface Registration { |
358 |
/** |
359 |
* Project type to associate with, such as {@code org-netbeans-modules-java-j2seproject}. |
360 |
* The {@code folderPath} passed to {@link ProjectCustomizer#createCustomizerDialog(String,Lookup,String,ActionListener,HelpCtx)} |
361 |
* should be {@code Projects/<projectType>/Customizer}. |
362 |
*/ |
363 |
String projectType(); |
364 |
/** |
365 |
* Category folder (perhaps multiple components separated by {@code /}) |
366 |
* in which to place this panel or which is the name of this panel folder. |
367 |
*/ |
368 |
String category() default ""; |
369 |
/** |
370 |
* Display name when defining a category folder. |
371 |
* Can use {@code pkg.of.Bundle#key_name} syntax. |
372 |
*/ |
373 |
String categoryLabel() default ""; |
374 |
/** |
375 |
* Position of this panel or subfolder within its folder. |
376 |
*/ |
377 |
int position() default Integer.MAX_VALUE; |
378 |
} |
379 |
/** |
380 |
* Used in case multiple registrations are needed in one place. |
381 |
*/ |
382 |
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PACKAGE}) |
383 |
@Retention(RetentionPolicy.SOURCE) |
384 |
@interface Registrations { |
385 |
Registration[] value(); |
386 |
} |
325 |
} |
387 |
} |
326 |
|
388 |
|
327 |
/** Describes category of properties to be customized by given component |
389 |
/** Describes category of properties to be customized by given component |