|
org.netbeans.modules.looks/2 1.12 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.spi.looks.Look<T>
public abstract class Look<T>
Base class for all Looks. All methods in the class provide
neutral behavior (i.e. do nothing, rerurn null or false).
Extending this class in order to implement
a Look requires overriding all methods which should provide some
functionality. You may also consider subclassing
the adaptor class DefaultLook class
, which provides basic implementations for
finding Icons and Actions.
Most methods take a Lookup as parameter. This lookup represents environement
associated with given represented object. This environement usually
contains data from the getLookupItems(T, org.openide.util.Lookup)
method. However if more
looks cooperate on the same represented object it should contain union
of items provided by all cooperating looks.
DefaultLook
Constructor Summary | |
---|---|
protected |
Look(String name)
Creates new instance of look does no work. |
Method Summary | |
---|---|
protected void |
attachTo(T representedObject)
Overriding this method permits registering listeners on represented objects. |
boolean |
canCopy(T representedObject,
Lookup env)
Test whether this object permits copying. |
boolean |
canCut(T representedObject,
Lookup env)
Test whether this object permits cutting. |
boolean |
canDestroy(T representedObject,
Lookup env)
Test whether this object can be deleted. |
boolean |
canRename(T representedObject,
Lookup env)
Test whether this object can be renamed. |
Transferable |
clipboardCopy(T representedObject,
Lookup env)
Called when a object is to be copied to the clipboard. |
Transferable |
clipboardCut(T representedObject,
Lookup env)
Called when the object is to be cut to the clipboard. |
void |
destroy(T representedObject,
Lookup env)
Called when object was destroyed. |
protected void |
detachFrom(T representedObject)
This method is called when listening on represeted object is no longer needed. |
Transferable |
drag(T representedObject,
Lookup env)
Called when a drag is started with this object. |
protected void |
fireChange(T representedObject,
long mask)
Notifies all listeners attached to the representedObject that result(s) of some method(s) changed. |
protected void |
firePropertyChange(T representedObject,
String propertyName)
Notifies all listeners attached to the representedObject that a property in the PropertySets changed it's value. |
Action[] |
getActions(T representedObject,
Lookup env)
Get the set of actions associated with the object. |
List<?> |
getChildObjects(T representedObject,
Lookup env)
Gets objects which are children of the represented object in the hierarchy represented by this Look. |
Action[] |
getContextActions(T representedObject,
Lookup env)
Get a special set of actions for situations when this object is displayed as a context. |
Component |
getCustomizer(T representedObject,
Lookup env)
Get the customizer for represented object if available. |
Action |
getDefaultAction(T representedObject,
Lookup env)
Get the default action for this object. |
String |
getDisplayName()
The human presentable name of the look. |
String |
getDisplayName(T representedObject,
Lookup env)
Gets localized name of the object. |
PasteType |
getDropType(T representedObject,
Transferable t,
int action,
int index,
Lookup env)
Determine if there is a paste operation that can be performed on provided transferable. |
HelpCtx |
getHelpCtx(T representedObject,
Lookup env)
Get context help associated with this object. |
Image |
getIcon(T representedObject,
int type,
Lookup env)
Find an icon for this object (in the closed state). |
Collection |
getLookupItems(T representedObject,
Lookup oldEnv)
Allowes for adding new object into the object's environement passed to other methods as the env parameter. |
String |
getName()
Returns name of the look. |
String |
getName(T representedObject,
Lookup env)
Gets the programmatic name of the object. |
NewType[] |
getNewTypes(T representedObject,
Lookup env)
Get the new types that user can create from given object. |
Image |
getOpenedIcon(T representedObject,
int type,
Lookup env)
Find an icon for this object (in the open state). |
PasteType[] |
getPasteTypes(T representedObject,
Transferable t,
Lookup env)
Determine which paste operations are allowed when a given transferable is in the clipboard. |
Node.PropertySet[] |
getPropertySets(T representedObject,
Lookup env)
Get the list of property sets for object. |
String |
getShortDescription(T representedObject,
Lookup env)
Gets short description for given object. |
boolean |
hasCustomizer(T representedObject,
Lookup env)
Check whether the customizer for the represented object is available. |
boolean |
isLeaf(T representedObject,
Lookup env)
Decides whether given object should be a leaf. |
void |
rename(T representedObject,
String newName,
Lookup env)
This method is called when the user renames the object. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long ALL_METHODS
public static final long NO_METHODS
public static final long DESTROY
destroy(T, org.openide.util.Lookup)
.
public static final long RENAME
rename(T, java.lang.String, org.openide.util.Lookup)
.
public static final long GET_LOOKUP_ITEMS
public static final long GET_DISPLAY_NAME
getDisplayName()
.
public static final long GET_NAME
getName()
.
public static final long GET_SHORT_DESCRIPTION
getShortDescription(T, org.openide.util.Lookup)
.
public static final long GET_ICON
getIcon(T, int, org.openide.util.Lookup)
.
public static final long GET_OPENED_ICON
getOpenedIcon(T, int, org.openide.util.Lookup)
.
public static final long GET_HELP_CTX
getHelpCtx(T, org.openide.util.Lookup)
.
public static final long GET_CHILD_OBJECTS
getChildObjects(T, org.openide.util.Lookup)
.
public static final long GET_NEW_TYPES
getNewTypes(T, org.openide.util.Lookup)
.
public static final long GET_ACTIONS
getActions(T, org.openide.util.Lookup)
.
public static final long GET_CONTEXT_ACTIONS
getContextActions(T, org.openide.util.Lookup)
.
public static final long GET_DEFAULT_ACTION
getDefaultAction(T, org.openide.util.Lookup)
.
public static final long GET_PROPERTY_SETS
getPropertySets(T, org.openide.util.Lookup)
.
public static final long GET_CUSTOMIZER
getCustomizer(T, org.openide.util.Lookup)
.
public static final long CAN_RENAME
canRename(T, org.openide.util.Lookup)
.
public static final long CAN_DESTROY
canDestroy(T, org.openide.util.Lookup)
.
public static final long CAN_COPY
canCopy(T, org.openide.util.Lookup)
.
public static final long CAN_CUT
canCut(T, org.openide.util.Lookup)
.
public static final long GET_PASTE_TYPES
getPasteTypes(T, java.awt.datatransfer.Transferable, org.openide.util.Lookup)
.
public static final long GET_DROP_TYPE
getDropType(T, java.awt.datatransfer.Transferable, int, int, org.openide.util.Lookup)
.
public static final long CLIPBOARD_COPY
clipboardCopy(T, org.openide.util.Lookup)
.
public static final long CLIPBOARD_CUT
clipboardCut(T, org.openide.util.Lookup)
.
public static final long DRAG
drag(T, org.openide.util.Lookup)
.
public static final long HAS_CUSTOMIZER
hasCustomizer(T, org.openide.util.Lookup)
.
Constructor Detail |
---|
protected Look(String name)
name
- the name to assign to the look.Method Detail |
---|
public final String getName()
public String getDisplayName()
public String toString()
protected void attachTo(T representedObject)
If given instance is used in many places (e.g. multiple views are using
the look for representing the given object or when the look is used as a sublook
in multiple composite looks) attachTo
will only be called once per
represented object.
Implementors may not wait for any other threads at it may be potentially called from internal lock.
representedObject
- Represented object the look should work with.
ClassCastException
- When the represented object is unacceptable
for the look due to wrong class
IllegalArgumentException
- When the represented object is
unacceptable for other reason than class cast.protected void detachFrom(T representedObject)
attachTo(T)
method.Implementors may not wait for any other threads at it may be potentially called from internal lock.
representedObject
- Represented object to detach from.public Collection getLookupItems(T representedObject, Lookup oldEnv)
representedObject
- Parameter is ignored.oldEnv
- Content of previous environement when called after a change
of environemnt or is empty.
null
public String getName(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
public String getDisplayName(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
public void rename(T representedObject, String newName, Lookup env) throws IOException
representedObject
- Represented object to be renamed.newName
- The new name set by the user.env
- Environment for the represented object.
IOException
public String getShortDescription(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
public Image getIcon(T representedObject, int type, Lookup env)
representedObject
- Represented object the look should work with.type
- Constant from BeanInfo
env
- Environment for the represented object.
public Image getOpenedIcon(T representedObject, int type, Lookup env)
representedObject
- Represented object the look should work with.type
- Constant from BeanInfo
env
- Environment for the represented object.
public HelpCtx getHelpCtx(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
or
HelpCtx.DEFAULT_HELP
)public List<?> getChildObjects(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
.public boolean isLeaf(T representedObject, Lookup env)
Notice : Implementation of
this method must be consistent with implementation of
getChildObjects(T, org.openide.util.Lookup)
.
Notice that you can switch the form LEAF to nonLEAF node and vice versa
by calling fireChange(T, long)
with parameter GET_CHILD_OBJECTS
,
which in turn will call
isLeaf(...)
and eventually getChildObjects(...)
where you can return new value.
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
true
if the object should be unexpandable
false
otherwise.public NewType[] getNewTypes(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
that is equivalent to empty arraypublic Action[] getActions(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
if actions in NodeOp.getDefaultActions()
should be used.public Action[] getContextActions(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
public Action getDefaultAction(T representedObject, Lookup env)
getActions(T, org.openide.util.Lookup)
.
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
if there should be none.public Node.PropertySet[] getPropertySets(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
that
is equivalent to empty arraypublic boolean hasCustomizer(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
public Component getCustomizer(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
null
if there is no customizer.public boolean canRename(T representedObject, Lookup env)
rename(T, java.lang.String, org.openide.util.Lookup)
will be called when the user changes the name
of the node.
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
true
if the node object be renamed.public boolean canDestroy(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
True
if can be deleted.public boolean canCopy(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
True
if so.public boolean canCut(T representedObject, Lookup env)
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
True
if so.public PasteType[] getPasteTypes(T representedObject, Transferable t, Lookup env)
representedObject
- Represented object the look should work with.t
- The transferable in the clipboard.env
- Environment for the represented object.
null
that is equivalent to empty arraypublic PasteType getDropType(T representedObject, Transferable t, int action, int index, Lookup env)
representedObject
- Represented object the look should work with.t
- The transferable.action
- The drag'n'drop action to do DnDConstants.ACTION_MOVE,
ACTION_COPY, ACTION_LINK.index
- Index between children the drop occured at or -1 if not specified.env
- Environment for the represented object.
Null
if the transferable cannot be accepted or the paste type
to execute when the drop occurs.public Transferable clipboardCopy(T representedObject, Lookup env) throws IOException
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
IOException
- When the copy cannot be performed.public Transferable clipboardCut(T representedObject, Lookup env) throws IOException
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
IOException
- When the copy cannot be performed.public Transferable drag(T representedObject, Lookup env) throws IOException
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
IOException
- If a drag cannot be started.public void destroy(T representedObject, Lookup env) throws IOException
representedObject
- Represented object the look should work with.env
- Environment for the represented object.
IOException
- If reflecting the destroy action in underlying data
fails for some reason.protected final void fireChange(T representedObject, long mask)
representedObject
- the object that has changedmask
- Bit mask of methods which's result changed. See Look
for the constantsprotected final void firePropertyChange(T representedObject, String propertyName)
representedObject
- the object that has changedpropertyName
- Name of the property
|
org.netbeans.modules.looks/2 1.12 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |