net.xoetrope.swt
Class XToolItem

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Item
          extended by org.eclipse.swt.widgets.ToolItem
              extended by net.xoetrope.swt.XToolItem
All Implemented Interfaces:
XActionable, XAttributedComponent, XModelHolder

public class XToolItem
extends org.eclipse.swt.widgets.ToolItem
implements XActionable, XAttributedComponent, XModelHolder

Draws a coolitem

Copyright (c) Xoetrope Ltd., 1998-2003

License: see license.txt $Revision: 2.18 $


Field Summary
protected  org.eclipse.swt.widgets.Menu menu
           
protected  XModel model
           
protected  XToolBar tb
           
 
Constructor Summary
XToolItem(XToolBar parent, int style)
          Constructs a new toolitem for a toolbar
 
Method Summary
protected  void checkSubclass()
          Suppress the subclassing exception
 org.eclipse.swt.widgets.Menu getMenu()
           
 XModel getModel()
          Get the model
 java.lang.String getText(XModel xmodel, int i)
          Get the appropriate text inside the model
 void setAction(java.lang.Object action)
          Set an Action for the toolitem - does nothing
 int setAttribute(java.lang.String attribName, java.lang.Object attribValue)
          Set one or more attributes of the component.
 void setModel(XModel xmodel)
          Set the XModel which we will be generating the toolitem dropdown from
 void update()
          Update the toolitem dropdown
 
Methods inherited from class org.eclipse.swt.widgets.ToolItem
addSelectionListener, getBounds, getControl, getDisabledImage, getEnabled, getHotImage, getParent, getSelection, getToolTipText, getWidth, isEnabled, removeSelectionListener, setControl, setDisabledImage, setEnabled, setHotImage, setImage, setSelection, setText, setToolTipText, setWidth
 
Methods inherited from class org.eclipse.swt.widgets.Item
getImage, getText
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

menu

protected org.eclipse.swt.widgets.Menu menu

model

protected XModel model

tb

protected final XToolBar tb
Constructor Detail

XToolItem

public XToolItem(XToolBar parent,
                 int style)
Constructs a new toolitem for a toolbar

Parameters:
parent - parent toolbar
style - the style
Method Detail

checkSubclass

protected void checkSubclass()
Suppress the subclassing exception

Overrides:
checkSubclass in class org.eclipse.swt.widgets.ToolItem

setAction

public void setAction(java.lang.Object action)
Set an Action for the toolitem - does nothing

Specified by:
setAction in interface XActionable
Parameters:
action - the action object

setAttribute

public int setAttribute(java.lang.String attribName,
                        java.lang.Object attribValue)
Set one or more attributes of the component.

Specified by:
setAttribute in interface XAttributedComponent
Parameters:
attribName - the name of the attribute
attribValue - the value of the attribute
Returns:
0 for success, non zero for failure or to require some further action

setModel

public void setModel(XModel xmodel)
Set the XModel which we will be generating the toolitem dropdown from

Specified by:
setModel in interface XModelHolder
Parameters:
xmodel - the XModel of data

getModel

public XModel getModel()
Get the model


update

public void update()
Update the toolitem dropdown

Specified by:
update in interface XModelHolder

getMenu

public org.eclipse.swt.widgets.Menu getMenu()

getText

public java.lang.String getText(XModel xmodel,
                                int i)
Get the appropriate text inside the model

Parameters:
xmodel - parent model
i - index of the children
Returns:
the text