Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.jdevimpl.audit.profile
Class AuditProfilePanel

java.lang.Object
  extended by oracle.jdevimpl.audit.profile.AuditProfilePanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.swing.event.ChangeListener, javax.swing.event.ListDataListener, ApplyListener, Traversable

public class AuditProfilePanel
extends java.lang.Object
implements java.awt.event.ActionListener, ApplyListener, javax.swing.event.ChangeListener, javax.swing.event.ListDataListener, Traversable

The Audit and Metrics profile panel. This panel allows a user to view, create, edit, and delete audit and metrics profiles. A profile is a set of properties for all the rules or all the metrics registered with Audit. Profiles are saved in the IDE system directory and are known to users by their simple name.

This panel has a profile combobox and Save As and Delete buttons at the top. The combobox allows the user to select which profile to view or modify. Once the user modifies a profile, the combobox shows blank as the profile name, until the modifications are saved or deleted using the Save As or Delete buttons.

The contents of the selected profile are shown below the combobox: the rules or metrics are shown in a tree; the editable properties and an explanation of the selected rule or metric are shown in an adjoining property sheet and text area. The main players in keeping these views current are the following:

The profile repository maintains Profile instances corresponding to the saved profiles. This panel lets the repository be the keeper of those instances and holds only one Profile instance itself:

When the combo box selection changes, the profile panel resets the profile in the profile model to (a copy of) the selected profile. The profile model doesn't actually hold any objects from a profile, but holds names instead and retrieves categories, rules, and metrics from the current profile only as needed. This means that the tree nodes do not change when the profile changes; however, the tree must be repainted (because enabled properties might have changed) and the text area and property inspector must be reset (because they depend on the actual objects in the profile, not the names in the profile model).

When the tree selection changes, the profile panel resets the text of the text area and the object edited by the property inspector, and makes itself a listener to the edited object (removing itself as a listener to the previously edited object).

When a property changes, the profile panel clears the profile name and ensures that the unnamed profile is selected in the repository model.

When the profile panel is hidden, it saves the unnamed profile to be restored when the panel is next shown.

See Also:
ProfileModel, Profile

Constructor Summary
AuditProfilePanel()
           
AuditProfilePanel(ProfileModel model)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Reports that the Save As or Delete button was clicked.
 void apply(ApplyEvent e)
          This method is called when the changes made in the NavigableUIContainer are to be committed to the original data structures.
 void cancel(ApplyEvent e)
          This method is called when the changes made in the NavigableUIContainer are to be discarded.
 void contentsChanged(javax.swing.event.ListDataEvent event)
          Reports that the selection changed in the combobox (index of -1) or that an attribute of a particular profile changed.
protected  java.awt.Component createComponent()
           
 java.awt.Component getComponent()
          Normally, the Traversable class will itself be the UI Component.
 java.lang.Object getExitTransition()
          Returns the exit transition that can be used by a Traversable-aware wizard.
 java.lang.String getHelpID()
          Returns the context-sensitive help topic ID to use for this Traversable.
 void intervalAdded(javax.swing.event.ListDataEvent event)
          Reports that a profile was added to the combobox.
 void intervalRemoved(javax.swing.event.ListDataEvent event)
          Reports that a profile was removed from the combobox.
 boolean isAllowsManagement()
           
 void onEntry(TraversableContext context)
          This method is called when the Traversable is being entered.
 void onExit(TraversableContext context)
          This method is called when the Traversable is being exited.
 void setAllowsManagement(boolean allowsManagement)
           
 Profile show()
          Shows a modal dialog using this panel and returns the selected profile, or null if none was selected.
 Profile show(java.awt.Component parent)
          Shows a modal dialog using this panel and returns the selected profile, or null if none was selected.
 void stateChanged(javax.swing.event.ChangeEvent event)
          Reports the selected subpanel changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuditProfilePanel

public AuditProfilePanel()

AuditProfilePanel

public AuditProfilePanel(ProfileModel model)
Method Detail

