Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
11 replies Latest Post - ‏2013-02-27T13:53:28Z by P8GM_alejandro_amen
SystemAdmin
SystemAdmin
1192 Posts
ACCEPTED ANSWER

Pinned topic Identification labels and fields

‏2013-02-20T09:55:45Z |
Hi All,

In my green screen side labels and fields are there,

Example: Loan# 0000878
in that above example "Loan#" is an label. "0000878" is an field.like that so many labels and fields in a single screen.
while default rendering the entire fields and labels are in the same format. I mean not differentiate.
is it possible to differentiate through HTAS 7.5.1.

for Example labels as a bold or some identification color.

for me, that i'm not expert of hats. if possible please help me.

Thanks in advance.
Updated on 2013-02-27T13:53:28Z at 2013-02-27T13:53:28Z by P8GM_alejandro_amen
  • P8GM_alejandro_amen
    P8GM_alejandro_amen
    34 Posts
    ACCEPTED ANSWER

    Re: Identification labels and fields

    ‏2013-02-21T13:25:33Z  in response to SystemAdmin
    I had the same problem, i solved it by making a custom component.

    My labels on the green screen are like this

    label1....:
    label2..:

    So i used the ":" as a parameter for identification, is there any common character or pattern in your labels?.
    • SystemAdmin
      SystemAdmin
      1192 Posts
      ACCEPTED ANSWER

      Re: Identification labels and fields

      ‏2013-02-21T14:09:12Z  in response to P8GM_alejandro_amen
      many thanks for your response alejandro!

      yes. common pattern is there for identification.
      can you please explain how can i make labels as a "bold" or "color", through custom component.

      if possible please provide code snippet.

      Thanks,
      -Venkat
      • P8GM_alejandro_amen
        P8GM_alejandro_amen
        34 Posts
        ACCEPTED ANSWER

        Re: Identification labels and fields

        ‏2013-02-21T15:39:23Z  in response to SystemAdmin
        Sorry,

        I think i didnt understood your first question.

        You only need to change the style of the "label" widget in the default rendering.

        Some screenshots of your green screen and your rendering settings also will help me understand, see if you can upload some on an image server and post the links here.

        regards

        Alejandro.
        • SystemAdmin
          SystemAdmin
          1192 Posts
          ACCEPTED ANSWER

          Re: Identification labels and fields

          ‏2013-02-21T16:56:28Z  in response to P8GM_alejandro_amen
          Hi,

          http://www.thaicyberupload.com/get/AXpe5BXzqv

          you can download the file using the above link. please wait and download to check this screenshot. In that screen shot please suggest whether all green color fonts can make as a BOLD.if possible suggest me.

          Thanks,
          -Venkat
          • P8GM_alejandro_amen
            P8GM_alejandro_amen
            34 Posts
            ACCEPTED ANSWER

            Re: Identification labels and fields

            ‏2013-02-21T18:09:09Z  in response to SystemAdmin
            Ok, Venkat,

            So, here we have two ways of doing this.
            1- Recognice all the fields in green.
            2- Recognice all the fields in white.
            You will know what fits best to your application...

            I guess, that the best way is creating a custom component capable of recognizing text by color, we can provide the color to recognize as a property.

            I've made something similar so i'll change it and post the code here for you to try, it out.

            In the mid time, since you said that you are new to hats, i suggest you to take a look at this link http://publib.boulder.ibm.com/infocenter/hatshelp/v75/index.jsp?topic=/com.ibm.hats.doc/doc/rcppgd10.htm

            In order to be able to use the code i'll post.
            please be patient

            regards!
            Alejandro
            • SystemAdmin
              SystemAdmin
              1192 Posts
              ACCEPTED ANSWER

              Re: Identification labels and fields

              ‏2013-02-22T13:46:34Z  in response to P8GM_alejandro_amen
              Thanks Alejandro for the immediate reply,

              Thanks for your suggestion, i will go through the provided link.

              Waiting for your reply on identifying host screen colors through custom components.

              Thanks,
              -Venkat
              • P8GM_alejandro_amen
                P8GM_alejandro_amen
                34 Posts
                ACCEPTED ANSWER

                Re: Identification labels and fields

                ‏2013-02-22T20:52:49Z  in response to SystemAdmin
                Hi Venkat,

                Now, you will have to create a custom component, follow the steps, and associate it with the hats "label" widget. Then make sure that the componentWidget.xml file was modified with this new component, if not add it yourself.
                Paste this code in the component you have just created...

                I put a property page, so you can set the colour you want to recognize, its an integer value, I belive that 7 is for "white" and 2 for "green" but I'am not sure try it out!.(I set white as default value)

                Now you can use this component to recognize any colour label, and give it a diferent style to the label widget for each one.

                Hope it works!! hahha
                Alejandro

                Here is the code:

                
                
                
                package yourProyect.components;   
                
                import java.util.logging.Logger;   
                
                import com.ibm.hats.common.HCustomProperty; 
                
                import com.ibm.hats.transform.components.FieldComponent; 
                
                import com.ibm.hats.transform.elements.ComponentElement; 
                
                import com.ibm.hats.transform.elements.FieldComponentElement; 
                
                import com.ibm.hats.transform.elements.FieldRowComponentElement; 
                
                import com.ibm.hats.transform.elements.TextComponentElement; 
                
                import com.ibm.hats.transform.regions.BlockScreenRegion; 
                
                import com.ibm.hsr.screen.HsrScreen; 
                
                import java.util.*;   
                
                public 
                
                class FieldsByColor 
                
                extends FieldComponent
                { 
                
                public 
                
                static Properties defaults = 
                
                new Properties();   
                
                public FieldsByColor(HsrScreen hostScreen) 
                { 
                
                super(hostScreen); 
                }   
                
                public ComponentElement[] recognize(BlockScreenRegion region, Properties settings) 
                { ComponentElement[] cel = super.recognize(region, settings); Vector<ComponentElement> ces = 
                
                new Vector<ComponentElement>(); 
                
                int searchColor = Integer.parseInt(getStringProperty(settings, PROPERTY_SEARCH_COLOR)); 
                
                int i = 0; FieldRowComponentElement frce = 
                
                null; FieldComponentElement fce = 
                
                null; 
                
                while (i<cel.length)
                { System.out.println(
                "i = "+i); frce = (FieldRowComponentElement) cel[i]; 
                
                int x = 0; 
                
                while (x < frce.getElementCount())
                { fce = (FieldComponentElement) frce.getElement(x); 
                
                if (fce.getForegroundColor() == searchColor && !fce.isHolderOnly() && fce.isProtected() && !fce.isAllBlank())
                { TextComponentElement tce = 
                
                new TextComponentElement(fce.getText()); tce.setConsumedRegion(fce.getConsumedRegion()); ces.add(tce); 
                } x++; 
                } i++; 
                } ComponentElement[] cels = 
                
                new ComponentElement[ces.size()]; ComponentElement[] result = (ComponentElement[])(ComponentElement[])ces.toArray(cels); 
                
                return result; 
                }   
                /* ******************************************************************************************************************************* */ 
                
                public Properties getDefaultValues(
                
                int iPageNumber) 
                { 
                
                return super.getDefaultValues(iPageNumber); 
                } 
                
                public Vector getCustomProperties(
                
                int iPageNumber, Properties properties, ResourceBundle bundle) 
                { Vector<HCustomProperty> v = 
                
                new Vector<HCustomProperty>(); HCustomProperty c = 
                
                null; c = HCustomProperty.new_String(PROPERTY_SEARCH_COLOR, SEARCH_COLOR, false, null, 
                " ", null, 
                
                null); v.add(c); 
                
                return (v); 
                } 
                
                public 
                
                int getPropertyPageCount() 
                { 
                
                return 1; 
                } 
                
                static 
                { defaults.put(
                "seachColor", 
                "7"); 
                } 
                
                public 
                
                static 
                
                final String SEARCH_COLOR = 
                "Search for fields of COLOR.: "; 
                
                public 
                
                static 
                
                final String PROPERTY_SEARCH_COLOR = 
                "seachColor"; 
                /* ******************************************************************************************************************************* */   
                
                private String getStringProperty(Properties settings, String propertyName) 
                { String prop = settings.getProperty(propertyName, 
                
                null); 
                
                if(prop == 
                
                null || !(prop.trim().length()>0)) 
                { prop = defaults.getProperty(propertyName); 
                } 
                
                if(prop != 
                
                null)
                { prop.trim(); 
                } 
                
                return prop; 
                } 
                }
                
                • SystemAdmin
                  SystemAdmin
                  1192 Posts
                  ACCEPTED ANSWER

                  Re: Identification labels and fields

                  ‏2013-02-25T11:07:43Z  in response to P8GM_alejandro_amen
                  Hi Alejandero

                  I am beginner of IBM HATS

                  I am also waiting for identifiying the color i saw ur post...
                  i created a new javacomponent with name FieldByColor but i am unable identify the Hostscreen color..
                  can you please explian which mapping component i have to paste in Component.Xml file

                  Thanks in advance
                  Sabir
                  • P8GM_alejandro_amen
                    P8GM_alejandro_amen
                    34 Posts
                    ACCEPTED ANSWER

                    Re: Identification labels and fields

                    ‏2013-02-25T13:28:52Z  in response to SystemAdmin
                    Go to the navigator Tab and search for the componentwidget.xml file, go to the source tab and paste this code:

                    
                    <component className=
                    "yourProyect.components.FieldsByColor" displayName=
                    "FieldsByColor" helpID=
                    "" image=
                    ""> <associatedWidgets> <widget className=
                    "com.ibm.hats.transform.widgets.LabelWidget"/> </associatedWidgets> </component>
                    


                    Then build the proyect and go to the default rendering set, now you will have a new component available just like any of the HATS standard components.

                    Alejandro Amen
                • SystemAdmin
                  SystemAdmin
                  1192 Posts
                  ACCEPTED ANSWER

                  Re: Identification labels and fields

                  ‏2013-02-27T13:39:22Z  in response to P8GM_alejandro_amen
                  many thanks for your reply;

                  Through this code i am able to recognize only the white label color of the HOST Screen data.But unable to recognize green color labels data from HOST screen at a time.(in the recognize screen). if i changed instead of "7" to 2(white to green), but able to see only green color label data.but want to recognize both white and green labels data, instead of that make green labels as a bold.if i am wrong please correct me.
                  Thanks,
                  -Venkat
                  • P8GM_alejandro_amen
                    P8GM_alejandro_amen
                    34 Posts
                    ACCEPTED ANSWER

                    Re: Identification labels and fields

                    ‏2013-02-27T13:53:28Z  in response to SystemAdmin
                    Hi Venkat,

                    Yes! thats the idea, you are changing the color code on the component properties not directly on the java code right?.

                    Ok, so you need to do this:

                    1) First you need to add the component to yout rendering set make it recognize all white texts.
                    Then on the "label" widget properties, give it a bold style.

                    2) Add the component again to the rendering set make it recognize all green texts.
                    Leave the label widget properties as default in this case.

                    This way you will have a diferent style of label for white texts and for green texts and you will see all the data.

                    Let me know if i'am not making myself clear.

                    regards
                    Alejandro