Posts Tagged ‘Java’
Finally Speaking – Part 2
So instead of bothering with adding Listeners by iteration, we did an object-oriented approach instead.
Well these are eye-openers for me, since I’m not used to object-oriented programming in web development.
Finally Speaking
I have this certain code and I can’t seem to get the variable i plugged in to the MouseUpHandler. It seems that I cannot refer to a non-final variable inside an inner class.
for(int i = 0; i < activityCount; i++) {
activities.add(new VerticalPanel());
activities.get(i).add(new Label("Learning Activity #" + (i + 1)));
objectList.add(new VerticalPanel());
activities.get(i).add(objectList.get(i));
Button addLink = new Button("Add");
addLink.addMouseUpHandler(new MouseUpHandler() {
@Override
public void onMouseUp(MouseUpEvent event) {
addObject(i); // I CAN'T DO THIS!
}
});
}
And I haven’t figured out how to code-style-display the code above unlike what partner does.
Forgive My Ignorance
… but I just knew how to “array-ize” lists and such things.
List<List<TextBox>> descriptions = new ArrayList<List<TextBox>>();
… which is, in array form,
TextBox[][] descriptions = new TextBox[][];
Now I’m thinking if I have to initialize every widget add, or get them immediately (but I’m betting on the former).
List<VerticalPanel> vpanel = new ArrayList<VerticalPanel>();
// initialize component to add to vpanel
vpanel.add(new VerticalPanel());
// access it
vpanel.get(0);
GWTScript
So the other day, I got a first glimpse of coding using the Google Web Toolkit (GWT) myself. It was pretty fun actually — it’s like you’re doing JavaScript but it’s on pure Java now.
RootPanel.get(optional_id_of_element_in_page).getElement().function;
is the equivalent of…
document.getElementById(id_of_element_in_page).function;
There’s a list of functions that can be used. Thank goodness for auto-complete.
Services
Currently I’m searching on how to create web services in Java–and make sure that it will run on the App Engine.
As I always say–if Projectrix was in C#.NET, we’re almost done with the project by now. But no. *sighs*