isAllowsManagement

public boolean isAllowsManagement()

setAllowsManagement

public void setAllowsManagement(boolean allowsManagement)

show

public Profile show(java.awt.Component parent)
Shows a modal dialog using this panel and returns the selected profile, or null if none was selected.

Returns:
The selected profile, or null if none.

show

public Profile show()
Shows a modal dialog using this panel and returns the selected profile, or null if none was selected.

Returns:
The selected profile, or null if none.

onEntry

public void onEntry(TraversableContext context)
Description copied from interface: Traversable
This method is called when the Traversable is being entered. The data that the Traversable should use to populate its UI components comes from the specified TraversableContext.

When the same Traversable is entered more than once in the course of interacting with the user, the Traversable needs to reload the data directly from the TraversableContext rather than caching data objects. Some reasons for this include:

Loading data directly from the TraversableContext is the best way to ensure that the Traversable will not be editing the wrong data.

The Traversable should not even cache references to data objects between invocations of onEntry and Traversable.onExit(TraversableContext) because the UI container is not required to guarantee that the references will be identical.

Specified by:
onEntry in interface Traversable
Parameters:
context - The data wrapper where the Traversable locates the data that it needs to populate the UI.

onExit

public void onExit(TraversableContext context)
            throws TraversalException
Description copied from interface: Traversable
This method is called when the Traversable is being exited. At this point, the Traversable should copy the data from its associated UI back into the data structures in the TraversableContext.

If the Traversable should not be exited because the user has entered either incomplete, invalid, or inconsistent data, then this method can throw a TraversalException to indicate to the property dialog or wizard that validation failed and that the user should not be allowed to exit the current Traversable. Refer to the TraversalException javadoc for details on passing the error message that should be shown to the user.

Specified by:
onExit in interface Traversable
Parameters:
context - The data object where changes made in the UI should be copied so that the changes can be accessed by other Traversables.
Throws:
TraversalException - if the user has entered either incomplete, invalid, or inconsistent data. This exception prevents the property dialog or wizard from continuing and forces the user to stay on the current Traversable until the data entered is valid or the user cancels. The exception class itself is capable of carrying an error message that will be shown to the user. Refer to its javadoc for details.

apply

public void apply(ApplyEvent e)
Description copied from interface: ApplyListener
This method is called when the changes made in the NavigableUIContainer are to be committed to the original data structures. This normally occurs when the user pushes the "OK", "Apply", or "Finish" button.

This method is called as soon as the user's action is recognized. Typically, if the NavigableUIContainer is editing a copy of the original data, there will be an ApplyListener registered that is responsible for flushing the changes from the edited data copy back to the original data structure. The API in the oracle.ide.panels package does not specify when such an ApplyListener is registered or whether one is registered at all.

If you are writing code that must depend on the registration order of such an ApplyListener, you will need to consult the documentation for the code that instantiates the NavigableUIContainer to determine if the registration order for ApplyListeners is specified there.

Specified by:
apply in interface ApplyListener
Parameters:
e - The ApplyEvent that provides contextual information about when the ApplyEvent was fired.

cancel

public void cancel(ApplyEvent e)
Description copied from interface: ApplyListener
This method is called when the changes made in the NavigableUIContainer are to be discarded. This normally occurs when the user pushes the "Cancel" button.

No data validation occurs when the user cancels, and the NavigableUIContainer may or may not call the onExit method of the currently showing Traversable. In general, onExit will not be called.

Specified by:
cancel in interface ApplyListener
Parameters:
e - The ApplyEvent that provides contextual information about when the ApplyEvent was fired.

getExitTransition

public java.lang.Object getExitTransition()
Description copied from interface: Traversable
Returns the exit transition that can be used by a Traversable-aware wizard. The wizard can use the exit transition to direct the user through an alternate or streamlined set of panels based on their current input.

If the Traversable implementation does not support multiple exit transitions or is not used in a wizard, then this method should just return null.

