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

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

org.netbeans.modules.looks/2 1.12

org.netbeans.spi.looks
Class Selectors

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

public abstract class Selectors
extends Object

Static factory class providing useful look selectors. For looks which can be constructed using module layer XMLFileSystems, a sample of such XML definition is given in their Javadoc.


Method Summary
static LookSelector array(Look[] delegates)
          Utility method, creates a LookSelector which will allways return the looks put into this method as a parameter.
static LookSelector composite(LookSelector[] selectors)
          Creates composite selector which merges all selectors given as parameter and removed duplicities.
static LookSelector decorator(LookSelector lookSelector, Look decoratingLook)
          Decorates looks found by given selector, with a decorating look.
static LookSelector defaultTypes()
          NamespaceSelector which searches for a look in default namespace "Looks/Types/".
static LookSelector first(LookSelector delegate)
          Utility method, creates a LookSelector which selects the first only Look from another LookSelector which it delegates to.
static LookSelector namespaceTypes(String contextPrefix)
          Searches for a look in namespace given name of context to search.
static LookSelector selector(ChangeableLookProvider provider)
          Creates a LookSelector which may change it's content.
static LookSelector selector(LookProvider provider)
          Creates a LookSelector based on LookProvider which will never change it's content.
static LookSelector singleton(Look delegate)
          Utility method, creates a LookSelector which will allways return the look put into this method as a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

selector

public static final LookSelector selector(LookProvider provider)
Creates a LookSelector based on LookProvider which will never change it's content.

Parameters:
provider - The concrete implementation of finding the Looks
Returns:
LookSelector based on given LookProvider
See Also:
LookProvider

selector

public static final LookSelector selector(ChangeableLookProvider provider)
Creates a LookSelector which may change it's content.

Parameters:
provider - The concrete implementation of finding the Looks and firing changes of the LookSelector content
Returns:
LookSelector based on given LookProvider
See Also:
ChangeableLookProvider

singleton

public static final LookSelector singleton(Look delegate)
Utility method, creates a LookSelector which will allways return the look put into this method as a parameter.

Parameters:
delegate - The Look to be returned from the selector.
Returns:
LookSelector returning Enumeration which contains given look.

array

public static final LookSelector array(Look[] delegates)
Utility method, creates a LookSelector which will allways return the looks put into this method as a parameter.

Parameters:
delegates - Array of Looks to be returned from the selector.
Returns:
LookSelector returning Enumeration which contains given looks.

first

public static final LookSelector first(LookSelector delegate)
Utility method, creates a LookSelector which selects the first only Look from another LookSelector which it delegates to.

Parameters:
delegate - LookSelector from which the first Look only will be returned
Returns:
LookSelector returning Enumeration which contains the first Look selected by delegate selector for given represented object

defaultTypes

public static final LookSelector defaultTypes()
NamespaceSelector which searches for a look in default namespace "Looks/Types/".

To create this namespace selector from an XML layer type:

 <file name="NameOfYourNamaspaceSelector.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.LookSelector" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Selectors.defaultTypes" />
 </file>
 

Returns:
default namespace selector searching for looks in "Looks/Types" on system filesystem.
See Also:
namespaceTypes(String)

namespaceTypes

public static final LookSelector namespaceTypes(String contextPrefix)
Searches for a look in namespace given name of context to search. Name of the look should correspond with a type (class, superclass, interface) of the represented object.

To create this namespace selector from an XML layer type:

 <file name="NameOfYourNamaspaceSelector.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.LookSelector" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Selectors.namespaceTypes" />
   <!--Optionally! The context prefix for the namespace. The default prefix is "Looks/Types/".-->
   <attr name="context" stringvalue="Looks/Selectors/MyTypes/" />
 </file>
 

Parameters:
contextPrefix - the Context to be searched
Returns:
LookSelector searching the given Context by type of the represented object.

decorator

public static final LookSelector decorator(LookSelector lookSelector,
                                           Look decoratingLook)
Decorates looks found by given selector, with a decorating look. Works exactly as the decorator. Resulting looks are composite looks made from the look found by the selector and the decorating look.

To create this decorator selector from an XML layer type:

 <file name="NameOfYourDecoratorSelector.instance" >
   <attr name="instanceClass" stringvalue="org.netbeans.spi.looks.LookSelector" />
   <attr name="instanceCreate" methodvalue="org.netbeans.spi.looks.Selectors.decorator" />
   <!--The path to declaration of look selector searches for the looks.-->
   <attr name="lookSelector" stringvalue="Looks/Selectors/MyTypes/" />
   <!--The path to declaration of decorating look.-->
   <attr name="decoratingLook" stringvalue="Looks/MyLayer/MyLooks/FooLook" />
   <!--Optionally! The additionally features are append at last. The default value is false.-->
 </file>
 

Parameters:
lookSelector - Selector used for searching for Looks for given represented object
decoratingLook - Look which will decorate all the subnodes.
Returns:
LookSelector which adds the decorating look to every look provided in the parameter selector.

composite

public static final LookSelector composite(LookSelector[] selectors)
Creates composite selector which merges all selectors given as parameter and removed duplicities.

Parameters:
selectors - Array of selctors to be merged.
Returns:
Selector which merges the selectors

org.netbeans.modules.looks/2 1.12

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