|
From: Benoit X. (JIRA) <no...@sp...> - 2008-04-07 16:37:06
|
Adding shortcuts to BigDecimalTextField
---------------------------------------
Key: RCP-553
URL: http://jira.springframework.org/browse/RCP-553
Project: Spring Framework Rich Client Project
Issue Type: Improvement
Components: Helper Classes
Affects Versions: 1.0.0
Reporter: Benoit Xhenseval
We would like to be able to add shortcuts, like "3m" meaning 3 millions, 2k = 2,000. Typically a shortcut for hundred, thousand, millions, billions (for SocGen J ).
Unfortunately, BigDecimalTextField is explicitly instantiated in several places, making it impossible to extend.
We have a patch that works fine for us and it should work internationally as the shortcut may vary from one language to the other.
One needs to add the shortcut characters in a messages.properties file:
BigDecimalTextField.shortcut.hundred=h
BigDecimalTextField.shortcut.thousand=k
BigDecimalTextField.shortcut.million=m
BigDecimalTextField.shortcut.billion=b
...
So if you type 3k in the field, it will immediately be replaced by 3000.
If you do not have those entries in the messages.properties, it won't use shortcuts so it is transparent if you do not want it.
I hope that the patch will be accepted so that we can use SpringRC straight out of the box...
Many thanks
Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Benoit X. (JIRA) <no...@sp...> - 2008-04-07 16:41:05
|
[ http://jira.springframework.org/browse/RCP-553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benoit Xhenseval updated RCP-553:
---------------------------------
Attachment: BigDecimalTextField.java.patch
I do not know why the patch appears to be so different from the code, this is not the case. I think it is due to SVN thinking that many items have been inserted?
2 set of changes:
in insertString:
} else if (str.length() == 1 && SHORTCUTS.containsKey(str.toLowerCase())) { //+ BX Shortcut start
Integer shortcut = (Integer) SHORTCUTS.get(str.toLowerCase());
if (offset == 0) {
str = "1";
} else {
str = "";
}
for (int count = 0; count < shortcut.intValue(); count++) {
str += "0";
}
//+ BX Shortcut end
and a set of new methods at the beginning:
private static final Map SHORTCUTS = new HashMap();
private static boolean shortcutInitialised = false;
private static void initialiseShortcut() {
if (!shortcutInitialised) {
final Object o = ApplicationServicesLocator.services().getService(MessageSourceAccessor.class);
if (o instanceof MessageSourceAccessor) {
MessageSourceAccessor messageSourceAccessor = (MessageSourceAccessor) o;
addShortcut(messageSourceAccessor, "BigDecimalTextField.shortcut.hundred", new Integer(2));
addShortcut(messageSourceAccessor, "BigDecimalTextField.shortcut.thousand", new Integer(3));
addShortcut(messageSourceAccessor, "BigDecimalTextField.shortcut.million", new Integer(6));
addShortcut(messageSourceAccessor, "BigDecimalTextField.shortcut.billion", new Integer(9));
addShortcut(messageSourceAccessor, "BigDecimalTextField.shortcut.squillion", new Integer(0));
shortcutInitialised = true;
}
}
}
private static void addShortcut(final MessageSourceAccessor messageSourceAccessor, final String msgKey, final Integer offset) {
try {
SHORTCUTS.put(messageSourceAccessor.getMessage(msgKey), offset);
}catch(final NoSuchMessageException e) {
// do nothing
}
}
and finally a call to initialiseShortcut() in the main constructor.
I hope it is ok
Kind regards
Benoit.
> Adding shortcuts to BigDecimalTextField
> ---------------------------------------
>
> Key: RCP-553
> URL: http://jira.springframework.org/browse/RCP-553
> Project: Spring Framework Rich Client Project
> Issue Type: Improvement
> Components: Helper Classes
> Affects Versions: 1.0.0
> Reporter: Benoit Xhenseval
> Attachments: BigDecimalTextField.java.patch
>
>
> We would like to be able to add shortcuts, like "3m" meaning 3 millions, 2k = 2,000. Typically a shortcut for hundred, thousand, millions, billions (for SocGen J ).
> Unfortunately, BigDecimalTextField is explicitly instantiated in several places, making it impossible to extend.
> We have a patch that works fine for us and it should work internationally as the shortcut may vary from one language to the other.
> One needs to add the shortcut characters in a messages.properties file:
> BigDecimalTextField.shortcut.hundred=h
> BigDecimalTextField.shortcut.thousand=k
> BigDecimalTextField.shortcut.million=m
> BigDecimalTextField.shortcut.billion=b
> ...
> So if you type 3k in the field, it will immediately be replaced by 3000.
> If you do not have those entries in the messages.properties, it won't use shortcuts so it is transparent if you do not want it.
> I hope that the patch will be accepted so that we can use SpringRC straight out of the box...
> Many thanks
> Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Lieven D. (JIRA) <no...@sp...> - 2008-10-09 19:28:18
|
[ http://jira.springframework.org/browse/RCP-553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lieven Doclo updated RCP-553:
-----------------------------
Priority: Minor (was: Major)
Fix Version/s: 1.x
> Adding shortcuts to BigDecimalTextField
> ---------------------------------------
>
> Key: RCP-553
> URL: http://jira.springframework.org/browse/RCP-553
> Project: Spring Framework Rich Client Project
> Issue Type: Improvement
> Components: Helper Classes
> Affects Versions: 1.0.0
> Reporter: Benoit Xhenseval
> Priority: Minor
> Fix For: 1.x
>
> Attachments: BigDecimalTextField.java.patch
>
>
> We would like to be able to add shortcuts, like "3m" meaning 3 millions, 2k = 2,000. Typically a shortcut for hundred, thousand, millions, billions (for SocGen J ).
> Unfortunately, BigDecimalTextField is explicitly instantiated in several places, making it impossible to extend.
> We have a patch that works fine for us and it should work internationally as the shortcut may vary from one language to the other.
> One needs to add the shortcut characters in a messages.properties file:
> BigDecimalTextField.shortcut.hundred=h
> BigDecimalTextField.shortcut.thousand=k
> BigDecimalTextField.shortcut.million=m
> BigDecimalTextField.shortcut.billion=b
> ...
> So if you type 3k in the field, it will immediately be replaced by 3000.
> If you do not have those entries in the messages.properties, it won't use shortcuts so it is transparent if you do not want it.
> I hope that the patch will be accepted so that we can use SpringRC straight out of the box...
> Many thanks
> Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Lieven D. (JIRA) <no...@sp...> - 2009-01-21 10:26:20
|
[ http://jira.springframework.org/browse/RCP-553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lieven Doclo updated RCP-553:
-----------------------------
Fix Version/s: (was: 1.x)
1.1.0
> Adding shortcuts to BigDecimalTextField
> ---------------------------------------
>
> Key: RCP-553
> URL: http://jira.springframework.org/browse/RCP-553
> Project: Spring Rich Client Project
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0.0
> Reporter: Benoit Xhenseval
> Priority: Minor
> Fix For: 1.1.0
>
> Attachments: BigDecimalTextField.java.patch
>
>
> We would like to be able to add shortcuts, like "3m" meaning 3 millions, 2k = 2,000. Typically a shortcut for hundred, thousand, millions, billions (for SocGen J ).
> Unfortunately, BigDecimalTextField is explicitly instantiated in several places, making it impossible to extend.
> We have a patch that works fine for us and it should work internationally as the shortcut may vary from one language to the other.
> One needs to add the shortcut characters in a messages.properties file:
> BigDecimalTextField.shortcut.hundred=h
> BigDecimalTextField.shortcut.thousand=k
> BigDecimalTextField.shortcut.million=m
> BigDecimalTextField.shortcut.billion=b
> ...
> So if you type 3k in the field, it will immediately be replaced by 3000.
> If you do not have those entries in the messages.properties, it won't use shortcuts so it is transparent if you do not want it.
> I hope that the patch will be accepted so that we can use SpringRC straight out of the box...
> Many thanks
> Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: jokeway <jo...@ho...> - 2009-01-22 02:20:55
|
Hi How can I show the validate message by the control's 'tab' order? Thanks --------------------- jokeway |
|
From: Lieven D. (JIRA) <no...@sp...> - 2009-01-21 11:09:20
|
[ http://jira.springframework.org/browse/RCP-553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lieven Doclo resolved RCP-553.
------------------------------
Resolution: Fixed
shortcuts for k, m and b applied with scaling
> Adding shortcuts to BigDecimalTextField
> ---------------------------------------
>
> Key: RCP-553
> URL: http://jira.springframework.org/browse/RCP-553
> Project: Spring Rich Client Project
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0.0
> Reporter: Benoit Xhenseval
> Assignee: Lieven Doclo
> Priority: Minor
> Fix For: 1.1.0
>
> Attachments: BigDecimalTextField.java.patch
>
>
> We would like to be able to add shortcuts, like "3m" meaning 3 millions, 2k = 2,000. Typically a shortcut for hundred, thousand, millions, billions (for SocGen J ).
> Unfortunately, BigDecimalTextField is explicitly instantiated in several places, making it impossible to extend.
> We have a patch that works fine for us and it should work internationally as the shortcut may vary from one language to the other.
> One needs to add the shortcut characters in a messages.properties file:
> BigDecimalTextField.shortcut.hundred=h
> BigDecimalTextField.shortcut.thousand=k
> BigDecimalTextField.shortcut.million=m
> BigDecimalTextField.shortcut.billion=b
> ...
> So if you type 3k in the field, it will immediately be replaced by 3000.
> If you do not have those entries in the messages.properties, it won't use shortcuts so it is transparent if you do not want it.
> I hope that the patch will be accepted so that we can use SpringRC straight out of the box...
> Many thanks
> Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|