Skip to main content
1-Visitor
December 11, 2014
Solved

creating textarea wherein I can manually enter values.

  • December 11, 2014
  • 2 replies
  • 5897 views

I have written datautility extending AbstractDataUtility but textarea is not visible in table builder.Code is as follows.

public class AttributeTextAreaDataUtility extends AbstractAttributeDataUtility {

public Object getDataValue(String component_id, Object datum, ModelContext mc) throws WTException

{

super.getDataValue(component_id, datum, mc);

TextArea textarea = new TextArea();

TextArea textArea = GuiComponentUtil.createTextArea(1, 2, 3 );

//textArea.setColumnName(AttributeDataUtilityHelper.getColumnName(component_id, datum, mc));

textarea.setValue(getAttributeDisplayValue(component_id, component_id, datum, mc));

textarea.setReadOnly(true);

textarea.setWidth(40);

textarea.setHeight(5);

//textarea.setName(component_id);

return textarea;

}

private static String getAttributeDisplayValue(String attributeName,String componentId, Object datum, ModelContext mc)

throws WTException

{

Object raw_val = UtilityHelper.getRawValue(attributeName, datum, mc);

String value = UtilityHelper.getStringValue(raw_val, componentId,datum, mc);

return value;

}

}

Best answer by Prabhash

Hello Hrishikesh,

Have you created a custom builder class? Are you trying to hook the datautility to an attribute from builder or is this attribute is OOTB attribue?

But whatever the case may be you dont need these many lines of code in a datautility to display a Text Box.

Just one method inside your datautiliy class is sufficient:

public Object getDataValue(String component_id, Object datum,

ModelContext modelcontext) throws WTException {

TextArea textArea = new TextArea();

textArea.setId(component_id);

textArea.setEditable(true);

textArea.setLabel("MY TEXT AREA");

textArea.setWidth(20);

return textArea;

}

-Prabhash

2 replies

Prabhash1-VisitorAnswer
1-Visitor
December 12, 2014

Hello Hrishikesh,

Have you created a custom builder class? Are you trying to hook the datautility to an attribute from builder or is this attribute is OOTB attribue?

But whatever the case may be you dont need these many lines of code in a datautility to display a Text Box.

Just one method inside your datautiliy class is sufficient:

public Object getDataValue(String component_id, Object datum,

ModelContext modelcontext) throws WTException {

TextArea textArea = new TextArea();

textArea.setId(component_id);

textArea.setEditable(true);

textArea.setLabel("MY TEXT AREA");

textArea.setWidth(20);

return textArea;

}

-Prabhash

hmungekar1-VisitorAuthor
1-Visitor
December 12, 2014

I tried with the above mentioned code but still i am not getting textbox wherein i can manually enter values.I have created a table builder wherein I hav added customized Data utility as a column.

1-Visitor
December 12, 2014

Hrishikesh, I have used the same code many a times without any error. If you could send me your code may be i will be able to debug it and help you out. And finally do you want a Text Box or a Text Area?

-Prabhash

hmungekar1-VisitorAuthor
1-Visitor
December 12, 2014

I have attached table builder code and customized data utility.i have attached snap shot of the output im getting

1-Visitor
December 12, 2014

Just Curious...is control going inside your datautility class? Where and how did you register the datautility?

hmungekar1-VisitorAuthor
1-Visitor
December 13, 2014

yes code inside data utility is working as i had written system.out.println inside it.i hav registered it inside service.properties