com.ibm.carma.ui.widget
Class CARMAResourceAndContainerGroup

java.lang.Object
  extended by com.ibm.carma.ui.widget.CARMAResourceAndContainerGroup
All Implemented Interfaces:
org.eclipse.swt.widgets.Listener

public class CARMAResourceAndContainerGroup
extends java.lang.Object
implements org.eclipse.swt.widgets.Listener

A widget which allows users to select a CARMA resource in the CARMA hierarchy. The parent selection can be retrieved from the getParentContainer() method. The widget also provides a text input box to allow the user to input a resource name in addition to CARMA Resource selection.

Since:
7.0

Field Summary
static java.lang.String COPYRIGHT
           
static int PROBLEM_CONTAINER_EMPTY
           
static int PROBLEM_NONE
           
static int PROBLEM_RESOURCE_EMPTY
           
static int PROBLEM_RESOURCE_EXIST
           
 
Constructor Summary
CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Listener listener, java.lang.String resourceLabel, int resourceType)
          Creates the widget with the default height
CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Listener listener, java.lang.String resourceLabel, int resourceType, int height)
          Creates the widget
CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Listener listener, java.lang.String resourceLabel, int resourceType, int height, boolean checkNames)
          Creates the widget
 
Method Summary
 ResourceContainer getParentContainer()
          Return the container selected by the widget or null if no container is selected
 java.lang.String getProblemMessage()
          Returns an error message indicating the current problem with the value of a control in the group, or an empty message if all controls in the group contain valid values.
 int getProblemType()
          Returns the type of problem with the value of a control in the group.
 java.lang.String getResourceName()
          Returns the name of the resource as specified by the user in the widget.
 void handleEvent(org.eclipse.swt.widgets.Event event)
           
 boolean isCheckDuplicateNames()
          Returns true if the group will validate that the resource name is not duplicating an existing resource name
 boolean isControlValid()
          Returns true when all the values entered by the user are considered valid
 void setCheckDuplicateNames(boolean checkDuplicateNames)
          Set to true if the group should validate that the resource name is unique in the parent container
 void setFocus()
          Assigns the focus to the resource name field
 void setParentContainer(ResourceContainer container)
          Sets the value of the container to select in the widget display
 void setResourceName(java.lang.String newName)
          Sets the name the will be shown to the user in the resource name field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

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

PROBLEM_NONE

public static final int PROBLEM_NONE
See Also:
Constant Field Values

PROBLEM_RESOURCE_EMPTY

public static final int PROBLEM_RESOURCE_EMPTY
See Also:
Constant Field Values

PROBLEM_RESOURCE_EXIST

public static final int PROBLEM_RESOURCE_EXIST
See Also:
Constant Field Values

PROBLEM_CONTAINER_EMPTY

public static final int PROBLEM_CONTAINER_EMPTY
See Also:
Constant Field Values
Constructor Detail

CARMAResourceAndContainerGroup

public CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent,
                                      org.eclipse.swt.widgets.Listener listener,
                                      java.lang.String resourceLabel,
                                      int resourceType)
Creates the widget with the default height

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
listener - listener to notify of changes in the resource selection
resourceLabel - the label to display next to the resource name input
resourceType - type of resource the widget is querying for

CARMAResourceAndContainerGroup

public CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent,
                                      org.eclipse.swt.widgets.Listener listener,
                                      java.lang.String resourceLabel,
                                      int resourceType,
                                      int height)
Creates the widget

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
listener - listener to notify of changes in the resource selection
resourceLabel - the label to display next to the resource name input
resourceType - type of resource the widget is querying for
height - height to assign to the widget

CARMAResourceAndContainerGroup

public CARMAResourceAndContainerGroup(org.eclipse.swt.widgets.Composite parent,
                                      org.eclipse.swt.widgets.Listener listener,
                                      java.lang.String resourceLabel,
                                      int resourceType,
                                      int height,
                                      boolean checkNames)
Creates the widget

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
listener - listener to notify of changes in the resource selection
resourceLabel - the label to display next to the resource name input
resourceType - type of resource the widget is querying for
height - height to assign to the widget
checkNames - flag to indicate an error when duplicate names are detected for the given resource input
Method Detail

handleEvent

public void handleEvent(org.eclipse.swt.widgets.Event event)
Specified by:
handleEvent in interface org.eclipse.swt.widgets.Listener

getProblemMessage

public java.lang.String getProblemMessage()
Returns an error message indicating the current problem with the value of a control in the group, or an empty message if all controls in the group contain valid values.

Returns:
Error message string

getProblemType

public int getProblemType()
Returns the type of problem with the value of a control in the group.

Returns:
one of the PROBLEM_* constants

isControlValid

public boolean isControlValid()
Returns true when all the values entered by the user are considered valid

Returns:
true if the user entered values are valid

isCheckDuplicateNames

public boolean isCheckDuplicateNames()
Returns true if the group will validate that the resource name is not duplicating an existing resource name

Returns:
Returns true if duplicate name validation is turned on.

setCheckDuplicateNames

public void setCheckDuplicateNames(boolean checkDuplicateNames)
Set to true if the group should validate that the resource name is unique in the parent container

Parameters:
checkDuplicateNames - true if duplication name validation should be activated.

getResourceName

public java.lang.String getResourceName()
Returns the name of the resource as specified by the user in the widget. Returns an empty string if no resource is specified

Returns:
the name of the resource as specified by the user

setResourceName

public void setResourceName(java.lang.String newName)
Sets the name the will be shown to the user in the resource name field.

Parameters:
newName -

getParentContainer

public ResourceContainer getParentContainer()
Return the container selected by the widget or null if no container is selected

Returns:
the selected container object

setParentContainer

public void setParentContainer(ResourceContainer container)
Sets the value of the container to select in the widget display

Parameters:
container - the container that should be selected in the widget display

setFocus

public void setFocus()
Assigns the focus to the resource name field