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

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

org.netbeans.modules.looks/2 1.12

org.netbeans.spi.looks
Class DefaultLook

java.lang.Object
  extended by org.netbeans.spi.looks.Look
      extended by org.netbeans.spi.looks.DefaultLook

public abstract class DefaultLook
extends Look

Utility class for providing Looks. Some methods are linked together to make it easier for subclasses to implement reasonable functionality (iconBase, actionBase), etc.


Field Summary
 
Fields inherited from class org.netbeans.spi.looks.Look
ALL_METHODS, CAN_COPY, CAN_CUT, CAN_DESTROY, CAN_RENAME, CLIPBOARD_COPY, CLIPBOARD_CUT, DESTROY, DRAG, GET_ACTIONS, GET_CHILD_OBJECTS, GET_CONTEXT_ACTIONS, GET_CUSTOMIZER, GET_DEFAULT_ACTION, GET_DISPLAY_NAME, GET_DROP_TYPE, GET_HELP_CTX, GET_ICON, GET_LOOKUP_ITEMS, GET_NAME, GET_NEW_TYPES, GET_OPENED_ICON, GET_PASTE_TYPES, GET_PROPERTY_SETS, GET_SHORT_DESCRIPTION, HAS_CUSTOMIZER, NO_METHODS, RENAME
 
Constructor Summary
DefaultLook(String name)
          Creates new instance of look does no work.
 
Method Summary
protected  String actionBase(Object representedObject, boolean context, Lookup env)
          Allows subclasses to specify actions in a easy way - by providing a name of a context name where to find the javax.swing.Action objects.
 Action[] getActions(Object representedObject, Lookup env)
          Calls actionBase (substitute, false) and extracts actions from that context.
 Action[] getContextActions(Object representedObject, Lookup env)
          Calls actionBase (substitute, true) and extracts actions from that context.
 Action getDefaultAction(Object representedObject, Lookup env)
          Extracts the first action from getActions, if any.
 Image getIcon(Object representedObject, int type, Lookup env)
          Finds icon using the value returned from iconBase
 Image getOpenedIcon(Object representedObject, int type, Lookup env)
          Finds icon using the value returned from iconBase
 boolean hasCustomizer(Object representedObject, Lookup env)
          Check whether the customizer for the represented object is available.
protected  String iconBase(Object representedObject, Lookup env)
          Allows subclasses to specify an icon in easier way without need to load the actual objects.
 
Methods inherited from class org.netbeans.spi.looks.Look
attachTo, canCopy, canCut, canDestroy, canRename, clipboardCopy, clipboardCut, destroy, detachFrom, drag, fireChange, firePropertyChange, getChildObjects, getCustomizer, getDisplayName, getDisplayName, getDropType, getHelpCtx, getLookupItems, getName, getName, getNewTypes, getPasteTypes, getPropertySets, getShortDescription, isLeaf, rename, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultLook

public DefaultLook(String name)
Creates new instance of look does no work.

Parameters:
name - the name to assign to the look
Method Detail

getIcon

public Image getIcon(Object representedObject,
                     int type,
                     Lookup env)
Finds icon using the value returned from iconBase

Overrides:
getIcon in class Look
Parameters:
representedObject - Parameter is ignored.
type - Icon type constant from BeanInfo
env - Parameter is ignored.
Returns:
an icon or null if not found

getOpenedIcon

public Image getOpenedIcon(Object representedObject,
                           int type,
                           Lookup env)
Finds icon using the value returned from iconBase

Overrides:
getOpenedIcon in class Look
Parameters:
representedObject - Parameter is ignored.
type - Icon type constant from BeanInfo
env - Parameter is ignored.
Returns:
an icon or null if not found

getActions

public Action[] getActions(Object representedObject,
                           Lookup env)
Calls actionBase (substitute, false) and extracts actions from that context.

Overrides:
getActions in class Look
Parameters:
representedObject - Parameter is ignored.
env - Parameter is ignored.
Returns:
the actions at the context or null

getContextActions

public Action[] getContextActions(Object representedObject,
                                  Lookup env)
Calls actionBase (substitute, true) and extracts actions from that context.

Overrides:
getContextActions in class Look
Parameters:
representedObject - Parameter is ignored.
env - Parameter is ignored.
Returns:
the actions at the context or null

getDefaultAction

public Action getDefaultAction(Object representedObject,
                               Lookup env)
Extracts the first action from getActions, if any.

Overrides:
getDefaultAction in class Look
Parameters:
representedObject - Parameter is ignored.
env - Parameter is ignored.
Returns:
the action or null

hasCustomizer

public boolean hasCustomizer(Object representedObject,
                             Lookup env)
Check whether the customizer for the represented object is available. I.e. whether getCustomizer (substitute) returns non-null value

Overrides:
hasCustomizer in class Look
Parameters:
representedObject - Parameter is ignored.
env - Parameter is ignored.
Returns:
true if the customizer is available, false otherwise

iconBase

protected String iconBase(Object representedObject,
                          Lookup env)
Allows subclasses to specify an icon in easier way without need to load the actual objects.

For example, if the returned base is /resource/MyIcon, the following images may be used according to the icon state and presentation type:

  • resource/MyIcon.gif
  • resource/MyIconOpen.gif
  • resource/MyIcon32.gif
  • resource/MyIconOpen32.gif

The default implementation returns null.

Parameters:
representedObject - The substitute to locate icon for.
env - Environement of the object.
Returns:
the base for icon search (no initial slash) or null if this look does not provide an icon

actionBase

protected String actionBase(Object representedObject,
                            boolean context,
                            Lookup env)
Allows subclasses to specify actions in a easy way - by providing a name of a context name where to find the javax.swing.Action objects.

By default the method returns name of this class (separated by slashes) with a prefix Looks/Actions. So for a class org.nb.mymod.MyLook the default action context is Looks/Actions/org/nb/mymod/MyLook. As a result it is not necessary to override this method in many cases.

Parameters:
representedObject - The object to work on.
context - false if getActions was called, true if getContextActions was called
env - Environement for the object.
Returns:
the name of a context

org.netbeans.modules.looks/2 1.12

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