cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2969
Views
1
Helpful
18
Replies

Custom "math" CVP CallStudio element.

e.gailiss
Level 4
Level 4

I'm trying to create custom element for CallStudio. Something along the lines of built-in math element. It has to have some parameters and a button to open simple editor where I can enter multiple lines of text.

Dealing with parameters is easy, but I couldn't find any examples how to do this "button to open additional editor window". Can anyone point me to any samples?

Thank you!

Ervins

18 Replies 18

vinodkewate
Level 1
Level 1

If you are trying to pass Text as parameter to your Custom Configurable element, you could declare the field as TextField under setting configuration,

settingArray[n] = new Setting("TextEditor", "Enter Text Content",

                          "This setting is for large text content",

                          false,  // It is not required

                          true,   // It appears only once

                          true,   // It allows substitution

                          Setting.TEXTFIELD);

Vinod,

Thank you for your suggestion.

At the moment I went with this suggestion. All is looking more or less fine but I have hit another problem - substitutions.

Textfield editor has substitutions enabled regardless if they are disabled for this parameter when Setting is created.

I couldn't find any way how to prevent substitution analysis happening on text field and data format I'm using involves {}.

I could replace curly brackets with some pattern and then replace them back in element logic itself, but then it looks like the way Hemal suggested - I have to create my own editor to modify textfield before saving..

Ervins

hemal.mehta
Level 5
Level 5

I assume you are looking for an editor similar to expression in Math element. Check for Math related classes in elements.jar. For example on CVP 8.5, it will be under:

C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.elements.core_8.5.1

You can look at the code for the same.

Hemal

Hemal,

Thank you for suggestion.

In folder you mention contains only class files - pre-compiled java bytecode. Are those the files you were thinking about?

Ervins

Yes, you can decompile them.

Regards,

Hemal

Hemal,

I decompiled class files - they use the same approach as Vinod suggested.

The problem with that is I need to disable substitution process in order to use curly brackets in text itself. Any ideas?

Thank you!

Ervins

Are you saying that you do not need the substitution functionality where the system will interpret what is there in the { } ? Could you give more details on what you are trying to accomplish ?

The real question is whether the updateApp.bat will allow you to use { }

for something other than specifying studio variable names! My guess is

that it won't.

You can disable substitution when you define the setting for the TextField.

Just set the 2nd boolean to false.

Setting constructor:

string real-name, string display-name, string description, boolean is

setting required?, boolean is substitution allowed?, boolean is the

setting single?, typeOfSetting

Janine,

I already tried setting false for "substitution allowed". Result is - on main settings tab substitution button is grayed out, but on dialog where I can enter text it is available and usable. It looks like text entry dialog is ignoring setting setup parameters.

I'm creating text field setting like this:

Setting tp = new Setting("matrix", "matrix", "Logic martix",

  Setting.REQUIRED, Setting.SINGLE,

  Setting.SUBSTITUTION_NOT_ALLOWED, Setting.TEXTFIELD);

At the moment I get exception while loading custom element if I leave {} in place. As far as I can tell I have only 2 options:

1. Leave {} as they are in text field. Catch java exception when I try to get setting value and in exception handler get original pre-substituted value. Problem is, I couldn't find function to get pre-substituted value.

2. Avoid {} in original textfield. I don't have control how data are entered, so solution would be mangle input data (search&replace {}, URL encode, MIME encode or just plain zip input text) before saving setting in CallStudio. Then, in element doAction, get mangled data and un-mangle them. Problem with this is - I have to have a way to create my own GUI for entering text or at least intervene with "Save" button on text entry dialog. And I couldn't find a way how to do it.

... and maybe 3rd option - use dynamic configuration class to do the mangling. But I don't know if dynamic config class gets access to pre-substituted vaues or post-substituted values. Couldn't find that info in docs as-well.

Any ideas I'm missing or suggestions on the ones I mentioned?

Thanks for looking at this! I know I'm still a newbie.

Ervins

If you set the boolean to false, then the {} button should be greyed out

from the Text box - that's a bug.

I can't think of anything else other than using a different character

instead of then replacing it using regular expressions in the

java code.

Since I cannot fix the bug, I agree that changing text content looks like easier way to proceed. Problem with this is  - I don't have that many points where I can make changes.

1. create my own GUI for text field.

2. use dynamic configuration - if that has access to pre-substituted element data.

I don't have any experience with both points. GUI would be more cleaner solution, I think. But I have not seen any documentation how to do that.

I'll try with dynamic config class but I don't think it has access to pre-substituted element data.

Ervins

Why can't you just modify your doAction?

retrieve the Setting Value then do a string replacement?

I do not see why this cannot be done by replacing the value of the Setting to the appropriate one in your action class.

Hemal