Disabled + invisible field is it possible?

Hello,

we want to show a button, which behavior depends on current user state.
F.i. <Dial|Answer|Transfer|Dial(Disabled)>. One of these three actions can be available or a disabled button with text “Dial” should be shown in case of wrong configuration.
At the moment we see two ways to go:

  1. Dynamically change button text and use visibleprop in conjunction with invisiblemode=“disabled”.
  2. Provide four buttons and use visibleprop in conjunction with invisiblemode=“invisible”.

But both ways are not good enough. The lacks are following:

  1. We have not found how to access multilingual resources in order to set the text according to selected language except of direct csv file parsing.
  2. It seems to be completely impossible to disable a button if its invisiblemode is not “disabled”.

Could you please give us a hint how we can proceed with one of described methods, or may be with some completely different one?

Thank you in advance,
consros

Hi,
ad 1.) you can accesse the multi language CSV resources via replaceLiteratl()-methods in the adapter, or - if you are outside adapter processing - via MLManagerFactor.getMLManager() + corresponding methods.
ad 2.) yes, that’s right: vai button-visibleprop (true/false) you can control the button’s state - via the button-invisiblemode you control how “false” is interpreted: either invisible (default) or disabled (as you mention).
Hope this helps…
Bj

Hi, thanks for your answer!

This seems to be exactly what we are looking for, but I cannot get the thing working. And the JavaDoc is a bit unclear at this point. F.i. I have no idea what for replaceLiterals with additional parameters are provided: “…same as replaceLiteral(application,literal) but now with one additional parameter.”
I’ve prepared a simple example.

In application designer I defined a follofing literal:


File Content  
  ...
btnDial;Dial
  ...

Here is my code:


        String app = findPageApplication();
        System.out.println("app = " + app);

        String lit = "btnDial";
        System.out.println("lit = " + lit);
        System.out.println("lit = " + replaceLiteral(app, lit));

And here is the output I get:


app = MyApp
lit = btnDial
lit = $en/default/btnDial$

I would expect to get my “Dial” in the last line.
But maybe it’s not the last step? Maybe now I should proceed further with “en/default/btnDial” ? Could you please tell me what else should I check?

The same:


        String prj = "cis";
        System.out.println("prj = " + prj);
        
        String app = findPageApplication();
        System.out.println("app = " + app);

        String lit = "btnContact";
        System.out.println("lit = " + lit);
                
        IMLManager man = MLManagerFactory.getMLManager();
        lit = man.getString("de", prj, app, lit);
        
        System.out.println("lit = " + lit);                        

(Language and literal are different as above)


prj = cis
app = MyApp
lit = btnContact
lit = $de/default/btnContact$

Hi,

I just refer to replaceLiteral(), this is the easier one :wink: Well the problem is the word “application”, this is not the page_s project, but the name of the CSV file (or in terms of a page definition: the name of the “language reference”).

…replaceLiteral(“demo”,“btnDial”);…
looks for “btnDial” in “demo.csv”.

And the other replaceLiterals? - Inside a message you can define variables to be replaced at runtime, e.g. the message is “Document &1 was saved in &2.” You can pass the variables by using the call:
replaceLiteral(“demo”,“msgSaved”,“xyz.xml”,"/project/xyz");

Bj

Thanks, not it works indeed!
One small additional question - can I read somewhere the “translationreference” field of the page - it’s the value of application parameter - to make implementation more abstract?
Thanks once again!

no[W] it works indeed!

There’s no API for reading it. - But I would make it as simple as possible: typically you have exactly one translation reference per project in which you collect all the literals in order to avoid redundant maintenance. Name it “translation” or whatever, use it consitently throughout all your pages and define a Java constant “as API” :wink:

Bj

Thank you very much, clear!

Hi, This post is very informative, however I would like some specific information. If someone can help me then please send me a private message. Best Regards,