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

Looks (Looks) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.looks/2 1.12

org.netbeans.spi.looks
Class Looks

java.lang.Object
  extended by org.netbeans.spi.looks.Looks

public abstract class Looks
extends Object

Static factory class for different kinds of useful Looks. For looks which can be constructed using module layer XMLFileSystems, a sample of such XML definition is given in the Javadoc.


Method Summary
static Look bean()
          Look that presents an object as a JavaBean.
static Look childrenSelectorProvider(String name, Look look, LookSelector selector)
           
static Look composite(String name, Look[] delegates)
          Look that is composite of the delegates specified by a given context or composite of array of looks.
static Look filter(String name, Look delegate, long mask)
          Look that filters the features of look which delegates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

bean

public static final Look bean()
Look that presents an object as a JavaBean. Uses java.beans.Introspector to get the properties and delegates to the object all other methods.

To create this look from an XML layer type:

 <file name="NameOfYourLook.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.Look" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Looks.bean" />
 </file>
 

Returns:
Look which represents objects as JavaBeans
See Also:
BeanNode

filter

public static final Look filter(String name,
                                Look delegate,
                                long mask)
Look that filters the features of look which delegates. The filtered features are specified by mask.

To create this filter look from an XML layer type:

 <file name="NameOfYourLook.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.Look" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Looks.filter" />
   <!--The path to declaration of delegate look.-->
   <attr name="delegateLook" stringvalue="Looks/MyLayer/MyLooks/FooLook" />
   <!--Optionally! The mask can be specified in mask attribute. The default mask is ALL_METHODS.-->
   <attr name="ALL_METHODS" boolvalue="false" />
   <!--Optionally! Mask specification of a methods individually, can enlarge the mask in detail.-->
   <attr name="GET_NAME" boolvalue="false" />
   <attr name="GET_ICON" boolvalue="true" />
   ...
 </file>
 
The <attr name="delegateLook" /> attribute can directly return an instance of your look (instead of specifying its path). So one can replace that line with:
   <attr name="delegateLook" newvalue="yourpkg.YourLook" />
 
or if one wants to use methodvalue:
   <attr name="delegateLook" methodvalue="yourpkg.YourFactoryClass.yourMethod" />
 
under the condition that there is a YourFactoryClass in yourpkg that contains following method:
 package yourpkg;
 public final class YourFactoryClass {
   public static Look yourMethod () {
     Look l = ...;
     return l;
   }
 }
 

Parameters:
delegate - The look the FilterLook will delegate to
mask - Binary mask where 1 means that the method call will be forwarded to the delegate look. 0 means that the delegation will be suppressed
Returns:
new filter look with given mask and delegate
See Also:
ProxyLook for values for method masking

composite

public static final Look composite(String name,
                                   Look[] delegates)
Look that is composite of the delegates specified by a given context or composite of array of looks. Composite means that all attributes of the node are determined by asking all sublooks for the value. If the attribute only allows one value (e.g. name or icon) first not null or not false value is chosen. If the attribute is multivalued (e.g. child nodes or properties) the result is set produced by merging results from all sublooks.

To create this composite look from an XML layer type:

 <file name="NameOfYourNamespaceSelector.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.Look" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Looks.composite" />
   <attr name="context" stringvalue="Looks/Types/" />
 </file>
 

The context attribute should point to some Context (usualy a folder on system filesystem) which will contain all sublooks of the look. Content of the folder is equivalent of the delegates parameter.

Parameters:
name - Name of the composite look.
delegates - Sublooks of the look.
Returns:
new look composed from sublooks
See Also:
ProxyLook for more info about looks composition.

childrenSelectorProvider

public static final Look childrenSelectorProvider(String name,
                                                  Look look,
                                                  LookSelector selector)

org.netbeans.modules.looks/2 1.12

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