org.eclipse.swt.nebula.widgets.cdatetime
Class AbstractCombo

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.nebula.widgets.cdatetime.AbstractCombo
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
CDateTime

public abstract class AbstractCombo
extends org.eclipse.swt.widgets.Composite

The AbstractCombo is an abstract class which provides the basic functionality for a button with a DROP_DOWN, or "popup", shell component. When the user selects the button the shell is set visible and the SWT Components which have been placed on the "content" Composite will be shown.


Field Summary
static boolean carbon
          true if the platform is carbon, false otherwise
static boolean gtk
          true if the platform is gtk, false otherwise
static boolean win32
          true if the platform is win32, false otherwise
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
AbstractCombo(org.eclipse.swt.widgets.Composite parent, int style)
           
 
Method Summary
 void addModifyListener(org.eclipse.swt.events.ModifyListener listener)
          Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in the ModifyListener interface.
 void addTraverseListener(org.eclipse.swt.events.TraverseListener listener)
           
 org.eclipse.swt.widgets.Menu getMenu()
          returns the menu for the Text widget of this DropCombo
 int getStyle()
           
 java.lang.String getText()
           
 boolean isOpen()
          returns the state of the popup shell's visibility
 void removeModifyListener(org.eclipse.swt.events.ModifyListener listener)
          Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.
 void removeTraverseListener(org.eclipse.swt.events.TraverseListener listener)
           
 void setButtonVisibility(int visibility)
          Set the visibility style of the drop button.
 void setButtonVisible(boolean visible)
          Set the visible state of the button
 void setEditable(boolean editable)
           
 void setEnabled(boolean enabled)
           
 boolean setFocus()
           
 void setFont(org.eclipse.swt.graphics.Font font)
           
 void setHoldOpen(boolean holdOpen)
          if holdOpen is true, the popup shell will not close regardless of events and/or calls to popUp(false) until holdOpen is first set false
 void setMenu(org.eclipse.swt.widgets.Menu menu)
          Sets the menu for the Text widget of this DropCombo
 void setOpen(boolean open)
          If pop is true, then opens the popup shell (sets to visible)
If pop is false, closes the popup shell (sets to not visible)
If content == null this method simply returns.
If popup == null then popup will be created.
 void setRedraw(boolean redraw)
           
 void setStretch(boolean stretch)
          If stretch is false, then the width of the popup will be set to its preferred width (via computeSize(SWT.DEFAULT, SWT.DEFAULT))
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setForeground, setLayoutData, setLocation, setLocation, setParent, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, dispose, getData, getData, getDisplay, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

carbon

public static final boolean carbon
true if the platform is carbon, false otherwise


gtk

public static final boolean gtk
true if the platform is gtk, false otherwise


win32

public static final boolean win32
true if the platform is win32, false otherwise

Constructor Detail

AbstractCombo

public AbstractCombo(org.eclipse.swt.widgets.Composite parent,
                     int style)
Method Detail

addModifyListener

public void addModifyListener(org.eclipse.swt.events.ModifyListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in the ModifyListener interface.

Note: event.data will hold implementation specific data
ie: CDateTime places its current Date object here


Parameters:
listener - the listener which should be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ModifyListener, removeModifyListener(org.eclipse.swt.events.ModifyListener)

addTraverseListener

public void addTraverseListener(org.eclipse.swt.events.TraverseListener listener)
Overrides:
addTraverseListener in class org.eclipse.swt.widgets.Control

getMenu

public org.eclipse.swt.widgets.Menu getMenu()
returns the menu for the Text widget of this DropCombo

Overrides:
getMenu in class org.eclipse.swt.widgets.Control

getStyle

public int getStyle()
Overrides:
getStyle in class org.eclipse.swt.widgets.Widget

getText

public java.lang.String getText()

isOpen

public boolean isOpen()
returns the state of the popup shell's visibility


setOpen

public void setOpen(boolean open)
If pop is true, then opens the popup shell (sets to visible)
If pop is false, closes the popup shell (sets to not visible)
If content == null this method simply returns.
If popup == null then popup will be created.

Parameters:
open -

removeModifyListener

public void removeModifyListener(org.eclipse.swt.events.ModifyListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.

Parameters:
listener - the listener which should no longer be notified
Throws:
java.lang.IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ModifyListener, addModifyListener(org.eclipse.swt.events.ModifyListener)

removeTraverseListener

public void removeTraverseListener(org.eclipse.swt.events.TraverseListener listener)
Overrides:
removeTraverseListener in class org.eclipse.swt.widgets.Control

setButtonVisibility

public void setButtonVisibility(int visibility)
Set the visibility style of the drop button.

The style will be forced to NEVER if the contents are null

Styles:
ALWAYS, AUTO, MANUAL, NEVER
Style ALWAYS:
Button will always be shown - standard SWT.DROP_DOWN behaviour. The method setButtonVisible(boolean) has no affect with this style set
Style AUTO:
Button visibility will be handled automatically through focus events, popup events, as well as programmatically
Style MANUAL:
Button visibility will only be handled programmatically
Style NEVER:
Button will never be shown - standard SWT.SIMPLE behaviour. The method setButtonVisible(boolean) has no affect with this style set

Parameters:
visibility - the visibility style constant
See Also:
setButtonVisible(boolean)

setButtonVisible

public void setButtonVisible(boolean visible)
Set the visible state of the button

Note: This method is only useful when the button's visibility style is either AUTO or MANUAL.

Parameters:
visible -
See Also:
setButtonVisibility(int)

setEditable

public void setEditable(boolean editable)

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class org.eclipse.swt.widgets.Control

setFocus

public boolean setFocus()
Overrides:
setFocus in class org.eclipse.swt.widgets.Composite

setFont

public void setFont(org.eclipse.swt.graphics.Font font)
Overrides:
setFont in class org.eclipse.swt.widgets.Control

setHoldOpen

public void setHoldOpen(boolean holdOpen)
if holdOpen is true, the popup shell will not close regardless of events and/or calls to popUp(false) until holdOpen is first set false

merely sets the holdOpen flag, does not change popup visibility state

Parameters:
holdOpen -

setMenu

public void setMenu(org.eclipse.swt.widgets.Menu menu)
Sets the menu for the Text widget of this DropCombo

Note that setting the menu to null causes the native menu to be used

If the intent is to disable the menu, then set it to a blank menu

Overrides:
setMenu in class org.eclipse.swt.widgets.Control

setRedraw

public void setRedraw(boolean redraw)
Overrides:
setRedraw in class org.eclipse.swt.widgets.Control

setStretch

public void setStretch(boolean stretch)
If stretch is false, then the width of the popup will be set to its preferred width (via computeSize(SWT.DEFAULT, SWT.DEFAULT))

However, if stretchControl is true, the width of the popup will be stretched to equal the width of this control (if, however, popup's preferred width is greater than this control's width popup will not be shrunk down)

Parameters:
stretch -