ISimpleTypeModifiable. UnsupportedOperationException on setLocale method

Hi,
I have some context attribute(build in decimal type), and want to configure output view(grouping and decimal separators) of this value on UI components for different users using  ISimpleTypeModifiable interface. I didn't find any setter methods for Formatter(NumberFormat interface). So, I have tried to use setLocale method(different locales have different separators: "RU" locale output for ex. - 123 456,78), but it throws UnsupportedOperationException. Here is some simple code to describe this situation:
ISimpleTypeModifiable type = attrInfo.getModifiableSimpleType();
type.setLocale(new Locale("some locale"));
type.setFormat("some format");
If there is some other way to configure output view for decimal attributes without changing attribute type?
Thanks
Edited by: Mikhail Udalov on Nov 10, 2008 3:30 PM
Edited by: Mikhail Udalov on Nov 10, 2008 3:30 PM

Hi, Mikhail!
The simplest solution is to configure (or change in runtime - if it possible) user's locale.
Also you can create calculated read only attribute of type string and use it for presenting your decimal value in right format. Something like this:
// get method of calculated attribute
final NumberFormat format = NumberFormat.getInstance(locale);
return format.format(numericValue);
More one solution is creating "right localized" attribute dynamically:
final ISimpleType decimalType = attrInfo.getSimpleType(); // some decimal attribute created in designer
final ISimpleTypeModifiable localizedDecimal = decimalType.cloneType(locale);
localizedDecimal.setFormat("some format"); // specify format if need
nodeInfo.addAttribute("DecimalValue", localizedDecimal);

