Package com.iizigo.prop.editor
Class KStringPropEditor
- java.lang.Object
- com.iizigo.prop.BaseEditor<KStringProp,KString>
- com.iizigo.prop.editor.KStringPropEditor
- All Implemented Interfaces:
IEditedPropControllerOwner<KStringProp,KString>
,IEditedPropertyEntry<KStringProp,KString>
,IEditedPropertyEntryMultiProp<KStringProp,KString>
,IPropertyDefined
- Direct Known Subclasses:
PatternPropEditor
public class KStringPropEditor extends BaseEditor<KStringProp,KString>
The KString property editor consists of an icon describing the string value, an entry field.A context menu is available when right-clicking on the icon. A double-click on it opens the Rich Text Editor or the Text Editor.
The option "plain" makes input limited to PLAIN KStrings and should be combined with PlainKStringProp.
- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.swt.widgets.Listener
caretListener
Selection listener to check for caret location.protected IzMenu
menu
protected IzMenuItem
miConvert
protected IzMenuItem
miExternalize
protected IzMenuItem
miGoto
protected IzMenuItem
miRawText
protected IzMenuItem
miRichText
protected IzMenuItem
miTagProcessing
protected IzToolTip
tip
Tooltip.protected boolean
usesTagProcessing
Fields inherited from class com.iizigo.prop.BaseEditor
appUI, combo, control, controller, definedButton, display, editor, focusListener, hasBeenModified, info, more, multipleValueWarningInput, options, parent, propController, shell, text, validator, wasDefinedAtFocusGained
Constructor Summary
Constructors Constructor Description KStringPropEditor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkGoto()
Checks the goto-enablement from the selection.protected void
create()
Creates the property editor controls.protected void
createTextAndTTCursorChange()
Create the text and tooltip.protected boolean
doUndefineIfEmpty(boolean focusLost)
Keeps empty strings as defined, when input has been changed specifically to empty string, or if the entry was defined when editing began.java.lang.String
formatValue(KString value)
Formats the value for user input as a String.protected int
getCaretPosition()
Gets the selection from the text or combo.KString
getDefaultValue()
Gets the default defined value to set in the property when defined.protected java.lang.String
getToolTipText()
Gets the tooltip text to display in the entry fields (not the one for property errors or validator).protected KString
getValue(java.lang.String input)
Gets the property value for a user input.protected void
onDoubleClick(org.eclipse.swt.widgets.Event e)
Called when mouse is double-clicked in the text or combobox.void
onError(java.lang.String input, java.lang.String message, int severity, boolean isMultipleValueWarning, boolean isChildError)
Called when the property is updated due to an error.void
onF4List()
Called when F4 is pressed in a Text field.void
onUndefined()
Called when the property is undefined.void
onUpdate(KString value)
Called when the property is updated without errors, with a new value.protected void
setInputValue(KString value)
Sets the new input value.protected void
setToolTipText(java.lang.String msg)
Sets the tooltip text.protected void
showDialogBox(boolean doRich)
Shows the raw text dialog box.protected void
updateStates()
Changes state of "icon".Methods inherited from class com.iizigo.prop.BaseEditor
assignMaster, beginProcessEvent, canProcessEvents, checkInput, createCCombo, createControls, createGridLayout, createIzMenu, createMoreButton, createMoreIzMenu, createText, dispose, doValueChangeConversion, endProcessEvent, getBaseEditor, getCurrentInput, getCurrentValue, getCurrentValues, getModifyListener, getNativeToolTip, getOption, getSelectionListener, getSeverity, getShell, getToolTipText2, hasFocus, initialize, isPropReadOnly, onDefine, onDispose, onFocusGained, onFocusLost, onMore, onReadOnly, setColors, setCurrentValue, setEditable, setFocus, setInput, setInputValueFromProp, showMenu, updateTooltip, validate
Field Detail
tip
protected IzToolTip tip
Tooltip.
menu
protected IzMenu menu
usesTagProcessing
protected boolean usesTagProcessing
miTagProcessing
protected IzMenuItem miTagProcessing
miConvert
protected IzMenuItem miConvert
miRichText
protected IzMenuItem miRichText
miRawText
protected IzMenuItem miRawText
miExternalize
protected IzMenuItem miExternalize
miGoto
protected IzMenuItem miGoto
caretListener
protected final org.eclipse.swt.widgets.Listener caretListener
Selection listener to check for caret location.
Method Detail
create
protected void create()
Creates the property editor controls.- Specified by:
create
in classBaseEditor<KStringProp,KString>
createTextAndTTCursorChange
protected void createTextAndTTCursorChange()
Create the text and tooltip.
getCaretPosition
protected int getCaretPosition()
Gets the selection from the text or combo.
onF4List
public void onF4List()
Called when F4 is pressed in a Text field.- Overrides:
onF4List
in classBaseEditor<KStringProp,KString>
getToolTipText
protected java.lang.String getToolTipText()
Gets the tooltip text to display in the entry fields (not the one for property errors or validator).- Specified by:
getToolTipText
in classBaseEditor<KStringProp,KString>
setToolTipText
protected void setToolTipText(java.lang.String msg)
Sets the tooltip text. The default is to apply the getToolTipText() text to the edit control.- Overrides:
setToolTipText
in classBaseEditor<KStringProp,KString>
- Parameters:
msg
- Message in tooltip (normally error), null for none, in which case the getToolTipText2() is used.
getDefaultValue
public KString getDefaultValue()
Gets the default defined value to set in the property when defined.- Specified by:
getDefaultValue
in interfaceIEditedPropControllerOwner<KStringProp,KString>
- Specified by:
getDefaultValue
in classBaseEditor<KStringProp,KString>
doUndefineIfEmpty
protected boolean doUndefineIfEmpty(boolean focusLost)
Keeps empty strings as defined, when input has been changed specifically to empty string, or if the entry was defined when editing began.- Overrides:
doUndefineIfEmpty
in classBaseEditor<KStringProp,KString>
getValue
protected KString getValue(java.lang.String input) throws KStringException
Gets the property value for a user input.- Specified by:
getValue
in classBaseEditor<KStringProp,KString>
- Parameters:
input
- The current user input.- Returns:
- The property value for the input, or null to un-define the property.
- Throws:
KStringException
- For parsing errors.
formatValue
public java.lang.String formatValue(KString value)
Formats the value for user input as a String.- Specified by:
formatValue
in interfaceIEditedPropControllerOwner<KStringProp,KString>
- Specified by:
formatValue
in classBaseEditor<KStringProp,KString>
- Parameters:
value
- The value.- Returns:
- The formatted value.
setInputValue
protected void setInputValue(KString value)
Sets the new input value.- Overrides:
setInputValue
in classBaseEditor<KStringProp,KString>
- Parameters:
value
- The value to set, null for empty.
showDialogBox
protected void showDialogBox(boolean doRich)
Shows the raw text dialog box.
onUpdate
public void onUpdate(KString value)
Called when the property is updated without errors, with a new value.- Specified by:
onUpdate
in interfaceIEditedPropControllerOwner<KStringProp,KString>
- Overrides:
onUpdate
in classBaseEditor<KStringProp,KString>
onUndefined
public void onUndefined()
Called when the property is undefined.- Specified by:
onUndefined
in interfaceIEditedPropControllerOwner<KStringProp,KString>
- Overrides:
onUndefined
in classBaseEditor<KStringProp,KString>
onError
public void onError(java.lang.String input, java.lang.String message, int severity, boolean isMultipleValueWarning, boolean isChildError)
Called when the property is updated due to an error.- Specified by:
onError
in interfaceIEditedPropControllerOwner<KStringProp,KString>
- Overrides:
onError
in classBaseEditor<KStringProp,KString>
updateStates
protected void updateStates()
Changes state of "icon".
checkGoto
protected void checkGoto()
Checks the goto-enablement from the selection.
onDoubleClick
protected void onDoubleClick(org.eclipse.swt.widgets.Event e)
Called when mouse is double-clicked in the text or combobox. Overridden to check if Goto reference is enabled, and if so goes there.- Overrides:
onDoubleClick
in classBaseEditor<KStringProp,KString>