cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic controls

Former Member
0 Kudos

hi ,

u have given about dynamic text creating in webdynpro but i am confusing .

in src package we are placing SomeBackend.java file that file having information about user interface elements

The following is the coding in .java file

-


private Object[] fields ={new FieldDescriptor("InputField","first","com.sap.dictionary.string","First Name","enter first name",""),

new FieldDescriptor("InputField","last","com.sap.dictionary.string","Last Name","enter Last name",""),

new FieldDescriptor("InputField","birth","com.sap.dictionary.date","Date of Birth","enter date name",null),

new FieldDescriptor("DropDownByKey","country","com.sap.workshop.dynamicprogramming.simpletypes.Country","country","choose sex",""),

new FieldDescriptor("RadioButtonGroupByKey","first","com.sap.dictionary.string","First Name","enter first name",""),

new FieldDescriptor("CheckBox","isManager","com.sap.dictionary.string","First Name","enter first name",new Boolean(false))

};

-


THE ABOVE I AM TYPING IN .JAVA FILE I AM GETTING ERRORS

FieldDescriptor cannot be resolved

PLZ GIVE ME THAT .JAVA FILE FULLCODE I WANT

IN THAT U ARE USING INNER CLASS JUST U ARE GIVING Object[]

how can i declare FieldDescriptor in SomeBackEnd.java file

i am waiting for complete .java file

swathi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

jagadeesh,

seems that you are using one of WD tutorials, just download files that accompanied this tutorial -- FieldDescriptor class should be there, it is not standard WD class.

VS

Former Member
0 Kudos

Hi Jagadeesh,

I guess u need to create FieldDescriptor.java file.

public class FieldDescriptor

{

String field1,field2......;

public FieldDescriptor(String f1, String f2, String ....)

{

this.field1 = f1;

...

...

}

}

U might find this tutorial to be confusing but u should more concentrate on the dynamic creation of UIEs rather than these .java files. Try to learn the basics like:

how to create UI dynamically,

how to create value nodes, attributes etc,

how to map them to UIEs etc.

how to create and map action etc.

better u think of ur own scenario(Eg: a simple TextView UIE showing ur details etc) and try to create them dynamically.

regards,

Piyush.

Former Member
0 Kudos

Please see the code below. Hope this helps.

- Lokesh

package com.sap.tut.wd.dynamic;

/**

  • @author d021199

*

  • To change this generated comment edit the template variable "typecomment":

  • Window>Preferences>Java>Templates.

  • To enable and disable the creation of type comments go to

  • Window>Preferences>Java>Code Generation.

*/

public class SomeBackEnd {

public class FieldDescriptor

{

public FieldDescriptor(String uiType, String name, String type, String label, String tooltip, Object init)

{

this.uiType = uiType;

this.name = name;

this.type = type;

this.label = label;

this.tooltip = tooltip;

this.init = init;

}

String getUIType(){ return uiType; };

String getName(){ return name; };

String getType(){ return type; };

String getLabel(){ return label; };

String getTooltip(){ return tooltip; };

Object getInit(){return init; };

private String uiType;

private String name;

private String type;

private String label;

private String tooltip;

private Object init;

}

public class OperationDescriptor

{

OperationDescriptor(String name, String displayText, String tooltip)

{

this.name = name;

this.displayText = displayText;

this.tooltip = tooltip;

}

String getName(){ return name; };

String getDisplayText(){ return displayText; };

String getTooltip(){ return tooltip; };

private String name;

private String displayText;

private String tooltip;

}

int getNumberFields()

{

return fields.length;

}

FieldDescriptor getField(int index)

{

return (FieldDescriptor)fields[index];

}

int getNumberActions()

{

return operations.length;

}

OperationDescriptor getAction(int index)

{

return (OperationDescriptor)operations[index];

}

private Object[] fields = {

new FieldDescriptor("InputField","firstName","com.sap.dictionary.string","First Name","Enter first name here",""),

new FieldDescriptor("InputField","lastName","com.sap.dictionary.string","Last Name","Enter last name here",""),

new FieldDescriptor("InputField","birthday","com.sap.dictionary.date","Date of Birth","Enter date here", null),

new FieldDescriptor("DropDownByKey","country","com.sap.tut.wd.dynamic.simpletype.Country","Country","Choose your country here",""),

new FieldDescriptor("RadioButtonGroupByKey","sex","com.sap.tut.wd.dynamic.simpletype.Sex","Sex","Choose your sex here",""),

new FieldDescriptor("CheckBox","isManager","com.sap.dictionary.boolean","Is a Manager","Checked if person is a manager", new Boolean(false))

};

private Object[] operations = {

new OperationDescriptor ("delete", "Delete", "Delete your input."),

new OperationDescriptor ("save", "Save", "Save current record."),

};

}