Similar Messages

  • Page navigation buttons not working properly

    Hi,
    I am having a multilingual Java Application (e.g. English, Japanese, French...).  In this application there are reports which display the data using locale parameter (like en_US, ja_JP etc.) to display the data in selected language.
    The problem comes up when I see Japanese reports on English operating system machine and vice versa.
    When I click any button of page navigation it changes the page number but does not load and display the page accordingly.
    It's like when I run the report it displays the first page, then clicking on Next button brings 2 in navigation field but the report  would still show first page, same happens for 3, 4.... all pages. 
    The other navigation buttons also do not work, they change the page number but display only the first page.
    This problem does not occur when I see Japanese reports on Japanese OS machine and English reports on English OS machine.
    However my clients need the first case, Japanese reports should work on English OS machine also.
    Please advise urgenly.

    Hi,
    I resolved the above issue by removing the call to method setProductLocale in jsp file (which was really unnecessary in code as product locale is meant to set languange for crystal report design environment ).
    Actually the problem was I had set locale at two place
                    1. using setLocale method of ReportClientDocument object) after the initialization of report client document object
                    2. using setProductLocale method of CrystalReportViewer object after the initialization of Crystal Report Viewer  object
    After commenting out code for setProductLocale, reports in all languages and all their functionalities started working 100% perfectly.
    Thanks.

  • Getting parsing exception messages in another language

    I am using the Oracle XML SAXParser for Java to validate an XML document against a DTD, and I want to display the result to the user. Is there a way to get the parsing errors/warnings in a language other than English? What languages are supported? Thanks.

    You can get localized messages using the setLocale method. The listing of countries and languages is in the README.HTML.
    Oracle XML Team

  • DOMParser Locale problem

    Hi,
    i got a problem using the setLocale() method of the DOMParserin order to set the language of the Parser in FRENCH :
    I wrote the code below :
    DOMParser dp = new DOMParser();
    Locale loc = new Locale("FRENCH", "FRANCE");
    try {
         dp.setLocale(loc);
    // THIS COMMAND RETURNS fr
         System.out.println(loc.getLanguage());
    } catch (Exception e)
         System.out.println("Exception : " + e.getLocalizedMessage());
    try
    dp.parse(url);
    catch (XMLParseException pe)
    System.out.println(pe.getLocalizedMessage());
    AND THE MESSAGES ARE STILL IN ENGLISH !!!
    WHAT's wrong ??
    Help me please

    I found the response for my problem :
    I/ include in CLASSPATH=$CLASSPTH:$XDK_HOME/lib/xmlmesg.jar
    but the messages are not good : the {1} element is never replaced.
    II/ modify the file "XMLErrorMesg_fr.properties" in order to remove all the ' :
    exemple:
    XSD-2025 become Texte ''{0}'' non valide dans l \u00e9l\u00e9ment : ''{1}''

  • Why JSTL change the encoding of response?

    Dear all,
    I use JSTL to display multiple language, and it can work fine. I also have a servlet to let the user to select the display language. All the request and response encoding is set to UTF-8, but I found that when user choose language to Chinese, and the servlet set the Locale to ZH, and then, all the jsp file which use JSTL to display message, the response is set to "GB2312"!
    Why this happen? because the response encoding is gb2312, so I cannot get the user inputted Chinese character! I want still reserve the UTF-8, how can I do that? I just found that webapp 2.4 can set locale-encoding-mapping, but I am using tomcat4.1.4, which does not support 2.4.
    Any advice will be appreciate.
    Lichunlin

    Hi, everyone,
    I find that the setLocale method of Reponse will change the response encoding automatically according to the locale, for example, the page encoding is UTF-8, but after I set locale to "CN"(china), the encoding is changed to "GB2312", but I still want it is "UTF-8".
    So I have to change the message tag source code, to change the encoding back after the setLocale method invoke, it is not so good, but it can work now.
    Could you have any other advice? Thank you very much.
    Lichunlin
    Dear all,
    I use JSTL to display multiple language, and it can
    work fine. I also have a servlet to let the user to
    select the display language. All the request and
    response encoding is set to UTF-8, but I found that
    when user choose language to Chinese, and the servlet
    set the Locale to ZH, and then, all the jsp file which
    use JSTL to display message, the response is set to
    "GB2312"!
    Why this happen? because the response encoding is
    gb2312, so I cannot get the user inputted Chinese
    character! I want still reserve the UTF-8, how can I
    do that? I just found that webapp 2.4 can set
    locale-encoding-mapping, but I am using tomcat4.1.4,
    which does not support 2.4.
    Any advice will be appreciate.
    Lichunlin

  • Limit access on returned Collection

    Hello, is it possible to write a method to return a collection and don't allow the caller to add or remove objects from the collection, but allow the caller modify the objects in the collection.

    Hello, is it possible to write a method to return a
    collection and don't allow the caller to add or remove
    objects from the collection, but allow the caller
    modify the objects in the collection.Well there is nothing to stop someone from modifying the object in a Collection other than through that Collection itself.
    Do you mean you want to allow people to replace immutable objects like Strings but not add or remove them?
    The only Collections this would seem to make any sense for are Lists. YOu ca nso this pretty easily. extend AbstractList and implement the get(index) and size methods. Then implement the set(index. object) method so that it throws an exception if the index >= size.
    Oh here it is:
    UpdateableList extends AbstractList {
       List list;
       public UpdateableList(List list) {
          if (list == null)  throw new IllegalArgumentException();
          this.list = list;
       public Object get(int index) {
          return list.get(index);
       public int size() {
          return list.size();
       public Object set(int index, Object object) {
          if (index >= size) throw new IndexOutOfBoundsException();
          return list.set(index, object);
    }Note, I'm not sure but allowing the set method may open up the add other methods, so you might need to throw UnsupportedOperationException in those methods.

  • Parse Exception, Expert please help!

    Hello World,
    Please have a look at following code snippet.
    String dateString (Getting from client)
    SimpleDateFormat defaultformat = new SimpleDateFormat();
    Date d = null;
    try {
    d = defaultformat.parse(dateString);
    catch(ParseException pe)
    System.out.println(pe.getMessage());
    In this program I require date object for further processing. I get dateString (date and time) from client. I got Date object from above code for all locales except Chinese. When Chinese client enter a date, the string I got contains some Chinese characters (representing AM. and PM.) And I get ParseException. Now my question is why parse function is throwing exception? I have Chinese font on machine also. I am using Jdk1.4.2 and operating system is Windows XP.
    Can anybody tell me solution on this?
    Thanks and Regards,
    Sachin Dare.

    Probably your locale is not China. I think you can either pass a Locale to a SimpleDateFormat constructor, or maybe there's a setLocale method. Check SimpleDateFormat's docs for handling locales.

  • Locale and Formatter

    Hi,
    my application works fine until I tried to add a number column, which should be formatted like this: "####0.00".
    Than the numbers are shown with the german number format. This is OK. But if I want to edit the
    number values the BC4J Application don't understand the german number format.
    Next step was to try to change the default locale to ENGLISH or US.
    In this case the numbers are not formatted and the labels are wrong.
    Could anybody tell me how to use german number format with BC4J or how to change the default locale
    to ENGLISH or US in the right way?
    Thank you
    Claudia

    Is this JSP application, JClient? In a JSP appliction, you change the runtime locale via the browser's language settings. You can also use the ApplicationModule.getSesstion().setLocale method. You should not change the global locale within a web application since it will affect the single VM running more than one application.

  • Decimal notations : Urgent

    Hi,
    I have developed a sales application in java. It was initially done for UK. I am using lot of number calculations, floating numbers etc. Now, the software is required for Germany, the problem is with the decimal notation. The notation in Germany is a comma, and it is a period(.) in the UK. So, 1,000 is read as Thousand in the UK and 'One' in Germany.
    The numerous Float.parseFloat methods and other methods return exceptions, if comma is given as a decimal separator.
    Since the application is already live in the UK and just about to go live in germany, I dont have the time to do major changes. But I suppose that as Java is used by the international community, there should be an easy way round.
    Any ideas?
    Thanks a lot

    Mark,
    Thanks for the reply.
    But in which class is the setLocale method?
    Sorry if I sounded dumb..but please help..
    Thanks a lot

  • Setting Locale

    I am having trouble setting the locale for my web application.
    I set the locale using UIViewRoot.setLocale() in a ValueChangeListener method on a managed bean. I more or less just copied this code from the cardemo application (CarStore.chooseLocaleFromLink()).
    After choosing the locale, I fill out a separate form on the same page , hit submit and navigate to another jsp (configured by a navigation rule in faces-config).
    At this point , things work great: the page is in the locale previously set. From this page, I click on a hyperlink which takes me to another page, and the locale previously set goes away. The locale for the page is the "default", or rather the locale requested by the browser.
    What am I doing wrong?
    Is there something different about navigating and linking to a page? Why does the locale not "stick" in the ViewRoot? What is resetting the locale?
    Thanks,
    Silmendil

    Ok, I know it's lame to respond to one's own post but...(I wonder if they give me Duke points?)...
    I think I got it working. This seems like a really hacked up solution that seems way too complicated but, so far, it works.
    1. Create a session scope managed bean which holds current locale, we'll call it LocaleBean
    2. In the event method which is responsible for changing the locale, get a reference to LocaleBean and set its locale to the new value. Call the FacesContext.renderResponse() method. For example,
    public void changeLocale(ValueChangeEvent event)
            String targetLocale = (String)event.getNewValue();
            Locale locale = new Locale(targetLocale);
            getLocaleBean().setLocale(locale);
            FacesContext context = FacesContext.getCurrentInstance();
            context.renderResponse();
        }3. Override ViewHandler.
    4. In the new ExtendedViewHandler class create a field of type Locale.
    5. In the calculateLocale() method, return this Locale field.
    6. Override the renderView() method: get a reference to the LocaleBean, get its Locale value and set it to the ExtendedValueHandler's Locale field, get the UIViewRoot from the context and call its setLocale() method, call the super class renderView method. For example:
    public void renderView(FacesContext context, UIViewRoot viewRoot)
            throws IOException, FacesException
            _locale = getLocaleBean().getLocale();
            UIViewRoot root = context.getViewRoot();
            root.setLocale(_locale);
            baseViewHandler.renderView(context, viewRoot);
        }7. Override all the other required methods in ExtendedViewHandler call the super class method.
    8. Configure the view-handler property in faces-config to take the ExtendedViewHandler class.

  • Java.lang.UnsupportedOperationException: Method not yet implemented

    Hi
    I work on a project that use java api version 1.2, after the deployment of the web application and using it I have had the following error message:
    [Mon Oct 16 11:52:51 GMT 2006] Memory used: 24467288 Error: org.epoline.soprano.Csstart: A fatal error occured in SOPRANO: Method not yet implemented : java.lang.UnsupportedOperationException: Method not yet implemented
         at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:156)
    here is the code:
    // attach the file to the message
    FileDataSource fds = new FileDataSource(fileName);
    attach.setDataHandler(new DataHandler(fds));
    attach.setFileName(fds.getName());
    it sseems that the method setFileName of MimeBodyPart class throw the exception. I tried to change the jar to version 1.3.3 or 1.4 but nothing change. Can you help me. Thanks

    here is the Exception stack trace:
    [Tue Nov 07 11:57:01 GMT 2006] Memory used: 43627528 Error: org.epoline.soprano.Csstart: A fatal error occured in SOPRANO: Method not yet implemented : java.lang.UnsupportedOperationException: Method not yet implemented
         at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:156)
         at org.epoline.soprano.container.xmlOutput.LstXmlOutput.sendResultByMail(LstXmlOutput.java:812)
         at org.epoline.soprano.xmlOutput.XmlOutput.doSendResultByMail(XmlOutput.java:437)
         at org.epoline.soprano.xmlOutput.XmlOutput.doValid(XmlOutput.java:87)
         at org.epoline.soprano.share.CsServlet.doIt(CsServlet.java:475)
         at org.epoline.soprano.share.CsServlet.doWork(CsServlet.java:857)
         at org.epoline.soprano.share.CsServlet.doPost(CsServlet.java:685)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
         at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.epoline.soprano.hibernate.HibernateFilter.doFilter(HibernateFilter.java:39)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:534)
    I'm using tomcat version 5.0.30, I don't know where to go next.
    thanks

  • Clearing values from request in decode method

    I am using a custom table paginator. In its ‘decode’ method I have the next code to control whether ‘next’ link is clicked:
    String pLink = (String)requestMap.get("pLink" + clientId);
    if ((pLink != null) && (!pLink.equals(""))) {
         if (pLink.equals("next")) {     
         } else if (pLink.equals("previous")) {
    }But the next sequence produces some problems:
    1.     Initial page load.
    2.     Click on ‘next’ link.
    3.     Table navigates ok to next page.
    4.     Reload page (push F5).
    5.     The previous click still remains in the request, so decode method think ‘next’ link is pressed again.
    6.     Application abnormal behaviour arises.
    So, I am trying to clear the ‘next_link’ key from the request, but next code throws an UnsupportedOperationException:
    String pLink = (String)requestMap.get("pLink" + clientId);
    if ((pLink != null) && (!pLink.equals(""))) {
         if (pLink.equals("next")) {     
         } else if (pLink.equals("previous")) {
         requestMap.put("pLink" + clientId, "");
    }Do any of you have some ideas?

    Hey, where are you RaymondDeCampo, rLubke, BalusC ... the masters of JSF Universe?
    ;-)

  • "Abstract" method in a non-abstract class

    Hi all.
    I have a class "SuperClass" from which other class are extended...
    I'd like to "force" some methods (method1(), method2, ...) to be implemented in the inherited classes.
    I know I can accomplish this just implementing the superclass method body in order to throw an exception when it's directly called:
    void method1(){
    throw new UnsupportedOperationException();
    }...but I was wondering if there's another (better) way...
    It's like I would like to declare some abstract methods in a non-abstract class...
    Any ideas?

    The superclass just models the information held by
    the subclasses.
    The information is taken from the database, by
    accessing the proper table (one for each subclass).??
    What do you mean by "models the information"?
    You should use inheritance (of implementation) only when the class satisfies the following criteria:
    1) "Is a special kind of," not "is a role played by a";
    2) Never needs to transmute to be an object in some other class;
    3) Extends rather than overrides or nullifies superclass;
    4) Does not subclass what is merely a utility class (useful functionality you'd like to reuse); and
    5) Within PD: expresses special kinds of roles, transactions, or things.
    Why are you trying to force these mystery methodsfrom the superclass?
    It's not mandatory for me to do it... I 'd see it
    just like a further way to check that the subclasses
    implements these methods, as they have to do.That's not a good idea. If the superclass has no relation to the database, it shouldn't contain methods (abstract or otherwise) related to database transactions.
    The subclasses are the classes that handle db
    transaction.
    They are designed as a binding to a db table.And how is the superclass designed to handle db transactions? My guess (based on your description) is that it isn't. That should tell you right away that the subclasses should not extend your superclass.

  • Adobe Offline Form - Parse method is not possible for this type

    Hi All,
    I have developed an application for the offline scenario of interactive adobe form. I tried to load the adobe form from my desktop. After pressing the button "Display form" it throws an error "Parse method is not possible for this type".
    If I include wdContext.getNodeInfo().getAttribute("pdfObject").getModifiableSimpleType() in the doInit() method of the view I receive this error -
    com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(UploadView.pdfObject): must not modify the datatype of a mapped attribute
    When I comment it out and upload I receive the error enclosed -
    Parse method is not possible for this type
    Can someone please help me with a step by step solution to this problem?
    Any help is highly appreciated.
    Many thanks,
    Divya

    Hi Divya,
    Please try to do it as stated below:
         IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("pdfObject");
         ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
         IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)type;
    Try putting the code in wdInit() or wdDoModifyView().
    Let me know if you still face the issue.
    Regards,
    Arafat

  • UnsupportedOperationException Error while removing object from List

    Hi,
    I need to remove a set of objects from List if it contains similar objects as the other one.
    Follwing is the code snippet of the above scenario...
    List selectedPaxList = new ArrayList();
    TreeSet seatAssignedPaxlist= new TreeSet();
    selectedPaxList.add("1");
    selectedPaxList.add("2");
    selectedPaxList.add("3");
    seatAssignedPaxlist.add("1");
    seatAssignedPaxlist.add("2");
    if(selectedPaxList.containsAll(seatAssignedPaxlist))
    selectedPaxList.removeAll(seatAssignedPaxlist);
    If i do this in java program it executes fine without any error.But if I do the same in JSP I am getting the following error......
    java.lang.UnsupportedOperationException
    at java.util.AbstractList.remove(AbstractList.java:167)
    at java.util.AbstractList$Itr.remove(AbstractList.java:432)
    at java.util.AbstractCollection.removeAll(AbstractCollection.java:351)
    Plz... help me to resolve the issue

    java.lang.UnsupportedOperationException
    at
    java.util.AbstractList.remove(AbstractList.java:167)
    at
    java.util.AbstractList$Itr.remove(AbstractList.java:43
    2)
    at
    java.util.AbstractCollection.removeAll(AbstractCollect
    ion.java:351)
    That stack trace looks wrong to me.
    ArrayList overrides the remove method, so it
    shouldn't be using the method in AbstractList. That's what I thought, too. There is either something missing or it's not an ArrayList. In fact the javadoc of AbstractList.remove sais:
    "This implementation always throws an UnsupportedOperationException."
    So it really looks like another subclass is used.
    Also
    the object it is trying to remove is a list (from
    your exmaple it should be a String)
    I could be wrong.These are just the code references not the parameters, I think.
    -Puce

