com.japisoft.xmlpad
Class ToolBarModel

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

public class ToolBarModel
extends java.lang.Object

Here a data model for the main toolbar, this data model handles Actions. It is possible to dynamically add or remove toolbar actions. This data model is available inside the XMLContainer. This is only need when you want to customize a toolBar for an editing context.

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

Version:
1.3
Author:
(c) 2002 JAPISoft / A.Brillant
See Also:
XMLAction, com.japiosft.xmlpad.action.ActionModel, ToolBarModelListener

Constructor Summary
ToolBarModel(XMLContainer container)
           
 
Method Summary
 void addAction(javax.swing.Action a)
          Add a new Swing Action or XMLAction.
 void addSeparator()
          Add a separator
 void addToolBarModelListener(ToolBarModelListener listener)
          Add a new listener for the toolbar update
 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)
          Remove the a action
 void removeAction(javax.swing.Action a, boolean definitly)
          Remove a swing Action or XMLAction.
 void removeSeparator(int location)
          Remove a separator at the location
 void removeToolBarModelListener(ToolBarModelListener listener)
          Remove a listener for the toolbar update
static void resetToolBarModel(ToolBarModel model)
          Reset the toolBar model to include all action (Toolbarable) from the ActionModel
 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

ToolBarModel

public ToolBarModel(XMLContainer container)
Method Detail

dispose

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


addToolBarModelListener

public void addToolBarModelListener(ToolBarModelListener listener)
Add a new listener for the toolbar update


removeToolBarModelListener

public void removeToolBarModelListener(ToolBarModelListener 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 Swing Action or XMLAction. In the last case the notifyContainer will be called


removeAction

public void removeAction(javax.swing.Action a,
                         boolean definitly)
Remove a swing Action or XMLAction. If definitly is true then if a is a XMLAction, the dispose method will be called


removeAction

public void removeAction(javax.swing.Action a)
Remove the a action


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

resetToolBarModel

public static void resetToolBarModel(ToolBarModel model)
Reset the toolBar model to include all action (Toolbarable) from the ActionModel