com.japisoft.xmlpad
Class PopupModel

java.lang.Object
  extended bycom.japisoft.xmlpad.PopupModel

public class PopupModel
extends java.lang.Object

This popup is available inside the XMLContainer. It is responsable to maintain a separate collection of XMLAction. This is useful to alter it when you want to add or remove an XMLAction in a particular editing context,then the popup will be dynamically updated.

If you want to add common action, use the ActionModel not this model

If is adviced to user not to use their own swing Action but rather XMLAction for commodity

Author:
(c) 2003 JAPISOFT / A.Brillant
See Also:
XMLAction, com.japiosft.xmlpad.action.ActionModel, ToolBarModelListener

Constructor Summary
PopupModel(XMLContainer container)
           
 
Method Summary
 void addAction(javax.swing.Action a)
          Add a new action.
 void addPopupModelListener(PopupModelListener listener)
          Add a new listener for the popup update
 void addSeparator()
          Add a separator
 void dispose()
          Only when the container is disposed.
 javax.swing.Action getActionAt(int location)
           
 void insertActionAt(javax.swing.Action a, int location)
          Insert an action for the location
 void insertSeparatorAt(int location)
          Insert a separator at the location
 boolean isAction(int location)
           
 boolean isSeparator(int location)
           
 void removeAction(javax.swing.Action a)
           
 void removeAction(javax.swing.Action a, boolean definitly)
          Remove an action or XMLAction.
 void removePopupModelListener(PopupModelListener listener)
          Remove a listener for the toolbar update
 void removeSeparator(int location)
          Remove a separator at the location
static void resetPopupModel(PopupModel model)
          Reset the popup model to include all action (Popable) from the ActionModel
static void resetTreePopupModel(PopupModel model)
          Reset this popup model to include all tree popable action from the ActionModel tree group.
 void setEnabledListener(boolean enable)
          Enable "real time" notification
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopupModel

public PopupModel(XMLContainer container)
Method Detail

dispose

public void dispose()
Only when the container is disposed. User shouldn't call it


addPopupModelListener

public void addPopupModelListener(PopupModelListener listener)
Add a new listener for the popup update


removePopupModelListener

public void removePopupModelListener(PopupModelListener listener)
Remove a listener for the toolbar update


setEnabledListener

public void setEnabledListener(boolean enable)
Enable "real time" notification


size

public int size()
Returns:
the number of action

addAction

public void addAction(javax.swing.Action a)
Add a new action. User can add new XMLAction here. In the last case a notifyContainer will be called with the current XMLContainer


removeAction

public void removeAction(javax.swing.Action a,
                         boolean definitly)
Remove an action or XMLAction. I the last case, the current XMLContainer and XMLEditor will be disposed calling dispose on the XMLAction

Parameters:
a - Action to be removed
definitly - Call the dispose method on XMLAction if true

removeAction

public void removeAction(javax.swing.Action a)

insertActionAt

public void insertActionAt(javax.swing.Action a,
                           int location)
Insert an action for the location


getActionAt

public javax.swing.Action getActionAt(int location)
Returns:
an action for the location

isAction

public boolean isAction(int location)
Returns:
true if an action is available for the location

addSeparator

public void addSeparator()
Add a separator


insertSeparatorAt

public void insertSeparatorAt(int location)
Insert a separator at the location


removeSeparator

public void removeSeparator(int location)
Remove a separator at the location


isSeparator

public boolean isSeparator(int location)
Returns:
true if a separator is available for the location

resetPopupModel

public static void resetPopupModel(PopupModel model)
Reset the popup model to include all action (Popable) from the ActionModel


resetTreePopupModel

public static void resetTreePopupModel(PopupModel model)
Reset this popup model to include all tree popable action from the ActionModel tree group.