|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.gmf.runtime.common.ui.dialogs.SelectableElement
An element that contains a hint, a serializable String ID, a String label, and an ImageDescriptor label. SeletableElements keep track of its parent which may or may not be null and a list of children which may be empty. This allows SelectableElement objects to be optionally represented in tree viewers. SelectableElements also keep track of their SelectedType, which describes if the element is selected, unselected, or set to leave. Therefore, SelectableElement objects typically correspond to elements in the UI.
This class contains public convenience methods. For eaxmple, it includes methods to find SelectableElement objects or their hints based on their String ID and a method to make copies of SelectableElement objects.
The SelectableElement class is used in at least 3 places, Show Related Elements Show Hide Relationships, and Browse Diagrams.
| Constructor Summary | |
SelectableElement(java.lang.String aName,
ImageDescriptor anIcon,
java.lang.Object aHint)
Deprecated. Use the other constructor. |
|
SelectableElement(java.lang.String anID,
java.lang.String aName,
ImageDescriptor anIcon,
java.lang.Object aHint)
Constructor to make a new SelectableElement. |
|
| Method Summary | |
void |
addChild(SelectableElement element)
Adds a child to this element |
static void |
addHintsToList(java.util.List list,
SelectableElement selectableElement)
Recursively add this SelectableElement's and this SelectableElement's children's hints to a List which is not null. |
static int |
calculateLongestStringLength(SelectableElement selectableElement,
Control control)
Calculates the longest string length of this element's children for the text that will be displayed in the control. |
static int |
calculateNumberOfChildren(SelectableElement selectableElement)
Returns the number of children including itself. |
static boolean |
doAllChildrenHaveSelectedType(SelectableElement parent,
SelectedType selectType)
Returns if all children have the same selected type |
static SelectableElement |
findById(java.util.List selectableElements,
java.lang.String id)
Return the first element that matches the given id from the List of SelectableElement objects |
SelectableElement |
findById(java.lang.String theId)
Return the first element that matches the given id from this SelectableElement and its children |
static void |
getAllChildrenOfType(SelectableElement parent,
SelectedType selectType,
java.util.List list)
Return all children that have the SelectedType. |
void |
getAllHints(java.util.Set hints)
Retrieve all hints for the subtree rooted at this selectable element. |
SelectableElement |
getChild(int i)
Returns a child |
SelectableElement[] |
getChildren()
Returns the children of this element as an array |
java.lang.Object |
getHint()
Returns the hint, which is an Object. |
void |
getHints(java.util.List stringRepresentations,
java.util.Set hints)
Retrieves all of the hints from the list of selections. |
void |
getHintsThatMatchTheseIds(java.util.List list,
java.util.List ids)
Collect the types that match a list of String ids. |
ImageDescriptor |
getIconImageDescriptor()
Returns the icon of this element to display to the user. |
java.lang.String |
getId()
Returns a string representation of this selectable element. |
java.util.List |
getLeaveElementTypes()
Returns a list of LEAVE RelationshipTypes for a SelectableElement. |
java.lang.String |
getName()
Returns the name of this element to display to the user. |
int |
getNumberOfChildren()
Returns the number of children |
SelectableElement |
getParent()
Returns the parent of this element. |
java.util.List |
getSelectedElementIds()
Return element IDs, including children, that are SelectedType.SELECTED. |
java.util.List |
getSelectedElementTypes()
Returns a list of SELECTED RelationshipTypes for a SelectableElement. |
SelectedType |
getSelectedType()
Returns if the element was selected. |
java.util.List |
getUnSelectedElementTypes()
Returns a list of UNSELECTED RelationshipTypes for a SelectableElement. |
SelectableElement |
makeCopy()
Same idea as the clone method. |
void |
removeAllChildren()
Remove all children of this SelectableElement |
void |
setIconImageDescriptor(ImageDescriptor anIcon)
Sets the icon of this element to display to the user. |
void |
setName(java.lang.String aName)
Sets the name of this element to display to the user. |
void |
setParent(SelectableElement aParent)
Sets the parent of this element. |
void |
setSelectedType(SelectedType aSelectedType)
Sets whether or not the element is selected. |
static void |
setSelectedTypeForMatchingSelecteableElementAndChildren(SelectableElement parent,
SelectedType selectedType,
java.util.List list)
Sets the SelectedType for a SelectableElement and its children that match the IDs in the List of IDs. |
static void |
setSelectedTypeForSelecteableElementAndChildren(SelectableElement parent,
SelectedType selectedType)
Sets the SelectedType for a SelectableElement and its children |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SelectableElement(java.lang.String aName,
ImageDescriptor anIcon,
java.lang.Object aHint)
aName - the String name of the elementanIcon - the icon Image for the elementaHint - the element type
public SelectableElement(java.lang.String anID,
java.lang.String aName,
ImageDescriptor anIcon,
java.lang.Object aHint)
anID - A non-language specific unique identifier for this selectable
element.aName - A user-presentable name for this selectable element.anIcon - The icon image for the element.aHint - A hint associated with the selection of this element.| Method Detail |
public void addChild(SelectableElement element)
element - the child to addpublic void removeAllChildren()
public int getNumberOfChildren()
public SelectableElement getChild(int i)
i - with the index of the child of this element
public ImageDescriptor getIconImageDescriptor()
public java.lang.String getName()
public void setIconImageDescriptor(ImageDescriptor anIcon)
anIcon - The icon to setpublic void setName(java.lang.String aName)
aName - The name to setpublic SelectableElement getParent()
public void setParent(SelectableElement aParent)
aParent - The parent to setpublic SelectableElement[] getChildren()
public SelectedType getSelectedType()
public void setSelectedType(SelectedType aSelectedType)
aSelectedType - from the SelectedType EnumeratedTypepublic java.lang.Object getHint()
public static void setSelectedTypeForSelecteableElementAndChildren(SelectableElement parent,
SelectedType selectedType)
parent - sets the SelectedType for this SelectableElementselectedType - the SelectedType to set for the SelectableElement and its
children.
public static void setSelectedTypeForMatchingSelecteableElementAndChildren(SelectableElement parent,
SelectedType selectedType,
java.util.List list)
parent - sets the SelectedType for this SelectableElementselectedType - the SelectedType to set for the SelectableElement and its
children.list - List of IDs, not hints
public static int calculateLongestStringLength(SelectableElement selectableElement,
Control control)
selectableElement - the SelectableElement to calculate the longest string length.
Also looks at its children.control - the control with the font to use when calculating the font
size
public static int calculateNumberOfChildren(SelectableElement selectableElement)
selectableElement - the SelectableElement that we will find the number of children
for.
public java.util.List getSelectedElementTypes()
public java.util.List getUnSelectedElementTypes()
public java.util.List getLeaveElementTypes()
public java.lang.String getId()
public void getHints(java.util.List stringRepresentations,
java.util.Set hints)
stringRepresentations - Strings produced by the SelectableElement.getId()
method.hints - (out) A set used to store all of the hints.public void getAllHints(java.util.Set hints)
hints - (out) A set used to store all of the hints.
public static void addHintsToList(java.util.List list,
SelectableElement selectableElement)
list - not null, add hints to this ListselectableElement - recursively add hints from this SelectableElement and its
children
public static boolean doAllChildrenHaveSelectedType(SelectableElement parent,
SelectedType selectType)
parent - we'll be checking the children of this parentselectType - the SelectedType that all children of the parent are checked
for
public static void getAllChildrenOfType(SelectableElement parent,
SelectedType selectType,
java.util.List list)
parent - parent selectable element.selectType - the selected type to matchlist - of SelectableElementspublic java.util.List getSelectedElementIds()
public SelectableElement makeCopy()
public void getHintsThatMatchTheseIds(java.util.List list,
java.util.List ids)
list - List to add intoids - List of String ids we are trying to match
public static SelectableElement findById(java.util.List selectableElements,
java.lang.String id)
selectableElements - List of SelectableElement objects to matchid - String id to match
public SelectableElement findById(java.lang.String theId)
theId - String id to match
|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.