Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.widgets
Class InheritableEntryField


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.rse.ui.widgets.InheritableEntryField
All Implemented Interfaces:
EventListener, KeyListener, Drawable, org.eclipse.swt.internal.SWTEventListener

public class InheritableEntryField
extends Composite
implements KeyListener

This is an entry which allows the user to decide whether to inherit a parent value or type in his own local value.

To accomplish this, we create a composite containing a toggle button followed by an entry field.

The toggle button has left and right arrows. Typically, an arrow pointing to the left means to inherit from parent, and pointing to the right means to override locally. However, the control can be used for any binary decision!

Although this control inherits from Composite it does not make sense to set a layout for it or to add children to it.


Field Summary
 
Fields inherited from class org.eclipse.swt.widgets. Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets. Widget
handle
 
Constructor Summary
InheritableEntryField ( Composite parent, int style)
          Constructor
InheritableEntryField ( Composite parent, int style, int buttonStyle, int textStyle)
          Constructor when you want to set the style of the toggle button and entry field too.
InheritableEntryField ( Composite parent, int style, int buttonStyle, int textStyle, boolean showToggleButton)
          Constructor when you want to hide the toggle button
 
Method Summary
 void addModifyListener ( ModifyListener listener)
          Register a listener interested in entry field modify events
 void addSelectionListener ( SelectionListener listener)
          Register a listener interested in when the button is toggled Call isLocal() to determine if left (false) or right (true) was pressed.
 void addStateChangeListener ( IInheritableEntryFieldStateChangeListener l)
          Adds a state change listener.
protected  void createTextField ( Composite parent, int textStyle)
          Creates a text field with a given style.
protected  void createToggleButton ( Composite parent, int buttonStyle)
           
  String getInheritedText ()
          Query the entry field's inherited text value.
  String getLocalText ()
          Query the entry field's local text value.
  String getText ()
          Query the entry field's current contents, regardless of local/inherit state
  Text getTextField ()
          Return a reference to the entry field
  InheritButton getToggleButton ()
          Return the toggle button
 boolean isLocal ()
          Query the inherit/local state
 void keyPressed ( KeyEvent e)
           
 void keyReleased ( KeyEvent e)
           
protected   Composite prepareComposite (int numColumns)
          Prepares the given composite control and sets the default layout data.
 void removeModifyListener ( ModifyListener listener)
          Remove a previously set entry field listener.
 void removeSelectionListener ( SelectionListener listener)
          Remove a previously set toggle button selection listener.
 void removeStateChangeListener ( IInheritableEntryFieldStateChangeListener l)
          Removes a state change listener.
 void setAllowEditingOfInheritedText (boolean allow)
          Specify if user is allowed to edit the inherited text.
 void setInheritedText ( String text)
          Set the entry field's inherited text value
 void setLocal (boolean local)
          Toggle the inherit/local state.
 void setLocalText ( String text)
          Set the entry field's local text value
 void setTextFieldFocus ()
          Set the focus to the entry field
 void setTextFieldToolTipText ( String tip)
          Set the tooltip text for the entry field
 void setTextLimit (int limit)
          Set the entry field's text limit
 void setToggleButtonFocus ()
          Set the focus to the toggle button
 void setToggleButtonHeight (int height)
           
 void setToggleEnabled (boolean enabled)
          Disable the toggle.
 void setToggleToolTipText ( String tip)
          Set the tooltip text for the toggle button
 
Methods inherited from class org.eclipse.swt.widgets. Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, 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, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getData, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets. Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getDisplay, getListeners, 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
 

Constructor Detail

InheritableEntryField

public InheritableEntryField(
Composite parent,
                             int style)
Constructor

Parameters:
parent - The parent composite to hold this widget
style - the SWT style for this widget (eg, SWT.BORDER or SWT.NULL)

InheritableEntryField

public InheritableEntryField(
Composite parent,
                             int style,
                             int buttonStyle,
                             int textStyle)
Constructor when you want to set the style of the toggle button and entry field too.

