diff options
author | Matthias Otterbach | 2015-07-01 11:10:11 +0000 |
---|---|---|
committer | Claudio Guglielmo | 2015-07-01 13:16:48 +0000 |
commit | d6098d83be355a3bd2c8dec5e3a8384f3f97e338 (patch) | |
tree | 4ec42b1f03d63d6cbfc923cb49b90230eb097cec | |
parent | ae3572160820676a9b9797ae275c2c7d6669b86e (diff) | |
download | org.eclipse.scout.rt-d6098d83be355a3bd2c8dec5e3a8384f3f97e338.tar.gz org.eclipse.scout.rt-d6098d83be355a3bd2c8dec5e3a8384f3f97e338.tar.xz org.eclipse.scout.rt-d6098d83be355a3bd2c8dec5e3a8384f3f97e338.zip |
Added property selectionTrackingEnabled
Reduces network traffic between client and frontend server.
Change-Id: I79b825476f4677c6d84bd779065c826ab5495cc8
Signed-off-by: Matthias Otterbach <Matthias.Otterbach@bsiag.com>
Reviewed-on: https://git.eclipse.org/r/51185
Tested-by: Hudson CI
Reviewed-by: Claudio Guglielmo <claudio.guglielmo@bsiag.com>
2 files changed, 44 insertions, 3 deletions
diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java index df7d6ee18f..a6bc86d96f 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/AbstractStringField.java @@ -124,10 +124,17 @@ public abstract class AbstractStringField extends AbstractBasicField<String> imp return null; } + /** + * Define whether selection tracking should be enabled (might increase number of events between client and fronted + * server). + * <p> + * If <code>false</code>, {@link #getSelectionStart()} and {@link #getSelectionEnd()} might not reflect the actual + * selection. + */ @ConfigProperty(ConfigProperty.BOOLEAN) @Order(340) - protected boolean getConfiguredSelectAllOnFocus() { - return true; + protected boolean getConfiguredSelectionTrackingEnabled() { + return false; } /** @@ -224,6 +231,7 @@ public abstract class AbstractStringField extends AbstractBasicField<String> imp configuredDropType = 0; } setDropType(configuredDropType); + setSelectionTrackingEnabled(getConfiguredSelectionTrackingEnabled()); setHtmlEnabled(getConfiguredHtmlEnabled()); setSpellCheckEnabled(computeSpellCheckEnabled()); } @@ -352,16 +360,44 @@ public abstract class AbstractStringField extends AbstractBasicField<String> imp } } + /** + * Use {@link #getConfiguredSelectionTrackingEnabled()}, {@link #isSelectionTrackingEnabled()} and + * {@link #setSelectionTrackingEnabled(boolean)} to enable selection tracking. If + * {@link #isSelectionTrackingEnabled()} is not <code>true</code> the return value of this method might not reflect + * the actual selection start. + */ @Override public int getSelectionStart() { return propertySupport.getPropertyInt(PROP_SELECTION_START); } + /** + * Use {@link #getConfiguredSelectionTrackingEnabled()}, {@link #isSelectionTrackingEnabled()} and + * {@link #setSelectionTrackingEnabled(boolean)} to enable selection tracking. If + * {@link #isSelectionTrackingEnabled()} is not <code>true</code> the return value of this method might not reflect + * the actual selection end. + */ @Override public int getSelectionEnd() { return propertySupport.getPropertyInt(PROP_SELECTION_END); } + /** + * @see {@link #getConfiguredSelectionTrackingEnabled()} + */ + @Override + public boolean isSelectionTrackingEnabled() { + return propertySupport.getPropertyBool(PROP_SELECTION_TRACKING_ENABLED); + } + + /** + * @see {@link #getConfiguredSelectionTrackingEnabled()} + */ + @Override + public void setSelectionTrackingEnabled(boolean selectionTrackingEnabled) { + propertySupport.setPropertyBool(PROP_SELECTION_TRACKING_ENABLED, selectionTrackingEnabled); + } + @Override public IStringFieldUIFacade getUIFacade() { return m_uiFacade; @@ -489,7 +525,7 @@ public abstract class AbstractStringField extends AbstractBasicField<String> imp * any further chain elements. */ protected static class LocalStringFieldExtension<OWNER_FIELD extends AbstractStringField> extends AbstractBasicField.LocalBasicFieldExtension<String, OWNER_FIELD> - implements IStringFieldExtension<OWNER_FIELD> { + implements IStringFieldExtension<OWNER_FIELD> { public LocalStringFieldExtension(OWNER_FIELD owner) { super(owner); diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java index 7465d88c99..99870e8d31 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/stringfield/IStringField.java @@ -29,6 +29,7 @@ public interface IStringField extends IBasicField<String>, IDNDSupport, IHtmlCap String PROP_SELECTION_START = "selectionStart"; String PROP_SELECTION_END = "selectionEnd"; String PROP_SPELL_CHECK_ENABLED = "spellCheckEnabled"; + String PROP_SELECTION_TRACKING_ENABLED = "selectionTrackingEnabled"; /* enum for formats */ String FORMAT_UPPER = "A"; @@ -74,6 +75,10 @@ public interface IStringField extends IBasicField<String>, IDNDSupport, IHtmlCap void select(int startIndex, int endIndex); + boolean isSelectionTrackingEnabled(); + + void setSelectionTrackingEnabled(boolean selectionTrackingEnabled); + @Override IStringFieldUIFacade getUIFacade(); |