Specified by:
getExitTransition in interface Traversable
Returns:
The exit transition for the Traversable that is used by dynamic interview-style wizards to determine the next course of action. A Traversable class that does not support multiple possible transitions should just return null.

createComponent

protected java.awt.Component createComponent()

getComponent

public java.awt.Component getComponent()
Description copied from interface: Traversable
Normally, the Traversable class will itself be the UI Component. Therefore, getComponent() typically just returns this. In this situation the getComponent() method then is simply a means of avoiding a type cast.

In other cases, it would be useful to have the ability to return a different Component based on the contents of the TraversableContext that is passed to the Traversable.onEntry(TraversableContext) method. UI containers (e.g. property dialogs and wizards) that are designed to use the Traversable interface must call the Traversable.onEntry(TraversableContext) method before calling getComponent(). This allows a Traversable implementation to have the opportunity to configure the UI Component or even create a new one before it is displayed.

In either situation, the implementation should strive to return the same Component instance as often as possible rather than creating a new instance becaues the UI container will call this method frequently.

Specified by:
getComponent in interface Traversable
Returns:
The UI Component that the user interacts with for creating or editing an object.

getHelpID

public java.lang.String getHelpID()
Description copied from interface: Traversable
Returns the context-sensitive help topic ID to use for this Traversable. A null return value means that the Traversable implementation doesn't specify a help topic ID. However, there are other ways that a help topic ID could get associated with a Traversable.

Specifically, when a Traversable instance is created by a MetaTraversable such as Step or Navigable in the context of a Navigable container such as MDDPanel, TabbedPanel or FSMWizard, the help ID is searched according to the following order:

  1. MetaTraversable.getHelpID()
  2. Traversable.getHelpID(). This may lead into a recursion if the Traversable's Component is a nested Navigable container.
  3. oracle.bali.ewt.help.HelpUtils.getHelpID( Traversable.getComponent() )
  4. oracle.bali.ewt.help.HelpUtils.getHelpID(...) on the Navigable container itself.
  5. null
The search returns the first non-null help ID encountered or else null if all possible sources of a help ID returned null.

Since a Navigable wraps a Traversable, and a Traversable wraps a Component, the priority order for determining the help ID is based on giving the outer-most wrapper the opportunity to override. The Navigable container has the lowest priority because containers such as MDDPanel, TabbedPanel, and FSMWizard don't normally have a help topic ID of their own, since help topics tend to be on a per page basis.

For most cases the recommended approach is to have the Traversable specify the help ID. However, when the same Traversable can be used in different contexts, then specifying or overriding the help ID from the MetaTraversable could be better, especially if that avoids the need for conditional logic in Traversable.getHelpID(). If no dynamic behavior is needed in determining the help ID, then the implementation can probably just subclass DefaultTraversablePanel and call the DefaultTraversablePanel.setHelpID(String) method from the subclass constructor.

The getHelpID() method is called only when the user requests help, so the actual help ID may be determined dynamically (e.g. return a different ID depending on the state of the UI).

Specified by:
getHelpID in interface Traversable

intervalAdded

public void intervalAdded(javax.swing.event.ListDataEvent event)
Reports that a profile was added to the combobox.

Specified by:
intervalAdded in interface javax.swing.event.ListDataListener

intervalRemoved

public void intervalRemoved(javax.swing.event.ListDataEvent event)
Reports that a profile was removed from the combobox.

Specified by:
intervalRemoved in interface javax.swing.event.ListDataListener

contentsChanged

public void contentsChanged(javax.swing.event.ListDataEvent event)
Reports that the selection changed in the combobox (index of -1) or that an attribute of a particular profile changed. In the latter case, the combo box will repaint due to the event, and the renderer will adjust as necessary (e.g., to add or remove the " (Modified}" suffix from the label).

Specified by:
contentsChanged in interface javax.swing.event.ListDataListener

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent event)
Reports the selected subpanel changed.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Reports that the Save As or Delete button was clicked.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

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