Terminal Emulation & Transformation Community
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources

Custom Widgets in IBM Host Access Transformation Services

10/11/2018

0 Comments

 
Picture
HATS provides host components that recognize elements of the host screen and widgets that render transformed elements on web page. HATS supports a rich set of default widgets.

​Widgets are used to display host components in our GUI. Customizing a widget specifies how widgets appear on the web page. If the default settings of the widgets don’t satisfy your needs, you can customize them to suit your needs.


​We can customize widgets by creating a new widget or by modifying an existing one.

             1. To create a new widget, extend the abstract widget parent class,                                                      com.ibm.hats.transform.widgets.Widget, and implement the                                                              com.ibm.hats.transform.rendererers.HTMLRenderer interface and the public                                    StringBuffer  drawHTML() method.
           
​            2.  To modify an existing widget, extend existing widget classes and overwrite its                              drawhtml() method.


Creating New Widget:
Select HATS-- > New-- > Widget menu in HATS toolkit, to get the dialogue below:
Picture
Picture
Click on finish.
A new CustomWidget class gets created and the code looks as below:
​
Picture
When a new widget is created, below operations are performed in HATS:
  • A new MyCustomWidget class is created, which extends the widget class and implements the HTMLRenderer interface. Also, a method drawHtml() gets created for web project output.
  • The new widget class is compiled, if “Build Automatically” is selected in workspace.
  • ​The new widget class is registered in the ComponentWidget.xml file so that it is available in HATS toolkit.
Example of creating new widget:
Below is a piece of code which generates responsive design for table elements:
​
Picture
Following screen shot show us, how the table looks when we maximize browser. This is achieved due to the code that we wrote in the widget
​
Picture
And below picture shows how it looks when we use restore option in browser:
​
Picture
Modifying existing widgets:
You can modify any of the existing widgets present in ComponentWidget.xml by extending one of the Widget classes and overwriting its drawMethod(). Refer to the HATS API References for details about widget interfaces and methods.

Create Custom widget by following the steps mentioned before and extend the existing widgets as below:


public class MyCustomWidget extends com.ibm.hats.transform.widgets.FieldWidget

Refer the link below for more examples:

​https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Wcd0f7758d3a2_4be8_a938_ffe8271d536b/page/HATS+Custom+Widget+Tutorial

Soumya Surgihalli
Senior Consultant – IBM Host Access Transformation Services
soumyamallappa.s@hcl.com

0 Comments



Leave a Reply.

    Archives

    May 2020
    October 2019
    July 2019
    June 2019
    May 2019
    March 2019
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    October 2017
    September 2017

    Categories

    All
    HACP
    HACPEE
    HATS
    HOD
    PCOMM

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources