|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.rse.ui.widgets.InheritableEntryField
public class InheritableEntryField
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, drawBackground, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, 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.Widget |
---|
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InheritableEntryField(Composite parent, int style)
parent
- The parent composite to hold this widgetstyle
- the SWT style for this widget (eg, SWT.BORDER or SWT.NULL)public InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle)
parent
- The parent composite to hold this widgetstyle
- the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)buttonStyle
- the SWT style for the toggle button widgettextStyle
- the SWT style for the entry field widgetpublic InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle, boolean showToggleButton)
parent
- The parent composite to hold this widgetstyle
- the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)buttonStyle
- the SWT style for the toggle button widgettextStyle
- the SWT style for the entry field widgetshowToggleButton
- true to show the toggle button, false not toMethod Detail |
---|
public void setLocal(boolean local)
public boolean isLocal()
public void setAllowEditingOfInheritedText(boolean allow)
public void setInheritedText(String text)
public String getInheritedText()
public void setLocalText(String text)
public String getLocalText()
public String getText()
public Text getTextField()
public InheritButton getToggleButton()
public void setToggleEnabled(boolean enabled)
public void setToggleToolTipText(String tip)
public void setTextFieldToolTipText(String tip)
public void setTextLimit(int limit)
public void setToggleButtonFocus()
public void setTextFieldFocus()
public void addSelectionListener(SelectionListener listener)
Call isLocal()
to determine if left (false) or right (true) was pressed.
removeSelectionListener(SelectionListener)
public void removeSelectionListener(SelectionListener listener)
addSelectionListener(SelectionListener)
public void addModifyListener(ModifyListener listener)
removeModifyListener(ModifyListener)
public void removeModifyListener(ModifyListener listener)
addModifyListener(ModifyListener)
protected Composite prepareComposite(int numColumns)
numColumns
- the number of columns in the composite layout.protected void createTextField(Composite parent, int textStyle)
parent
- the parent composite.textStyle
- the style of the text field.protected void createToggleButton(Composite parent, int buttonStyle)
public void setToggleButtonHeight(int height)
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public void addStateChangeListener(IInheritableEntryFieldStateChangeListener l)
l
- the listener to add.public void removeStateChangeListener(IInheritableEntryFieldStateChangeListener l)
l
- the listener to remove.
|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |