Extension SDK

oracle.ide.layout
Class Layouts

java.lang.Object
  extended byoracle.ide.layout.Layouts
All Implemented Interfaces:
Copyable, Data, Displayable, Element, Folder

public class Layouts
extends java.lang.Object
implements Folder, Copyable

Layouts class. Manages user created layouts.


Field Summary
static java.lang.String DATA_KEY
           
static java.lang.String DESIGN_FILENAME
           
static java.lang.String DESIGN_FILENAME_BASE
           
static java.lang.String LAYOUT_EXT
           
 
Constructor Summary
Layouts()
           
 
Method Summary
protected  void activate(Layout layout, java.util.HashMap listeners)
           
 void activateDefaultDesignLayout()
           
 void activateLayout(IdeLayout layout)
           
 void activateLayout(IdeLayout layout, boolean startup)
           
 void activateLayout(Layout child)
           
 void activatePreferredLayout(LayoutSelector selector)
           
 boolean add(Element element)
          Remove the specified Element from this Folder.
 void addLayoutListener(java.lang.String viewName, LayoutListener listener)
           
 void addStartupLayoutListener(java.lang.String viewName, LayoutListener listener)
           
 void addView(ViewId id, View view)
           
 java.net.URL buildLayoutURL(java.lang.String baseName)
          Build a layout URL using baseName as the unqualified file name.
 boolean canAdd(Element element)
          Other classes can call this method to determine whether the given Element can be added to the Folder.
 boolean canRemove(Element element)
          Other classes can call this method to determine whether the specified Element can be removed from this Folder.
protected  void close(Layout layout)
           
 boolean containsChild(Element child)
          Returns true if the folder contains the specified child Element; returns false otherwise.
 java.lang.Object copyTo(java.lang.Object target)
          Copies the internal state of this object to the specified copy.
protected  void copyToImpl(Layouts copy)
           
 boolean equals(java.lang.Object o)
           
protected  boolean equalsImpl(Layouts other)
           
 Layout findLayout(java.net.URL url)
           
protected  java.net.URL generateLayoutURL()
           
 Layout getActive()
           
 IdeLayout getActiveLayout()
           
 Layout getActiveSubLayout()
           
 Attributes getAttributes()
          This method returns an Attributes object that encodes the attributes of the Element.
protected static java.lang.String getBaseName()
           
 java.util.Iterator 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.
 java.lang.Object getData()
          Gets the data object that implements this interface.
 IdeLayout getDesignLayout()
           
protected static java.net.URL getDirectoryURL()
           
 javax.swing.Icon getIcon()
          Returns an Icon that can be shown in association with this Displayable.
 BaseLayoutListener getLayoutListener(java.lang.String type)
           
 java.lang.String getLongLabel()
          Gets a fully qualified label for display purpose.
 java.lang.String getShortLabel()
          Gets a short label for display purpose.
 java.lang.String getToolTipText()
          Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Displayable.
 View getView(ViewId id)
           
 void initialize()
           
 boolean isDesignActive()
           
 boolean isShowLayoutActivator()
          Indicates whether or not the combo box used for layout activation should be shown in the toolbar.
 boolean isUseActiveLayoutInEditor()
          Indicates whether or not to use the active layout in the currently active editor.
 boolean isUseEditorPreferredLayout()
          Indicates whether or not editors should used their preferred layouts.
 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.
 Layout newDesignLayout(java.net.URL url)
          Creates a SimpleLayout owned by the Design layout.
 Layout newLayout(IdeLayout parent)
           
 Layout newLayout(IdeLayout parent, java.net.URL fileURL)
           
 boolean remove(Element element)
          Remove the specified Element from this Folder.
 void removeAll()
          Removes all children from the folder.
 void saveAll()
           
 void setShowLayoutActivator(boolean showActivator)
          Indicate whether or not the combo box used for layout activation should be shown in the toolbar.
 void setUseActiveLayoutInEditor(boolean useActiveLayoutInEditor)
          Indicate whether or not to use the active layout in the currently active editor.
 void setUseEditorPreferredLayout(boolean useEditorPreferredLayout)
          Indicate whether or not editors should use their preferred layouts.
 int size()
          Returns the current number of children in the folder.
 void update(Layout layout)
           
protected  void update(Layout layout, java.util.Iterator iter)
           
protected  void updateStartupLayout()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.model.Displayable
toString
 

Field Detail

DATA_KEY

public static final java.lang.String DATA_KEY
See Also:
Constant Field Values

LAYOUT_EXT

public static final java.lang.String LAYOUT_EXT
See Also:
Constant Field Values

DESIGN_FILENAME_BASE

public static final java.lang.String DESIGN_FILENAME_BASE
See Also:
Constant Field Values

DESIGN_FILENAME

public static final java.lang.String DESIGN_FILENAME
See Also:
Constant Field Values
Constructor Detail

Layouts

public Layouts()
Method Detail

addLayoutListener

public void addLayoutListener(java.lang.String viewName,
                              LayoutListener listener)

addStartupLayoutListener

public void addStartupLayoutListener(java.lang.String viewName,
                                     LayoutListener listener)

initialize

public void initialize()

getActiveLayout

public IdeLayout getActiveLayout()

getActiveSubLayout

public Layout getActiveSubLayout()

getActive

public Layout getActive()

activateLayout

public void activateLayout(IdeLayout layout)

activateLayout

public void activateLayout(IdeLayout layout,
                           boolean startup)

isDesignActive

public boolean isDesignActive()

activatePreferredLayout

public void activatePreferredLayout(LayoutSelector selector)

activateLayout

public void activateLayout(Layout child)

activateDefaultDesignLayout

