ilog.views.appframe.swing
Class IlvMenuCompletion

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by ilog.views.appframe.swing.IlvMenuCompletion
All Implemented Interfaces:
Serializable, UndoableEdit

public class IlvMenuCompletion
extends CompoundEdit

Defines objects that modify menu bars and toolbars by adding or removing menu items and buttons.
Typically, when a new document becomes active within an Application Framework application, menu items associated with actions that this document can process are added to the main menu and toolbar. This is done by the document template of the document, using an instance of the IlvMenuCompletion class.

A menu completion is a Swing undoable edit. Its completeMenus(java.lang.Object[]) method brings modifications to a set of menu bars and toolbars, while its CompoundEdit.undo() method restores their state before they were modified. The redo() method reapplies the modifications to the menu bar and toolbars.

A menu completion edit is a compound edit that performs a set of elementary menu edits. Each of these edits can perform one of the following tasks:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
IlvMenuCompletion()
          Constructs a new IlvMenuCompletion.
 
Method Summary
 boolean canRedo()
          Determines whether the menu completion can complete the menu bars and toolbars again.
 boolean canUndo()
          Determines whether the menu completion can remove the changes its has made on menu bars and toolbars when invoking the method completeMenus(java.lang.Object[]).
 boolean completeMenus(Object[] components)
          Completes the specified menu bars and toolbars.
 IlvApplication getApplication()
          Gets the application associated with this menu completion.
 String getSettingsName()
          Returns the name of the the settings root node that defines the menu completion into settings.
 String getSettingsPath()
          Returns the settings path that locates the root settings node defining the menu completion into settings.
 boolean readSettings(IlvSettings settings)
          Reads the definition of the menu completion from the specified settings.
 boolean readSettings(IlvSettingsElement element)
          Reads the definition of the menu completion into the specified settings element.
 void redo()
          Reapplies the menu completions.
 void setApplication(IlvApplication application)
          Sets the application to associate with this menu completion.
 void setSettingsName(String name)
          Sets the name of the settings node that defines the menu completion into settings.
 void setSettingsPath(String settingsPath)
          Sets the settings path that locates the root settings node defining the menu completion into settings.
 
Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, isSignificant, lastEdit, toString, undo
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvMenuCompletion

public IlvMenuCompletion()
Constructs a new IlvMenuCompletion.

Method Detail

completeMenus

public boolean completeMenus(Object[] components)
Completes the specified menu bars and toolbars.

Parameters:
components - The set of menu bars and toolbars to apply menu completion to.
Returns:
true if all the modifications can be performed; false otherwise. For example, the modifications can fail if component keys specified in the menu completion definition do not correspond to existing components in the specified menus or toolbars.

readSettings

public boolean readSettings(IlvSettings settings)
Reads the definition of the menu completion from the specified settings. To retrieve the root settings node that defines the menu completion, the settings path given by the method getSettingsPath() is used.

Parameters:
settings - The settings to extract the menu completion definition from.
Returns:
true if the menu completion could be read successfully; false, if the settings path is not correct.
See Also:
readSettings(IlvSettingsElement)

readSettings

public boolean readSettings(IlvSettingsElement element)
Reads the definition of the menu completion into the specified settings element.

Returns:
true if the menu completion could be read successfully; false otherwise.
See Also:
readSettings(IlvSettings)

getSettingsPath

public String getSettingsPath()
Returns the settings path that locates the root settings node defining the menu completion into settings.

Returns:
The settings path.
See Also:
setSettingsPath(java.lang.String)

setSettingsPath

public void setSettingsPath(String settingsPath)
Sets the settings path that locates the root settings node defining the menu completion into settings.

Parameters:
settingsPath - The new settings path of the menu completion.
See Also:
getSettingsPath()

getSettingsName

public String getSettingsName()
Returns the name of the the settings root node that defines the menu completion into settings.

Returns:
The settings name.
See Also:
setSettingsName(java.lang.String), getSettingsPath()

setSettingsName

public void setSettingsName(String name)
Sets the name of the settings node that defines the menu completion into settings. Setting a new name creates a new corresponding settings path that selects an element of type "menuCompletion" and of the same name as the specified name.

Parameters:
name - The new settings name of the menu completion.
See Also:
getSettingsName(), getSettingsPath()

getApplication

public IlvApplication getApplication()
Gets the application associated with this menu completion.


setApplication

public void setApplication(IlvApplication application)
Sets the application to associate with this menu completion.


redo

public void redo()
Reapplies the menu completions.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class CompoundEdit

canRedo

public boolean canRedo()
Determines whether the menu completion can complete the menu bars and toolbars again.

Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class CompoundEdit
Returns:
true if the menu completion was previously undone with a call to CompoundEdit.undo(); false otherwise.

canUndo

public boolean canUndo()
Determines whether the menu completion can remove the changes its has made on menu bars and toolbars when invoking the method completeMenus(java.lang.Object[]).

Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class CompoundEdit
Returns:
true if the menu completion was previously applied with the completeMenus(java.lang.Object[]) method; false otherwise.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.