GWT - newbie

Posted on 2012-09-17
Medium Priority
Last Modified: 2013-01-21
hi guys
I am working on GWT and i have something like

public class QuickSearch extends Canvas
private HLayout mainBodyLayout = new HLayout(); //the main layout containing other layouts.

//button layout
private Layout getButtonLayout()
//here i want to check IF mainBodyLayout already contains
getButtonLayout() , if it does not contain only then add it like
Any idea how i can check if getButtonLayout() is already present in mainBodyLayout ?

return VLayout;

thanks in advance.
Question by:royjayd
  • 2
LVL 36

Expert Comment

ID: 38408204
It's not clear what you are asking. You are asking if the main layout contains 'getButtonLayout()' but that is a function not an object!? And if you mean, 'does the main layout contain whatever the returned object from getButtonLayout()' well then you have an infinite recursion problem. How can you know if the main layout contains an object that is returned from a function when you are still INSIDE that function?

I think you need to explain at a higher level what it is you are trying to do!
LVL 36

Accepted Solution

mccarl earned 1600 total points
ID: 38408211
Once you sort the above out, it seems the Canvas objects (those objects that can be added as members of layouts) can take/be assigned an 'ID' . Then you can call mainBodyLayout.getMember("MY_ID") to see if it returns an object (ie. it has already been added) or null (ie. is has NOT yet been added)

Author Comment

ID: 38409356
....can be assigned an I'D.
Yeah, I am looking for that,  any idea how I can do that?
Also getButtonlayout() returns a layout object.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question