Question

This is simple question but there's No answer found on the Internet.

Ok, some widgets such as CheckBox have a method called myCHeckBox.setFormValue(text); so I take advantage of this method to store the unique ID into a CheckBox so that later on I just myCHeckBox.getFormValue(); to retrieve back the unique value.

However, there's no setFormValue on GWT Panel?

So if we want to store a unique value into a Panel (for example, FlowPanel, VerticalPanel)? Then Which method can i use to do that?

Était-ce utile?

La solution

The way I see it what you are really trying is to extend the purpose of the Panel. I cannot see why you would want a unique identifier, as the object of the Panel is as unique as it guess but that's not the point here.

Since you want to extend the Panel do just that. Extend the corresponding class and give it a unique value, implement the corresponding getters and setters and then you are set. It is as simple as that

class AbsolutePanelUnq extends AbsolutePanel
{
      private int uniqueId;

      public getUniqueId(){
          return uniqueId;
      }

      public setUniqueId(int uniqueId)
      {
          this.uniqueId = uniqueId;
      }

}

Then create the object and do whatever you need.

Autres conseils

Best way I can suggest:

Public class myPanel extends Panel {

  private myUniqueValue;

  //Getter setter for myUniqueValue
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top