Maybe you are looking for

  • Restored Apps from Iphone 4 to 3gs, problem.

    I had a Verizon iphone 4 with ios 4.2.6. I lost it, so I went and got my old AT&T 3gs phone with ios 4.2.1 and did a "restore from backup" and used my Verizon Iphone 4 backup. Everything works great..(other than I dont have cellular service) but....

  • SQL injection on login system by Adobe?

    Hello everybody! I recently bought a wonderful book "Adobe Dreamweaver CS5 with PHP - Training from the source" by Daivid Powers. In the book is described how you can create a login system. What I would like to ask is: Have the dreamweaver server beh

  • Technical Content Cube 0TCT_MC21, Query 0TCT_MC21_Q0111

    Hi SAP experts We have a problem: Executing the query 0TCT_MC21_Q0111 for runtime processes seems to ignore some relevant infopackages with high runtime. Have you ever experienced such symptom with content statistics in 7.0? The subsequent respectivl

  • OEM dosen't see databases

    Hello, I've configured OMS and agent. Host is visible on OMS. There is a little strange configuration because oracle processes are not working under oracle user There are 4 diverent homes under different users: bcaora,carora, etlora and cmiora. There

  • Offline 6310 all in one

    I have the above printer connected to wireless network. The printer appears in the network and sharing centre (Vista Premium) but appears offline in the ControlPanel>Printers>Offline,Ready. My question. How do I get the printer to show ready so I can