Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.jdeveloper.template
Class AbstractTemplate

java.lang.Object
  extended by oracle.javatools.data.HashStructureAdapter
      extended by oracle.jdeveloper.template.AbstractTemplate
All Implemented Interfaces:
java.lang.Comparable, Displayable, Element
Direct Known Subclasses:
ApplicationTemplate, ProjectTemplate

public abstract class AbstractTemplate
extends HashStructureAdapter
implements java.lang.Comparable, Element


Field Summary
static java.util.Comparator NAME_COMPARATOR
           
protected  TemplateData parent_
           
static java.util.Comparator WEIGHT_COMPARATOR
           
 
Fields inherited from class oracle.javatools.data.HashStructureAdapter
_hash
 
Constructor Summary
protected AbstractTemplate()
           
protected AbstractTemplate(HashStructure hash)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
          Equals support.
 Attributes getAttributes()
          This method returns an Attributes object that encodes the attributes of the Element.
 java.util.Iterator<Element> getChildren()
          This method is part of the Element interface to provide a convenient way of getting an Iterator over any contained child Elements without having to test the object's type with the instanceof operator or having to downcast to a more specific type.
protected  java.lang.String getChildTemplatesKey()
           
 java.lang.String getContainerName()
           
protected abstract  java.lang.String getContainerNameKey()
           
 HashStructure getData()
          Returns the data object associated with this Element.
protected abstract  javax.swing.Icon getDefaultIcon()
           
 java.lang.String getDeploymentProfile()
           
 java.lang.String getDescription()
           
 java.lang.String getGalleryFolder()
           
 javax.swing.Icon getIcon()
          Returns an Icon that can be shown in association with this Displayable.
 java.lang.String getIconFile()
           
 java.lang.String getLongLabel()
          Returns a long label that can be displayed to the user.
 java.lang.String getName()
           
 java.lang.String getPackageName()
           
 java.lang.String getShortLabel()
          Returns a short label that can be displayed to the user.
 TemplateData getTemplateData()
          The TemplateData container which holds this template.
 java.lang.String getTemplateId()
           
static java.lang.String getTemplateId(HashStructure hash)
           
protected  java.lang.String getTextFromHook(HashStructure hash, java.lang.String key)
           
 java.lang.String getToolTipText()
          Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Displayable.
 float getWeight()
           
 int hashCode()
           
 void initializeFromExtensionHook(HashStructure hash, TemplateData lookup)
          Initialize this template from a HashStructure read from the template extension hook.
 boolean isUnsorted()
          Indicates whether this item should be sorted by its label or whether it should always sort to the top of the list.
 boolean isValid()
           
 boolean mayHaveChildren()
          This method is part of the Element interface to provide a convenient way of determining whether an object may have children without having to test the object's type with the instanceof operator or having to downcast to a more specific type.
 void setContainerName(java.lang.String name)
           
 void setDeploymentProfile(java.lang.String deploymentProfile)
           
 void setDescription(java.lang.String desc)
           
 void setGalleryFolder(java.lang.String category)
           
 void setIconFile(java.lang.String iconFile)
           
 void setName(java.lang.String name)
           
 void setPackageName(java.lang.String name)
           
 void setTemplateClass(java.lang.String clazz)
           
 void setTemplateData(TemplateData parent)
          The TemplateData container which holds this template.
static void setTemplateId(HashStructure hash, java.lang.String id)
           
 void setTemplateId(java.lang.String id)
           
 void setToolTipText(java.lang.String toolTip)
           
 void setUnsorted(boolean value)
          Determines how this template is sorted in the New Gallery.
protected  void setValid(boolean valid)
           
 void setWeight(float weight)
           
 java.lang.String toString()
          Returns the Short Label displayed to a user.
protected  boolean validate()
           
 
Methods inherited from class oracle.javatools.data.HashStructureAdapter
addStructureChangeListener, containsKey, copyTo, copyToImpl, equalsImpl, findOrCreate, forcedCopyTo, getHashStructure, removeStructureChangeListener, useObjectEquals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_COMPARATOR

public static final java.util.Comparator NAME_COMPARATOR

WEIGHT_COMPARATOR

public static final java.util.Comparator WEIGHT_COMPARATOR

parent_

protected TemplateData parent_
Constructor Detail

AbstractTemplate

protected AbstractTemplate(HashStructure hash)

AbstractTemplate

protected AbstractTemplate()
Method Detail

toString

public java.lang.String toString()
Description copied from interface: Displayable
Returns the Short Label displayed to a user. This overrides the toString method in java.lang.Object.

Implementors of the Displayable interface should override this as appropriate. The default implementation is the same as getShortLabel

Specified by:
toString in interface Displayable
Overrides:
toString in class java.lang.Object
See Also:
Object.toString(), Displayable.getShortLabel()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Description copied from class: HashStructureAdapter
Equals support. As long as the subclass stores all data in the HashStructureAdapter._hash, this base equals implementation should be sufficient and not need to be overridden.

Overrides:
equals in class HashStructureAdapter

initializeFromExtensionHook

public void initializeFromExtensionHook(HashStructure hash,
                                        TemplateData lookup)
Initialize this template from a HashStructure read from the template extension hook. Use lookup to resolve any references to external templates. Only properties that are available in the hash are set, the rest are left untouched.


getTextFromHook

protected java.lang.String getTextFromHook(HashStructure hash,
                                           java.lang.String key)

getTemplateId

public java.lang.String getTemplateId()

getTemplateId

public static java.lang.String getTemplateId(HashStructure hash)

setTemplateId

public static void setTemplateId(HashStructure hash,
                                 java.lang.String id)

setTemplateId

public void setTemplateId(java.lang.String id)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String desc)