public void activateDefaultDesignLayout()

findLayout

public Layout findLayout(java.net.URL url)

buildLayoutURL

public java.net.URL buildLayoutURL(java.lang.String baseName)
Build a layout URL using baseName as the unqualified file name. A file extension is added and the system directory is used as the parent directory.


newDesignLayout

public Layout newDesignLayout(java.net.URL url)
Creates a SimpleLayout owned by the Design layout.


newLayout

public Layout newLayout(IdeLayout parent)

newLayout

public Layout newLayout(IdeLayout parent,
                        java.net.URL fileURL)

getDesignLayout

public IdeLayout getDesignLayout()

update

public void update(Layout layout)

saveAll

public void saveAll()

getView

public View getView(ViewId id)

addView

public void addView(ViewId id,
                    View view)

getLayoutListener

public BaseLayoutListener getLayoutListener(java.lang.String type)

getShortLabel

public java.lang.String getShortLabel()
Gets a short label for display purpose.

Specified by:
getShortLabel in interface Displayable
Returns:
a short descriptive label. For example; an unqaualified file name.

getLongLabel

public java.lang.String getLongLabel()
Gets a fully qualified label for display purpose.

Specified by:
getLongLabel in interface Displayable
Returns:
a long descriptive label. For example; a fully qualified file name.

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 for this node instance

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 children.

getChildren

public java.util.Iterator 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 of any children held by this Element, else null.

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 for this node instance

getData

public java.lang.Object getData()
Gets the data object that implements this interface.

Specified by:
getData in interface Data
Returns:
object implementing this interface.

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
Returns:
a bit field specifying whether the element is:

add

public boolean add(Element element)
Remove the specified Element from this Folder.

Specified by:
add in interface Folder

remove

public boolean remove(Element element)
Remove the specified Element from this Folder.

Specified by:
remove in interface Folder
Parameters:
element - Element to be removed from this container.

canRemove

public boolean canRemove(Element element)
Description copied from interface: Folder
Other classes can call this method to determine whether the specified Element can be removed from this Folder.

Specified by:
canRemove in interface Folder
Parameters:
element - the Element being checked for removal from this folder
Returns:
TRUE if the specified element can be removed from this folder in the specified context. Quick responses are appreciated, since this method is used to enable/disable the Delete accelerator key in the Navigator with every context change.

canAdd

public boolean canAdd(Element element)
Description copied from interface: Folder
Other classes can call this method to determine whether the given Element can be added to the Folder.

Specified by:
canAdd in interface Folder
Parameters:
element - the Element that is about to be added to this Folder.
Returns:
true if the specified Element can be added to this Folder; false if the Element cannot be added.

containsChild

public boolean containsChild(Element child)
Description copied from interface: Folder
Returns true if the folder contains the specified child Element; returns false otherwise.

Specified by:
containsChild in interface Folder

size

public int size()
Description copied from interface: Folder
Returns the current number of children in the folder.

Specified by:
size in interface Folder

removeAll

public void removeAll()
Description copied from interface: Folder
Removes all children from the folder.

Specified by:
removeAll in interface Folder

isUseEditorPreferredLayout

public boolean isUseEditorPreferredLayout()
Indicates whether or not editors should used their preferred layouts.


setUseEditorPreferredLayout

public void setUseEditorPreferredLayout(boolean useEditorPreferredLayout)
Indicate whether or not editors should use their preferred layouts.


isShowLayoutActivator

public boolean isShowLayoutActivator()
Indicates whether or not the combo box used for layout activation should be shown in the toolbar.


setShowLayoutActivator

public void setShowLayoutActivator(boolean showActivator)
Indicate whether or not the combo box used for layout activation should be shown in the toolbar.


isUseActiveLayoutInEditor

public boolean isUseActiveLayoutInEditor()
Indicates whether or not to use the active layout in the currently active editor.


setUseActiveLayoutInEditor

public void setUseActiveLayoutInEditor(boolean useActiveLayoutInEditor)
Indicate whether or not to use the active layout in the currently active editor.


copyTo

public java.lang.Object copyTo(java.lang.Object target)
Description copied from interface: Copyable
Copies the internal state of this object to the specified copy. If copy is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.

Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this object's state was copied.

There is a standard implementation pattern for the copyTo method that helps avoid problems that arise when a Copyable object is subclassed. The pattern is:

public Object copyTo( Object target )
{
final <this_class> copy =
target != null ? (<this_class>) target : new <this_class>();
copyToImpl( copy );
return copy;
} protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
The parameter passed into the copyToImpl method is the same type of this class. The responsibility of copyToImpl is to copy the state of this class through direct access of the fields. The copyToImpl method should not use getters and setters since these may be overridden, causing the state of this class to be incompletely copied.

Specified by:
copyTo in interface Copyable
Parameters:
target - The target object to which the state of this object should be copied. If target is null, then the copyTo method will return a new instance of this class.
Returns:
The object to which the state of this object was copied. If the target was non-null, then the return value is the same as the target object that was passed in; otherwise, the return value is a new instance of this class.

equals

public boolean equals(java.lang.Object o)

equalsImpl

protected final boolean equalsImpl(Layouts other)

copyToImpl

protected final void copyToImpl(Layouts copy)

getBaseName

protected static java.lang.String getBaseName()

getDirectoryURL

protected static java.net.URL getDirectoryURL()

generateLayoutURL

protected java.net.URL generateLayoutURL()

close

protected void close(Layout layout)

activate

protected void activate(Layout layout,
                        java.util.HashMap listeners)

updateStartupLayout

protected void updateStartupLayout()

update

protected void update(Layout layout,
                      java.util.Iterator iter)

Extension SDK

 

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