Parameters:
parent - The parent composite to hold this widget
style - the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
buttonStyle - the SWT style for the toggle button widget
textStyle - the SWT style for the entry field widget

InheritableEntryField

public InheritableEntryField(
Composite parent,
                             int style,
                             int buttonStyle,
                             int textStyle,
                             boolean showToggleButton)
Constructor when you want to hide the toggle button

Parameters:
parent - The parent composite to hold this widget
style - the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
buttonStyle - the SWT style for the toggle button widget
textStyle - the SWT style for the entry field widget
showToggleButton - true to show the toggle button, false not to
Method Detail

setLocal

public void setLocal(boolean local)
Toggle the inherit/local state. It is important that you have already called setLocalText and setInheritedText


isLocal

public boolean isLocal()
Query the inherit/local state


setAllowEditingOfInheritedText

public void setAllowEditingOfInheritedText(boolean allow)
Specify if user is allowed to edit the inherited text. Default is false.


setInheritedText

public void setInheritedText(
String text)
Set the entry field's inherited text value


getInheritedText

public 
String getInheritedText()
Query the entry field's inherited text value. If widget is in inherit mode, returns entry field contents, else returns cached value


setLocalText

public void setLocalText(
String text)
Set the entry field's local text value


getLocalText

public 
String getLocalText()
Query the entry field's local text value. If widget is in local mode, returns entry field contents, else returns "".


getText

public 
String getText()
Query the entry field's current contents, regardless of local/inherit state


getTextField

public 
Text getTextField()
Return a reference to the entry field


getToggleButton

public 
InheritButton getToggleButton()
Return the toggle button


setToggleEnabled

public void setToggleEnabled(boolean enabled)
Disable the toggle. Used when there is no inherited value


setToggleToolTipText

public void setToggleToolTipText(
String tip)
Set the tooltip text for the toggle button


setTextFieldToolTipText

public void setTextFieldToolTipText(
String tip)
Set the tooltip text for the entry field


setTextLimit

public void setTextLimit(int limit)
Set the entry field's text limit


setToggleButtonFocus

public void setToggleButtonFocus()
Set the focus to the toggle button


setTextFieldFocus

public void setTextFieldFocus()
Set the focus to the entry field


addSelectionListener

public void addSelectionListener(
SelectionListener listener)
Register a listener interested in when the button is toggled

Call isLocal() to determine if left (false) or right (true) was pressed.

See Also:
removeSelectionListener(SelectionListener)

removeSelectionListener

public void removeSelectionListener(
SelectionListener listener)
Remove a previously set toggle button selection listener.

See Also:
addSelectionListener(SelectionListener)

addModifyListener

public void addModifyListener(
ModifyListener listener)
Register a listener interested in entry field modify events

See Also:
removeModifyListener(ModifyListener)

removeModifyListener

public void removeModifyListener(
ModifyListener listener)
Remove a previously set entry field listener.

See Also:
addModifyListener(ModifyListener)

prepareComposite

protected 
Composite prepareComposite(int numColumns)
Prepares the given composite control and sets the default layout data.

Parameters:
numColumns - the number of columns in the composite layout.

createTextField

protected void createTextField(
Composite parent,
                               int textStyle)
Creates a text field with a given style.

Parameters:
parent - the parent composite.
textStyle - the style of the text field.

createToggleButton

protected void createToggleButton(
Composite parent,
                                  int buttonStyle)

setToggleButtonHeight

public void setToggleButtonHeight(int height)

keyPressed

public void keyPressed(
KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(
KeyEvent e)
Specified by:
keyReleased in interface KeyListener

addStateChangeListener

public void addStateChangeListener(
IInheritableEntryFieldStateChangeListener l)
Adds a state change listener. If the listener was already added, it will not be added again.

Parameters:
l - the listener to add.

removeStateChangeListener

public void removeStateChangeListener(
IInheritableEntryFieldStateChangeListener l)
Removes a state change listener.

Parameters:
l - the listener to remove.

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire