站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Look & Feel Customization Library - NetBeans Architecture Questions - NetBeans API Javadoc (Current Development Version)

NetBeans Architecture Answers for Look & Feel Customization Library module

WARNING: answering questions version 1.24 rather than the current 1.29.

Interfaces table

Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
PlafAPIExportedFriend .../netbeans/swing/plaf/package-summary.html


General Information

    Question (arch-what): What is this project good for?

    Answer: The plaf library consists primarily of code that used to be in core. What it does:
    • Installs a custom look and feel if a custom look and feel class is passed to it
    • Sets the correct fonts in the Swing UIDefaults if a custom fontsize is desired for the application's UI
    • Loads a UI theme if a URL for the theme file (no format changes since NetBeans 3.4) is passed to it
    • Installs custom UI keys and values used by other components of NetBeans, such as colors and UI delegate class names used by other parts NetBeans. Examples of these:
      • Tab control UI delegate class name, depending on the look and feel, for the window system
      • Definitions of colors which the tab control, property sheet and output window will use, if present in UIDefaults, to color themselves in accordance with the UI spec for them on a given look and feel
      • Custom border implementations NetBeans uses for scroll panes to reduce "border-buildup"
      • A custom implementation of ToolbarUI which NetBeans uses for its toolbars, and a custom UI for toolbar buttons which sizes them correctly (GTK and Aqua only, currently)
      • Insets definition for the editor scrollbar, used to get the height of the upper and lower button of the scrollbar for purposes of the Error Stripe. The appropriate key value is "Nb.Editor.ErrorStripe.ScrollBar.Insets".
    • Compensate for missing elements on some (GTK) look and feels, which standard Swing code expects to be present, i.e. UIManager.getColor ("control"), to enable older code to run unmodified on newer look and feels.
    Its API consists of a single method, org.netbeans.swing.plaf.Startup.run (Class lookAndFeel, int fontSize, URL themeFile), which should be called early in NetBeans startup sequence by core, to initialize UIDefaults values before any main window GUI is constructed. It provides a minimal SPI in the form of the abstract class LFCustoms, which an alternate look and feel could use to provide lists of keys and values which should be installed into UIDefaults, via the mechanism documented in the documentation for LFCustoms. PlafAPI

    Question (arch-overall): Describe the overall architecture.

    Answer: N/A

    Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module?

    Answer: Used by NetBeans to customize the UI to conform to UI design specifications; can be used by third parties who are employing parts of the NetBeans platform in their applications, such as the windowing system.

    Question (arch-time): What are the time estimates of the work?

    Answer: NetBeans 4.0 feature freeze

    Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented?

    Answer: Some unit tests may be provided in the future; the per-look-and-feel classes are simply a mechanism to provide mainly a list of strings to put into UIDefaults - they could (and may be eventually) be replaced by XML theme files.

    Question (arch-where): Where one can find sources for your module?

    WARNING: Question with id="arch-where" has not been answered!