getPackageName

public java.lang.String getPackageName()

setPackageName

public void setPackageName(java.lang.String name)

getWeight

public float getWeight()

setWeight

public void setWeight(float weight)

getDeploymentProfile

public java.lang.String getDeploymentProfile()

setDeploymentProfile

public void setDeploymentProfile(java.lang.String deploymentProfile)

getContainerName

public java.lang.String getContainerName()

setContainerName

public void setContainerName(java.lang.String name)

setUnsorted

public void setUnsorted(boolean value)
Determines how this template is sorted in the New Gallery. If true, the item is not sorted by its name, it is sorted to the top of the list along with other unsorted items. When false, the item is sorted by its name.

Parameters:
value - true if the items should be sorted to the top of the list, false otherwise

isUnsorted

public boolean isUnsorted()
Indicates whether this item should be sorted by its label or whether it should always sort to the top of the list.

Returns:
true if the items should be sorted to the top of the list, false otherwise

setGalleryFolder

public void setGalleryFolder(java.lang.String category)

getGalleryFolder

public java.lang.String getGalleryFolder()

setTemplateClass

public void setTemplateClass(java.lang.String clazz)

getChildTemplatesKey

protected java.lang.String getChildTemplatesKey()

getContainerNameKey

protected abstract java.lang.String getContainerNameKey()

getDefaultIcon

protected abstract javax.swing.Icon getDefaultIcon()

mayHaveChildren

public boolean mayHaveChildren()
Description copied from interface: Element
This method is part of the Element interface to provide a convenient way of determining whether an object may have children without having to test the object's type with the instanceof operator or having to downcast to a more specific type.

An implementation of Element that represents a leaf in a tree structure should return false from this method. An implementation of Element that could represent a non-leaf in a tree structure should return true from this method, even if it does not currently contain any children.

Specified by:
mayHaveChildren in interface Element
Returns:
true if this Element may contain child Elements.

getAttributes

public Attributes getAttributes()
Description copied from interface: Element
This method returns an Attributes object that encodes the attributes of the Element. Changing the attribute settings on the return object changes the element attributes. Subclasses should use their super class attributes object to define their own attributes. This allows subclasses to inherit their super class attributes. If a subclass does not wish to inherit attributes, they should first call getAttributes().clear() and define new attributes.

Specified by:
getAttributes in interface Element

getData

public HashStructure getData()
Description copied from interface: Element
Returns the data object associated with this Element. Implementations will often simply return this, since the Element is often its own data object. If the implementation returns an object other than this, be sure to set ElementAttributes.DECORATES_DATA_ELEMENT.

Specified by:
getData in interface Element
Returns:
the data object associated with this Element instance.

getShortLabel

public java.lang.String getShortLabel()
Description copied from interface: Displayable
Returns a short label that can be displayed to the user. Generally, the value of the returned String is considered translatable and should therefore be placed in an appropriate resource file. When possible, the returned label should be reasonably short enough to show in the navigator or explorer windows but long enough to clearly identify and distinguish the Displayable.

Specified by:
getShortLabel in interface Displayable
Returns:
a short descriptive label of the Displayable that can be shown to the user.

getLongLabel

public java.lang.String getLongLabel()
Description copied from interface: Displayable
Returns a long label that can be displayed to the user. Generally, the value of the returned String is considered translatable and should therefore be placed in an appropriate resource file. The long label differs from the short label essentially on length. Usually the long label will only be shown on-demand and in places where horizontal space is more available. Examples are the status bar and tooltips.

Specified by:
getLongLabel in interface Displayable
Returns:
a long descriptive label of the Displayable that can be shown to the user.

getChildren

public java.util.Iterator<Element> getChildren()
Description copied from interface: Element
This method is part of the Element interface to provide a convenient way of getting an Iterator over any contained child Elements without having to test the object's type with the instanceof operator or having to downcast to a more specific type.

An implementation of Element that represents a leaf in a tree structure should return null from this method. An implementation of Element that could represent a non-leaf in a tree structure should return either an Iterator over the child Elements or null if there are no children.

Specified by:
getChildren in interface Element
Returns:
an Iterator over any child Elements contained by this Element. If there are no children, null is returned.

getIconFile

public java.lang.String getIconFile()

getIcon

public javax.swing.Icon getIcon()
Description copied from interface: Displayable
Returns an Icon that can be shown in association with this Displayable. Typically the icon will be used in a tree control or list control. Therefore the icon must fit naturally within the space normally given to items within those controls. Such icons are usually 16x16 in size or, if there is a one-pixel transparent padding around the edge, 18x18 in size. It is strongly recommended that icons returned by this method be either 16x16 or 18x18 in size. If null is returned, the control may show a default icon, or it may show no icon, whichever is appropriate.

Specified by:
getIcon in interface Displayable
Returns:
the Icon to be displayed for the Displayable.

setIconFile

public void setIconFile(java.lang.String iconFile)

getToolTipText

public java.lang.String getToolTipText()
Description copied from interface: Displayable
Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Displayable. In many cases it may be appropriate for this method to return the same value as Displayable.getLongLabel().

Specified by:
getToolTipText in interface Displayable
Returns:
the tooltip to show when the mouse pointer pauses over a UI component that represents this Displayable.

setToolTipText

public void setToolTipText(java.lang.String toolTip)

setTemplateData

public void setTemplateData(TemplateData parent)
The TemplateData container which holds this template. This is set by TemplateData whenever a new Template is added to it.

Parameters:
parent - the TemplateData container.

getTemplateData

public TemplateData getTemplateData()
The TemplateData container which holds this template.

Returns:

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

isValid

public boolean isValid()

setValid

protected void setValid(boolean valid)

validate

protected boolean validate()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.