Project and platform dependencies

    Question (dep-nb): What other NetBeans projects and modules does this one depend on?

    Answer: None, it is a standalone library that could be used in other applications.

    The default answer to this question is:

    These modules are required in project.xml:

      Question (dep-non-nb): What other projects outside NetBeans does this one depend on?

      Answer: None.

      Question (dep-platform): On which platforms does your module run? Does it run in the same way on each?

      Answer: Platform independent.

      Question (dep-jre): Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?

      Answer: 1.4

      Question (dep-jrejdk): Do you require the JDK or is the JRE enough?

      Answer: JRE

    Deployment

      Question (deploy-jar): Do you deploy just module JAR file(s) or other files as well?

      Answer: Just a JAR.

      Question (deploy-nbm): Can you deploy an NBM via the Update Center?

      Answer: Presumably yes.

      Question (deploy-shared): Do you need to be installed in the shared location only, or in the user directory only, or can your module be installed anywhere?

      Answer: It is a library, not a module, because its code must run very early in the startup sequence, before other GUI is constructed, so that all GUIs will have the correct colors, borders, UI delegates, etc. All of this was formerly done directly in core.

      Question (deploy-packages): Are packages of your module made inaccessible by not declaring them public?

      Answer: No. There is one root package containing the API, and several per-look-and-feel packages containing implementations of standard Swing UI delegates (such as a custom toolbar UI for Aqua and GTK look and feels), and custom implementations of Border and such. Swing's mechanism for loading a UI delegate is by fetching the UI class name from UIDefaults and creating an instance of that class, so the UI delegates must be publicly accessible for Swing to be able to load them.

      Question (deploy-dependencies): What do other modules need to do to declare a dependency on this one, in addition to or instead of the normal module dependency declaration (e.g. tokens to require)?

      Answer: Components such as the window system, which use values defined here, will behave in a reasonable way if those values are not defined. However, it is preferable that they declare a runtime dependency on the plaf library.

    Compatibility with environment

      Question (compat-i18n): Is your module correctly internationalized?

      Answer: N/A - provides no user visible text.

      Question (compat-standards): Does the module implement or define any standards? Is the implementation exact or does it deviate somehow?

      Answer: N/A

      Question (compat-version): Can your module coexist with earlier and future versions of itself? Can you correctly read all old settings? Will future versions be able to read your current settings? Can you read or politely ignore settings stored by a future version?

      Answer: N/A; no persisted settings.

      Question (compat-deprecation): How the introduction of your project influences functionality provided by previous version of the product?

      WARNING: Question with id="compat-deprecation" has not been answered!

    Access to resources

      Question (resources-file): Does your module use java.io.File directly?

      Answer: No.

      Question (resources-layer): Does your module provide own layer? Does it create any files or folders in it? What it is trying to communicate by that and with which components?

      Answer: No.

      Question (resources-read): Does your module read any resources from layers? For what purpose?

      Answer: No.

      Question (resources-mask): Does your module mask/hide/override any resources provided by other modules in their layers?

      Answer: No.

      Question (resources-preferences): Does your module uses preferences via Preferences API? Does your module use NbPreferences or or regular JDK Preferences ? Does it read, write or both ? Does it share preferences with other modules ? If so, then why ?

      WARNING: Question with id="resources-preferences" has not been answered!

    Lookup of components


    Execution Environment

      Question (exec-property): Is execution of your code influenced by any environment or Java system (System.getProperty) property? On a similar note, is there something interesting that you pass to java.util.logging.Logger? Or do you observe what others log?

      Answer: It will decide which sets of customizations to load based on the look and feel it is asked to install, or the one currently in use if it is not asked to install one.

      Question (exec-component): Is execution of your code influenced by any (string) property of any of your components?

      Answer: For testing purposes only, the system property "nb.forceui" can be used to load NetBeans customizations for a different look and feel (such as loading the custom Aqua UI delegates on Windows). The only purpose for this flag is to enable development/bug fixing and minimal testing when a developer is working on a machine that does not support the requested look and feel, and they want to be sure they have not broken anything.

      Question (exec-ant-tasks): Do you define or register any ant tasks that other can use?

      WARNING: Question with id="exec-ant-tasks" has not been answered!

      Question (exec-classloader): Does your code create its own class loader(s)?

      Answer: No.

      Question (exec-reflection): Does your code use Java Reflection to execute other code?

      Answer: If org.openide.util.Utilities is not resolvable, it will use ImageIO.read() to load images.

      Question (exec-privateaccess): Are you aware of any other parts of the system calling some of your methods by reflection?

      Answer: Swing will resolve and load UI classes which are added to UIDefaults, which are defined in this library, when a component needs a UI delegate.

      Question (exec-process): Do you execute an external process from your module? How do you ensure that the result is the same on different platforms? Do you parse output? Do you depend on result code?

      Answer: No.

      Question (exec-introspection): Does your module use any kind of runtime type information (instanceof, work with java.lang.Class, etc.)?

      Answer: No.

      Question (exec-threading): What threading models, if any, does your module adhere to? How the project behaves with respect to threading?

      Answer: First come first served - the single API method is meant to be called once (this is enforced) by an application on startup. It does not matter on which thread; what is important is that the application do so before constructing its main GUI.

      Question (security-policy): Does your functionality require modifications to the standard policy file?

      Answer: No.

      Question (security-grant): Does your code grant additional rights to some other code?

      Answer: No.

    Format of files and protocols

      Question (format-types): Which protocols and file formats (if any) does your module read or write on disk, or transmit or receive over the network? Do you generate an ant build script? Can it be edited and modified?

      Answer: NetBeans theme support (formerly core.NbTheme) has been moved into this library, so it will read Metal LF special theme files.

      Question (format-dnd): Which protocols (if any) does your code understand during Drag & Drop?

      Answer: N/A

      Question (format-clipboard): Which data flavors (if any) does your code read from or insert to the clipboard (by access to clipboard on means calling methods on java.awt.datatransfer.Transferable?

      Answer: N/A

    Performance and Scalability

      Question (perf-startup): Does your module run any code on startup?

      Answer: No.

      Question (perf-exit): Does your module run any code on exit?

      Answer: No.

      Question (perf-scale): Which external criteria influence the performance of your program (size of file in editor, number of files in menu, in source directory, etc.) and how well your code scales?

      Answer: None.

      Question (perf-limit): Are there any hard-coded or practical limits in the number or size of elements your code can handle?

      Answer: No.

      Question (perf-mem): How much memory does your component consume? Estimate with a relation to the number of windows, etc.

      Answer: A marginal amount of memory for String, Border, Insets and Color objects added to UIDefaults. For components which install a very large number of these, the keys and values are bootstrapped into UIDefaults the first time the component's UI class is requested, by using a subclass of UIDefaults.LazyValue

      Question (perf-wakeup): Does any piece of your code wake up periodically and do something even when the system is otherwise idle (no user interaction)?

      Answer: No.

      Question (perf-progress): Does your module execute any long-running tasks?

      Answer: No.

      Question (perf-huge_dialogs): Does your module contain any dialogs or wizards with a large number of GUI controls such as combo boxes, lists, trees, or text areas?

      Answer: No.

      Question (perf-menus): Does your module use dynamically updated context menus, or context-sensitive actions with complicated and slow enablement logic?

      Answer: No.

      Question (perf-spi): How the performance of the plugged in code will be enforced?

      Answer: N/A

    Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.